Browse Source

Keep CMakeCache.txt in between build script invocation to speed things up. Correct typo error.

Wei Tjong Yao 12 years ago
parent
commit
09ba853aba

+ 4 - 5
Source/CMake/Modules/Urho3D-CMake-magic.cmake

@@ -142,6 +142,9 @@ else ()
     if (ANDROID)
     if (ANDROID)
         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof -fstack-protector")
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof -fstack-protector")
+        if (ENABLE_64BIT)
+            # For now just reference it to suppress "unused variable" warning
+        endif ()
     elseif (NOT IOS)
     elseif (NOT IOS)
         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof -ffast-math")
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof -ffast-math")
@@ -233,17 +236,13 @@ endfunction ()
 
 
 # Override builtin function to suit our need, takes care of C flags as well as CXX flags
 # Override builtin function to suit our need, takes care of C flags as well as CXX flags
 function (add_compiler_export_flags)
 function (add_compiler_export_flags)
-    if (NOT ANDROID)
-        message ("--")
+    if (NOT ANDROID AND NOT MSVC AND NOT DEFINED USE_COMPILER_HIDDEN_VISIBILITY AND NOT DEFINED COMPILER_HAS_DEPRECATED)
         message ("-- Following tests check whether compiler installed in this system has export/import and deprecated attributes support")
         message ("-- Following tests check whether compiler installed in this system has export/import and deprecated attributes support")
         message ("-- CMake will generate a suitable export header file for this system based on the test result")
         message ("-- CMake will generate a suitable export header file for this system based on the test result")
         message ("-- It is OK to proceed to build Urho3D regardless of the test result")
         message ("-- It is OK to proceed to build Urho3D regardless of the test result")
     endif ()
     endif ()
     _test_compiler_hidden_visibility ()
     _test_compiler_hidden_visibility ()
     _test_compiler_has_deprecated ()
     _test_compiler_has_deprecated ()
-    if (NOT ANDROID)
-        message ("--")
-    endif ()
 
 
     if (NOT (USE_COMPILER_HIDDEN_VISIBILITY AND COMPILER_HAS_HIDDEN_VISIBILITY))
     if (NOT (USE_COMPILER_HIDDEN_VISIBILITY AND COMPILER_HAS_HIDDEN_VISIBILITY))
         # Just return if there are no flags to add.
         # Just return if there are no flags to add.

+ 4 - 0
Source/CMake/Toolchains/raspberrypi.toolchain.cmake

@@ -22,6 +22,10 @@
 
 
 cmake_minimum_required (VERSION 2.6.3)
 cmake_minimum_required (VERSION 2.6.3)
 
 
+if (CMAKE_TOOLCHAIN_FILE)
+    # Reference toolchain variable to suppress "unused variable" warning
+endif()
+
 # this one is important
 # this one is important
 set (CMAKE_SYSTEM_NAME Linux)
 set (CMAKE_SYSTEM_NAME Linux)
 #this one not so much
 #this one not so much

+ 12 - 11
Source/CMakeLists.txt

@@ -157,15 +157,16 @@ else ()
 endif ()
 endif ()
 
 
 # Generate platform specific export header file automatically
 # Generate platform specific export header file automatically
-set_target_properties (Urho3D PROPERTIES DEFINE_SYMBOL URHO3D_EXPORTS)
-generate_export_header (Urho3D EXPORT_MACRO_NAME URHO3D_API EXPORT_FILE_NAME Engine/Urho3D.h.new)
-
-# Append Urho3D license notice to the export header file
-file (READ ${CMAKE_SOURCE_DIR}/Engine/Urho3D.h.in LICENSE)
-file (READ ${CMAKE_BINARY_DIR}/Engine/Urho3D.h.new EXPORT_DEFINE)
-file (WRITE ${CMAKE_BINARY_DIR}/Engine/Urho3D.h.new ${LICENSE}${EXPORT_DEFINE})
-
-# Copy the new export header file only if it is different to prevent unnecessary library rebuild
-execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/Engine/Urho3D.h.new ${CMAKE_BINARY_DIR}/Engine/Urho3D.h)
-file (REMOVE ${CMAKE_BINARY_DIR}/Engine/Urho3D.h.new)
+if (NOT URHO3D_BUILD_TYPE STREQUAL URHO3D_EXPORTS_BUILD_TYPE OR ${CMAKE_SOURCE_DIR}/Engine/Urho3D.h.in IS_NEWER_THAN ${CMAKE_BINARY_DIR}/Engine/Urho3D.h)
+    set_target_properties (Urho3D PROPERTIES DEFINE_SYMBOL URHO3D_EXPORTS)
+    generate_export_header (Urho3D EXPORT_MACRO_NAME URHO3D_API EXPORT_FILE_NAME Engine/Urho3D.h)
+    set (URHO3D_EXPORTS_BUILD_TYPE ${URHO3D_BUILD_TYPE} CACHE INTERNAL "Build type when Urho3D export header was last generated")
+    
+    # Append Urho3D license notice to the export header file
+    file (READ ${CMAKE_BINARY_DIR}/Engine/Urho3D.h EXPORT_DEFINE)
+    configure_file (${CMAKE_SOURCE_DIR}/Engine/Urho3D.h.in ${CMAKE_BINARY_DIR}/Engine/Urho3D.h) 
+endif ()
 
 
+# Reference supported build options that are potentially not being referenced due to platform or build type branching to suppress "unused variable" warning
+if (ENABLE_SAMPLES AND ENABLE_EXTRAS AND ENABLE_TOOLS AND ENABLE_MINIDUMPS AND ENABLE_SAFE_LUA AND USE_MKLINK AND USE_STATIC_RUNTIME AND SCP_TO_TARGET AND ANDROID_ABI)
+endif()

+ 1 - 0
Source/Engine/Urho3D.h.in

@@ -24,3 +24,4 @@
 #pragma warning(disable: 4251)
 #pragma warning(disable: 4251)
 #pragma warning(disable: 4275)
 #pragma warning(disable: 4275)
 #endif
 #endif
+@EXPORT_DEFINE@

+ 3 - 3
Source/Extras/LuaScript/LuaScript.cpp

@@ -171,12 +171,12 @@ void LuaScript::ScriptSubscribeToEvent(const String& eventName, const String& fu
 {
 {
     StringHash eventType(eventName);
     StringHash eventType(eventName);
 
 
-    LuaFunction* luaFunciton = GetFunction(functionName);
-    if (luaFunciton)
+    LuaFunction* luaFunction = GetFunction(functionName);
+    if (luaFunction)
     {
     {
         SubscribeToEvent(eventType, HANDLER(LuaScript, HandleEvent));
         SubscribeToEvent(eventType, HANDLER(LuaScript, HandleEvent));
 
 
-        eventTypeToFunctionMap_[eventType] = luaFunciton;
+        eventTypeToFunctionMap_[eventType] = luaFunction;
     }
     }
 }
 }
 
 

+ 1 - 1
Source/Extras/LuaScript/LuaScript.h

@@ -70,7 +70,7 @@ public:
     /// Return Lua state.
     /// Return Lua state.
     lua_State* GetState() const { return luaState_; }
     lua_State* GetState() const { return luaState_; }
     /// Return Lua function.
     /// Return Lua function.
-    LuaFunction* GetFunction(const String& funcitonName, bool silentIfNotfound = false);
+    LuaFunction* GetFunction(const String& functionName, bool silentIfNotfound = false);
 
 
 private:
 private:
     /// Register loader.
     /// Register loader.

+ 5 - 5
Source/ThirdParty/SDL/CMakeLists.txt

@@ -54,10 +54,11 @@ else ()
         endif ()
         endif ()
         include_directories (${X11_INCLUDE_DIRS})  
         include_directories (${X11_INCLUDE_DIRS})  
 
 
-        message ("--")
-        message ("-- Following tests check whether X11 library installed in this system uses _Xconst in below functions")
-        message ("-- A failed test result simply means the installed X11 library does not use _Xconst")
-        message ("-- It is OK to proceed to build Urho3D regardless of the test result")
+        if (NOT DEFINED HAVE_CONST_XEXT_ADDDISPLAY)
+            message ("-- Following tests check whether X11 library installed in this system uses _Xconst in below functions")
+            message ("-- A failed test result simply means the installed X11 library does not use _Xconst")
+            message ("-- It is OK to proceed to build Urho3D regardless of the test result")
+        endif ()
         include (CheckCSourceCompiles)
         include (CheckCSourceCompiles)
         set  (CMAKE_REQUIRED_LIBRARIES ${X11_LIB} ${X11_LIB})
         set  (CMAKE_REQUIRED_LIBRARIES ${X11_LIB} ${X11_LIB})
         check_c_source_compiles ("
         check_c_source_compiles ("
@@ -78,7 +79,6 @@ else ()
             add_definitions (-DSDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32)
             add_definitions (-DSDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32)
         endif ()
         endif ()
         set (CMAKE_REQUIRED_LIBRARIES)
         set (CMAKE_REQUIRED_LIBRARIES)
-        message ("--")
         
         
         file (GLOB VIDEO_DRIVER_C_FILES src/video/x11/*.c)
         file (GLOB VIDEO_DRIVER_C_FILES src/video/x11/*.c)
     endif ()
     endif ()

+ 7 - 7
cmake_android.bat

@@ -22,10 +22,6 @@
 
 
 @echo off
 @echo off
 :: Define USE_MKLINK to 1 to enable out-of-source build and symbolic linking of resources from Bin directory
 :: Define USE_MKLINK to 1 to enable out-of-source build and symbolic linking of resources from Bin directory
-if exist CMakeCache.txt. del /F CMakeCache.txt
-if exist Source\Android\CMakeCache.txt. del /F Source\Android\CMakeCache.txt
-if exist CMakeFiles. rd /S /Q CMakeFiles
-if exist Source\Android\CMakeFiles. rd /S /Q Source\Android\CMakeFiles
 set "build=Source\Android"
 set "build=Source\Android"
 set "source=.."
 set "source=.."
 set "use_mklink="
 set "use_mklink="
@@ -37,15 +33,19 @@ if not "%1" == "" (
     goto loop
     goto loop
 )
 )
 if "%use_mklink%" == "1" (
 if "%use_mklink%" == "1" (
+    :: Remove cache file from opposite build directory
+    if exist Source\Android\CMakeCache.txt. del /F Source\Android\CMakeCache.txt
+    if exist Source\Android\CMakeFiles. rd /S /Q Source\Android\CMakeFiles
     cmake -E make_directory android-Build
     cmake -E make_directory android-Build
-    if exist android-Build\CMakeCache.txt. del /F android-Build\CMakeCache.txt
-    if exist android-Build\CMakeFiles. rd /S /Q android-Build\CMakeFiles
     set "build=android-Build"
     set "build=android-Build"
     set "source=..\Source"
     set "source=..\Source"
     for %%d in (CoreData Data) do mklink /D "Source\Android\assets\%%d" "..\..\..\Bin\%%d"
     for %%d in (CoreData Data) do mklink /D "Source\Android\assets\%%d" "..\..\..\Bin\%%d"
     for %%d in (src res assets) do mklink /D "android-Build\%%d" "..\Source\Android\%%d"
     for %%d in (src res assets) do mklink /D "android-Build\%%d" "..\Source\Android\%%d"
     for %%f in (AndroidManifest.xml build.xml project.properties) do mklink "android-Build\%%f" "..\Source\Android\%%f"
     for %%f in (AndroidManifest.xml build.xml project.properties) do mklink "android-Build\%%f" "..\Source\Android\%%f"
-)
+) else (
+    if exist android-Build\CMakeCache.txt. del /F android-Build\CMakeCache.txt
+    if exist android-Build\CMakeFiles. rd /S /Q android-Build\CMakeFiles
+) 
 cmake -E copy_if_different Docs\Doxyfile.in Doxyfile
 cmake -E copy_if_different Docs\Doxyfile.in Doxyfile
 echo on
 echo on
 cmake -E chdir %build% cmake -G "Unix Makefiles" -DANDROID=1 -DCMAKE_TOOLCHAIN_FILE=%source%\CMake\Toolchains\android.toolchain.cmake -DLIBRARY_OUTPUT_PATH_ROOT=.  %* %source%
 cmake -E chdir %build% cmake -G "Unix Makefiles" -DANDROID=1 -DCMAKE_TOOLCHAIN_FILE=%source%\CMake\Toolchains\android.toolchain.cmake -DLIBRARY_OUTPUT_PATH_ROOT=.  %* %source%

+ 1 - 7
cmake_gcc.sh

@@ -104,12 +104,6 @@ cmake -E make_directory Build
 [ $RASPI_TOOL ] && cmake -E make_directory raspi-Build
 [ $RASPI_TOOL ] && cmake -E make_directory raspi-Build
 [ $ANDROID_NDK ] && cmake -E make_directory android-Build
 [ $ANDROID_NDK ] && cmake -E make_directory android-Build
 
 
-# Remove existing CMake cache and rules
-rm -rf {Build,raspi-Build,android-Build}/CMakeCache.txt {Build,raspi-Build,android-Build}/CMakeFiles
-# Do cleanup a few more times for old build directory created by previous version of cmake_gcc.sh, just in case
-rm -rf {.,build,Android}/CMakeCache.txt {.,build,Android}/CMakeFiles
-rm -rf {../build,../raspi-build,../android-build}/CMakeCache.txt {../build,../raspi-build,../android-build}/CMakeFiles
-
 # Add support for Eclipse IDE
 # Add support for Eclipse IDE
 IFS=#
 IFS=#
 GENERATOR="Unix Makefiles"
 GENERATOR="Unix Makefiles"
@@ -118,7 +112,7 @@ GENERATOR="Unix Makefiles"
 # Add support for both native and cross-compiling build for Raspberry Pi
 # Add support for both native and cross-compiling build for Raspberry Pi
 [[ $( uname -m ) =~ ^armv6 ]] && PLATFORM="-DRASPI=1"
 [[ $( uname -m ) =~ ^armv6 ]] && PLATFORM="-DRASPI=1"
 
 
-# Create project with the respective Cmake generators
+# Create project with the respective CMake generators
 OPT=
 OPT=
 msg "Native build" && cmake -E chdir Build cmake $OPT -G $GENERATOR $PLATFORM $@ $SOURCE && post_cmake Build
 msg "Native build" && cmake -E chdir Build cmake $OPT -G $GENERATOR $PLATFORM $@ $SOURCE && post_cmake Build
 [ $RASPI_TOOL ] && msg "Raspberry Pi build" && cmake -E chdir raspi-Build cmake $OPT -G $GENERATOR -DRASPI=1 -DCMAKE_TOOLCHAIN_FILE=$SOURCE/CMake/Toolchains/raspberrypi.toolchain.cmake $@ $SOURCE && post_cmake raspi-Build
 [ $RASPI_TOOL ] && msg "Raspberry Pi build" && cmake -E chdir raspi-Build cmake $OPT -G $GENERATOR -DRASPI=1 -DCMAKE_TOOLCHAIN_FILE=$SOURCE/CMake/Toolchains/raspberrypi.toolchain.cmake $@ $SOURCE && post_cmake raspi-Build

+ 9 - 13
cmake_macosx.sh

@@ -22,21 +22,17 @@
 
 
 # Ensure we are in project root directory
 # Ensure we are in project root directory
 cd $( dirname $0 )
 cd $( dirname $0 )
-SOURCE=`pwd`/Source
 
 
 # Create out-of-source build directory
 # Create out-of-source build directory
-cmake -E make_directory Build
-
-# Remove existing CMake cache and rules
-rm -rf Build/CMakeCache.txt Build/CMakeFiles
-# Do cleanup one more time for old build directory created by previous version of cmake_macosx.sh, just in case
-rm -rf {../build,.,build}/CMakeCache.txt {../build,.,build}/CMakeFiles
+SOURCE=`pwd`/Source
+BUILD=Build
+if [ $1 == "-DIOS=1" ]; then
+    BUILD=ios-Build
+fi
+cmake -E make_directory $BUILD
 
 
 # Create project with the Xcode generator
 # Create project with the Xcode generator
-cmake -E chdir Build cmake -G "Xcode" $@ $SOURCE
-
-# Below temporary fix may no longer be required by newer version of CMake
-sed -i.bak 's/lastKnownFileType = sourcecode; name = "as_callfunc_arm_xcode.S"/lastKnownFileType = sourcecode.asm; name = "as_callfunc_arm_xcode.S"/g' Build/*.xcodeproj/project.pbxproj
+cmake -E chdir $BUILD cmake -G "Xcode" $@ $SOURCE
 
 
 # Apple always uses OpenGL
 # Apple always uses OpenGL
 sed 's/OpenGL/Direct3D9/g' Docs/Doxyfile.in >Doxyfile
 sed 's/OpenGL/Direct3D9/g' Docs/Doxyfile.in >Doxyfile
@@ -44,8 +40,8 @@ sed 's/OpenGL/Direct3D9/g' Docs/Doxyfile.in >Doxyfile
 if [ $1 == "-DIOS=1" ]; then
 if [ $1 == "-DIOS=1" ]; then
     # Due to a bug in the CMake/Xcode generator where it has wrongly assumed the IOS bundle structure to be the same as MacOSX bundle structure,
     # Due to a bug in the CMake/Xcode generator where it has wrongly assumed the IOS bundle structure to be the same as MacOSX bundle structure,
     # below temporary fix is required in order to solve the auto-linking issue when dependent libraries are changed
     # below temporary fix is required in order to solve the auto-linking issue when dependent libraries are changed
-    sed -i.bak 's/\/Contents\/MacOS//g' Build/CMakeScripts/XCODE_DEPEND_HELPER.make
-    echo -e "\tsed -i.bak 's/\/Contents\/MacOS//g' CMakeScripts/XCODE_DEPEND_HELPER.make" >> Build/CMakeScripts/ReRunCMake.make
+    sed -i.bak 's/\/Contents\/MacOS//g' $BUILD/CMakeScripts/XCODE_DEPEND_HELPER.make
+    echo -e "\tsed -i.bak 's/\/Contents\/MacOS//g' CMakeScripts/XCODE_DEPEND_HELPER.make" >> $BUILD/CMakeScripts/ReRunCMake.make
 fi
 fi
 
 
 # vi: set ts=4 sw=4 expandtab:
 # vi: set ts=4 sw=4 expandtab:

+ 0 - 6
cmake_mingw.bat

@@ -22,12 +22,6 @@
 
 
 @echo off
 @echo off
 cmake -E make_directory Build
 cmake -E make_directory Build
-if exist CMakeCache.txt. del /F CMakeCache.txt
-if exist Build\CMakeCache.txt. del /F Build\CMakeCache.txt
-if exist Source\CMakeCache.txt. del /F Source\CMakeCache.txt
-if exist CMakeFiles. rd /S /Q CMakeFiles
-if exist Build\CMakeFiles. rd /S /Q Build\CMakeFiles
-if exist Source\CMakeFiles. rd /S /Q Source\CMakeFiles
 cmake -E copy_if_different Docs\Doxyfile.in Doxyfile
 cmake -E copy_if_different Docs\Doxyfile.in Doxyfile
 echo on
 echo on
 cmake -E chdir Build cmake -G "MinGW Makefiles" %* ..\Source
 cmake -E chdir Build cmake -G "MinGW Makefiles" %* ..\Source

+ 0 - 6
cmake_vs2008.bat

@@ -22,12 +22,6 @@
 
 
 @echo off
 @echo off
 cmake -E make_directory Build
 cmake -E make_directory Build
-if exist Build\CMakeCache.txt. del /F Build\CMakeCache.txt
-if exist Source\CMakeCache.txt. del /F Source\CMakeCache.txt
-if exist CMakeCache.txt del /F CMakeCache.txt
-if exist Build\CMakeFiles. rd /S /Q Build\CMakeFiles
-if exist Source\CMakeFiles. rd /S /Q Source\CMakeFiles
-if exist CMakeFiles. rd /S /Q CMakeFiles.
 set "arch="
 set "arch="
 set "version=9 2008"
 set "version=9 2008"
 :loop
 :loop