Browse Source

windows 32bit builds

Grant Limberg 5 years ago
parent
commit
ea5bb43cf9
2 changed files with 19 additions and 2 deletions
  1. 11 0
      CMakeLists.txt
  2. 8 2
      Jenkinsfile

+ 11 - 0
CMakeLists.txt

@@ -70,6 +70,17 @@ if(WIN32)
 		-trimpath
 	)
 
+	option(BUILD_32BIT "Force building as 32-bit binary" OFF)
+
+	if(BUILD_32BIT)
+		set(CMAKE_SYSTEM_PROCESSOR "x86" CACHE STRING "system processor")
+		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "c++ flags")
+		set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -m32" CACHE STRING "c flags")
+		set(GOARCH "GOARCH=386" CACHE STRING "go architecture")
+		add_compile_options(
+			-m32
+		)
+	endif(BUILD_32BIT)
 else(WIN32)
 
 	set(GOFLAGS

+ 8 - 2
Jenkinsfile

@@ -55,16 +55,22 @@ def buildMacOS() {
 
 def buildWindows() {
     def tasks = [:]
-    tasks << getTasks(['windows'], ['amd64'], { unused1, unused2 ->
+    tasks << getTasks(['windows'], ['amd64', 'i386'], { unused1, platform ->
         def myNode = {
             node ('windows') {
                 env.SHELL = 'C:/Windows/System32/cmd.exe'
                 env.PATH = 'C:\\TDM-GCC-64\\bin;C:\\WINDOWS;C:\\Windows\\system32;C:\\CMake\\bin;C:\\Go\\bin'
                 dir ("build") {
                     checkout scm
+
+                    
                     dir ("build") {
+                        def cmakeFlags = ""
+                        if (platform == "i386") {
+                            cmakeFlags = '-DBUILD_32BIT=1'
+                        }
                         bat """
-                        cmake -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..
+                        cmake -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ${cmakeFlags} ..
                         mingw32-make
                         """
                     }