Browse Source

Make repo root is also CMake source tree for the Urho3D project.
Build tree location is now fully user defined. The build tree location could also be the same as source tree, although it is not recommended.

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

+ 1 - 4
.bash_helpers.sh

@@ -23,9 +23,6 @@
 # Define helpers
 # Define helpers
 post_cmake() {
 post_cmake() {
     if [ $ECLIPSE ]; then
     if [ $ECLIPSE ]; then
-        # Integrate Urho3D documentation into Eclipse IDE
-        ln -snf $SOURCE/Docs/html ~/.eclipse/$(ls -1t ~/.eclipse |grep org.eclipse.platform_ |head -1)/plugins
-
         # Check if xmlstarlet software package is available for fixing the generated Eclipse project setting
         # Check if xmlstarlet software package is available for fixing the generated Eclipse project setting
         if [ $HAS_XMLSTARLET ]; then
         if [ $HAS_XMLSTARLET ]; then
             # Common fixes for all builds
             # Common fixes for all builds
@@ -63,7 +60,7 @@ post_cmake() {
                         $BUILD/.project
                         $BUILD/.project
                 done
                 done
 
 
-            elif [ $RASPI ]; then
+            elif [ $RPI ]; then
                 # For Raspberry Pi build, add [Bin] linked resource
                 # For Raspberry Pi build, add [Bin] linked resource
                 #
                 #
                 # Replace [Subprojects]/Urho3D linked resource to [Targets]/[Bin] instead
                 # Replace [Subprojects]/Urho3D linked resource to [Targets]/[Bin] instead

+ 5 - 4
.gitignore

@@ -1,4 +1,4 @@
-# Output directories
+# Output directories (in case of non out-of-source)
 Bin/*
 Bin/*
 !Bin/**/
 !Bin/**/
 !Bin/*.bat
 !Bin/*.bat
@@ -6,7 +6,9 @@ Bin/*
 Bin/*.app/
 Bin/*.app/
 Bin/*.app.dSYM/
 Bin/*.app.dSYM/
 Bin/Data/LuaScripts/jit/
 Bin/Data/LuaScripts/jit/
-Bin/Screenshots
+Bin/Screenshots/
+Bin/tool/
+generated/
 Lib/
 Lib/
 
 
 # Compiled shaders
 # Compiled shaders
@@ -21,11 +23,10 @@ Lib/
 # Compiled Lua script
 # Compiled Lua script
 *.luc
 *.luc
 
 
-# Generated documentation
+# Generated documentation (in case of non out-of-source)
 Docs/html/
 Docs/html/
 Docs/qch/
 Docs/qch/
 Docs/Doxyfile
 Docs/Doxyfile
-Docs/minimal-*
 
 
 # Eclipse project settings
 # Eclipse project settings
 Source/.*project
 Source/.*project

+ 114 - 86
CMake/Modules/FindUrho3D.cmake

@@ -20,8 +20,7 @@
 # THE SOFTWARE.
 # THE SOFTWARE.
 #
 #
 
 
-# Find Urho3D library and include directories in the project root tree or installed location
-# For project root tree detection to work, Urho3D library must be already been built
+# Find Urho3D include directories and library in source & build tree or installed Urho3D SDK.
 #
 #
 #  URHO3D_FOUND
 #  URHO3D_FOUND
 #  URHO3D_INCLUDE_DIRS
 #  URHO3D_INCLUDE_DIRS
@@ -29,8 +28,26 @@
 #  URHO3D_LIBRARIES_REL
 #  URHO3D_LIBRARIES_REL
 #  URHO3D_LIBRARIES_DBG
 #  URHO3D_LIBRARIES_DBG
 #
 #
+#
+# For Urho3D project, the Urho3D library "source tree" and "build tree" paths are already known.
+#
+# For external project that attempts to use the Urho3D source and build trees:
+#   1) Set the URHO3D_HOME environment variable to poin to the location of Urho3D "source tree"
+#   2) Set the URHO3D_BUILD_TREE environment variable to point to the location of Urho3D "build tree"
+# This module would not assume the location of the build tree anymore as in the previous versions.
+#
+# For external project that attempts to use the installed Urho3D SDK:
+#   1) Install the SDK into your filesystem.
+#      If you change the default value of CMAKE_INSTALL_PREFIX variable and/or if you use DESTDIR variable during installation, then proceed to 2)
+#   2) Set the CMAKE_PREFIX_PATH environment variable to point to the location of installed Urho3D SDK.
+#      The CMAKE_PREFIX_PATH should be set to a parent directory containing both the "include" or "lib" subdirectories.
+#      For example on Windows platform: set "CMAKE_PREFIX_PATH=C:/Users/john/Urho3D" if the SDK is installed using CMAKE_INSTALL_PREFIX=C:/Users/john/Urho3D
+#      For example on Linux platform: export CMAKE_PREFIX_PATH=/home/john/usr/local if the SDK is installed using DESTDIR=/home/john and CMAKE_INSTALL_PREFIX=/usr/local
+# You may use semicolon to separate multiple prefix paths to other SDKs intalled in custom location.
+#
 
 
 if (URHO3D_FOUND)
 if (URHO3D_FOUND)
+    # All the subprojects should use the same Urho3D library, so only need to search on the first (sub)project that requires Urho3D library
     return ()
     return ()
 endif ()
 endif ()
 
 
@@ -45,111 +62,122 @@ if (NOT URHO3D_LIB_TYPE STREQUAL URHO3D_FOUND_LIB_TYPE)
     endif ()
     endif ()
 endif ()
 endif ()
 
 
-set (URHO3D_LIB_NAMES Urho3D)
-if (WIN32)
-    set (URHO3D_LIB_NAMES_DBG Urho3D_d)
-endif ()
-
-if (CMAKE_PROJECT_NAME STREQUAL Urho3D AND PROJECT_ROOT_DIR)
-    set (URHO3D_HOME ${PROJECT_ROOT_DIR} CACHE PATH "Path to Urho3D project root tree" FORCE)
+if (CMAKE_PROJECT_NAME STREQUAL Urho3D AND TARGET Urho3D)
+    set (URHO3D_HOME ${CMAKE_SOURCE_DIR} CACHE PATH "Path to Urho3D source tree" FORCE)
     set (IS_INTERNAL 1)
     set (IS_INTERNAL 1)
 elseif (NOT URHO3D_HOME AND DEFINED ENV{URHO3D_HOME})
 elseif (NOT URHO3D_HOME AND DEFINED ENV{URHO3D_HOME})
+    # The URHO3D_HOME variable should point to Urho3D's source tree, even when Urho3D is being used in an external project which has its own source tree
+    if (NOT DEFINED ENV{URHO3D_BUILD_TREE})
+        message (FATAL_ERROR "Could not determine the Urho3D build tree location. Use URHO3D_BUILD_TREE environment variable to specify the location of the build tree.")
+    endif ()
     file (TO_CMAKE_PATH "$ENV{URHO3D_HOME}" URHO3D_HOME)
     file (TO_CMAKE_PATH "$ENV{URHO3D_HOME}" URHO3D_HOME)
-    set (URHO3D_HOME ${URHO3D_HOME} CACHE PATH "Path to Urho3D project root tree")
+    set (URHO3D_HOME ${URHO3D_HOME} CACHE PATH "Path to Urho3D source tree")
+    file (TO_CMAKE_PATH "$ENV{URHO3D_BUILD_TREE}" URHO3D_BUILD_TREE)
+    set (URHO3D_BUILD_TREE ${URHO3D_BUILD_TREE} CACHE PATH "Path to Urho3D build tree")
 endif ()
 endif ()
+
 if (URHO3D_HOME)
 if (URHO3D_HOME)
-    # Construct source tree paths from URHO3D_HOME environment variable
-    find_file (URHO3D_SOURCE_TREE Urho3D.h.in ${URHO3D_HOME}/Source/Engine DOC "Path to Urho3D project source tree" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-    if (URHO3D_SOURCE_TREE)
-        get_filename_component (URHO3D_SOURCE_TREE ${URHO3D_SOURCE_TREE} PATH)
-        set (URHO3D_INCLUDE_DIRS ${URHO3D_SOURCE_TREE})
-        foreach (DIR Audio Container Core Engine Graphics Input IO LuaScript Math Navigation Network Physics Resource Scene Script UI Urho2D)
-            list (APPEND URHO3D_INCLUDE_DIRS ${URHO3D_SOURCE_TREE}/${DIR})     # Note: variable change to list context after this
-        endforeach ()
-        set (DIRS SDL/include)
+    # Using source tree
+    if (EXISTS ${URHO3D_HOME}/Source/Engine/Urho3D.h.in)
+        set (ENGINE_DIRS Audio Container Core Engine Graphics Input IO Math Resource Scene UI)
+        set (THIRDPARTY_DIRS SDL/include)
         if (URHO3D_ANGELSCRIPT)
         if (URHO3D_ANGELSCRIPT)
-            list (APPEND DIRS AngelScript/include)
+            list (APPEND ENGINE_DIRS Script)
+            list (APPEND THIRDPARTY_DIRS AngelScript/include)
+        endif ()
+        if (URHO3D_LUA)
+            list (APPEND ENGINE_DIRS LuaScript)
         endif ()
         endif ()
         if (URHO3D_NETWORK)
         if (URHO3D_NETWORK)
-            list (APPEND DIRS kNet/include)
+            list (APPEND ENGINE_DIRS Network)
+            list (APPEND THIRDPARTY_DIRS kNet/include)
+        endif ()
+        if (URHO3D_NAVIGATION)
+            list (APPEND ENGINE_DIRS Navigation)
         endif ()
         endif ()
         if (URHO3D_PHYSICS)
         if (URHO3D_PHYSICS)
-            list (APPEND DIRS Bullet/src)
+            list (APPEND ENGINE_DIRS Physics)
+            list (APPEND THIRDPARTY_DIRS Bullet/src)
         endif ()
         endif ()
         if (URHO3D_URHO2D)
         if (URHO3D_URHO2D)
-            list (APPEND DIRS Box2D)
+            list (APPEND ENGINE_DIRS Urho2D)
+            list (APPEND THIRDPARTY_DIRS Box2D)
         endif ()
         endif ()
-        foreach (DIR ${DIRS})
+        set (URHO3D_INCLUDE_DIRS ${URHO3D_HOME}/Source/Engine)
+        if (IS_INTERNAL)
+            list (APPEND URHO3D_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/Source/Engine)
+        else ()
+            list (APPEND URHO3D_INCLUDE_DIRS ${URHO3D_BUILD_TREE}/Source/Engine)
+        endif ()
+        foreach (DIR ${ENGINE_DIRS})
+            list (APPEND URHO3D_INCLUDE_DIRS ${URHO3D_HOME}/Source/Engine/${DIR})
+        endforeach ()
+        foreach (DIR ${THIRDPARTY_DIRS})
             list (APPEND URHO3D_INCLUDE_DIRS ${URHO3D_HOME}/Source/ThirdParty/${DIR})
             list (APPEND URHO3D_INCLUDE_DIRS ${URHO3D_HOME}/Source/ThirdParty/${DIR})
         endforeach ()
         endforeach ()
+    endif ()
+endif ()
 
 
-        # For non Urho3D project using Urho3D as external library, Urho3D project itself must be built using predefined build directory as per specified in the provided build scripts.
-        if (IS_INTERNAL)
-            set (BINARY_DIR ${CMAKE_BINARY_DIR})
-        elseif (ANDROID AND CMAKE_HOST_WIN32 AND NOT URHO3D_MKLINK)
-            set (BINARY_DIR ${URHO3D_HOME}/Android)
-        else ()
-            set (BINARY_DIR ${URHO3D_HOME}/${PLATFORM_PREFIX}Build)
-        endif () 
-        list (APPEND URHO3D_INCLUDE_DIRS ${BINARY_DIR}/Engine)
+if (IS_INTERNAL)
+    set (URHO3D_LIBRARIES Urho3D)
+    set (FOUND_MESSAGE "Found Urho3D: as CMake target")
+else ()
+    set (URHO3D_LIB_NAMES Urho3D)
+    if (WIN32)
+        set (URHO3D_LIB_NAMES_DBG ${URHO3D_LIB_NAMES}_d)
+    endif ()
+    if (URHO3D_BUILD_TREE)
+        # Using build tree
         if (ANDROID)
         if (ANDROID)
-            if (IS_INTERNAL)
-                set (URHO3D_LIB_SEARCH_PATH ${ANDROID_LIBRARY_OUTPUT_PATH})
-            else ()
-                set (URHO3D_LIB_SEARCH_PATH ${BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME})
-            endif ()
+            set (URHO3D_LIB_SEARCH_PATH ${URHO3D_BUILD_TREE}/libs/${ANDROID_NDK_ABI_NAME})
         else ()
         else ()
-            set (URHO3D_LIB_SEARCH_PATH ${URHO3D_HOME}/${PLATFORM_PREFIX}Lib)
+            set (URHO3D_LIB_SEARCH_PATH ${URHO3D_BUILD_TREE}/Lib)
         endif ()
         endif ()
-        if (TARGET Urho3D)
-            set (URHO3D_LIBRARIES Urho3D)
-            set (FOUND_MESSAGE "Found Urho3D: as CMake target")
-        else ()
-            find_library (URHO3D_LIBRARIES NAMES ${URHO3D_LIB_NAMES} PATHS ${URHO3D_LIB_SEARCH_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-            if (WIN32)
-                find_library (URHO3D_LIBRARIES_DBG NAMES ${URHO3D_LIB_NAMES_DBG} PATHS ${URHO3D_LIB_SEARCH_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-            endif ()
+        # Only perform a non-rooted search in the specified path
+        find_library (URHO3D_LIBRARIES NAMES ${URHO3D_LIB_NAMES} PATHS ${URHO3D_LIB_SEARCH_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+        if (WIN32)
+            find_library (URHO3D_LIBRARIES_DBG NAMES ${URHO3D_LIB_NAMES_DBG} PATHS ${URHO3D_LIB_SEARCH_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
         endif ()
         endif ()
-    endif ()
-else ()
-    # If Urho3D SDK is not being installed in the default system location, use the CMAKE_PREFIX_PATH environment variable to specify the prefix path to that location
-    # Note that the prefix path should not contain the "/include" or "/lib"
-    # For example on Windows platform: CMAKE_PREFIX_PATH=C:/Users/john/Urho3D if the SDK is installed using CMAKE_INSTALL_PREFIX=C:/Users/john/Urho3D
-    # For example on Linux platform: CMAKE_PREFIX_PATH=/home/john/usr/local if the SDK is installed using DESTDIR=/home/john and CMAKE_INSTALL_PREFIX=/usr/local
-    if (CMAKE_HOST_WIN32)
-        set (URHO3D_INC_SEARCH_PATH include)
-        set (URHO3D_LIB_SEARCH_PATH lib)
     else ()
     else ()
-        set (PATH_SUFFIX Urho3D)
-        if (IOS)
-            set (CMAKE_LIBRARY_ARCHITECTURE ios)
-        endif ()
-    endif ()
-    # Additional search paths are added by CMake by default which should already include most common platform specific paths
-    find_path (URHO3D_INCLUDE_DIRS Urho3D.h PATHS ${URHO3D_INC_SEARCH_PATH} PATH_SUFFIXES ${PATH_SUFFIX})
-    find_library (URHO3D_LIBRARIES NAMES ${URHO3D_LIB_NAMES} PATHS ${URHO3D_LIB_SEARCH_PATH} PATH_SUFFIXES ${PATH_SUFFIX})
-    if (WIN32)
-        find_library (URHO3D_LIBRARIES_DBG NAMES ${URHO3D_LIB_NAMES_DBG} PATHS ${URHO3D_LIB_SEARCH_PATH} PATH_SUFFIXES ${PATH_SUFFIX})
-    endif ()
-
-    if (URHO3D_INCLUDE_DIRS)
-        set (BASE_DIR ${URHO3D_INCLUDE_DIRS})
-        set (DIRS SDL)
-        if (URHO3D_ANGELSCRIPT)
-            list (APPEND DIRS AngelScript)
+        # Using SDK installation
+        if (NOT CMAKE_HOST_WIN32)
+            set (PATH_SUFFIX Urho3D)
+            if (IOS)
+                set (CMAKE_LIBRARY_ARCHITECTURE ios)
+            endif ()
         endif ()
         endif ()
-        if (URHO3D_NETWORK)
-            list (APPEND DIRS kNet)
+        if (ANDROID)
+            if (PATH_SUFFIX)
+                set (PATH_SUFFIX ${PATH_SUFFIX}/${ANDROID_NDK_ABI_NAME})
+            else ()
+                set (PATH_SUFFIX ${ANDROID_NDK_ABI_NAME})
+            endif ()
         endif ()
         endif ()
-        if (URHO3D_PHYSICS)
-            list (APPEND DIRS Bullet)
+        # Perform a full search including a rooted search
+        find_path (URHO3D_INCLUDE_DIRS Urho3D.h PATH_SUFFIXES ${PATH_SUFFIX})
+        find_library (URHO3D_LIBRARIES NAMES ${URHO3D_LIB_NAMES} PATH_SUFFIXES ${PATH_SUFFIX})
+        if (WIN32)
+            find_library (URHO3D_LIBRARIES_DBG NAMES ${URHO3D_LIB_NAMES_DBG} PATH_SUFFIXES ${PATH_SUFFIX})
         endif ()
         endif ()
-        if (URHO3D_URHO2D)
-            list (APPEND DIRS Box2D)
+        if (URHO3D_INCLUDE_DIRS)
+            set (BASE_DIR ${URHO3D_INCLUDE_DIRS})
+            set (DIRS SDL)
+            if (URHO3D_ANGELSCRIPT)
+                list (APPEND DIRS AngelScript)
+            endif ()
+            if (URHO3D_NETWORK)
+                list (APPEND DIRS kNet)
+            endif ()
+            if (URHO3D_PHYSICS)
+                list (APPEND DIRS Bullet)
+            endif ()
+            if (URHO3D_URHO2D)
+                list (APPEND DIRS Box2D)
+            endif ()
+            foreach (DIR ${DIRS})
+                list (APPEND URHO3D_INCLUDE_DIRS ${BASE_DIR}/${DIR})     # Note: variable change to list context after this, so we need BASE_DIR to remain the same
+            endforeach ()
         endif ()
         endif ()
-        foreach (DIR ${DIRS})
-            list (APPEND URHO3D_INCLUDE_DIRS ${BASE_DIR}/${DIR})     # Note: variable change to list context after this, so we need BASE_DIR to remain the same
-        endforeach ()
     endif ()
     endif ()
 endif ()
 endif ()
 
 
@@ -177,10 +205,10 @@ if (URHO3D_FOUND)
 else ()
 else ()
     if (Urho3D_FIND_REQUIRED)
     if (Urho3D_FIND_REQUIRED)
         message (FATAL_ERROR
         message (FATAL_ERROR
-            "Could not find Urho3D library in default SDK installation location or Urho3D project root tree. "
-            "For searching in a non-default Urho3D SDK installation, use 'CMAKE_PREFIX_PATH' environment variable to specify the prefix path of the installation location. "
-            "For searching in a build tree of Urho3D project, use 'URHO3D_HOME' environment variable to specify the Urho3D project root directory. The Urho3D library itself must already be built successfully.")
+            "Could not find Urho3D library in Urho3D source/build trees or SDK installation. "
+            "To search in Urho3D source/build trees, Use URHO3D_HOME and URHO3D_BUILD_TREE environment variables to specify the location of source and build tree, respectively. "
+            "To search in a non-default Urho3D SDK installation location, use CMAKE_PREFIX_PATH environment variable to specify the prefix path of the installation location.")
     endif ()
     endif ()
 endif ()
 endif ()
 
 
-mark_as_advanced (URHO3D_INCLUDE_DIRS URHO3D_LIBRARIES URHO3D_SOURCE_TREE URHO3D_HOME)
+mark_as_advanced (URHO3D_INCLUDE_DIRS URHO3D_LIBRARIES URHO3D_HOME URHO3D_BUILD_TREE)

+ 6 - 20
CMake/Modules/Urho3D-CMake-common.cmake

@@ -92,8 +92,8 @@ if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
     cmake_dependent_option (URHO3D_LUAJIT_AMALG "Enable LuaJIT amalgamated build (LuaJIT only)" FALSE "URHO3D_LUAJIT" FALSE)
     cmake_dependent_option (URHO3D_LUAJIT_AMALG "Enable LuaJIT amalgamated build (LuaJIT only)" FALSE "URHO3D_LUAJIT" FALSE)
     cmake_dependent_option (URHO3D_SAFE_LUA "Enable Lua C++ wrapper safety checks (Lua scripting only)" FALSE "URHO3D_LUA OR URHO3D_LUAJIT" FALSE)
     cmake_dependent_option (URHO3D_SAFE_LUA "Enable Lua C++ wrapper safety checks (Lua scripting only)" FALSE "URHO3D_LUA OR URHO3D_LUAJIT" FALSE)
     option (URHO3D_SAMPLES "Build sample applications")
     option (URHO3D_SAMPLES "Build sample applications")
-    cmake_dependent_option (URHO3D_TOOLS "Build standalone tools (Desktop and RPI only; on Android only build Lua standalone tools)" TRUE "NOT IOS;NOT ANDROID OR URHO3D_LUA OR URHO3D_LUAJIT" FALSE)
-    cmake_dependent_option (URHO3D_EXTRAS "Build extras (Desktop and RPI only)" FALSE "NOT IOS AND NOT ANDROID" FALSE)
+    cmake_dependent_option (URHO3D_TOOLS "Build tools (native and RPI only)" TRUE "NOT IOS AND NOT ANDROID" FALSE)
+    cmake_dependent_option (URHO3D_EXTRAS "Build extras (native and RPI only)" FALSE "NOT IOS AND NOT ANDROID" FALSE)
     option (URHO3D_DOCS "Generate documentation as part of normal build")
     option (URHO3D_DOCS "Generate documentation as part of normal build")
     option (URHO3D_DOCS_QUIET "Generate documentation as part of normal build, suppress generation process from sending anything to stdout")
     option (URHO3D_DOCS_QUIET "Generate documentation as part of normal build, suppress generation process from sending anything to stdout")
     cmake_dependent_option (URHO3D_MINIDUMPS "Enable minidumps on crash (VS only)" TRUE "MSVC" FALSE)
     cmake_dependent_option (URHO3D_MINIDUMPS "Enable minidumps on crash (VS only)" TRUE "MSVC" FALSE)
@@ -372,9 +372,6 @@ endif ()
 # Include CMake builtin module for building shared library support
 # Include CMake builtin module for building shared library support
 include (GenerateExportHeader)
 include (GenerateExportHeader)
 
 
-# Determine the project root directory
-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})
@@ -387,18 +384,7 @@ macro (set_output_directories OUTPUT_PATH)
 endmacro ()
 endmacro ()
 
 
 # Set common binary output directory for all platforms
 # Set common binary output directory for all platforms
-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
-    elseif (MINGW)
-        set (PLATFORM_PREFIX mingw-)
-    endif ()
-endif ()
-set_output_directories (${PROJECT_ROOT_DIR}/${PLATFORM_PREFIX}Bin RUNTIME PDB)
+set_output_directories (${CMAKE_BINARY_DIR}/Bin RUNTIME PDB)
 
 
 # Macro for setting symbolic link on platform that supports it
 # Macro for setting symbolic link on platform that supports it
 macro (create_symlink SOURCE DESTINATION)
 macro (create_symlink SOURCE DESTINATION)
@@ -443,10 +429,10 @@ if (ANDROID)
     endif ()
     endif ()
     # Create symbolic links in the build tree
     # Create symbolic links in the build tree
     foreach (I CoreData Data)
     foreach (I CoreData Data)
-        create_symlink (../../Bin/${I} Android/assets/${I})
+        create_symlink (../../Bin/${I} ${CMAKE_SOURCE_DIR}/Android/assets/${I})
     endforeach ()
     endforeach ()
     foreach (I AndroidManifest.xml build.xml src res assets jni)
     foreach (I AndroidManifest.xml build.xml src res assets jni)
-        if (EXISTS Android/${I})
+        if (EXISTS ${CMAKE_SOURCE_DIR}/Android/${I})
             create_symlink (${CMAKE_SOURCE_DIR}/Android/${I} ${CMAKE_BINARY_DIR}/${I})
             create_symlink (${CMAKE_SOURCE_DIR}/Android/${I} ${CMAKE_BINARY_DIR}/${I})
         endif ()
         endif ()
     endforeach ()
     endforeach ()
@@ -679,7 +665,7 @@ endmacro ()
 macro (setup_main_executable)
 macro (setup_main_executable)
     # Define resource files
     # Define resource files
     if (XCODE)
     if (XCODE)
-        set (RESOURCE_FILES ${PROJECT_ROOT_DIR}/Bin/CoreData ${PROJECT_ROOT_DIR}/Bin/Data)
+        set (RESOURCE_FILES ${CMAKE_BINARY_DIR}/Bin/CoreData ${CMAKE_SOURCE_DIR}/Bin/Data)
         set_source_files_properties (${RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
         set_source_files_properties (${RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
         list (APPEND SOURCE_FILES ${RESOURCE_FILES})
         list (APPEND SOURCE_FILES ${RESOURCE_FILES})
     endif ()
     endif ()

+ 138 - 0
CMakeLists.txt

@@ -0,0 +1,138 @@
+#
+# Copyright (c) 2008-2014 the Urho3D project.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+# Set project name
+project (Urho3D)
+
+# Set minimum version
+cmake_minimum_required (VERSION 2.8.6)
+
+if (COMMAND cmake_policy)
+    cmake_policy (SET CMP0003 NEW)
+    if (CMAKE_VERSION VERSION_GREATER 2.8.12 OR CMAKE_VERSION VERSION_EQUAL 2.8.12)
+        cmake_policy (SET CMP0022 NEW) # INTERFACE_LINK_LIBRARIES defines the link interface
+    endif ()
+    if (CMAKE_VERSION VERSION_GREATER 3.0.0 OR CMAKE_VERSION VERSION_EQUAL 3.0.0)
+        cmake_policy (SET CMP0026 OLD) # Disallow use of the LOCATION target property - therefore we set to OLD as we still need it
+        cmake_policy (SET CMP0042 NEW) # MACOSX_RPATH is enabled by default
+    endif ()
+endif ()
+
+# Set CMake modules search path
+set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
+
+# Include Urho3D Cmake common module
+include (Urho3D-CMake-common)
+
+# Setup SDK install destinations
+if (CMAKE_HOST_WIN32)
+    # CMake already automatically appends "Urho3D" to CMAKE_INSTALL_PREFIX on Windows platform
+    set (SCRIPT_PATTERN *.bat)
+else ()
+    set (PATH_SUFFIX /Urho3D)
+    if (URHO3D_64BIT)
+        if (NOT CMAKE_CROSSCOMPILING AND EXISTS /usr/lib64)
+            # Probably target system is a RedHat-based distro
+            set (LIB_SUFFIX 64)
+        endif ()
+    endif ()
+    if (IOS)
+        # Use 'ios' arch subdirectory to differentiate, in case both Mac OS X and iOS build are installed at the same destination
+        set (LIB_SUFFIX ${LIB_SUFFIX}/ios)
+    endif ()
+    set (SCRIPT_PATTERN *.sh)
+endif ()
+set (DEST_INCLUDE_DIR include${PATH_SUFFIX})
+set (DEST_SHARE_DIR share${PATH_SUFFIX})
+set (DEST_RUNTIME_DIR ${DEST_SHARE_DIR}/Bin)
+# Note: ${PATH_SUFFIX} for library could be removed if the extra path is not desirable, but if so then the RPATH setting below needs to be adjusted accordingly
+set (DEST_LIBRARY_DIR lib${LIB_SUFFIX}${PATH_SUFFIX})
+if (ANDROID)
+    set (DEST_RUNTIME_DIR ${DEST_RUNTIME_DIR}/${ANDROID_NDK_ABI_NAME})
+    set (DEST_LIBRARY_DIR ${DEST_LIBRARY_DIR}/${ANDROID_NDK_ABI_NAME})
+endif ()
+set (SYSROOT ${ANDROID_TOOLCHAIN_ROOT} ${RASPI_SYSROOT} ${MINGW_SYSROOT})       # SYSROOT is empty for native build
+string (REPLACE "${SYSROOT}" "" DEST_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})    # Our CMAKE_INSTALL_PREFIX is rooted, use DEST_INSTALL_PREFIX for the non-rooted version
+set (DEST_PKGCONFIG_DIR lib${LIB_SUFFIX}/pkgconfig)
+set (DEST_PERMISSIONS FILE_PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+# Install application launcher scripts
+file (GLOB APP_SCRIPTS ${CMAKE_SOURCE_DIR}/Bin/${SCRIPT_PATTERN})
+install (FILES ${APP_SCRIPTS} DESTINATION ${DEST_RUNTIME_DIR} PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)   # 755
+# Install resource directories required by applications built with Urho3D library
+install (DIRECTORY ${CMAKE_SOURCE_DIR}/Bin/CoreData ${CMAKE_SOURCE_DIR}/Bin/Data DESTINATION ${DEST_RUNTIME_DIR} ${DEST_PERMISSIONS})
+# Install CMake modules and toolchains provided by and for Urho3D
+install (DIRECTORY ${CMAKE_SOURCE_DIR}/CMake/ DESTINATION ${DEST_SHARE_DIR}/CMake ${DEST_PERMISSIONS})    # Note: the trailing slash is significant
+# Install CMake launcher scripts
+file (GLOB CMAKE_SCRIPTS ${CMAKE_SOURCE_DIR}/${SCRIPT_PATTERN})
+install (FILES ${CMAKE_SCRIPTS} DESTINATION ${DEST_SHARE_DIR}/Scripts PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+
+# Setup package variables
+set (URHO3D_DESCRIPTION "Urho3D is a free lightweight, cross-platform 2D and 3D game engine implemented in C++ and released under the MIT license. Greatly inspired by OGRE (http://www.ogre3d.org) and Horde3D (http://www.horde3d.org).")
+set (CPACK_PACKAGE_DESCRIPTION_SUMMARY ${URHO3D_DESCRIPTION})
+set (URHO3D_URL "https://github.com/urho3d/Urho3D")
+set (CPACK_PACKAGE_VENDOR ${URHO3D_URL})
+set (CPACK_PACKAGE_CONTACT ${URHO3D_URL})
+execute_process (COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/CMake/Modules/GetUrho3DRevision.cmake OUTPUT_VARIABLE URHO3D_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+set (CPACK_PACKAGE_VERSION ${URHO3D_VERSION})
+string (REGEX MATCH "([^.]+)\\.([^.]+)\\.(.+)" MATCHED ${URHO3D_VERSION})
+if (MATCHED)
+    set (CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1})
+    set (CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
+    set (CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3})
+endif ()
+set (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/License.txt)
+set (CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
+set (CPACK_GENERATOR TGZ)
+if (ANDROID)
+    set (CPACK_SYSTEM_NAME Android)
+elseif (IOS)
+    set (CPACK_SYSTEM_NAME iOS)
+elseif (APPLE)
+    set (CPACK_SYSTEM_NAME OSX)
+elseif (WIN32)
+    set (CPACK_GENERATOR ZIP)
+elseif (CPACK_SYSTEM_NAME STREQUAL Linux)
+    if (RASPI)
+        set (CPACK_SYSTEM_NAME Raspberry-Pi)
+    endif ()
+    list (APPEND CPACK_GENERATOR RPM DEB)
+    set (CPACK_PACKAGING_INSTALL_PREFIX ${DEST_INSTALL_PREFIX})
+endif ()
+if (URHO3D_64BIT)
+    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-64bit)
+endif ()
+set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-${URHO3D_LIB_TYPE})
+if (WIN32 AND NOT URHO3D_OPENGL)
+    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-D3D)    # Stands for Direct 3D
+elseif (ANDROID AND X86)    # Take advantage of Android toolchain setting X86 variable to true for both 'x86' and 'x86_64' ABIs
+    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-IA)     # Stands for Intel Architecture
+endif ()
+if (NOT DEFINED ENV{RELEASE_TAG})
+    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-snapshot)
+endif ()
+include (CPack)
+
+# Urho3D source
+add_subdirectory (Source)
+
+# Urho3D documentation
+add_subdirectory (Docs)

+ 20 - 13
Docs/CMakeLists.txt

@@ -40,8 +40,8 @@ find_package (Doxygen QUIET)
 
 
 if (DOXYGEN_FOUND)
 if (DOXYGEN_FOUND)
     # Generate platform specific Doxyfile automatically
     # Generate platform specific Doxyfile automatically
-    if (NOT URHO3D_OPENGL EQUAL DOXYFILE_URHO3D_OPENGL OR ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in IS_NEWER_THAN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
-        set (DOXYFILE_URHO3D_OPENGL ${URHO3D_OPENGL} CACHE INTERNAL "URHO3D_OPENGL flag when Doxyfile was last generated")
+    if (NOT URHO3D_OPENGL EQUAL DOXYFILE_URHO3D_OPENGL OR ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
+        set (DOXYFILE_URHO3D_OPENGL ${URHO3D_OPENGL} CACHE INTERNAL "URHO3D_OPENGL build option when Doxyfile was last generated")
         if (URHO3D_OPENGL)
         if (URHO3D_OPENGL)
             set (EXCLUDE_GRAPHICS_API Direct3D9)
             set (EXCLUDE_GRAPHICS_API Direct3D9)
         else ()
         else ()
@@ -50,7 +50,7 @@ if (DOXYGEN_FOUND)
         foreach (IDE XCODE MSVC Eclipse CodeBlocks)
         foreach (IDE XCODE MSVC Eclipse CodeBlocks)
             enable_help (${IDE})
             enable_help (${IDE})
         endforeach ()
         endforeach ()
-        configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
+        configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
     endif ()
     endif ()
 
 
     # Dump AngelScript and LuaScript API to Doxygen file if the tool is available
     # Dump AngelScript and LuaScript API to Doxygen file if the tool is available
@@ -59,28 +59,28 @@ if (DOXYGEN_FOUND)
     # 2) ScriptAPI.dox and LuaScriptAPI.dox always get refreshed first before the 'doc' target is being built (similar to VS-only PRE_BUILD custom command)
     # 2) ScriptAPI.dox and LuaScriptAPI.dox always get refreshed first before the 'doc' target is being built (similar to VS-only PRE_BUILD custom command)
     if (TARGET ScriptCompiler AND NOT CMAKE_CROSSCOMPILING)
     if (TARGET ScriptCompiler AND NOT CMAKE_CROSSCOMPILING)
         add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox
         add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox
-            COMMAND ${PROJECT_ROOT_DIR}/Bin/ScriptCompiler -dumpapi ScriptAPI.dox AngelScriptAPI.h
+            COMMAND ${CMAKE_BINARY_DIR}/Bin/tool/ScriptCompiler -dumpapi ScriptAPI.dox AngelScriptAPI.h
             DEPENDS Urho3D ScriptCompiler
             DEPENDS Urho3D ScriptCompiler
             WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
             WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
             COMMENT "Dumping AngelScript API to ScriptAPI.dox")
             COMMENT "Dumping AngelScript API to ScriptAPI.dox")
     else ()
     else ()
-        add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox COMMAND echo dummy >${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox)
+        add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox)
     endif ()
     endif ()
     if (TARGET tolua++ AND NOT CMAKE_CROSSCOMPILING)
     if (TARGET tolua++ AND NOT CMAKE_CROSSCOMPILING)
-        file (GLOB PKGS RELATIVE ${PROJECT_ROOT_DIR}/Source/Engine/LuaScript/pkgs ${PROJECT_ROOT_DIR}/Source/Engine/LuaScript/pkgs/*.pkg)
+        file (GLOB PKGS RELATIVE ${CMAKE_SOURCE_DIR}/Source/Engine/LuaScript/pkgs ${CMAKE_SOURCE_DIR}/Source/Engine/LuaScript/pkgs/*.pkg)
         list (SORT PKGS)
         list (SORT PKGS)
         set (PKGLIST "// This is a generated file. DO NOT EDIT!\n\n")
         set (PKGLIST "// This is a generated file. DO NOT EDIT!\n\n")
         foreach (PKG ${PKGS})
         foreach (PKG ${PKGS})
             set (PKGLIST "${PKGLIST}$pfile \"${PKG}\"\n")
             set (PKGLIST "${PKGLIST}$pfile \"${PKG}\"\n")
         endforeach ()
         endforeach ()
-        file (WRITE ${PROJECT_ROOT_DIR}/Bin/LuaPkgToDox.txt ${PKGLIST})
+        file (WRITE ${CMAKE_BINARY_DIR}/Bin/tool/LuaPkgToDox.txt ${PKGLIST})
         add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox
         add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox
-            COMMAND ${PROJECT_ROOT_DIR}/Bin/tolua++ -L ToDoxHook.lua -P -o ${CMAKE_CURRENT_SOURCE_DIR}/LuaScriptAPI.dox ${PROJECT_ROOT_DIR}/Bin/LuaPkgToDox.txt
+            COMMAND ${CMAKE_BINARY_DIR}/Bin/tool/tolua++ -L ToDoxHook.lua -P -o ${CMAKE_CURRENT_SOURCE_DIR}/LuaScriptAPI.dox ${CMAKE_BINARY_DIR}/Bin/tool/LuaPkgToDox.txt
             DEPENDS Urho3D tolua++
             DEPENDS Urho3D tolua++
-            WORKING_DIRECTORY ${PROJECT_ROOT_DIR}/Source/Engine/LuaScript/pkgs
+            WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/Source/Engine/LuaScript/pkgs
             COMMENT "Dumping LuaScript API to LuaScriptAPI.dox")
             COMMENT "Dumping LuaScript API to LuaScriptAPI.dox")
     else ()
     else ()
-        add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox COMMAND echo dummy >${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox)
+        add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox)
     endif ()
     endif ()
 
 
     # If URHO3D_DOCS build option is set then add the custom 'doc' target into the default 'all' target, i.e. a normal build would not only build the software but also the documentation
     # If URHO3D_DOCS build option is set then add the custom 'doc' target into the default 'all' target, i.e. a normal build would not only build the software but also the documentation
@@ -100,13 +100,20 @@ if (DOXYGEN_FOUND)
     add_custom_target (doc ${ALL}
     add_custom_target (doc ${ALL}
         COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile ${REDIRECT_STDOUT}
         COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile ${REDIRECT_STDOUT}
         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox   # Note: these two dependencies need to be made explicit or otherwise CMake would not automatically 'refresh' them with provided custom command
         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox   # Note: these two dependencies need to be made explicit or otherwise CMake would not automatically 'refresh' them with provided custom command
-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
         COMMENT "Generating documentation with Doxygen")
         COMMENT "Generating documentation with Doxygen")
 endif ()
 endif ()
 
 
 # Make sure html output directory exists and not empty
 # Make sure html output directory exists and not empty
-file (WRITE ${CMAKE_CURRENT_SOURCE_DIR}/html/Readme.txt "If URHO3D_DOCS build option is not set then use 'make doc' command or an equivalent command in IDE to re-generate Urho3D documentation before calling 'make install' or its equivalent.")
+file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/html/Readme.txt "If URHO3D_DOCS build option is not set then use 'make doc' command to re-generate Urho3D documentation before calling 'make install', alternatively use the 'doc' and 'install' built-in targets in an IDE, respectively")
     
     
 # Currently it is not possible to make built-in 'install' target to depend on 'doc' in CMake, therefore 'make doc' command need to be invoked manually before 'make install' in order to install the SDK with complete documentation
 # Currently it is not possible to make built-in 'install' target to depend on 'doc' in CMake, therefore 'make doc' command need to be invoked manually before 'make install' in order to install the SDK with complete documentation
 # Unless, URHO3D_DOCS build option is set in which case the custom 'doc' target is part of the default 'all' target which in turn the 'install' target depends on, so a single 'make install' alone is suffice to install everything 
 # Unless, URHO3D_DOCS build option is set in which case the custom 'doc' target is part of the default 'all' target which in turn the 'install' target depends on, so a single 'make install' alone is suffice to install everything 
-install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/html/ DESTINATION ${DEST_SHARE_DIR}/Docs ${DEST_PERMISSIONS})
+install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ DESTINATION ${DEST_SHARE_DIR}/Docs ${DEST_PERMISSIONS})
+
+# Define post build steps
+if (CMAKE_EXTRA_GENERATOR MATCHES Eclipse AND NOT CMAKE_HOST_WIN32)
+    add_custom_command (TARGET doc
+        COMMAND ${CMAKE_COMMAND} -E remove ~/.eclipse/`ls -1t ~/.eclipse |grep org.eclipse.platform_ |head -1`/plugins/html || true
+        COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_BINARY_DIR}/html ~/.eclipse/`ls -1t ~/.eclipse |grep org.eclipse.platform_ |head -1`/plugins/html || true
+        COMMENT "Creating symbolic link to HTML documentation in the Eclipse IDE")
+endif ()

+ 3 - 3
Docs/Doxyfile.in

@@ -665,9 +665,9 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories 
 # directories like "/usr/src/myproject". Separate the files or directories 
 # with spaces.
 # with spaces.
 
 
-INPUT                  = ../Source/Engine \
-                         ../Source/ThirdParty/rapidjson/include/rapidjson \
-                         .
+INPUT                  = @CMAKE_SOURCE_DIR@/Source/Engine \
+                         @CMAKE_SOURCE_DIR@/Source/ThirdParty/rapidjson/include/rapidjson \
+                         @CMAKE_CURRENT_SOURCE_DIR@
 
 
 # This tag can be used to specify the character encoding of the source files 
 # This tag can be used to specify the character encoding of the source files 
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 

+ 45 - 45
Docs/GettingStarted.dox

@@ -30,7 +30,51 @@ To run Urho3D, the minimum system requirements are:
 
 
 - iOS: OpenGL ES 2.0 capable GPU.
 - iOS: OpenGL ES 2.0 capable GPU.
 
 
-SSE requirement can be eliminated by disabling the use of SSE instruction set, see \ref Build_Options "Build options" below.
+SSE requirement can be eliminated by disabling the use of SSE instruction set, see URHO3D_SSE build option below.
+
+\section Build_Options Build options
+
+A number of build options can be defined explicitly when invoking the above cmake_xxxx batch files or shell scripts or when configurating the project interactively using cmake-gui. To use one of these build options on the command line interface, pass it in this format "-DOPTION=VALUE" without the quotes.\n
+|Build Option         |V|Description          |
+|---------------------|-|---------------------|
+|ANDROID              |0|Configure project using Android cross-compiler toolchain (cmake_generic.bat and cmake_generic.sh only)|
+|RASPI                |0|Configure project using Raspberry Pi cross-compiler toolchain (cmake_generic.sh only)|
+|WIN32                |0|Configure project using MinGW cross-compiler toolchain (cmake_generic.sh only)|
+|IOS                  |0|Configure project for targeting iOS platform (cmake_generic.sh and cmake-gui only); use cmake_ios.sh as shortcut|
+|URHO3D_64BIT         |*|Enable 64bit build, on MSVC default to 0, on other compilers the default is set based on the installed toolchain on host system|
+|URHO3D_ANGELSCRIPT   |1|Enable AngelScript scripting support|
+|URHO3D_LUA           |0|Enable Lua scripting support|
+|URHO3D_LUAJIT        |0|Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)|
+|URHO3D_LUAJIT_AMALG  |0|Enable LuaJIT amalgamated build (LuaJIT only)|
+|URHO3D_SAFE_LUA      |0|Enable Lua C++ wrapper safety checks (when Lua scripting support is enabled only)|
+|URHO3D_NETWORK       |1|Enable Networking support|
+|URHO3D_PHYSICS       |1|Enable Physics support|
+|URHO3D_NAVIGATION    |1|Enable Navigation support|
+|URHO3D_URHO2D        |1|Enable 2D rendering & physics support|
+|URHO3D_SAMPLES       |0|Build sample applications|
+|URHO3D_TOOLS         |1|Build tools (native and RPI only)|
+|URHO3D_EXTRAS        |0|Build extras (native and RPI only)|
+|URHO3D_DOCS          |0|Generate documentation as part of normal build (the 'doc' builtin target can be used to generate documentation regardless of this option's value)|
+|URHO3D_DOCS_QUIET    |0|Generate documentation as part of normal build, suppress generation process from sending anything to stdout|
+|URHO3D_SSE           |1|Enable SSE instruction set|
+|URHO3D_MINIDUMPS     |1|Enable minidumps on crash (VS only)|
+|URHO3D_FILEWATCHER   |1|Enable filewatcher support|
+|URHO3D_PROFILING     |1|Enable profiling support|
+|URHO3D_LOGGING       |1|Enable logging support|
+|URHO3D_TESTING       |0|Enable testing support|
+|URHO3D_TEST_TIME_OUT |5|Number of seconds to test run the executables (when testing support is enabled only)|
+|URHO3D_OPENGL        |0|Use OpenGL instead of Direct3D (Windows platform only)|
+|URHO3D_STATIC_RUNTIME|0|Use static C/C++ runtime libraries and eliminate the need for runtime DLLs installation (VS only)|
+|URHO3D_LIB_TYPE      |*|Specify Urho3D library type, possible values are STATIC (\*default) and SHARED|
+|URHO3D_SCP_TO_TARGET |-|Use scp to transfer executables to target system (non-Android cross-compiling build only), SSH digital key must be setup first for this to work, typical value has a pattern of usr@tgt:remote-loc|
+|CMAKE_BUILD_TYPE     |*|Specify CMake build configuration (single-configuration generator only), possible values are Release (\*default), RelWithDebInfo, and Debug|
+|CMAKE_OSX_DEPLOYMENT_TARGET|-|Specify Mac OS X deployment target (OSX build only); default to current running OS X if not specified|
+|IPHONEOS_DEPLOYMENT_TARGET|-|Specify iPhone OS deployment target (iOS build only); default to latest installed iOS SDK if not specified|
+|ANDROID_ABI          |*|Specify target ABI (Android build only), possible values are arm64-v8a, armeabi, armeabi-v6 with VFP, armeabi-v7a (\*default), armeabi-v7a with NEON, armeabi-v7a with VFPV3, mips, mips64, x86, and x86_64|
+|ANDROID_NATIVE_API_LEVEL|*|Specify target API level (Android build only), possible values depends on installed NDK version, default to API level 12 on 32-bit ABIs, default to API level 21 on 64-bit ABIs|
+|ANDROID_NDK_GDB      |0|Enable ndk-gdb support (Android Debug build only)|
+
+Note that the specified build option values are cached by CMake. The cached values will be used by CMake in the subsequent invocation. That is, the same build options are not required to be specified again and again. But once a non-default build option value is being cached, it can only be reverted back to its default value by explicitly resetting it. That is, simply by not passing the corresponding build option would not work. One way to revert all the build options to their default values is by clearing the CMake cache by calling cmake_clean.bat or cmake_clean.sh.
 
 
 \section Building_Native Native build process
 \section Building_Native Native build process
 
 
@@ -138,50 +182,6 @@ When building with the Windows 8 SDK, copy d3dcompiler_46.dll from "C:\Program F
 
 
 Note that you can also force an OpenGL mode build on Windows platform by using the "URHO3D_OPENGL" build option in the table below; OpenGL does not depend on a separate shader compiler DLL.
 Note that you can also force an OpenGL mode build on Windows platform by using the "URHO3D_OPENGL" build option in the table below; OpenGL does not depend on a separate shader compiler DLL.
 
 
-\section Build_Options Build options
-
-A number of build options can be defined explicitly when invoking the above cmake_xxxx batch files or shell scripts or when configurating the project interactively using cmake-gui. To use one of these build options on the command line interface, pass it in this format "-DOPTION=VALUE" without the quotes.\n
-|Build Option         |V|Description          |
-|---------------------|-|---------------------|
-|ANDROID              |0|Configure project using Android cross-compiler toolchain (cmake_generic.bat and cmake_generic.sh only)|
-|RASPI                |0|Configure project using Raspberry Pi cross-compiler toolchain (cmake_generic.sh only)|
-|WIN32                |0|Configure project using MinGW cross-compiler toolchain (cmake_generic.sh only)|
-|IOS                  |0|Configure project for targeting iOS platform (cmake_generic.sh and cmake-gui only); use cmake_ios.sh as shortcut|
-|URHO3D_64BIT         |*|Enable 64bit build, on MSVC default to 0, on other compilers the default is set based on the installed toolchain on host system|
-|URHO3D_ANGELSCRIPT   |1|Enable AngelScript scripting support|
-|URHO3D_LUA           |0|Enable Lua scripting support|
-|URHO3D_LUAJIT        |0|Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)|
-|URHO3D_LUAJIT_AMALG  |0|Enable LuaJIT amalgamated build (LuaJIT only)|
-|URHO3D_SAFE_LUA      |0|Enable Lua C++ wrapper safety checks (when Lua scripting support is enabled only)|
-|URHO3D_NETWORK       |1|Enable Networking support|
-|URHO3D_PHYSICS       |1|Enable Physics support|
-|URHO3D_NAVIGATION    |1|Enable Navigation support|
-|URHO3D_URHO2D        |1|Enable 2D rendering & physics support|
-|URHO3D_SAMPLES       |0|Build sample applications|
-|URHO3D_TOOLS         |1|Build standalone tools (Desktop and RPI only; on Android only build Lua standalone tools)|
-|URHO3D_EXTRAS        |0|Build extras (Desktop and RPI only)|
-|URHO3D_DOCS          |0|Generate documentation as part of normal build (the 'doc' builtin target can be used to generate documentation regardless of this option's value)|
-|URHO3D_DOCS_QUIET    |0|Generate documentation as part of normal build, suppress generation process from sending anything to stdout|
-|URHO3D_SSE           |1|Enable SSE instruction set|
-|URHO3D_MINIDUMPS     |1|Enable minidumps on crash (VS only)|
-|URHO3D_FILEWATCHER   |1|Enable filewatcher support|
-|URHO3D_PROFILING     |1|Enable profiling support|
-|URHO3D_LOGGING       |1|Enable logging support|
-|URHO3D_TESTING       |0|Enable testing support|
-|URHO3D_TEST_TIME_OUT |5|Number of seconds to test run the executables (when testing support is enabled only)|
-|URHO3D_OPENGL        |0|Use OpenGL instead of Direct3D (Windows platform only)|
-|URHO3D_STATIC_RUNTIME|0|Use static C/C++ runtime libraries and eliminate the need for runtime DLLs installation (VS only)|
-|URHO3D_LIB_TYPE      |*|Specify Urho3D library type, possible values are STATIC (\*default) and SHARED|
-|URHO3D_SCP_TO_TARGET |-|Use scp to transfer executables to target system (non-Android cross-compiling build only), SSH digital key must be setup first for this to work, typical value has a pattern of usr@tgt:remote-loc|
-|CMAKE_BUILD_TYPE     |*|Specify CMake build configuration (single-configuration generator only), possible values are Release (\*default), RelWithDebInfo, and Debug|
-|CMAKE_OSX_DEPLOYMENT_TARGET|-|Specify Mac OS X deployment target (OSX build only); default to current running OS X if not specified|
-|IPHONEOS_DEPLOYMENT_TARGET|-|Specify iPhone OS deployment target (iOS build only); default to latest installed iOS SDK if not specified|
-|ANDROID_ABI          |*|Specify target ABI (Android build only), possible values are arm64-v8a, armeabi, armeabi-v6 with VFP, armeabi-v7a (\*default), armeabi-v7a with NEON, armeabi-v7a with VFPV3, mips, mips64, x86, and x86_64|
-|ANDROID_NATIVE_API_LEVEL|*|Specify target API level (Android build only), possible values depends on installed NDK version, default to API level 12 on 32-bit ABIs, default to API level 21 on 64-bit ABIs|
-|ANDROID_NDK_GDB      |0|Enable ndk-gdb support (Android Debug build only)|
-
-Note that the specified build option values are cached by CMake. The cached values will be used by CMake in the subsequent invocation. That is, the same build options are not required to be specified again and again. But once a non-default build option value is being cached, it can only be reverted back to its default value by explicitly resetting it. That is, simply by not passing the corresponding build option would not work. One way to revert all the build options to their default values is by clearing the CMake cache by calling cmake_clean.bat or cmake_clean.sh.
-
 \page Running Running Urho3D player application
 \page Running Running Urho3D player application
 
 
 The Urho3D player application in the Bin directory contains all the engine runtime functionality. However, it does not contain any inbuilt logic, and therefore must be supplied with the name of the application script file it should run:
 The Urho3D player application in the Bin directory contains all the engine runtime functionality. However, it does not contain any inbuilt logic, and therefore must be supplied with the name of the application script file it should run:

+ 66 - 76
Rakefile

@@ -42,12 +42,12 @@ task :scaffolding do
   scaffolding(abs_path, project, target)
   scaffolding(abs_path, project, target)
   abs_path = Pathname.new(abs_path).realpath
   abs_path = Pathname.new(abs_path).realpath
   puts "\nNew project created in #{abs_path}\n\n"
   puts "\nNew project created in #{abs_path}\n\n"
-  puts "To build the new project, you may need to first set and export either 'URHO3D_HOME' or 'CMAKE_PREFIX_PATH' environment variable"
-  puts "Please see http://urho3d.github.io/documentation/HEAD/_using_library.html for more detail. For example:\n\n"
+  puts "To build the new project, you may need to first set and export either 'URHO3D_HOME' and 'URHO3D_BUILD_TREE'; or 'CMAKE_PREFIX_PATH' environment variable"
+  puts "Please see http://urho3d.github.io/documentation/HEAD/_using_library.html for more detail. For example of using Urho3D source and build trees directly:\n\n"
   if ENV['OS']
   if ENV['OS']
-    puts "set URHO3D_HOME=#{Dir.pwd}\ncd #{abs_path}\ncmake_vs2013.bat -DURHO3D_64BIT=1 -DURHO3D_LUAJIT=1\n\n"
+    puts "set URHO3D_HOME=#{Dir.pwd}\nset URHO3D_BUILD_TREE=/path/to/your/build/tree\ncd #{abs_path}\ncmake_vs2013.bat -DURHO3D_64BIT=1 -DURHO3D_LUAJIT=1\n\n"
   else
   else
-    puts "export URHO3D_HOME=#{Dir.pwd}\ncd #{abs_path}\n./cmake_gcc.sh -DURHO3D_LUAJIT=1\ncd Build\nmake\n\n"
+    puts "export URHO3D_HOME=#{Dir.pwd} URHO3D_BUILD_TREE=/path/to/your/build/tree\ncd #{abs_path}\n./cmake_generic.sh -DURHO3D_LUAJIT=1\ncd Build\nmake\n\n"
   end
   end
 end
 end
 
 
@@ -90,8 +90,11 @@ task :ci do
   $build_options = "#{$build_options} -DURHO3D_OPENGL=#{ENV['URHO3D_OPENGL']}" if ENV['URHO3D_OPENGL']
   $build_options = "#{$build_options} -DURHO3D_OPENGL=#{ENV['URHO3D_OPENGL']}" if ENV['URHO3D_OPENGL']
   $build_options = "#{$build_options} -DANDROID_ABI=#{ENV['ABI']}" if ENV['ABI']
   $build_options = "#{$build_options} -DANDROID_ABI=#{ENV['ABI']}" if ENV['ABI']
   $build_options = "#{$build_options} -DANDROID_NATIVE_API_LEVEL=#{ENV['API']}" if ENV['API']
   $build_options = "#{$build_options} -DANDROID_NATIVE_API_LEVEL=#{ENV['API']}" if ENV['API']
+  $build_options = "#{$build_options} -DANDROID=#{ENV['ANDROID']}" if ENV['ANDROID']
+  $build_options = "#{$build_options} -DRPI=#{ENV['RPI']}" if ENV['RPI']
+  $build_options = "#{$build_options} -DWIN32=#{ENV['WINDOWS']}" if ENV['WINDOWS']
   if ENV['XCODE']
   if ENV['XCODE']
-    # xctool or xcodebuild
+    # xcodebuild
     xcode_ci
     xcode_ci
   else
   else
     # GCC or Clang
     # GCC or Clang
@@ -103,22 +106,22 @@ end
 desc 'Update site documentation to GitHub Pages'
 desc 'Update site documentation to GitHub Pages'
 task :ci_site_update do
 task :ci_site_update do
   # Pull or clone
   # Pull or clone
-  system 'cd doc-Build 2>/dev/null && git pull -q -r || git clone --depth 1 -q https://github.com/urho3d/urho3d.github.io.git doc-Build' or abort 'Failed to pull/clone'
+  system 'cd ../doc-Build 2>/dev/null && git pull -q -r || git clone --depth 1 -q https://github.com/urho3d/urho3d.github.io.git ../doc-Build' or abort 'Failed to pull/clone'
   # Update credits from Readme.txt to about.md
   # Update credits from Readme.txt to about.md
-  system "ruby -lne 'BEGIN { credits = false }; puts $_ if credits; credits = true if /bugfixes by:/; credits = false if /^$/' Readme.txt |ruby -i -le 'credits = STDIN.read; puts ARGF.read.gsub(/(?<=bugfixes by\n).*?(?=##)/m, credits)' doc-Build/about.md" or abort 'Failed to update credits'
+  system "ruby -lne 'BEGIN { credits = false }; puts $_ if credits; credits = true if /bugfixes by:/; credits = false if /^$/' Readme.txt |ruby -i -le 'credits = STDIN.read; puts ARGF.read.gsub(/(?<=bugfixes by\n).*?(?=##)/m, credits)' ../doc-Build/about.md" or abort 'Failed to update credits'
   # Setup doxygen to use minimal theme
   # Setup doxygen to use minimal theme
-  system "ruby -i -pe 'BEGIN { a = {%q{HTML_HEADER} => %q{minimal-header.html}, %q{HTML_FOOTER} => %q{minimal-footer.html}, %q{HTML_STYLESHEET} => %q{minimal-doxygen.css}, %q{HTML_COLORSTYLE_HUE} => 200, %q{HTML_COLORSTYLE_SAT} => 0, %q{HTML_COLORSTYLE_GAMMA} => 20, %q{DOT_IMAGE_FORMAT} => %q{svg}, %q{INTERACTIVE_SVG} => %q{YES}} }; a.each {|k, v| gsub(/\#{k}\s*?=.*?\n/, %Q{\#{k} = \#{v}\n}) }' Docs/Doxyfile" or abort 'Failed to setup doxygen configuration file'
-  system 'cp doc-Build/_includes/Doxygen/minimal-* Docs' or abort 'Failed to copy minimal-themed template'
+  system "ruby -i -pe 'BEGIN { a = {%q{HTML_HEADER} => %q{minimal-header.html}, %q{HTML_FOOTER} => %q{minimal-footer.html}, %q{HTML_STYLESHEET} => %q{minimal-doxygen.css}, %q{HTML_COLORSTYLE_HUE} => 200, %q{HTML_COLORSTYLE_SAT} => 0, %q{HTML_COLORSTYLE_GAMMA} => 20, %q{DOT_IMAGE_FORMAT} => %q{svg}, %q{INTERACTIVE_SVG} => %q{YES}} }; a.each {|k, v| gsub(/\#{k}\s*?=.*?\n/, %Q{\#{k} = \#{v}\n}) }' ../Build/Docs/Doxyfile" or abort 'Failed to setup doxygen configuration file'
+  system 'cp ../doc-Build/_includes/Doxygen/minimal-* ../Build/Docs' or abort 'Failed to copy minimal-themed template'
   release = ENV['RELEASE_TAG'] || 'HEAD'
   release = ENV['RELEASE_TAG'] || 'HEAD'
   unless release == 'HEAD'
   unless release == 'HEAD'
-    system "mkdir -p doc-Build/documentation/#{release}" or abort 'Failed to create directory for new document version'
-    system "ruby -i -pe 'gsub(/HEAD/, %q{#{release}})' Docs/minimal-header.html" or abort 'Failed to update document version in YAML Front Matter block'
-    append_new_release release, 'doc-Build/_data/urho3d.json' or abort 'Failed to add new release to document data file'
+    system "mkdir -p ../doc-Build/documentation/#{release}" or abort 'Failed to create directory for new document version'
+    system "ruby -i -pe 'gsub(/HEAD/, %q{#{release}})' ../Build/Docs/minimal-header.html" or abort 'Failed to update document version in YAML Front Matter block'
+    append_new_release release, '../doc-Build/_data/urho3d.json' or abort 'Failed to add new release to document data file'
   end
   end
   # Generate and sync doxygen pages
   # Generate and sync doxygen pages
-  system "cd Build && make -j$NUMJOBS doc >/dev/null 2>&1 && ruby -i -pe 'gsub(/(<\\/?h)3([^>]*?>)/, %q{\\14\\2}); gsub(/(<\\/?h)2([^>]*?>)/, %q{\\13\\2}); gsub(/(<\\/?h)1([^>]*?>)/, %q{\\12\\2})' ../Docs/html/_*.html && rsync -a --delete ../Docs/html/ ../doc-Build/documentation/#{release}" or abort 'Failed to generate/rsync doxygen pages'
+  system "cd ../Build && make -j$NUMJOBS doc >/dev/null 2>&1 && ruby -i -pe 'gsub(/(<\\/?h)3([^>]*?>)/, %q{\\14\\2}); gsub(/(<\\/?h)2([^>]*?>)/, %q{\\13\\2}); gsub(/(<\\/?h)1([^>]*?>)/, %q{\\12\\2})' Docs/html/_*.html && rsync -a --delete Docs/html/ ../doc-Build/documentation/#{release}" or abort 'Failed to generate/rsync doxygen pages'
   # Supply GIT credentials and push site documentation to urho3d/urho3d.github.io.git
   # Supply GIT credentials and push site documentation to urho3d/urho3d.github.io.git
-  system "cd doc-Build && pwd && git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/urho3d/urho3d.github.io.git && git add -A . && ( git commit -q -m \"Travis CI: site documentation update at #{Time.now.utc}.\n\nCommit: https://github.com/$TRAVIS_REPO_SLUG/commit/$TRAVIS_COMMIT\n\nMessage: $COMMIT_MESSAGE\" || true) && git push -q >/dev/null 2>&1" or abort 'Failed to update site'
+  system "cd ../doc-Build && pwd && git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/urho3d/urho3d.github.io.git && git add -A . && ( git commit -q -m \"Travis CI: site documentation update at #{Time.now.utc}.\n\nCommit: https://github.com/$TRAVIS_REPO_SLUG/commit/$TRAVIS_COMMIT\n\nMessage: $COMMIT_MESSAGE\" || true) && git push -q >/dev/null 2>&1" or abort 'Failed to update site'
   # Automatically give instruction to do packaging when API has changed, unless the instruction is already given in this commit
   # Automatically give instruction to do packaging when API has changed, unless the instruction is already given in this commit
   if ENV['PACKAGE_UPLOAD']
   if ENV['PACKAGE_UPLOAD']
     instruction = 'skip'
     instruction = 'skip'
@@ -156,24 +159,13 @@ task :ci_package_upload do
     $configuration = 'Release'
     $configuration = 'Release'
     $testing = 0
     $testing = 0
   end
   end
-  if ENV['ANDROID']
-    platform_prefix = 'android-'
-  elsif ENV['WINDOWS']
-    platform_prefix = 'mingw-'
-  elsif ENV['IOS']
-    platform_prefix = 'ios-'
-  elsif ENV['RPI']
-    platform_prefix = 'raspi-'
-  else
-    platform_prefix = ''
-  end
   # Generate the documentation if necessary
   # Generate the documentation if necessary
   unless ENV['SITE_UPDATE']
   unless ENV['SITE_UPDATE']
     system 'echo Generate documentation'
     system 'echo Generate documentation'
     if ENV['XCODE']
     if ENV['XCODE']
-      xcode_build(ENV['IOS'], "#{platform_prefix}Build/Urho3D.xcodeproj", 'doc', '>/dev/null') or abort 'Failed to generate documentation'
+      xcode_build(ENV['IOS'], "../Build/Urho3D.xcodeproj", 'doc', '>/dev/null') or abort 'Failed to generate documentation'
     else
     else
-      system "cd #{platform_prefix}Build && make -j$NUMJOBS doc >/dev/null" or abort 'Failed to generate documentation'
+      system "cd ../Build && make -j$NUMJOBS doc >/dev/null" or abort 'Failed to generate documentation'
     end
     end
   end
   end
   # Make the package
   # Make the package
@@ -186,17 +178,17 @@ task :ci_package_upload do
     if !ENV['CI_START_TIME'] || elapsed_time < 15 # minutes
     if !ENV['CI_START_TIME'] || elapsed_time < 15 # minutes
       # Build Mach-O universal binary consisting of iphoneos (universal ARM archs including 'arm64' if 64-bit is enabled) and iphonesimulator (i386 arch and also x86_64 arch if 64-bit is enabled)
       # Build Mach-O universal binary consisting of iphoneos (universal ARM archs including 'arm64' if 64-bit is enabled) and iphonesimulator (i386 arch and also x86_64 arch if 64-bit is enabled)
       system 'echo Rebuild Urho3D library as Mach-O universal binary'
       system 'echo Rebuild Urho3D library as Mach-O universal binary'
-      xcode_build(0, "#{platform_prefix}Build/Urho3D.xcodeproj", 'Urho3D_universal') or abort 'Failed to build Mach-O universal binary'
+      xcode_build(0, "../Build/Urho3D.xcodeproj", 'Urho3D_universal') or abort 'Failed to build Mach-O universal binary'
     end
     end
     # There is a bug in CMake/CPack that causes the 'package' target failed to build for IOS platform, workaround by calling cpack directly
     # There is a bug in CMake/CPack that causes the 'package' target failed to build for IOS platform, workaround by calling cpack directly
-    system "cd #{platform_prefix}Build && cpack -G TGZ 2>/dev/null" or abort 'Failed to make binary package'
+    system "cd ../Build && cpack -G TGZ 2>/dev/null" or abort 'Failed to make binary package'
   elsif ENV['XCODE']
   elsif ENV['XCODE']
-    xcode_build(ENV['IOS'], "#{platform_prefix}Build/Urho3D.xcodeproj", 'package') or abort 'Failed to make binary package'
+    xcode_build(ENV['IOS'], "../Build/Urho3D.xcodeproj", 'package') or abort 'Failed to make binary package'
   else
   else
     if ENV['ANDROID'] && !ENV['NO_SDK_SYSIMG']
     if ENV['ANDROID'] && !ENV['NO_SDK_SYSIMG']
-      system "cd #{platform_prefix}Build && android update project -p . -t $( android list target |grep android-$API |cut -d ' ' -f2 ) && ant debug" or abort 'Failed to make Urho3D Samples APK'
+      system "cd ../Build && android update project -p . -t $( android list target |grep android-$API |cut -d ' ' -f2 ) && ant debug" or abort 'Failed to make Urho3D Samples APK'
     end
     end
-    system "cd #{platform_prefix}Build && make package" or abort 'Failed to make binary package'
+    system "cd ../Build && make package" or abort 'Failed to make binary package'
   end
   end
   # Determine the upload location
   # Determine the upload location
   setup_digital_keys
   setup_digital_keys
@@ -233,7 +225,7 @@ EOF" or abort 'Failed to create release directory remotely'
     system 'rsync -e ssh -az Readme.txt License.txt [email protected]:/home/frs/project/$TRAVIS_REPO_SLUG' or abort 'Failed to sync readme and license files'
     system 'rsync -e ssh -az Readme.txt License.txt [email protected]:/home/frs/project/$TRAVIS_REPO_SLUG' or abort 'Failed to sync readme and license files'
   end
   end
   # Upload the package
   # Upload the package
-  system "scp #{platform_prefix}Build/Urho3D-* [email protected]:#{upload_dir}" or abort 'Failed to upload binary package'
+  system "scp ../Build/Urho3D-* [email protected]:#{upload_dir}" or abort 'Failed to upload binary package'
 end
 end
 
 
 def scaffolding(dir, project = 'Scaffolding', target = 'Main')
 def scaffolding(dir, project = 'Scaffolding', target = 'Main')
@@ -289,9 +281,9 @@ endif ()
 EOF
 EOF
   # TODO: Rewrite in pure Ruby when it supports symlink creation on Windows platform
   # TODO: Rewrite in pure Ruby when it supports symlink creation on Windows platform
   if ENV['OS']
   if ENV['OS']
-    system("@echo off && (for %d in (Source,Bin) do mkdir #{dir}\\%d) && copy Source\\Tools\\Urho3DPlayer\\Urho3DPlayer.* #{dir}\\Source >nul && (for %f in (*.bat Rakefile) do mklink #{dir}\\%f %cd%\\%f >nul) && (for %d in (CoreData,Data) do mklink /D #{dir}\\Bin\\%d %cd%\\Bin\\%d >nul)") && File.write("#{dir}/Source/CMakeLists.txt", build_script) or abort 'Failed to create new project using Urho3D as external library'
+    system("@echo off && mkdir #{dir}\\Bin && copy Source\\Tools\\Urho3DPlayer\\Urho3DPlayer.* #{dir} >nul && (for %f in (*.bat Rakefile) do mklink #{dir}\\%f %cd%\\%f >nul) && (for %d in (CoreData,Data) do mklink /D #{dir}\\Bin\\%d %cd%\\Bin\\%d >nul)") && File.write("#{dir}/CMakeLists.txt", build_script) or abort 'Failed to create new project using Urho3D as external library'
   else
   else
-    system("bash -c \"mkdir -p #{dir}/{Source,Bin} && cp Source/Tools/Urho3DPlayer/Urho3DPlayer.* #{dir}/Source && for f in {.,}*.sh Rakefile; do ln -sf `pwd`/\\$f #{dir}; done && ln -sf `pwd`/Bin/{Core,}Data #{dir}/Bin\"") && File.write("#{dir}/Source/CMakeLists.txt", build_script) or abort 'Failed to create new project using Urho3D as external library'
+    system("bash -c \"mkdir -p #{dir}/Bin && cp Source/Tools/Urho3DPlayer/Urho3DPlayer.* #{dir} && for f in {.,}*.sh Rakefile; do ln -sf `pwd`/\\$f #{dir}; done && ln -sf `pwd`/Bin/{Core,}Data #{dir}/Bin\"") && File.write("#{dir}/CMakeLists.txt", build_script) or abort 'Failed to create new project using Urho3D as external library'
   end
   end
 end
 end
 
 
@@ -305,10 +297,9 @@ def makefile_ci
     # 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.
     # 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 = ''
     jit = ''
     amalg = ''
     amalg = ''
-    # Lua on MinGW build requires tolua++ tool to be built natively first
-    system "MINGW_PREFIX= ./cmake_gcc.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE #{$build_options} -DURHO3D_LUA=1 -DURHO3D_TOOLS=0" or abort 'Failed to configure native build for tolua++ target'
-    system "cd Build/ThirdParty/toluapp/src/bin && make -j$NUMJOBS" or abort 'Failed to build tolua++ tool'
-    ENV['SKIP_NATIVE'] = '1'
+#    # Lua on MinGW build requires tolua++ tool to be built natively first
+#    system "MINGW_PREFIX= ./cmake_generic.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE #{$build_options} -DURHO3D_LUA=1 -DURHO3D_TOOLS=0" or abort 'Failed to configure native build for tolua++ target'
+#    system "cd Build/ThirdParty/toluapp/src/bin && make -j$NUMJOBS" or abort 'Failed to build tolua++ tool'
   elsif ENV['ANDROID'] && ENV['ABI'] == 'arm64-v8a'
   elsif ENV['ANDROID'] && ENV['ABI'] == 'arm64-v8a'
     # The upstream LuaJIT library does not support this Android ABI at the moment, fallback to use Lua library instead
     # The upstream LuaJIT library does not support this Android ABI at the moment, fallback to use Lua library instead
     jit = ''
     jit = ''
@@ -317,47 +308,45 @@ def makefile_ci
     jit = 'JIT'
     jit = 'JIT'
     amalg = '-DURHO3D_LUAJIT_AMALG=1'
     amalg = '-DURHO3D_LUAJIT_AMALG=1'
   end
   end
-  system "./cmake_gcc.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE #{$build_options} -DURHO3D_LUA#{jit}=1 #{amalg} -DURHO3D_SAMPLES=1 -DURHO3D_TOOLS=1 -DURHO3D_EXTRAS=1 -DURHO3D_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration}" or abort 'Failed to configure Urho3D library build'
+# Temporarily not using any build options that require native tool building
+#  system "./cmake_generic.sh ../Build -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE #{$build_options} -DURHO3D_LUA#{jit}=1 #{amalg} -DURHO3D_SAMPLES=1 -DURHO3D_TOOLS=1 -DURHO3D_EXTRAS=1 -DURHO3D_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration}" or abort 'Failed to configure Urho3D library build'
+  system "./cmake_generic.sh ../Build -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE #{$build_options} -DURHO3D_SAMPLES=1 -DURHO3D_TOOLS=1 -DURHO3D_EXTRAS=1 -DURHO3D_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration}" or abort 'Failed to configure Urho3D library build'
   if ENV['ANDROID']
   if ENV['ANDROID']
     if ENV['AVD'] && !ENV['PACKAGE_UPLOAD']   # Skip APK test run when packaging
     if ENV['AVD'] && !ENV['PACKAGE_UPLOAD']   # Skip APK test run when packaging
       android_prepare_device ENV['API'], ENV['ABI'], ENV['AVD'] or abort 'Failed to prepare Android (virtual) device for test run'
       android_prepare_device ENV['API'], ENV['ABI'], ENV['AVD'] or abort 'Failed to prepare Android (virtual) device for test run'
     end
     end
-    # LuaJIT on Android build requires tolua++ and buildvm-android tools to be built natively first
-    system "cd Build/ThirdParty/toluapp/src/bin && make -j$NUMJOBS" or abort 'Failed to build tolua++ tool'
-    if !jit.empty?
-      system "cd Build/ThirdParty/Lua#{jit}/generated/buildvm-android-#{ENV['ABI']} && make -j$NUMJOBS" or abort 'Failed to build buildvm-android tool'
-    end
-    # Reconfigure Android build one more time now that we have the tools built
-    ENV['SKIP_NATIVE'] = '1'
-    system './cmake_gcc.sh' or abort 'Failed to reconfigure Urho3D library for Android build'
-    platform_prefix = 'android-'
-  elsif ENV['RPI']
-    # LuaJIT on Raspberry Pi build requires tolua++ and buildvm-raspi tools to be built natively first
-    system "cd Build/ThirdParty/toluapp/src/bin && make -j$NUMJOBS" or abort 'Failed to build tolua++ tool'
-    system "cd Build/ThirdParty/LuaJIT/generated/buildvm-raspi && make -j$NUMJOBS" or abort 'Failed to build buildvm-raspi tool'
-    # Reconfigure Raspberry Pi build one more time now that we have the tools built
-    ENV['SKIP_NATIVE'] = '1'
-    system './cmake_gcc.sh' or abort 'Failed to reconfigure Urho3D library for Raspberry Pi build'
-    platform_prefix = 'raspi-'
-  elsif ENV['WINDOWS']
-    platform_prefix = 'mingw-'
-  else
-    platform_prefix = ''
+#    # LuaJIT on Android build requires tolua++ and buildvm-android tools to be built natively first
+#    system "cd Build/ThirdParty/toluapp/src/bin && make -j$NUMJOBS" or abort 'Failed to build tolua++ tool'
+#    if !jit.empty?
+#      system "cd Build/ThirdParty/Lua#{jit}/generated/buildvm-android-#{ENV['ABI']} && make -j$NUMJOBS" or abort 'Failed to build buildvm-android tool'
+#    end
+#    # Reconfigure Android build one more time now that we have the tools built
+#    system './cmake_generic.sh' or abort 'Failed to reconfigure Urho3D library for Android build'
+#  elsif ENV['RPI']
+#    # LuaJIT on Raspberry Pi build requires tolua++ and buildvm-raspi tools to be built natively first
+#    system "cd Build/ThirdParty/toluapp/src/bin && make -j$NUMJOBS" or abort 'Failed to build tolua++ tool'
+#    system "cd Build/ThirdParty/LuaJIT/generated/buildvm-raspi && make -j$NUMJOBS" or abort 'Failed to build buildvm-raspi tool'
+#    # Reconfigure Raspberry Pi build one more time now that we have the tools built
+#    system './cmake_generic.sh' or abort 'Failed to reconfigure Urho3D library for Raspberry Pi build'
   end
   end
   if $testing == 1
   if $testing == 1
     test = '&& make test'
     test = '&& make test'
   else
   else
     test = ''
     test = ''
   end
   end
-  system "cd #{platform_prefix}Build && make -j$NUMJOBS #{test}" or abort 'Failed to build or test Urho3D library'
+# Temporarily create a symlink to Urho3D asset dir
+system "ASSET_DIR=`pwd`/Bin; cd ../Build/Bin && ln -sf $ASSET_DIR/{CoreData,Data} ." or abort 'Failed to create symlink to Urho3D asset directory'
+  system "cd ../Build && make -j$NUMJOBS #{test}" or abort 'Failed to build or test Urho3D library'
   # Create a new project on the fly that uses newly built 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 #{$build_options} -DURHO3D_LUA#{jit}=1 -DURHO3D_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration} && cd #{platform_prefix}Build && make -j$NUMJOBS #{test}" or abort 'Failed to configure/build/test temporary project using Urho3D as external library' 
+  scaffolding "../Build/generated/UsingSourceAndBuildTrees"
+# Temporarily not using any build options that require native tool building
+#  system "export URHO3D_HOME=`pwd` URHO3D_BUILD_TREE=../.. && cd ../Build/generated/UsingSourceAndBuildTrees && echo '\nExternal project using Urho3D source and build trees' && ./cmake_generic.sh . #{$build_options} -DURHO3D_LUA#{jit}=1 -DURHO3D_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration} && make -j$NUMJOBS #{test}" or abort 'Failed to configure/build/test temporary project using Urho3D as external library' 
+  system "export URHO3D_HOME=`pwd` URHO3D_BUILD_TREE=../.. && cd ../Build/generated/UsingSourceAndBuildTrees && echo '\nExternal project using Urho3D source and build trees' && ./cmake_generic.sh . #{$build_options} -DURHO3D_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration} && make -j$NUMJOBS #{test}" or abort 'Failed to configure/build/test temporary project using Urho3D as external library' 
   # Make, deploy, and test run Android APK in an Android (virtual) device
   # Make, deploy, and test run Android APK in an Android (virtual) device
   if ENV['AVD'] && !ENV['PACKAGE_UPLOAD']
   if ENV['AVD'] && !ENV['PACKAGE_UPLOAD']
-    system "cd #{platform_prefix}Build && android update project -p . -t $( android list target |grep android-$API |cut -d ' ' -f2 ) && ant debug" or abort 'Failed to make Urho3D Samples APK'
+    system "echo '\nTest deploying and running Urho3D Samples APK...' && cd ../Build && android update project -p . -t $( android list target |grep android-$API |cut -d ' ' -f2 ) && ant debug" or abort 'Failed to make Urho3D Samples APK'
     if android_wait_for_device ENV['CI'] ? 1 : 10 # minutes
     if android_wait_for_device ENV['CI'] ? 1 : 10 # minutes
-      system "cd #{platform_prefix}Build && ant -Dadb.device.arg='-s #{$specific_device}' installd" or abort 'Failed to deploy Urho3D Samples APK'
+      system "cd ../Build && ant -Dadb.device.arg='-s #{$specific_device}' installd" or abort 'Failed to deploy Urho3D Samples APK'
       android_test_run or abort 'Failed to test run Urho3D Samples APK'
       android_test_run or abort 'Failed to test run Urho3D Samples APK'
     else
     else
       puts 'Skipped test running Urho3D Samples APK as emulator failed to start in time'
       puts 'Skipped test running Urho3D Samples APK as emulator failed to start in time'
@@ -449,23 +438,24 @@ def xcode_ci
     # IOS platform does not support LuaJIT
     # IOS platform does not support LuaJIT
     jit = ''
     jit = ''
     amalg = ''
     amalg = ''
-    platform_prefix = 'ios-'
     deployment_target = "-DIPHONEOS_DEPLOYMENT_TARGET=#{ENV['DEPLOYMENT_TARGET']}"
     deployment_target = "-DIPHONEOS_DEPLOYMENT_TARGET=#{ENV['DEPLOYMENT_TARGET']}"
-    # Lua on IOS build requires tolua++ tool to be built natively first
-    system "./cmake_macosx.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE #{$build_options} -DURHO3D_LUA=1 -DURHO3D_TOOLS=0" or abort 'Failed to configure native build for tolua++ target'
-    xcode_build(0, 'Build/Urho3D.xcodeproj', 'tolua++') or abort 'Failed to build tolua++ tool'
+#    # Lua on IOS build requires tolua++ tool to be built natively first
+#    system "./cmake_macosx.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE #{$build_options} -DURHO3D_LUA=1 -DURHO3D_TOOLS=0" or abort 'Failed to configure native build for tolua++ target'
+#    xcode_build(0, 'Build/Urho3D.xcodeproj', 'tolua++') or abort 'Failed to build tolua++ tool'
   else
   else
     jit = 'JIT'
     jit = 'JIT'
     amalg = '-DURHO3D_LUAJIT_AMALG=1'
     amalg = '-DURHO3D_LUAJIT_AMALG=1'
-    platform_prefix = ''
     deployment_target = "-DCMAKE_OSX_DEPLOYMENT_TARGET=#{ENV['DEPLOYMENT_TARGET']}"
     deployment_target = "-DCMAKE_OSX_DEPLOYMENT_TARGET=#{ENV['DEPLOYMENT_TARGET']}"
   end
   end
-  system "./cmake_macosx.sh -DIOS=$IOS #{deployment_target} -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE #{$build_options} -DURHO3D_LUA#{jit}=1 #{amalg} -DURHO3D_SAMPLES=1 -DURHO3D_TOOLS=1 -DURHO3D_EXTRAS=1 -DURHO3D_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'
+# Temporarily not using any build options that require native tool building
+#  system "./cmake_macosx.sh ../Build -DIOS=$IOS #{deployment_target} -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE #{$build_options} -DURHO3D_LUA#{jit}=1 #{amalg} -DURHO3D_SAMPLES=1 -DURHO3D_TOOLS=1 -DURHO3D_EXTRAS=1 -DURHO3D_TESTING=#{$testing}" or abort 'Failed to configure Urho3D library build'
+  system "./cmake_macosx.sh ../Build -DIOS=$IOS #{deployment_target} -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE #{$build_options} -DURHO3D_SAMPLES=1 -DURHO3D_TOOLS=1 -DURHO3D_EXTRAS=1 -DURHO3D_TESTING=#{$testing}" or abort 'Failed to configure Urho3D library build'
+  xcode_build(ENV['IOS'], "../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
   # 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 #{deployment_target} #{$build_options} -DURHO3D_LUA#{jit}=1 -DURHO3D_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'
+  scaffolding "../Build/generated/UsingSourceAndBuildTrees"
+#  system "export URHO3D_HOME=`pwd` URHO3D_BUILD_TREE=../.. && cd ../Build/generated/UsingSourceAndBuildTrees && echo '\nExternal project using Urho3D source and build trees' && ./cmake_macosx.sh . -DIOS=$IOS #{deployment_target} #{$build_options} -DURHO3D_LUA#{jit}=1 -DURHO3D_TESTING=#{$testing}" or abort 'Failed to configure temporary project using Urho3D as external library'
+  system "export URHO3D_HOME=`pwd` URHO3D_BUILD_TREE=../.. && cd ../Build/generated/UsingSourceAndBuildTrees && echo '\nExternal project using Urho3D source and build trees' && ./cmake_macosx.sh . -DIOS=$IOS #{deployment_target} #{$build_options} -DURHO3D_TESTING=#{$testing}" or abort 'Failed to configure temporary project using Urho3D as external library'
+  xcode_build(ENV['IOS'], "../Build/generated/UsingSourceAndBuildTrees/Scaffolding.xcodeproj") or abort 'Failed to configure/build/test temporary project using Urho3D as external library'
 end
 end
 
 
 def xcode_build(ios, project, target = 'ALL_BUILD', extras = '')
 def xcode_build(ios, project, target = 'ALL_BUILD', extras = '')

+ 0 - 110
Source/CMakeLists.txt

@@ -20,29 +20,6 @@
 # THE SOFTWARE.
 # THE SOFTWARE.
 #
 #
 
 
-# Set project name
-project (Urho3D)
-
-# Set minimum version
-cmake_minimum_required (VERSION 2.8.6)
-
-if (COMMAND cmake_policy)
-    cmake_policy (SET CMP0003 NEW)
-    if (CMAKE_VERSION VERSION_GREATER 2.8.12 OR CMAKE_VERSION VERSION_EQUAL 2.8.12)
-        cmake_policy (SET CMP0022 NEW) # INTERFACE_LINK_LIBRARIES defines the link interface
-    endif ()
-    if (CMAKE_VERSION VERSION_GREATER 3.0.0 OR CMAKE_VERSION VERSION_EQUAL 3.0.0)
-        cmake_policy (SET CMP0026 OLD) # Disallow use of the LOCATION target property - therefore we set to OLD as we still need it
-        cmake_policy (SET CMP0042 NEW) # MACOSX_RPATH is enabled by default
-    endif ()
-endif ()
-
-# Set CMake modules search path
-set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
-
-# Include Urho3D cmake common module
-include (Urho3D-CMake-common)
-
 # Check existence of stdint.h for LibCpuId
 # Check existence of stdint.h for LibCpuId
 include (CheckIncludeFiles)
 include (CheckIncludeFiles)
 CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H)
 CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H)
@@ -50,90 +27,6 @@ if (HAVE_STDINT_H)
     add_definitions (-DHAVE_STDINT_H)
     add_definitions (-DHAVE_STDINT_H)
 endif ()
 endif ()
 
 
-# Setup SDK install destinations
-if (CMAKE_HOST_WIN32)
-    # CMake already automatically appends "Urho3D" to CMAKE_INSTALL_PREFIX on Windows platform
-    set (SCRIPT_PATTERN *.bat)
-else ()
-    set (PATH_SUFFIX /Urho3D)
-    if (URHO3D_64BIT)
-        if (NOT CMAKE_CROSSCOMPILING AND EXISTS /usr/lib64)
-            # Probably target system is a RedHat-based distro
-            set (LIB_SUFFIX 64)
-        endif ()
-    endif ()
-    if (IOS)
-        # Use 'ios' arch subdirectory to differentiate, in case both Mac OS X and iOS build are installed at the same destination
-        set (LIB_SUFFIX ${LIB_SUFFIX}/ios)
-    endif ()
-    set (SCRIPT_PATTERN *.sh)
-endif ()
-set (DEST_INCLUDE_DIR include${PATH_SUFFIX})
-set (DEST_SHARE_DIR share${PATH_SUFFIX})
-set (DEST_RUNTIME_DIR ${DEST_SHARE_DIR}/Bin)
-# Note: ${PATH_SUFFIX} for library could be removed if the extra path is not desirable, but if so then the RPATH setting below needs to be adjusted accordingly
-set (DEST_LIBRARY_DIR lib${LIB_SUFFIX}${PATH_SUFFIX})
-set (SYSROOT ${ANDROID_TOOLCHAIN_ROOT} ${RASPI_SYSROOT} ${MINGW_SYSROOT})       # SYSROOT is empty for native build
-string (REPLACE "${SYSROOT}" "" DEST_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})    # Our CMAKE_INSTALL_PREFIX is rooted, use DEST_INSTALL_PREFIX for the non-rooted version
-set (DEST_PKGCONFIG_DIR lib${LIB_SUFFIX}/pkgconfig)
-set (DEST_PERMISSIONS FILE_PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
-# Install application launcher scripts
-file (GLOB APP_SCRIPTS ${PROJECT_ROOT_DIR}/Bin/${SCRIPT_PATTERN})
-install (FILES ${APP_SCRIPTS} DESTINATION ${DEST_RUNTIME_DIR} PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)   # 755
-# Install resource directories required by applications built with Urho3D library
-install (DIRECTORY ${PROJECT_ROOT_DIR}/Bin/CoreData ${PROJECT_ROOT_DIR}/Bin/Data DESTINATION ${DEST_RUNTIME_DIR} ${DEST_PERMISSIONS})
-# Install CMake modules and toolchains provided by and for Urho3D
-install (DIRECTORY ${PROJECT_ROOT_DIR}/CMake/ DESTINATION ${DEST_SHARE_DIR}/CMake ${DEST_PERMISSIONS})    # Note: the trailing slash is significant
-# Install CMake launcher scripts
-file (GLOB CMAKE_SCRIPTS ${PROJECT_ROOT_DIR}/${SCRIPT_PATTERN})
-install (FILES ${CMAKE_SCRIPTS} DESTINATION ${DEST_SHARE_DIR}/Scripts PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
-
-# Setup package variables
-set (URHO3D_DESCRIPTION "Urho3D is a free lightweight, cross-platform 2D and 3D game engine implemented in C++ and released under the MIT license. Greatly inspired by OGRE (http://www.ogre3d.org) and Horde3D (http://www.horde3d.org).")
-set (CPACK_PACKAGE_DESCRIPTION_SUMMARY ${URHO3D_DESCRIPTION})
-set (URHO3D_URL "https://github.com/urho3d/Urho3D")
-set (CPACK_PACKAGE_VENDOR ${URHO3D_URL})
-set (CPACK_PACKAGE_CONTACT ${URHO3D_URL})
-execute_process (COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/CMake/Modules/GetUrho3DRevision.cmake OUTPUT_VARIABLE URHO3D_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
-set (CPACK_PACKAGE_VERSION ${URHO3D_VERSION})
-string (REGEX MATCH "([^.]+)\\.([^.]+)\\.(.+)" MATCHED ${URHO3D_VERSION})
-if (MATCHED)
-    set (CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1})
-    set (CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
-    set (CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3})
-endif ()
-set (CPACK_RESOURCE_FILE_LICENSE ${PROJECT_ROOT_DIR}/License.txt)
-set (CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
-set (CPACK_GENERATOR TGZ)
-if (ANDROID)
-    set (CPACK_SYSTEM_NAME Android)
-elseif (IOS)
-    set (CPACK_SYSTEM_NAME iOS)
-elseif (APPLE)
-    set (CPACK_SYSTEM_NAME OSX)
-elseif (WIN32)
-    set (CPACK_GENERATOR ZIP)
-elseif (CPACK_SYSTEM_NAME STREQUAL Linux)
-    if (RASPI)
-        set (CPACK_SYSTEM_NAME Raspberry-Pi)
-    endif ()
-    list (APPEND CPACK_GENERATOR RPM DEB)
-    set (CPACK_PACKAGING_INSTALL_PREFIX ${DEST_INSTALL_PREFIX})
-endif ()
-if (URHO3D_64BIT)
-    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-64bit)
-endif ()
-set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-${URHO3D_LIB_TYPE})
-if (WIN32 AND NOT URHO3D_OPENGL)
-    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-D3D)    # Stands for Direct 3D
-elseif (ANDROID AND X86)    # Take advantage of Android toolchain setting X86 variable to true for both 'x86' and 'x86_64' ABIs
-    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-IA)     # Stands for Intel Architecture
-endif ()
-if (NOT DEFINED ENV{RELEASE_TAG})
-    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-snapshot)
-endif ()
-include (CPack)
-
 # Setup RPATH settings
 # Setup RPATH settings
 if (NOT WIN32 AND NOT ANDROID)
 if (NOT WIN32 AND NOT ANDROID)
     # Add RPATH entries when building
     # Add RPATH entries when building
@@ -217,6 +110,3 @@ endif ()
 if (NOT IOS AND NOT ANDROID AND URHO3D_EXTRAS)
 if (NOT IOS AND NOT ANDROID AND URHO3D_EXTRAS)
     add_subdirectory (Extras)
     add_subdirectory (Extras)
 endif ()
 endif ()
-
-# Urho3D documentation
-add_subdirectory (../Docs ${PROJECT_BINARY_DIR}/Docs)

+ 6 - 3
Source/Engine/CMakeLists.txt

@@ -107,7 +107,7 @@ list (APPEND INCLUDE_DIRS_ONLY ${CMAKE_CURRENT_BINARY_DIR} ../ThirdParty/SDL/inc
 if (ANDROID)
 if (ANDROID)
     set (OUTPUT_PATH ${ANDROID_LIBRARY_OUTPUT_PATH})
     set (OUTPUT_PATH ${ANDROID_LIBRARY_OUTPUT_PATH})
 else ()
 else ()
-    set (OUTPUT_PATH ${PROJECT_ROOT_DIR}/${PLATFORM_PREFIX}Lib)     # ${PLATFORM_PREFIX} is empty for native build
+    set (OUTPUT_PATH ${CMAKE_BINARY_DIR}/Lib)
 endif ()
 endif ()
 set_output_directories (${OUTPUT_PATH} ARCHIVE LIBRARY)
 set_output_directories (${OUTPUT_PATH} ARCHIVE LIBRARY)
  
  
@@ -251,7 +251,10 @@ if (NOT IOS)
     endif ()
     endif ()
     string (REPLACE ";" "\" ${DASH}I\"\${includedir}/" ENGINE_INCLUDE_DIRS "${DASH}I\"\${includedir};${INSTALL_INCLUDE_DIRS}\"")
     string (REPLACE ";" "\" ${DASH}I\"\${includedir}/" ENGINE_INCLUDE_DIRS "${DASH}I\"\${includedir};${INSTALL_INCLUDE_DIRS}\"")
     configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Urho3D.pc.in ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.pc @ONLY)
     configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Urho3D.pc.in ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.pc @ONLY)
-    install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.pc DESTINATION ${DEST_PKGCONFIG_DIR})
+    if (ANDROID)
+        set (RENAME RENAME Urho3D-${ANDROID_NDK_ABI_NAME}.pc)
+    endif ()
+    install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.pc DESTINATION ${DEST_PKGCONFIG_DIR} ${RENAME})
 endif ()
 endif ()
 
 
 # Setup the compiler flags for building shared library (do this here so that it does not interfere with the pkg-config file generation above)
 # Setup the compiler flags for building shared library (do this here so that it does not interfere with the pkg-config file generation above)
@@ -260,7 +263,7 @@ if (URHO3D_LIB_TYPE STREQUAL SHARED)
     add_compiler_export_flags ()
     add_compiler_export_flags ()
     # Use PIC on platforms that support it (shared library type has this property set to true by default, so we only have to deal with those static ones that the shared library links against)
     # Use PIC on platforms that support it (shared library type has this property set to true by default, so we only have to deal with those static ones that the shared library links against)
     set_target_properties (${STATIC_LIBRARY_TARGETS} PROPERTIES POSITION_INDEPENDENT_CODE true)
     set_target_properties (${STATIC_LIBRARY_TARGETS} PROPERTIES POSITION_INDEPENDENT_CODE true)
-    if (NOT MSVC AND NOT (CMAKE_CROSSCOMPILING AND MINGW) AND CMAKE_VERSION VERSION_LESS 2.8.9)  # \todo Remove this when CMake minimum version is 2.8.9
+    if (NOT MSVC AND NOT (CMAKE_CROSSCOMPILING AND MINGW) AND CMAKE_VERSION VERSION_LESS 2.8.9)  # todo: Remove this when CMake minimum version is 2.8.9
         set_property (TARGET ${STATIC_LIBRARY_TARGETS} APPEND PROPERTY COMPILE_FLAGS -fPIC)
         set_property (TARGET ${STATIC_LIBRARY_TARGETS} APPEND PROPERTY COMPILE_FLAGS -fPIC)
     endif ()
     endif ()
 endif ()
 endif ()

+ 2 - 2
Source/Engine/LuaScript/CMakeLists.txt

@@ -30,7 +30,7 @@ endif ()
 
 
 # The host tool must be built natively and would be used when cross-compiling
 # The host tool must be built natively and would be used when cross-compiling
 if (CMAKE_CROSSCOMPILING OR IOS)
 if (CMAKE_CROSSCOMPILING OR IOS)
-    execute_process (COMMAND ${PROJECT_ROOT_DIR}/Bin/tolua++ -v RESULT_VARIABLE TOLUA_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
+    execute_process (COMMAND ${CMAKE_BINARY_DIR}/Bin/tool/tolua++ -v RESULT_VARIABLE TOLUA_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
     if (NOT TOLUA_EXIT_CODE EQUAL 0)
     if (NOT TOLUA_EXIT_CODE EQUAL 0)
         message (WARNING "For cross-compiling build to be successful, the 'tolua++' tool must be built natively first and present in the 'Bin' folder." )
         message (WARNING "For cross-compiling build to be successful, the 'tolua++' tool must be built natively first and present in the 'Bin' folder." )
     endif ()
     endif ()
@@ -70,7 +70,7 @@ foreach (API_PKG_FILE ${API_PKG_FILES})
     set (GEN_CPP_FILES ${GEN_CPP_FILES} ${GEN_CPP_FILE})
     set (GEN_CPP_FILES ${GEN_CPP_FILES} ${GEN_CPP_FILE})
     file (GLOB PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/${API}/*.pkg)
     file (GLOB PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/${API}/*.pkg)
     add_custom_command (OUTPUT ${GEN_CPP_FILE} 
     add_custom_command (OUTPUT ${GEN_CPP_FILE} 
-        COMMAND ${PROJECT_ROOT_DIR}/Bin/tolua++ -L ToCppHook.lua -o ${CMAKE_CURRENT_BINARY_DIR}/${GEN_CPP_FILE} ${NAME}
+        COMMAND ${CMAKE_BINARY_DIR}/Bin/tool/tolua++ -L ToCppHook.lua -o ${CMAKE_CURRENT_BINARY_DIR}/${GEN_CPP_FILE} ${NAME}
         DEPENDS ${TOLUADEP} ${API_PKG_FILE} ${PKG_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/ToCppHook.lua
         DEPENDS ${TOLUADEP} ${API_PKG_FILE} ${PKG_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/ToCppHook.lua
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pkgs
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pkgs
         COMMENT "Generating tolua++ API binding on the fly for ${API}")
         COMMENT "Generating tolua++ API binding on the fly for ${API}")

+ 2 - 3
Source/ThirdParty/Lua/CMakeLists.txt

@@ -32,9 +32,8 @@ 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 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
-if (NOT IOS AND URHO3D_TOOLS)
+# Setup additional Lua standalone targets (these targets can be transfered and executed on an embedded device, such as Raspberry Pi and Android)
+if (NOT IOS)
     # Define target name for Lua interpreter
     # Define target name for Lua interpreter
     set (TARGET_NAME lua_interpreter)   # Note: intended target name is 'lua' which clashes with 'Lua' library target above for case-insensitive platform
     set (TARGET_NAME lua_interpreter)   # Note: intended target name is 'lua' which clashes with 'Lua' library target above for case-insensitive platform
 
 

+ 7 - 8
Source/ThirdParty/LuaJIT/CMakeLists.txt

@@ -163,9 +163,9 @@ if (CMAKE_CROSSCOMPILING OR IOS)
     else ()
     else ()
         message (FATAL_ERROR "Unsupported cross-compiling target") 
         message (FATAL_ERROR "Unsupported cross-compiling target") 
     endif ()
     endif ()
-    execute_process (COMMAND ${PROJECT_ROOT_DIR}/Bin/${BUILDVM_X} RESULT_VARIABLE BUILDVM_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
+    execute_process (COMMAND ${CMAKE_BINARY_DIR}/Bin/tool/${BUILDVM_X} RESULT_VARIABLE BUILDVM_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
     if (NOT BUILDVM_EXIT_CODE EQUAL 1)
     if (NOT BUILDVM_EXIT_CODE EQUAL 1)
-        file (WRITE ${PROJECT_ROOT_DIR}/Bin/${BUILDVM_X}-arch.txt ${TARGET_TESTARCH})
+        file (WRITE ${CMAKE_BINARY_DIR}/Bin/tool/${BUILDVM_X}-arch.txt ${TARGET_TESTARCH})
         message (FATAL_ERROR
         message (FATAL_ERROR
             "The configuration cannot be done now because the target-specific '${BUILDVM_X}' tool has not been built yet. "
             "The configuration cannot be done now because the target-specific '${BUILDVM_X}' tool has not been built yet. "
             "However, the specific target architecture information is now saved. "
             "However, the specific target architecture information is now saved. "
@@ -188,7 +188,7 @@ else ()
     set (BUILDVM_X buildvm)
     set (BUILDVM_X buildvm)
     
     
     # Also build variants for the supported target architectures
     # Also build variants for the supported target architectures
-    file (GLOB VARIANT_ARCHS ${PROJECT_ROOT_DIR}/Bin/buildvm-*-arch.txt)
+    file (GLOB VARIANT_ARCHS ${CMAKE_BINARY_DIR}/Bin/tool/buildvm-*-arch.txt)
     foreach (VARIANT_ARCH ${VARIANT_ARCHS})
     foreach (VARIANT_ARCH ${VARIANT_ARCHS})
         string (REGEX REPLACE "^.*buildvm(-.*)-arch\\.txt$" \\1 VARIANT ${VARIANT_ARCH})
         string (REGEX REPLACE "^.*buildvm(-.*)-arch\\.txt$" \\1 VARIANT ${VARIANT_ARCH})
         file (READ ${VARIANT_ARCH} TARGET_TESTARCH)
         file (READ ${VARIANT_ARCH} TARGET_TESTARCH)
@@ -213,7 +213,7 @@ macro (generate_source name mode)
     set (GEN_SRC ${CMAKE_CURRENT_BINARY_DIR}/generated/${name})
     set (GEN_SRC ${CMAKE_CURRENT_BINARY_DIR}/generated/${name})
     set (GEN_SRCS ${GEN_SRCS} ${GEN_SRC})
     set (GEN_SRCS ${GEN_SRCS} ${GEN_SRC})
     add_custom_command (OUTPUT ${GEN_SRC}
     add_custom_command (OUTPUT ${GEN_SRC}
-        COMMAND ${PROJECT_ROOT_DIR}/Bin/${BUILDVM_X} -m ${mode} -o ${GEN_SRC} ${ARGN}
+        COMMAND ${CMAKE_BINARY_DIR}/Bin/tool/${BUILDVM_X} -m ${mode} -o ${GEN_SRC} ${ARGN}
         DEPENDS ${BUILDVM_DEP} ${ARGN}
         DEPENDS ${BUILDVM_DEP} ${ARGN}
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
         COMMENT "Generating buildvm output: ${name}")
         COMMENT "Generating buildvm output: ${name}")
@@ -274,9 +274,8 @@ 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 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
-if (NOT IOS AND URHO3D_TOOLS)
+# Setup additional Lua standalone target (this target can be transfered and executed on an embedded device, such as Raspberry Pi and Android)
+if (NOT IOS)
     # Define target name for LuaJIT interpreter cum compiler
     # Define target name for LuaJIT interpreter cum compiler
     set (TARGET_NAME luajit_interpreter)   # Note: intended target name is 'luajit' which clashes with 'LuaJIT' library target above for case-insensitive platform
     set (TARGET_NAME luajit_interpreter)   # Note: intended target name is 'luajit' which clashes with 'LuaJIT' library target above for case-insensitive platform
 
 
@@ -291,7 +290,7 @@ if (NOT IOS AND URHO3D_TOOLS)
     adjust_target_name ()   # Adjust to intended target output name
     adjust_target_name ()   # Adjust to intended target output name
 
 
     # Define post build steps
     # Define post build steps
-    set (LUAJIT_DEP_DIR ${PROJECT_ROOT_DIR}/Bin/Data/LuaScripts/jit)
+    set (LUAJIT_DEP_DIR ${CMAKE_BINARY_DIR}/Bin/Data/LuaScripts/jit)
     add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
     add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
         COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src/jit ${LUAJIT_DEP_DIR}
         COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src/jit ${LUAJIT_DEP_DIR}
         COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/generated/vmdef.lua ${LUAJIT_DEP_DIR}
         COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/generated/vmdef.lua ${LUAJIT_DEP_DIR}

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

@@ -34,7 +34,7 @@ set (GEN_ARCH_H ${CMAKE_CURRENT_BINARY_DIR}/buildvm_arch.h)
 set (DASM ${DASM_DIR}/dynasm.lua)
 set (DASM ${DASM_DIR}/dynasm.lua)
 file (GLOB DASM_LUA ${DASM_DIR}/*.lua)
 file (GLOB DASM_LUA ${DASM_DIR}/*.lua)
 add_custom_command (OUTPUT ${GEN_ARCH_H}
 add_custom_command (OUTPUT ${GEN_ARCH_H}
-    COMMAND ${PROJECT_ROOT_DIR}/Bin/minilua ${DASM} ${DASM_FLAGS} -o ${GEN_ARCH_H} ${DASM_DASC}
+    COMMAND ${CMAKE_BINARY_DIR}/Bin/tool/minilua ${DASM} ${DASM_FLAGS} -o ${GEN_ARCH_H} ${DASM_DASC}
     DEPENDS minilua ${DASM_LUA} ${DASM_DASC}
     DEPENDS minilua ${DASM_LUA} ${DASM_DASC}
     WORKING_DIRECTORY ${DASM_DIR}
     WORKING_DIRECTORY ${DASM_DIR}
     COMMENT "Generating buildvm arch header file")
     COMMENT "Generating buildvm arch header file")

+ 1 - 1
Source/ThirdParty/LuaJIT/DetectTargetArchitecture.cmake

@@ -119,7 +119,7 @@ endif ()
 if (VARIANT)
 if (VARIANT)
     if (MSVC)
     if (MSVC)
         message (FATAL_ERROR "MSVC is not able to build 'buildvm${VARIANT}' target at this moment, please use GCC or LLVM/Clang instead. "
         message (FATAL_ERROR "MSVC is not able to build 'buildvm${VARIANT}' target at this moment, please use GCC or LLVM/Clang instead. "
-            "To recover from this error, remove this file (generated by Android build script when LuaJIT is enabled) in ${PROJECT_ROOT_DIR}/Bin/buildvm${VARIANT}-arch.txt.")
+            "To recover from this error, remove this file (generated by Android build script when LuaJIT is enabled) in ${CMAKE_BINARY_DIR}/Bin/tool/buildvm${VARIANT}-arch.txt.")
     else ()
     else ()
         string (REGEX REPLACE "-m(32|64) *" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
         string (REGEX REPLACE "-m(32|64) *" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m${ARCH_BITS}")
         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m${ARCH_BITS}")

+ 3 - 1
Source/Tools/CMakeLists.txt

@@ -27,11 +27,13 @@ project (Urho3D-Tools)
 find_package (Urho3D REQUIRED)
 find_package (Urho3D REQUIRED)
 include_directories (${URHO3D_INCLUDE_DIRS})
 include_directories (${URHO3D_INCLUDE_DIRS})
 
 
-# Urho3DPlayer application
+# Urho3DPlayer target is rather special, although it is here, it is not a tool because it builds into platform-specific binary
 add_subdirectory (Urho3DPlayer)
 add_subdirectory (Urho3DPlayer)
 
 
 # Do not build tools for iOS and Android regardless of the URHO3D_TOOLS build option
 # Do not build tools for iOS and Android regardless of the URHO3D_TOOLS build option
 if (NOT IOS AND NOT ANDROID AND URHO3D_TOOLS)
 if (NOT IOS AND NOT ANDROID AND URHO3D_TOOLS)
+    # All tools must be natively built and output to Bin/tool subdir to differentiate them from platform-specific binaries in the Bin directory
+    set_output_directories (${CMAKE_BINARY_DIR}/Bin/tool RUNTIME PDB)
     # Urho3D tools
     # Urho3D tools
     add_subdirectory (AssetImporter)
     add_subdirectory (AssetImporter)
     add_subdirectory (OgreImporter)
     add_subdirectory (OgreImporter)

+ 7 - 3
cmake_generic.sh

@@ -24,6 +24,8 @@
 # Determine source tree and build tree
 # Determine source tree and build tree
 if [ $1 ] && [[ ! $1 =~ ^- ]]; then BUILD=$1; shift; elif [ -f $(pwd)/CMakeCache.txt ]; then BUILD=$(pwd); else echo An error has occured, build tree has to be provided as the first argument OR call this script in a build tree itself; exit 1; fi
 if [ $1 ] && [[ ! $1 =~ ^- ]]; then BUILD=$1; shift; elif [ -f $(pwd)/CMakeCache.txt ]; then BUILD=$(pwd); else echo An error has occured, build tree has to be provided as the first argument OR call this script in a build tree itself; exit 1; fi
 SOURCE=$(dirname $0)
 SOURCE=$(dirname $0)
+if [ "$SOURCE" == "." ]; then SOURCE=$(pwd); fi
+if [ "$BUILD" == "." ]; then BUILD=$(pwd); fi
 
 
 # Define helpers
 # Define helpers
 . $SOURCE/.bash_helpers.sh
 . $SOURCE/.bash_helpers.sh
@@ -34,13 +36,14 @@ SOURCE=$(dirname $0)
 [ ! -d $TOOLCHAINS -a -d $CMAKE_PREFIX_PATH/share/Urho3D/CMake/Toolchains ] && TOOLCHAINS=$CMAKE_PREFIX_PATH/share/Urho3D/CMake/Toolchains
 [ ! -d $TOOLCHAINS -a -d $CMAKE_PREFIX_PATH/share/Urho3D/CMake/Toolchains ] && TOOLCHAINS=$CMAKE_PREFIX_PATH/share/Urho3D/CMake/Toolchains
 
 
 # Default to native generator and toolchain if none is specified explicitly
 # Default to native generator and toolchain if none is specified explicitly
+IFS=#
 OPTS=
 OPTS=
 for a in $@; do
 for a in $@; do
     case $a in
     case $a in
         --fix-scm)
         --fix-scm)
             FIX_SCM=1
             FIX_SCM=1
             ;;
             ;;
-        Eclipse CDT4 - Unix Makefiles)
+        Eclipse\ CDT4\ -\ Unix\ Makefiles)
             ECLIPSE=1 && if xmlstarlet --version >/dev/null 2>&1; then HAS_XMLSTARLET=1; fi
             ECLIPSE=1 && if xmlstarlet --version >/dev/null 2>&1; then HAS_XMLSTARLET=1; fi
             ;;
             ;;
         -DIOS=1)
         -DIOS=1)
@@ -49,8 +52,8 @@ for a in $@; do
         -DANDROID=1)
         -DANDROID=1)
             ANDROID=1 && OPTS="-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAINS/android.toolchain.cmake"
             ANDROID=1 && OPTS="-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAINS/android.toolchain.cmake"
             ;;
             ;;
-        -DRASPI=1)
-            RASPI=1 && if [[ ! $(uname -m) =~ ^armv6 ]]; then OPTS="-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAINS/raspberrypi.toolchain.cmake"; fi
+        -DRPI=1)
+            RPI=1 && if [[ ! $(uname -m) =~ ^armv6 ]]; then OPTS="-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAINS/raspberrypi.toolchain.cmake"; fi
             ;;
             ;;
         -DWIN32=1)
         -DWIN32=1)
             WINDOWS=1 && OPTS="-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAINS/mingw.toolchain.cmake"
             WINDOWS=1 && OPTS="-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAINS/mingw.toolchain.cmake"
@@ -60,5 +63,6 @@ done
 
 
 # Create project with the chosen CMake generator and toolchain
 # Create project with the chosen CMake generator and toolchain
 cmake -E make_directory $BUILD && cmake -E chdir $BUILD cmake $OPTS $@ $SOURCE && post_cmake
 cmake -E make_directory $BUILD && cmake -E chdir $BUILD cmake $OPTS $@ $SOURCE && post_cmake
+unset IFS
 
 
 # vi: set ts=4 sw=4 expandtab:
 # vi: set ts=4 sw=4 expandtab: