Skip to content

Commit

Permalink
Try modifying build.bat
Browse files Browse the repository at this point in the history
  • Loading branch information
jtraglia committed Aug 14, 2024
1 parent cf65824 commit 6d08822
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 7 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/csharp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,14 @@ jobs:
ext: .dll
reqs:
steps:
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install requirements
if: ${{ matrix.target.reqs }}
run: ${{ matrix.target.reqs }}
- name: Build native library for ${{ matrix.target.location }} using native capabilities (windows)
if: runner.os == 'windows'
shell: cmd
run: |
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" && make ckzg -C bindings/csharp CC=clang EXTENSION=${{ matrix.target.ext }} LOCATION=${{ matrix.target.location }} ARCH=${{ matrix.target.arch }}
- name: Build native library for ${{ matrix.target.location }} using native capabilities (not windows)
if: runner.os != 'windows'
- name: Build native library for ${{ matrix.target.location }} using native capabilities
run: make ckzg -C bindings/csharp CC=clang EXTENSION=${{matrix.target.ext}} LOCATION=${{matrix.target.location}} ARCH=${{matrix.target.arch}}
- name: Upload artifacts
uses: actions/upload-artifact@v3
Expand Down
53 changes: 53 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@echo off
SETLOCAL
set "PATH=%windir%\system32;%PATH%" &:: override msys if there is one on %PATH%
set TOP=%~dp0
cl /nologo /c /O2 /Zi /Fdblst.pdb /W4 /MT /Zl %TOP%src\server.c || EXIT /B
cl 2>&1 | find "for ARM64" > nul:
IF ERRORLEVEL 1 (
set arm64=no
FOR %%F IN (%TOP%build\win64\*-x86_64.asm) DO (
ml64 /nologo /c /Cp /Cx /Zi %%F || EXIT /B
)
) ELSE (
set arm64=yes
FOR %%F IN (%TOP%build\win64\*-armv8.asm) DO (
armasm64 -nologo %%F || EXIT /B
)
)
SETLOCAL ENABLEDELAYEDEXPANSION
set static=/out:blst.lib
set shared=
set arm64ec=
FOR %%O IN (%*) DO (
set opt=%%O
IF "!opt!" == "-shared" (
IF [!shared!] EQU [] set shared=/out:blst.dll
) ELSE IF "!opt:~0,5!" == "/out:" (
IF "!opt:~-4!" == ".dll" (set shared=!opt!) ELSE (set static=!opt!)
) ELSE IF "!opt!" == "-arm64x" (
set arm64x=%arm64%
)
)
IF [%shared%] NEQ [] (
cl /nologo /c /O2 /Oi- /MD %TOP%build\win64\dll.c || EXIT /B
IF [%arm64x%] NEQ [yes] (
link /nologo /debug /dll /entry:DllMain /incremental:no %shared% ^
/def:%TOP%build\win64\blst.def *.obj kernel32.lib && del *.obj
) ELSE (
lib /nologo /out:blst_arm64.lib *.obj && del *.obj || EXIT /B
cl /nologo /arm64EC /c /O2 /Zi /Fdblst.pdb /W4 /MT /Zl %TOP%src\server.c || EXIT /B
FOR %%F IN (%TOP%build\win64\*-armv8.asm) DO (
armasm64 -nologo -machine arm64ec -nowarn %%F || EXIT /B
)
cl /nologo /arm64EC /c /O2 /Oi- /MD %TOP%build\win64\dll.c || EXIT /B
link /nologo /machine:arm64x /dll /noentry %shared% ^
/def:%TOP%build\win64\blst.def *.obj ^
/defArm64Native:%TOP%build\win64\blst.def blst_arm64.lib ^
kernel32.lib && del *.obj blst_arm64.lib
)
) ELSE (
lib /nologo %static% *.obj && del *.obj
)
ENDLOCAL
EXIT /B
1 change: 1 addition & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ $(BLST_BUILDSCRIPT):
@git submodule update --init

$(BLST_LIBRARY): $(BLST_BUILDSCRIPT)
@cp ../build.bat ../blst/build.bat
@cd $(dir $(BLST_BUILDSCRIPT)) && \
./$(notdir $(BLST_BUILDSCRIPT)) $(BLST_BUILDSCRIPT_FLAGS) && \
cp $(notdir $(BLST_LIBRARY)) ../lib && \
Expand Down

0 comments on commit 6d08822

Please sign in to comment.