Skip to content

Commit 4cdb9be

Browse files
committed
feat: Add windows builds
1 parent 7e5df8c commit 4cdb9be

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
set(CMAKE_SYSTEM_NAME Windows)
2+
set(CMAKE_SYSTEM_PROCESSOR i686)
3+
4+
find_program(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
5+
find_program(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
6+
7+
execute_process(
8+
COMMAND ${CMAKE_C_COMPILER} -print-sysroot
9+
OUTPUT_VARIABLE CMAKE_SYSROOT
10+
OUTPUT_STRIP_TRAILING_WHITESPACE
11+
)
12+
13+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
14+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
15+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
16+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
set(CMAKE_SYSTEM_NAME Windows)
2+
set(CMAKE_SYSTEM_PROCESSOR x86_64)
3+
4+
find_program(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
5+
find_program(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
6+
7+
execute_process(
8+
COMMAND ${CMAKE_C_COMPILER} -print-sysroot
9+
OUTPUT_VARIABLE CMAKE_SYSROOT
10+
OUTPUT_STRIP_TRAILING_WHITESPACE
11+
)
12+
13+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
14+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
15+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
16+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ tasks.create("build_ios") {
108108
arrayOf("-GXcode", "-DCMAKE_OSX_SYSROOT=iphonesimulator"), arrayOf("--target", "box2d", "--", "-sdk", "iphonesimulator", "-arch", "x86_64")))
109109
}
110110

111+
tasks.create("build_windows") {
112+
group = "box2d"
113+
dependsOn(cmakeBuild(file("build/box2d/windows_x86"), "windows_x86", file("box2d_build/toolchain_windows_i686.cmake"), otherCFlags = "-msse2"))
114+
dependsOn(cmakeBuild(file("build/box2d/windows_x86_64"), "windows_x86_64", file("box2d_build/toolchain_windows_x86_64.cmake")))
115+
}
116+
111117
jnigen {
112118
javaClass.superclass.getDeclaredField("sharedLibName").apply { isAccessible = true }.set(this, "gdx-box2d")
113119
generator {
@@ -136,8 +142,12 @@ jnigen {
136142
addLinux(x64, ARM)
137143
addLinux(x64, RISCV)
138144

145+
addWindows(x32, x86)
146+
addWindows(x64, x86)
147+
139148
addMac(x64, ARM)
140149
addMac(x64, x86)
150+
141151
addAndroid {
142152
libraries = ""
143153
androidApplicationMk += "APP_PLATFORM := android-21\nAPP_STRIP_MODE := none\nAPP_STL := c++_shared"

0 commit comments

Comments
 (0)