瀏覽代碼

Try to add 32 bit CI test for Travis (see #496)

bel2125 8 年之前
父節點
當前提交
f3369924b3
共有 2 個文件被更改,包括 21 次插入2 次删除
  1. 8 2
      .travis.yml
  2. 13 0
      CMakeLists.txt

+ 8 - 2
.travis.yml

@@ -466,7 +466,7 @@ matrix:
     compiler: clang
     env:
       N=ClangLinux32Max
-      ARCH="x86"
+      ARCH=x86
       BUILD_TYPE=Release
       ENABLE_SSL_DYNAMIC_LOADING=YES
       OPENSSL_1_1=NO
@@ -488,10 +488,16 @@ matrix:
 
   -
     os: linux
+      addons:
+        apt:
+          sources:
+            - ubuntu-toolchain-r-test
+          packages:
+            - gcc-6
     compiler: gcc
     env:
       N=GCCLinux32Max
-      ARCH="x86"
+      ARCH=x86
       BUILD_TYPE=Release
       ENABLE_SSL_DYNAMIC_LOADING=YES
       OPENSSL_1_1=NO

+ 13 - 0
CMakeLists.txt

@@ -90,6 +90,10 @@ message(STATUS "Memory Debugging - ${CIVETWEB_ENABLE_MEMORY_DEBUGGING}")
 option(CIVETWEB_ENABLE_ASAN "Enable ASAN in debug mode" ON)
 message(STATUS "ASAN in debug mode - ${CIVETWEB_ENABLE_ASAN}")
 
+# ARCH flag
+option(CIVETWEB_ARCH "Force 32/64 bit architecture" OFF)
+message(STATUS "Force x32 / x64 architecture - ${CIVETWEB_ARCH}")
+
 # LUA CGI support
 option(CIVETWEB_ENABLE_LUA "Enable Lua CGIs" OFF)
 message(STATUS "Lua CGI support - ${CIVETWEB_ENABLE_LUA}")
@@ -417,6 +421,15 @@ if(CIVETWEB_SSL_OPENSSL_API_1_1)
 endif()
 add_definitions(-DUSE_STACK_SIZE=${CIVETWEB_THREAD_STACK_SIZE})
 
+# Set 32 or 64 bit environment
+if (${CMAKE_ARCH} MATCHES "[Xx]86")
+add_c_compiler_flag(-m32)
+endif()
+if (${CMAKE_ARCH} MATCHES "[Xx]64")
+add_c_compiler_flag(-m64)
+endif()
+# TODO: add support for -march
+
 # Build the targets
 add_subdirectory(src)