Browse Source

Fix host tool building and relinking dependency.
Also fix an issue with CMake reconfiguration where the internal cache work against the regeneration of the custom RESOURCE_CHECK target.

Yao Wei Tjong 姚伟忠 11 years ago
parent
commit
a66df72ff5

+ 7 - 3
CMake/Modules/Urho3D-CMake-common.cmake

@@ -496,12 +496,12 @@ macro (enable_pch HEADER_PATHNAME)
                 if (FILE MATCHES \\.cpp$)
                     if (FILE MATCHES ${NAME_WE}\\.cpp$)
                         # Precompiling header file
-                        set_property (SOURCE ${FILE} APPEND_STRING PROPERTY COMPILE_FLAGS "/Fp$(IntDir)${PCH_FILENAME} /Yc${HEADER_FILENAME}")
+                        set_property (SOURCE ${FILE} APPEND_STRING PROPERTY COMPILE_FLAGS " /Fp$(IntDir)${PCH_FILENAME} /Yc${HEADER_FILENAME}")     # Need a leading space for appending
                     else ()
                         # Use the precompiled header file
                         get_property (NO_PCH SOURCE ${FILE} PROPERTY NO_PCH)
                         if (NOT NO_PCH)
-                            set_property (SOURCE ${FILE} APPEND_STRING PROPERTY COMPILE_FLAGS "/Fp$(IntDir)${PCH_FILENAME} /Yu${HEADER_FILENAME} /FI${HEADER_FILENAME}")
+                            set_property (SOURCE ${FILE} APPEND_STRING PROPERTY COMPILE_FLAGS " /Fp$(IntDir)${PCH_FILENAME} /Yu${HEADER_FILENAME} /FI${HEADER_FILENAME}")
                         endif ()
                     endif ()
                 endif ()
@@ -835,6 +835,10 @@ macro (setup_main_executable)
             setup_macosx_linker_flags (CMAKE_EXE_LINKER_FLAGS)
         elseif (EMSCRIPTEN)
             setup_emscripten_linker_flags (CMAKE_EXE_LINKER_FLAGS)
+            if (RESOURCE_PAKS)
+                string (REPLACE ";" "\;" LINK_DEPENDS "${RESOURCE_PAKS}")       # Stringify for string replacement
+                list (APPEND TARGET_PROPERTIES LINK_DEPENDS "${LINK_DEPENDS}")  # Stringify with semicolons already escaped
+            endif ()
             if (PRELOAD_FLAGS)
                 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PRELOAD_FLAGS}")
             endif ()
@@ -869,7 +873,7 @@ macro (setup_main_executable)
         endforeach ()
         string (MD5 MD5ALL ${MD5ALL})
         # Ensure the resource check is done before building the main executable target
-        if (RESOURCE_CHECK_${MD5ALL})
+        if (RESOURCE_CHECK_${MD5ALL} AND NOT RESOURCE_CHECK_${MD5ALL} STREQUAL TARGET_NAME AND TARGET ${RESOURCE_CHECK_${MD5ALL}})
             add_dependencies (${TARGET_NAME} ${RESOURCE_CHECK_${MD5ALL}})
         else ()
             set (RESOURCE_CHECK RESOURCE_CHECK)

+ 2 - 2
Source/Tools/PackageTool/CMakeLists.txt

@@ -83,7 +83,7 @@ if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
     )
 
     # MSVC does not do cross-compiling at the moment, so only force include using GCC/Clang approach
-    set_property (SOURCE ${MINI_URHO_CPP_FILES} APPEND_STRING PROPERTY COMPILE_FLAGS "-include Urho3D.h")
+    set_property (SOURCE ${MINI_URHO_CPP_FILES} APPEND_STRING PROPERTY COMPILE_FLAGS " -include Urho3D.h")  # Need a leading space for appending
 
     # Check existence of stdint.h for LibCpuId
     include (CheckIncludeFiles)
@@ -100,7 +100,7 @@ if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
     add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LibCpuId host/LibCpuId)
     add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LZ4 host/LZ4)
     add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/SDL host/SDL)
-    set (INCLUDE_DIRS ${BAKED_CMAKE_BINARY_DIR}/include/Urho3D ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
+    set (INCLUDE_DIRS ${BAKED_CMAKE_BINARY_DIR}/include ${BAKED_CMAKE_BINARY_DIR}/include/Urho3D ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
     set (LIBS LibCpuId SDL)
 endif ()
 

+ 0 - 118
buildEmscriptenSamples.sh

@@ -1,118 +0,0 @@
-#!/bin/bash
-
-# This script assumes you have made Data.pak and CoreData.pak
-# and have them in your $URHO_DIR/Bin folder. It's best to make them
-# compressed with the -c option for PackageTool
-
-# steps:
-# 1) make sure emscripten is installed and you have set your environment
-#    properly
-# 2) run cmake_emscripten.sh 
-# 3) change to the emscripten-build directory
-# 4) copy this file there and make any necessary changes to directory names
-# 5) build the library - I use make -j3
-# 6) execute this script. It should build all the c++ samples.
-#
-
-# set this to the top level directory of your Urho build tree
-URHO_DIR=~/urho.badpixels/Urho3D
-
-#set this to where you want the html and other files to go
-HTML_DIR=$URHO_DIR/Bin
-
-cd #URHO_DIR/emscripten-Build
-
-# make sure environment is set up for emscripten sdk
-. ~/emscripten/emsdk_portable/emsdk_set_env.sh
-
-# various include directories
-INCLUDES="-I../../Engine/Physics/"
-INCLUDES=$INCLUDES" -I../../ThirdParty/Bullet/src/"
-INCLUDES=$INCLUDES" -I../../Engine/Network/"
-INCLUDES=$INCLUDES" -I../../Engine/UI/"
-INCLUDES=$INCLUDES" -I../../Engine/Graphics/"
-INCLUDES=$INCLUDES" -I../../Engine/Scene/"
-INCLUDES=$INCLUDES" -I../../Engine/Input/"
-INCLUDES=$INCLUDES" -I../../Samples/"
-INCLUDES=$INCLUDES" -I../../Engine/Engine/"
-INCLUDES=$INCLUDES" -I../../Engine/Core/"
-INCLUDES=$INCLUDES" -I../../Engine/Container/"
-INCLUDES=$INCLUDES" -I../../../emscripten-Build/Engine/"
-INCLUDES=$INCLUDES" -I../../Engine/Math/"
-INCLUDES=$INCLUDES" -I../../Engine/IO/"
-INCLUDES=$INCLUDES" -I../../Engine/Resource/" 
-INCLUDES=$INCLUDES" -I../../Engine/Audio/" 
-INCLUDES=$INCLUDES" -I../../Engine/Navigation/" 
-INCLUDES=$INCLUDES" -I../../Engine/Urho2D/" 
-INCLUDES=$INCLUDES" -I../../Engine/Script/" 
-INCLUDES=$INCLUDES" -I../../ThirdParty/Box2D/" 
-
-echo "INCLUDES:" $INCLUDES
-
-BIN=$URHO_DIR/Bin
-
-LIBS=" -L../../../Lib/"
-echo "LIBS:" $LIBS
-
-#MEMORY="-s TOTAL_MEMORY=32000000"
-MEMORY="-s ALLOW_MEMORY_GROWTH=1"
-
-OPTIMIZE="-O2"
-
-function buildSample {
-    APPNAME=$1
-    echo Building $APPNAME
-    cd $URHO_DIR/Source/Samples/$APPNAME
-    ln $BIN/Data.pak Data.pak
-    ln $BIN/CoreData.pak CoreData.pak
-    SOURCES=`ls *.cpp`
-    DEFINES=""
-    emcc -s USE_SDL=2 $OPTIMIZE -o $HTML_DIR/$APPNAME.html $DEFINES $INCLUDES $LIBS $SOURCES -lUrho3D --preload-file Data.pak --preload-file CoreData.pak $MEMORY
-    rm Data.pak CoreData.pak
-}
-
-SAMPLES=""
-SAMPLES=$SAMPLES" 01_HelloWorld"
-SAMPLES=$SAMPLES" 02_HelloGUI"
-SAMPLES=$SAMPLES" 03_Sprites"
-SAMPLES=$SAMPLES" 04_StaticScene"
-SAMPLES=$SAMPLES" 05_AnimatingScene"
-SAMPLES=$SAMPLES" 06_SkeletalAnimation"
-SAMPLES=$SAMPLES" 07_Billboards"
-SAMPLES=$SAMPLES" 08_Decals"
-SAMPLES=$SAMPLES" 09_MultipleViewports"
-SAMPLES=$SAMPLES" 10_RenderToTexture"
-SAMPLES=$SAMPLES" 11_Physics"
-SAMPLES=$SAMPLES" 12_PhysicsStressTest"
-SAMPLES=$SAMPLES" 13_Ragdolls"
-SAMPLES=$SAMPLES" 14_SoundEffects"
-SAMPLES=$SAMPLES" 15_Navigation"
-#SAMPLES=$SAMPLES" 16_Chat"
-#SAMPLES=$SAMPLES" 17_SceneReplication"
-SAMPLES=$SAMPLES" 18_CharacterDemo"
-SAMPLES=$SAMPLES" 19_VehicleDemo"
-SAMPLES=$SAMPLES" 20_HugeObjectCount"
-#SAMPLES=$SAMPLES" 21_AngelScriptIntegration"
-#SAMPLES=$SAMPLES" 22_LuaIntegration"
-SAMPLES=$SAMPLES" 23_Water"
-SAMPLES=$SAMPLES" 24_Urho2DSprite"
-SAMPLES=$SAMPLES" 25_Urho2DParticle"
-SAMPLES=$SAMPLES" 26_ConsoleInput"
-SAMPLES=$SAMPLES" 27_Urho2DPhysics"
-SAMPLES=$SAMPLES" 28_Urho2DPhysicsRope"
-SAMPLES=$SAMPLES" 29_SoundSynthesis"
-SAMPLES=$SAMPLES" 30_LightAnimation"
-SAMPLES=$SAMPLES" 31_MaterialAnimation"
-SAMPLES=$SAMPLES" 32_Urho2DConstraints"
-SAMPLES=$SAMPLES" 33_Urho2DSpriterAnimation"
-SAMPLES=$SAMPLES" 34_DynamicGeometry"
-SAMPLES=$SAMPLES" 35_SignedDistanceFieldText"
-SAMPLES=$SAMPLES" 36_Urho2DTileMap"
-SAMPLES=$SAMPLES" 37_UIDrag"
-
-
-for i in $SAMPLES; do
-    buildSample $i
-done
-
-