Browse Source

Refactor build scripts.

- Close issue #67, Urho3D iOS library should be built correctly now (either as single arch or as multiple archs Mach-O universal binary). Urho3D library build for Mac OS X and iOS platforms do not rely on CMake hack 'object-collecting' approach anymore. It uses Apple static linker 'ld' tool to merge all objects from third-party *.a directly.
- Add new custom target (Urho3D_universal) for iOS platform to build a single Mach-O universal binary library consists of both iphoneos (universal ARM archs) and iphonesimulator (i386 arch).
- Introduce PLATFORM_PREFIX (ios-, raspi-, android-) to prefix the build and output directories (Build, Bin, Lib).
- Correct Xcode-specific build setting for Mac OS X desktop build to use the latest OS X SDK but set deployment target to current OS X of the build system, unless CMAKE_OSX_DEPLOYMENT_TARGET is set explicitly to build for other target.
- Temporary workaround for CMake/Xcode generator bug where it always appends '/build' path element to SYMROOT attribute and as such the items in Products are always rendered as red as if they are not yet built.
- Change Assimp target to use setup_library() macro so that it gets the same settings (and workaround) as all other targets.
- Add a conditional check to prevent MSVC to build 'buildvm-android' target as it is not supported at this moment.
Yao Wei Tjong 姚伟忠 12 years ago
parent
commit
963c46d15b

+ 9 - 4
.gitignore

@@ -9,9 +9,9 @@ Bin/*
 !Bin/*.sh
 !Bin/*.sh
 Bin/*.app/
 Bin/*.app/
 Bin/*.app.dSYM/
 Bin/*.app.dSYM/
-Bin-CC/
+*-Bin/
 Lib/
 Lib/
-Lib-CC/
+*-Lib/
 
 
 # Compiled shaders
 # Compiled shaders
 *.vs2
 *.vs2
@@ -30,12 +30,17 @@ Docs/Doxyfile
 Source/.*project
 Source/.*project
 Source/.settings
 Source/.settings
 
 
-# Android project settings for non out-of-source build
+# Android in-the-source project settings
 Source/Android/project.properties
 Source/Android/project.properties
 Source/Android/local.properties
 Source/Android/local.properties
 Source/Android/proguard-project.txt
 Source/Android/proguard-project.txt
 
 
-# CMake files for non out-of-source build
+# Android in-the-source build and output directories
+Source/Android/Engine
+Source/Android/ThirdParty
+Source/Android/libs
+
+# Android in-the-source CMake build files
 CMakeCache.txt
 CMakeCache.txt
 CMakeFiles/
 CMakeFiles/
 CMakeScripts/
 CMakeScripts/

+ 4 - 12
Source/CMake/Modules/FindUrho3D.cmake

@@ -69,23 +69,15 @@ if (URHO3D_HOME)
 
 
         if (ANDROID)
         if (ANDROID)
             if (NOT CMAKE_HOST_WIN32 OR USE_MKLINK)
             if (NOT CMAKE_HOST_WIN32 OR USE_MKLINK)
-                set (BUILD_DIR android-Build)
+                set (BUILD_DIR ${PLATFORM_PREFIX}Build)
             else ()
             else ()
                 set (BUILD_DIR Source/Android)
                 set (BUILD_DIR Source/Android)
             endif ()
             endif ()
             list (APPEND URHO3D_INCLUDE_DIR ${URHO3D_HOME}/${BUILD_DIR}/Engine)
             list (APPEND URHO3D_INCLUDE_DIR ${URHO3D_HOME}/${BUILD_DIR}/Engine)
-            set (URHO3D_LIB_SEARCH_PATH ${URHO3D_HOME}/${BUILD_DIR}/libs/${ANDROID_NDK_ABI_NAME})
-        elseif (RASPI AND CMAKE_CROSSCOMPILING)
-            list (APPEND URHO3D_INCLUDE_DIR ${URHO3D_HOME}/raspi-Build/Engine)
-            set (URHO3D_LIB_SEARCH_PATH ${URHO3D_HOME}/Lib-CC)
+            set (URHO3D_LIB_SEARCH_PATH ${ANDROID_LIBRARY_OUTPUT_PATH})
         else ()
         else ()
-            if (IOS)
-                set (BUILD_DIR ios-Build)
-            else ()
-                set (BUILD_DIR Build)
-            endif ()
-            list (APPEND URHO3D_INCLUDE_DIR ${URHO3D_HOME}/${BUILD_DIR}/Engine)
-            set (URHO3D_LIB_SEARCH_PATH ${URHO3D_HOME}/Lib)
+            list (APPEND URHO3D_INCLUDE_DIR ${URHO3D_HOME}/${PLATFORM_PREFIX}Build/Engine)
+            set (URHO3D_LIB_SEARCH_PATH ${URHO3D_HOME}/${PLATFORM_PREFIX}Lib)
         endif ()
         endif ()
         if (TARGET Urho3D)
         if (TARGET Urho3D)
             set (URHO3D_LIBRARIES Urho3D)
             set (URHO3D_LIBRARIES Urho3D)

+ 32 - 17
Source/CMake/Modules/Urho3D-CMake-magic.cmake

@@ -144,14 +144,18 @@ if (IOS)
     if (NOT MACOSX_BUNDLE_GUI_IDENTIFIER)
     if (NOT MACOSX_BUNDLE_GUI_IDENTIFIER)
         set (MACOSX_BUNDLE_GUI_IDENTIFIER com.github.urho3d.\${PRODUCT_NAME:rfc1034identifier})
         set (MACOSX_BUNDLE_GUI_IDENTIFIER com.github.urho3d.\${PRODUCT_NAME:rfc1034identifier})
     endif ()
     endif ()
-    set (CMAKE_OSX_SYSROOT iphoneos)    # Set to "Latest iOS"
+    set (CMAKE_OSX_SYSROOT iphoneos)    # Set Base SDK to "Latest iOS"
 elseif (XCODE)
 elseif (XCODE)
     # MacOSX-Xcode-specific setup
     # MacOSX-Xcode-specific setup
     if (NOT ENABLE_64BIT)
     if (NOT ENABLE_64BIT)
         set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
         set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
     endif ()
     endif ()
-    set (CMAKE_OSX_SYSROOT "")        # Set to "Current OS X"
-    #set (CMAKE_OSX_SYSROOT macosx) # Uncomment to set to "Latest OS X"
+    set (CMAKE_OSX_SYSROOT macosx)	# Set Base SDK to "Latest OS X"
+    if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
+        # If not set, set to current running build system OS version by default
+        execute_process (COMMAND sw_vers -productVersion COMMAND tr -d '\n' OUTPUT_VARIABLE CURRENT_OSX_VERSION)
+        string (REGEX REPLACE ^\([^.]+\\.[^.]+\).* \\1 CMAKE_OSX_DEPLOYMENT_TARGET ${CURRENT_OSX_VERSION})
+    endif ()
 endif ()
 endif ()
 if (MSVC)
 if (MSVC)
     # Visual Studio-specific setup
     # Visual Studio-specific setup
@@ -229,18 +233,24 @@ get_filename_component (PROJECT_ROOT_DIR ${PROJECT_SOURCE_DIR} PATH)
 # Macro for setting common output directories
 # Macro for setting common output directories
 macro (set_output_directories OUTPUT_PATH)
 macro (set_output_directories OUTPUT_PATH)
     foreach (TYPE ${ARGN})
     foreach (TYPE ${ARGN})
-        set(CMAKE_${TYPE}_OUTPUT_DIRECTORY ${OUTPUT_PATH})
+        set (CMAKE_${TYPE}_OUTPUT_DIRECTORY ${OUTPUT_PATH})
         foreach (CONFIG RELEASE RELWITHDEBINFO DEBUG)
         foreach (CONFIG RELEASE RELWITHDEBINFO DEBUG)
-            set(CMAKE_${TYPE}_OUTPUT_DIRECTORY_${CONFIG} ${OUTPUT_PATH})
+            set (CMAKE_${TYPE}_OUTPUT_DIRECTORY_${CONFIG} ${OUTPUT_PATH})
         endforeach ()
         endforeach ()
     endforeach ()
     endforeach ()
 endmacro ()
 endmacro ()
 
 
 # Set common binary output directory for all targets
 # Set common binary output directory for all targets
-if (CMAKE_CROSSCOMPILING)
-    set (OUTPUT_PATH_SUFFIX -CC)
+if (IOS)
+    set (PLATFORM_PREFIX ios-)
+elseif (CMAKE_CROSSCOMPILING)
+    if (RASPI)
+        set (PLATFORM_PREFIX raspi-)
+    elseif (ANDROID)
+        set (PLATFORM_PREFIX android-)      # Note: this is for Android tools (ARM arch) runtime binaries, Android libs output directory is not affected by this
+    endif ()
 endif ()
 endif ()
-set_output_directories (${PROJECT_ROOT_DIR}/Bin${OUTPUT_PATH_SUFFIX} RUNTIME PDB)
+set_output_directories (${PROJECT_ROOT_DIR}/${PLATFORM_PREFIX}Bin RUNTIME PDB)
 
 
 # Reference supported build options that are potentially not being referenced due to platform or build type branching to suppress "unused variable" warning
 # 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
 if (ENABLE_SAMPLES AND ENABLE_EXTRAS AND ENABLE_TOOLS AND
@@ -359,6 +369,17 @@ macro (setup_target)
     define_dependency_libs (${TARGET_NAME})
     define_dependency_libs (${TARGET_NAME})
     string (REGEX REPLACE \\.\\./|ThirdParty/|Engine/|Extras/|/include|/src "" STRIP_LIBS "${LIBS};${LINK_LIBS_ONLY}")
     string (REGEX REPLACE \\.\\./|ThirdParty/|Engine/|Extras/|/include|/src "" STRIP_LIBS "${LIBS};${LINK_LIBS_ONLY}")
     target_link_libraries (${TARGET_NAME} ${ABSOLUTE_PATH_LIBS} ${STRIP_LIBS})
     target_link_libraries (${TARGET_NAME} ${ABSOLUTE_PATH_LIBS} ${STRIP_LIBS})
+
+    # Workaround CMake/Xcode generator bug where it always appends '/build' path element to SYMROOT attribute and as such the items in Products are always rendered as red as if they are not yet built
+    if (XCODE)
+        file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/build)
+        get_target_property (LOCATION ${TARGET_NAME} LOCATION)
+        string (REGEX REPLACE "^.*\\$\\(CONFIGURATION\\)" $(CONFIGURATION) SYMLINK ${LOCATION})
+        get_filename_component (DIRECTORY ${SYMLINK} DIRECTORY)
+        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+            COMMAND mkdir -p ${DIRECTORY} && ln -s -f $<TARGET_FILE:${TARGET_NAME}> ${DIRECTORY}/$<TARGET_FILE_NAME:${TARGET_NAME}>
+            WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build)
+    endif ()
 endmacro ()
 endmacro ()
 
 
 # Macro for setting up a library target
 # Macro for setting up a library target
@@ -370,18 +391,12 @@ macro (setup_library)
         get_target_property (LIB_TYPE ${TARGET_NAME} TYPE)
         get_target_property (LIB_TYPE ${TARGET_NAME} TYPE)
         # Only interested in static library type, i.e. exclude shared and module library types
         # Only interested in static library type, i.e. exclude shared and module library types
         if (LIB_TYPE MATCHES STATIC)
         if (LIB_TYPE MATCHES STATIC)
-            set (STATIC_LIBRARY_TARGETS ${STATIC_LIBRARY_TARGETS} ${TARGET_NAME} PARENT_SCOPE)
+            if (NOT ${TARGET_NAME} STREQUAL Urho3D)
+                set (STATIC_LIBRARY_TARGETS ${STATIC_LIBRARY_TARGETS} ${TARGET_NAME} PARENT_SCOPE)
+            endif ()
             if (URHO3D_LIB_TYPE STREQUAL SHARED)
             if (URHO3D_LIB_TYPE STREQUAL SHARED)
                 set_target_properties (${TARGET_NAME} PROPERTIES COMPILE_DEFINITIONS URHO3D_EXPORTS)
                 set_target_properties (${TARGET_NAME} PROPERTIES COMPILE_DEFINITIONS URHO3D_EXPORTS)
             endif ()
             endif ()
-    
-            if (XCODE)
-                # Specific to Xcode generator
-                set (SYMLINK ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_NAME}.lnk)
-                add_custom_command (TARGET ${TARGET_NAME} PRE_LINK
-                    COMMAND rm -f ${SYMLINK} && ln -s "$(OBJECT_FILE_DIR)-$(CURRENT_VARIANT)/$(CURRENT_ARCH)" ${SYMLINK}
-                    COMMENT "Creating a symbolic link pointing to object file directory")
-            endif ()
         endif ()
         endif ()
     endif ()
     endif ()
 endmacro ()
 endmacro ()

+ 1 - 0
Source/CMakeLists.txt

@@ -28,6 +28,7 @@ cmake_minimum_required (VERSION 2.8.6)
 
 
 if (COMMAND cmake_policy)
 if (COMMAND cmake_policy)
     cmake_policy (SET CMP0003 NEW)
     cmake_policy (SET CMP0003 NEW)
+    cmake_policy (SET CMP0022 OLD)
 endif ()
 endif ()
 
 
 # Set CMake modules search path
 # Set CMake modules search path

+ 66 - 55
Source/Engine/CMakeLists.txt

@@ -44,61 +44,59 @@ endif ()
 
 
 # Define generated object files
 # Define generated object files
 # This is a hack as it relies on internal working of CMake
 # This is a hack as it relies on internal working of CMake
-if (WIN32)
-    set (CMAKE_DEBUG_POSTFIX _d)
-    set (OBJ_EXT .obj)
-else ()
-    set (OBJ_EXT .o)
-endif ()
-foreach (TARGET ${STATIC_LIBRARY_TARGETS})
-    get_target_property (SOURCES ${TARGET} SOURCES)
-    get_target_property (INT_DIR ${TARGET} LOCATION)
-    get_filename_component (INT_DIR ${INT_DIR} PATH)
-    if (MSVC)
-        if (CMAKE_GENERATOR MATCHES 2008)
-            string (REPLACE /$(OutDir) /${TARGET}.dir/$(ConfigurationName) INT_DIR ${INT_DIR})
-        else ()
-            string (REPLACE /$(Configuration) /${TARGET}.dir/$(ConfigurationName) INT_DIR ${INT_DIR})
-        endif ()
+if (NOT APPLE)
+    if (WIN32)
+        set (CMAKE_DEBUG_POSTFIX _d)
+        set (OBJ_EXT .obj)
     else ()
     else ()
-        set (INT_DIR ${INT_DIR}/CMakeFiles/${TARGET}.dir)
-    endif ()
-    if (XCODE)
-        string (REPLACE /$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) "" INT_DIR ${INT_DIR})
-        string (REGEX REPLACE \\.dir$ .lnk INT_DIR ${INT_DIR})
+        set (OBJ_EXT .o)
     endif ()
     endif ()
-    foreach (SOURCE ${SOURCES})
-        get_filename_component (NAME ${SOURCE} NAME)
-        if (NAME MATCHES \\.c.*$|\\.mm?$|\\.S$|\\.s$)
-            if (MSVC OR XCODE)
-                string (REGEX REPLACE \\.c.*$|\\.mm?$|\\.S$|\\.s$ "" NAME ${NAME})
-            endif ()
-            unset (DIR_SUFFIX)
-            if (NOT MSVC AND NOT XCODE)
-                get_filename_component (PATH ${SOURCE} PATH)
-                foreach (DIR source src generated)
-                    if (PATH MATCHES \(ThirdParty|Engine\)/.*/${DIR}$)
-                        set (DIR_SUFFIX /${DIR})
-                        break ()
-                    elseif (PATH MATCHES ThirdParty/.*/${DIR}/)
-                        string (REGEX REPLACE .*/${DIR}/ "" DIR_SUFFIX ${PATH})
-                        set (DIR_SUFFIX /${DIR}/${DIR_SUFFIX})
-                        break ()
-                    elseif (PATH MATCHES ^${DIR}/|^${DIR}$)
-                        set (DIR_SUFFIX /${PATH})
-                        break ()
-                    endif ()
-                endforeach ()
+    foreach (TARGET ${STATIC_LIBRARY_TARGETS})
+        get_target_property (SOURCES ${TARGET} SOURCES)
+        get_target_property (INT_DIR ${TARGET} LOCATION)
+        get_filename_component (INT_DIR ${INT_DIR} PATH)
+        if (MSVC)
+            if (CMAKE_GENERATOR MATCHES 2008)
+                string (REPLACE /$(OutDir) /${TARGET}.dir/$(ConfigurationName) INT_DIR ${INT_DIR})
+            else ()
+                string (REPLACE /$(Configuration) /${TARGET}.dir/$(ConfigurationName) INT_DIR ${INT_DIR})
             endif ()
             endif ()
-            list (APPEND OBJ_FILES ${INT_DIR}${DIR_SUFFIX}/${NAME}${OBJ_EXT})
-        elseif (NAME MATCHES \\.o.*$)
-            list (APPEND OBJ_FILES ${SOURCE})
+        else ()
+            set (INT_DIR ${INT_DIR}/CMakeFiles/${TARGET}.dir)
         endif ()
         endif ()
+        foreach (SOURCE ${SOURCES})
+            get_filename_component (NAME ${SOURCE} NAME)
+            if (NAME MATCHES \\.c.*$|\\.mm?$|\\.S$|\\.s$)
+                if (MSVC)
+                    string (REGEX REPLACE \\.c.*$|\\.mm?$|\\.S$|\\.s$ "" NAME ${NAME})
+                endif ()
+                unset (DIR_SUFFIX)
+                if (NOT MSVC)
+                    get_filename_component (PATH ${SOURCE} PATH)
+                    foreach (DIR source src generated)
+                        if (PATH MATCHES \(ThirdParty|Engine\)/.*/${DIR}$)
+                            set (DIR_SUFFIX /${DIR})
+                            break ()
+                        elseif (PATH MATCHES ThirdParty/.*/${DIR}/)
+                            string (REGEX REPLACE .*/${DIR}/ "" DIR_SUFFIX ${PATH})
+                            set (DIR_SUFFIX /${DIR}/${DIR_SUFFIX})
+                            break ()
+                        elseif (PATH MATCHES ^${DIR}/|^${DIR}$)
+                            set (DIR_SUFFIX /${PATH})
+                            break ()
+                        endif ()
+                    endforeach ()
+                endif ()
+                list (APPEND OBJ_FILES ${INT_DIR}${DIR_SUFFIX}/${NAME}${OBJ_EXT})
+            elseif (NAME MATCHES \\.o.*$)
+                list (APPEND OBJ_FILES ${SOURCE})
+            endif ()
+        endforeach ()
+        source_group ("Object Files\\${TARGET}" FILES ${OBJ_FILES})
+        list (APPEND ALL_OBJ_FILES ${OBJ_FILES})
+        unset (OBJ_FILES)
     endforeach ()
     endforeach ()
-    source_group ("Object Files\\${TARGET}" FILES ${OBJ_FILES})
-    list (APPEND ALL_OBJ_FILES ${OBJ_FILES})
-    unset (OBJ_FILES)
-endforeach ()
+endif ()
 
 
 # Define source files
 # Define source files
 set (SOURCES Audio Container Core Engine Graphics Input IO Math Navigation Network Physics Resource Scene UI)
 set (SOURCES Audio Container Core Engine Graphics Input IO Math Navigation Network Physics Resource Scene UI)
@@ -126,11 +124,10 @@ endforeach ()
 list (APPEND INCLUDE_DIRS_ONLY ${CMAKE_CURRENT_BINARY_DIR} ../ThirdParty/SDL/include)
 list (APPEND INCLUDE_DIRS_ONLY ${CMAKE_CURRENT_BINARY_DIR} ../ThirdParty/SDL/include)
 
 
 # Setup library output path
 # Setup library output path
-set (OUTPUT_PATH ${PROJECT_ROOT_DIR}/Lib)
 if (ANDROID)
 if (ANDROID)
     set (OUTPUT_PATH ${ANDROID_LIBRARY_OUTPUT_PATH})
     set (OUTPUT_PATH ${ANDROID_LIBRARY_OUTPUT_PATH})
-elseif (CMAKE_CROSSCOMPILING)
-    set (OUTPUT_PATH ${OUTPUT_PATH}-CC)
+else ()
+    set (OUTPUT_PATH ${PROJECT_ROOT_DIR}/${PLATFORM_PREFIX}Lib)     # ${PLATFORM_PREFIX} is empty for native build
 endif ()
 endif ()
 set_output_directories (${OUTPUT_PATH} ARCHIVE LIBRARY)
 set_output_directories (${OUTPUT_PATH} ARCHIVE LIBRARY)
  
  
@@ -141,17 +138,31 @@ if (NOT GIT_EXIT_CODE EQUAL 0)
     add_dependencies (${TARGET_NAME} ${STATIC_LIBRARY_TARGETS})
     add_dependencies (${TARGET_NAME} ${STATIC_LIBRARY_TARGETS})
 endif ()
 endif ()
 
 
-# Setup the frameworks for Mac OS X platform
+# Setup the frameworks and libraries for Mac OS X and iOS platforms
 if (APPLE)
 if (APPLE)
     if (IOS)
     if (IOS)
         setup_ios_linker_flags (LINKER_FLAGS)
         setup_ios_linker_flags (LINKER_FLAGS)
+        # Add a custom target to build Mach-O universal binary consisting of iphoneos (universal ARM archs) and iphonesimulator (i386 arch)
+        add_custom_target (${TARGET_NAME}_universal
+            COMMAND xcodebuild -target ${TARGET_NAME} -configuration $(CONFIGURATION) -sdk iphonesimulator
+            COMMAND mv \"$<TARGET_FILE:${TARGET_NAME}>\"{,.iphonesimulator}
+            COMMAND xcodebuild -target ${TARGET_NAME} -configuration $(CONFIGURATION) -sdk iphoneos
+            COMMAND mv \"$<TARGET_FILE:${TARGET_NAME}>\"{,.iphoneos}
+            COMMAND lipo -create -output \"$<TARGET_FILE:${TARGET_NAME}>\" \"$<TARGET_FILE:${TARGET_NAME}>\"{.iphonesimulator,.iphoneos}
+            COMMAND rm \"$<TARGET_FILE:${TARGET_NAME}>\"{.iphonesimulator,.iphoneos}
+            WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+            COMMENT "Creating Mach-O universal binary library")
     else ()
     else ()
         # Intentionally use built-in CMAKE_EXE_LINKER_FLAGS here although CMake does not use it when building library, but the variable would be used later when configuring Urho3D.pc for MacOSX platform
         # Intentionally use built-in CMAKE_EXE_LINKER_FLAGS here although CMake does not use it when building library, but the variable would be used later when configuring Urho3D.pc for MacOSX platform
         setup_macosx_linker_flags (CMAKE_EXE_LINKER_FLAGS)
         setup_macosx_linker_flags (CMAKE_EXE_LINKER_FLAGS)
         # LuaJIT 64-bit specific - replace EXE linker flags with flags for building shared library (adapted from LuaJIT's original Makefile)
         # LuaJIT 64-bit specific - replace EXE linker flags with flags for building shared library (adapted from LuaJIT's original Makefile)
         string (REPLACE "-pagezero_size 10000 -image_base 100000000" "-image_base 7fff04c4a000" LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
         string (REPLACE "-pagezero_size 10000 -image_base 100000000" "-image_base 7fff04c4a000" LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
     endif ()
     endif ()
-    set_target_properties (${TARGET_NAME} PROPERTIES LINK_FLAGS ${LINKER_FLAGS})
+    set_target_properties (${TARGET_NAME} PROPERTIES LINK_FLAGS "${LINKER_FLAGS} -all_load")
+    foreach (TARGET ${STATIC_LIBRARY_TARGETS})
+        list (APPEND ARCHIVES $<TARGET_FILE:${TARGET}>)
+    endforeach ()
+    set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES ${ARCHIVES})
 endif ()
 endif ()
 
 
 # Generate platform specific export header file automatically
 # Generate platform specific export header file automatically

+ 4 - 7
Source/ThirdParty/Assimp/CMakeLists.txt

@@ -6,7 +6,7 @@
 #    source groups and library command)
 #    source groups and library command)
 #
 #
 
 
-# Modified by Lasse Oorni for Urho3D
+# Modified by Lasse Oorni and Yao Wei Tjong for Urho3D
 
 
 INCLUDE_DIRECTORIES( include )
 INCLUDE_DIRECTORIES( include )
 INCLUDE_DIRECTORIES( code/BoostWorkaround )
 INCLUDE_DIRECTORIES( code/BoostWorkaround )
@@ -692,12 +692,9 @@ SET( CONTRIB_FILES
 	${Boost_SRCS}
 	${Boost_SRCS}
 )
 )
 
 
-ADD_LIBRARY( Assimp STATIC
-	${SOURCE_FILES}
-	${CONTRIB_FILES}
-	${PUBLIC_HEADERS}
-	${COMPILER_HEADERS}
-)
+set (TARGET_NAME Assimp)
+list (APPEND SOURCE_FILES ${CONTRIB_FILES} ${PUBLIC_HEADERS} ${COMPILER_HEADERS})
+setup_library ()
 
 
 if (MSVC)
 if (MSVC)
     foreach(FILE ${SOURCE_FILES})
     foreach(FILE ${SOURCE_FILES})

+ 1 - 1
Source/ThirdParty/Lua/CMakeLists.txt

@@ -32,7 +32,7 @@ set (SOURCE_FILES ${C_FILES} ${H_FILES})
 # Setup target
 # Setup target
 setup_library ()
 setup_library ()
 
 
-# On Android platform, use 'adb push' to copy the tool(s) from Bin-CC to Android (virtual) device; use 'adb shell' to login into a remote shell to execute the tool in the (virtual) device
+# On Android platform, use 'adb push' to copy the tool(s) from android-Bin to Android (virtual) device; use 'adb shell' to login into a remote shell to execute the tool in the (virtual) device
 # The tools are not built on iOS platform as there is no (easy) way to execute them on the iOS device
 # The tools are not built on iOS platform as there is no (easy) way to execute them on the iOS device
 if (NOT IOS AND (NOT DEFINED ENABLE_TOOLS OR ENABLE_TOOLS))
 if (NOT IOS AND (NOT DEFINED ENABLE_TOOLS OR ENABLE_TOOLS))
     # Define target name for Lua interpreter
     # Define target name for Lua interpreter

+ 1 - 1
Source/ThirdParty/LuaJIT/CMakeLists.txt

@@ -270,7 +270,7 @@ set (INCLUDE_DIRS_ONLY ${CMAKE_CURRENT_BINARY_DIR}/generated)
 # Setup target
 # Setup target
 setup_library ()
 setup_library ()
 
 
-# On Android platform, use 'adb push' to copy the tool(s) from Bin-CC to Android (virtual) device; use 'adb shell' to login into a remote shell to execute the tool in the (virtual) device
+# On Android platform, use 'adb push' to copy the tool(s) from android-Bin to Android (virtual) device; use 'adb shell' to login into a remote shell to execute the tool in the (virtual) device
 # The tools are not built on iOS platform as there is no (easy) way to execute them on the iOS device
 # The tools are not built on iOS platform as there is no (easy) way to execute them on the iOS device
 if (NOT IOS AND (NOT DEFINED ENABLE_TOOLS OR ENABLE_TOOLS))
 if (NOT IOS AND (NOT DEFINED ENABLE_TOOLS OR ENABLE_TOOLS))
     # Define target name for LuaJIT interpreter cum compiler
     # Define target name for LuaJIT interpreter cum compiler

+ 7 - 3
Source/ThirdParty/LuaJIT/DetectTargetArchitecture.cmake

@@ -85,7 +85,7 @@ if (VARIANT)
     elseif (VARIANT MATCHES android|raspi)
     elseif (VARIANT MATCHES android|raspi)
         set (TARGET_SYS Linux)
         set (TARGET_SYS Linux)
     else ()
     else ()
-        message (FATAL_ERROR "Unsupported buildvm variant: ${VARIANT}") 
+        message (FATAL_ERROR "Unsupported buildvm variant: ${VARIANT}")
     endif ()
     endif ()
     # Makefile: ifneq ($(HOST_SYS),$(TARGET_SYS))
     # Makefile: ifneq ($(HOST_SYS),$(TARGET_SYS))
     if (TARGET_SYS STREQUAL Windows)
     if (TARGET_SYS STREQUAL Windows)
@@ -115,8 +115,12 @@ if (ARCH_BITS EQUAL 64)
     endif ()
     endif ()
 endif ()
 endif ()
 if (VARIANT)
 if (VARIANT)
-    string (REGEX REPLACE "-m(32|64) *" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
-    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m${ARCH_BITS}")
+    if (MSVC)
+        message (FATAL_ERROR "MSVC is not able to build 'buildvm-${VARIANT}' target at this moment, please use GCC or LLVM/Clang instead")
+    else ()
+        string (REGEX REPLACE "-m(32|64) *" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m${ARCH_BITS}")
+    endif ()
 endif ()
 endif ()
 
 
 find_string ("LJ_HASJIT (1)" "${TARGET_TESTARCH}" HASJIT ${VARIANT})
 find_string ("LJ_HASJIT (1)" "${TARGET_TESTARCH}" HASJIT ${VARIANT})