Selaa lähdekoodia

For Travis CI - do not set ENABLE_TESTING build option when packaging.

Yao Wei Tjong 姚伟忠 11 vuotta sitten
vanhempi
sitoutus
bdc0348b88
2 muutettua tiedostoa jossa 16 lisäystä ja 19 poistoa
  1. 15 18
      Rakefile
  2. 1 1
      Source/CMake/Modules/Urho3D-CMake-common.cmake

+ 15 - 18
Rakefile

@@ -47,6 +47,13 @@ end
 # Usage: NOT intended to be used manually (if you insist then try: rake travis_ci)
 desc 'Configure, build, and test Urho3D project'
 task :travis_ci do
+  if ENV['PACKAGE_UPLOAD']
+    $configuration = 'Release'
+    $testing = 0
+  else
+    $configuration = 'Debug'
+    $testing = 1
+  end
   if ENV['XCODE']
     # xctool or xcodebuild
     xcode_travis_ci
@@ -171,11 +178,6 @@ EOF" or abort 'Failed to create new project using Urho3D as external library'
 end
 
 def makefile_travis_ci
-  if ENV['PACKAGE_UPLOAD']
-    configuration = 'Release'
-  else
-    configuration = 'Debug'
-  end
   if ENV['WINDOWS']
     # LuaJIT on MinGW build is not possible on Ubuntu 12.04 LTS as its GCC cross-compiler version is too old. Fallback to use Lua library instead.
     jit = ''
@@ -188,7 +190,7 @@ def makefile_travis_ci
     jit = 'JIT'
     amalg = '-DENABLE_LUAJIT_AMALG=1'
   end
-  system "./cmake_gcc.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA#{jit}=1 #{amalg} -DENABLE_SAMPLES=1 -DENABLE_TOOLS=1 -DENABLE_EXTRAS=1 -DENABLE_TESTING=1 -DCMAKE_BUILD_TYPE=#{configuration}" or abort 'Failed to configure Urho3D library build'
+  system "./cmake_gcc.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA#{jit}=1 #{amalg} -DENABLE_SAMPLES=1 -DENABLE_TOOLS=1 -DENABLE_EXTRAS=1 -DENABLE_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration}" or abort 'Failed to configure Urho3D library build'
   if ENV['ANDROID']
     # LuaJIT on Android build requires tolua++ and buildvm-android tools to be built natively first
     system 'cd Build/ThirdParty/toluapp/src/bin && make' or abort 'Failed to build tolua++ tool'
@@ -203,7 +205,7 @@ def makefile_travis_ci
     platform_prefix = ''
   end
   # Only 64-bit Linux environment with virtual framebuffer X server support and not MinGW build; or OSX build environment are capable to run tests
-  if ENV['ENABLE_64BIT'] and ENV['WINDOWS'].to_i != 1 or ENV['OSX']
+  if $testing == 1 and (ENV['ENABLE_64BIT'] and ENV['WINDOWS'].to_i != 1 or ENV['OSX'])
     test = '&& make test'
   else
     test = ''
@@ -211,7 +213,7 @@ def makefile_travis_ci
   system "cd #{platform_prefix}Build && make #{test}" or abort 'Failed to build or test Urho3D library'
   # Create a new project on the fly that uses newly built Urho3D library
   scaffolding "#{platform_prefix}Build/generated/externallib"
-  system "URHO3D_HOME=`pwd`; export URHO3D_HOME && cd #{platform_prefix}Build/generated/externallib && echo '\nUsing Urho3D as external library in external project' && ./cmake_gcc.sh -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA#{jit}=1 -DENABLE_TESTING=1 -DCMAKE_BUILD_TYPE=#{configuration} && cd #{platform_prefix}Build && make #{test}" or abort 'Failed to configure/build/test temporary project using Urho3D as external library' 
+  system "URHO3D_HOME=`pwd`; export URHO3D_HOME && cd #{platform_prefix}Build/generated/externallib && echo '\nUsing Urho3D as external library in external project' && ./cmake_gcc.sh -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA#{jit}=1 -DENABLE_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration} && cd #{platform_prefix}Build && make #{test}" or abort 'Failed to configure/build/test temporary project using Urho3D as external library' 
 end
 
 def xcode_travis_ci
@@ -228,11 +230,11 @@ def xcode_travis_ci
     amalg = '-DENABLE_LUAJIT_AMALG=1'
     platform_prefix = ''
   end
-  system "./cmake_macosx.sh -DIOS=$IOS -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA#{jit}=1 #{amalg} -DENABLE_SAMPLES=1 -DENABLE_TOOLS=1 -DENABLE_EXTRAS=1 -DENABLE_TESTING=1" or abort 'Failed to configure Urho3D library build'
+  system "./cmake_macosx.sh -DIOS=$IOS -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA#{jit}=1 #{amalg} -DENABLE_SAMPLES=1 -DENABLE_TOOLS=1 -DENABLE_EXTRAS=1 -DENABLE_TESTING=#{$testing}" or abort 'Failed to configure Urho3D library build'
   xcode_build(ENV['IOS'], "#{platform_prefix}Build/Urho3D.xcodeproj") or abort 'Failed to build or test Urho3D library'
   # Create a new project on the fly that uses newly built Urho3D library
   scaffolding "#{platform_prefix}Build/generated/externallib"
-  system "URHO3D_HOME=`pwd`; export URHO3D_HOME && cd #{platform_prefix}Build/generated/externallib && echo '\nUsing Urho3D as external library in external project' && ./cmake_macosx.sh -DIOS=$IOS -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA#{jit}=1 -DENABLE_TESTING=1" or abort 'Failed to configure temporary project using Urho3D as external library'
+  system "URHO3D_HOME=`pwd`; export URHO3D_HOME && cd #{platform_prefix}Build/generated/externallib && echo '\nUsing Urho3D as external library in external project' && ./cmake_macosx.sh -DIOS=$IOS -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA#{jit}=1 -DENABLE_TESTING=#{$testing}" or abort 'Failed to configure temporary project using Urho3D as external library'
   xcode_build(ENV['IOS'], "#{platform_prefix}Build/generated/externallib/#{platform_prefix}Build/Scaffolding.xcodeproj") or abort 'Failed to configure/build/test temporary project using Urho3D as external library'
 end
 
@@ -246,16 +248,11 @@ def xcode_build(ios, project, scheme = 'ALL_BUILD', autosave = true, extras = ''
     xcproj.save     # There is a bug in this gem, it does not appear to exit with proper exit status (assume always success for now)
   end
   sdk = ios.to_i == 1 ? '-sdk iphonesimulator' : ''
-  if ENV['PACKAGE_UPLOAD']
-    configuration = 'Release'
-  else
-    configuration = 'Debug'
-  end
   # Use xctool when building as its output is nicer
-  system "xctool -project #{project} -scheme #{scheme} -configuration #{configuration} #{sdk} #{extras}" or return 1
-  if ios.to_i != 1 and scheme == 'ALL_BUILD'     # Disable testing for IOS as we don't have unit tests for IOS platform yet
+  system "xctool -project #{project} -scheme #{scheme} -configuration #{$configuration} #{sdk} #{extras}" or return 1
+  if $testing == 1 and ios.to_i != 1 and scheme == 'ALL_BUILD'     # Disable testing for IOS as we don't have unit tests for IOS platform yet
     # Use xcodebuild when testing as its output is instantaneous (ensure Travis-CI does not kill the process during testing)
-    system "xcodebuild -project #{project} -scheme RUN_TESTS -configuration #{configuration} #{sdk} #{extras}" or return 1
+    system "xcodebuild -project #{project} -scheme RUN_TESTS -configuration #{$configuration} #{sdk} #{extras}" or return 1
   end
   return 0
 end

+ 1 - 1
Source/CMake/Modules/Urho3D-CMake-common.cmake

@@ -209,7 +209,7 @@ else ()
         endif ()
     elseif (IOS)
         # Using the fact that ENABLE_TESTING option is provided when performing CI build, suppress all the warnings for iOS build because 3rd party libraries produce too many of them and yet we don't want to touch the 3rd party library's source codes unnecessarily
-        if (ENABLE_TESTING)
+        if (DEFINED ENABLE_TESTING)
             set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
             set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
         endif ()