Skip to content

Commit 5cb8800

Browse files
committed
windows build
1 parent f768f1e commit 5cb8800

File tree

5 files changed

+60
-24
lines changed

5 files changed

+60
-24
lines changed

.github/workflows/xtracfg.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ jobs:
88
strategy:
99
matrix:
1010
os:
11-
# - runner: ubuntu-24.04
12-
# type: linux
13-
# platform: linux-amd64
14-
# - runner: ubuntu-24.04-arm
15-
# type: linux
16-
# platform: linux-arm64
17-
# - runner: macos-14
18-
# type: macos
19-
# platform: darwin-arm64
11+
# - runner: ubuntu-24.04
12+
# type: linux
13+
# platform: linux-amd64
14+
# - runner: ubuntu-24.04-arm
15+
# type: linux
16+
# platform: linux-arm64
17+
# - runner: macos-14
18+
# type: macos
19+
# platform: darwin-arm64
2020
- runner: windows-2022
2121
type: windows
2222
platform: windows-amd64
@@ -56,17 +56,18 @@ jobs:
5656
./gradlew nativeCompile -PLIB=true
5757
- name: log0
5858
run: |
59-
ls -Recurse ./libxtracfg/java/build/native/nativeCompile
6059
cat ./libxtracfg/java/build/native/nativeCompile/logs/compiler_commands.txt
6160
- name: log1
6261
run: |
6362
ls -l ./libxtracfg/c/build
6463
# TODO: windows
6564
- name: c
6665
working-directory: ./libxtracfg/c
66+
env:
67+
EXT: ${{ matrix.os.type == 'windows' && 'bat' || 'sh' }}
6768
run: |
68-
./build.sh
69-
./test.sh
69+
./build.${EXT}
70+
./test.${EXT}
7071
- name: log2
7172
run: |
7273
ls -l ./libxtracfg/c/build
@@ -102,15 +103,15 @@ jobs:
102103
strategy:
103104
matrix:
104105
os:
105-
# - runner: ubuntu-24.04
106-
# type: linux
107-
# platform: linux-amd64
108-
# - runner: ubuntu-24.04-arm
109-
# type: linux
110-
# platform: linux-arm64
111-
# - runner: macos-14
112-
# type: macos
113-
# platform: darwin-arm64
106+
# - runner: ubuntu-24.04
107+
# type: linux
108+
# platform: linux-amd64
109+
# - runner: ubuntu-24.04-arm
110+
# type: linux
111+
# platform: linux-arm64
112+
# - runner: macos-14
113+
# type: macos
114+
# platform: darwin-arm64
114115
- runner: windows-2022
115116
type: windows
116117
platform: windows-amd64

libxtracfg/c/build.bat

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@echo off
2+
REM Windows batch file conversion of build.sh
3+
4+
SET OUT_DIR=build
5+
SET PLATFORM=windows
6+
SET EXT=lib
7+
8+
if not exist %OUT_DIR% mkdir %OUT_DIR%
9+
10+
cd %OUT_DIR%
11+
12+
echo lib
13+
14+
REM static
15+
cl.exe /c /W4 /I./ /I%JAVA_HOME%/include /I%JAVA_HOME%/include/%PLATFORM% /Folibxtracfg.obj ../wrapper/libxtracfg.c
16+
copy libxtracfgjni.lib libxtracfg.lib
17+
lib.exe /OUT:libxtracfg.lib libxtracfg.lib libxtracfg.obj
18+
19+
certutil -hashfile libxtracfg.lib SHA1 > libxtracfg.sha1sum.tmp
20+
REM Extract just the hash from certutil output (it includes headers/footers)
21+
findstr /v "SHA1 CertUtil" libxtracfg.sha1sum.tmp > libxtracfg.sha1sum
22+
del libxtracfg.sha1sum.tmp
23+
copy libxtracfg.sha1sum ..\..\go\xtracfg\
24+
25+
echo test
26+
27+
REM static
28+
cl.exe /I./ /Fetest.exe ../test/main.c libxtracfg.lib
29+
30+
cd ..

libxtracfg/c/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ echo "lib"
2121
clang -c -Wall -fPIC -I./ -I$JAVA_HOME/include -I$JAVA_HOME/include/${PLATFORM} -o libxtracfg.o ../wrapper/libxtracfg.c
2222
cp libxtracfgjni.a libxtracfg.a
2323
ar -rv libxtracfg.a libxtracfg.o
24+
2425
if [ "$PLATFORM" = "darwin" ]; then
2526
shasum libxtracfg.a > libxtracfg.sha1sum
2627
else

libxtracfg/c/native-image/static-compiler-windows.bat

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ REM To create a static library on Windows we need to call lib.exe input.obj /OUT
5050
REM We don't want to overwrite the .lib needed to compile against the .dll, so
5151
REM we append "_s" to indicate that it is a static library.
5252
if not exist %OUTPUT_PATH% mkdir %OUTPUT_PATH%
53-
if exist %OUTPUT_PATH%\%LIB_NAME%.lib rm -force %OUTPUT_PATH%\%LIB_NAME%.lib
54-
REM set LIB_ARGS=%LIB_NAME%.obj /OUT:%OUTPUT_PATH%\%LIB_NAME%_s.lib
55-
set LIB_ARGS=%LIB_NAME%.obj /OUT:%OUTPUT_PATH%\%LIB_NAME%.lib
53+
set LIB_ARGS=%LIB_NAME%.obj /OUT:%OUTPUT_PATH%\%LIB_NAME%_static.lib
5654
echo lib.exe %LIB_ARGS% >> %LOG_FILE%
5755
cmd /c lib.exe %LIB_ARGS%

libxtracfg/c/test.bat

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
3+
set DIR=%~dp0
4+
set DIR=%DIR:~0,-1%
5+
6+
build\test.exe "{\"command\": \"info\", \"source\": \"%DIR%\", \"debug\": \"true\", \"verbose\": \"true\"}"

0 commit comments

Comments
 (0)