Skip to content

Commit

Permalink
Updated build scripts and README.md
Browse files Browse the repository at this point in the history
Updated build scripts. README was updated to include instructions
on how to build and generate bindings.
  • Loading branch information
mjblack committed Jan 20, 2025
1 parent bf58fb7 commit 683990d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 7 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ dependencies:
github: mjblack/win32cr
```
Build WinMD by executing the script `build.ps1` in the location where the shard `win32cr` is installed.

```
C:\Projects\SomeCrystalApp\lib\win32cr> & .\build.ps1
```
## Usage
For more examples, please see the [examples](https://github.com/mjblack/win32cr/tree/master/examples) directory.
Expand Down
12 changes: 10 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,20 @@ function Run {
if ($env:WINMD_TRACE) {
$WINMD_PARAMS = $WINMD_PARAMS + " -t"
}

& .\bin\winmd.exe generate $WINMD_PARAMS json\win32json\api .
mkdir src/win32cr
Start-Process -Wait -NoNewWindow -FilePath .\bin\winmd.exe -ArgumentList "generate","${WINMD_PARAMS}","json\\win32json\\api","."
}

function BuildWinMD {

if (!(Test-Path .\bin\winmd.exe)) {
& .\scripts\build_winmd.ps1
}
}


PrepSrcDir
PrepJSON
BuildWinMD
Run
CleanUp
38 changes: 33 additions & 5 deletions scripts/build_winmd.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
Set-Location .\lib\winmd
mkdir bin
& .\build.ps1
Set-Location ..\..
mkdir bin
function returnToRoot {
Set-Location ..\..
}

if (!(Test-Path .\lib\winmd)) {
throw "WinMD shard not found"
}

if (!(Test-Path .\lib\winmd\bin\winmd.exe)) {
Set-Location .\lib\winmd

# create bin dir under winmc
if (!(Test-Path .\bin)) {
mkdir bin
}

if (!(Test-Path .\build.ps1)) {
returnToRoot
throw "WinMD build script not found in WinMD shard"
}

& .\build.ps1

returnToRoot

# create the bin dir under win32cr
if (!(Test-Path .\bin)) {
mkdir bin
}
if (!(Test-Path .\lib\winmd\bin\winmd.exe)) {
throw "WinMD executable not found"
}
}
Copy-Item .\lib\winmd\bin\winmd.exe .\bin\winmd.exe

0 comments on commit 683990d

Please sign in to comment.