Browse Source

Merge branch 'master' of https://github.com/urho3d/Urho3D

gleb 9 years ago
parent
commit
5cd12a6e6b
37 changed files with 4931 additions and 4918 deletions
  1. 1875 1875
      CMake/Modules/Urho3D-CMake-common.cmake
  2. 1 1
      CMakeLists.txt
  3. 1 1
      Docs/Reference.dox
  4. 21 0
      LICENSE
  5. 1 1
      README.md
  6. 2 2
      Rakefile
  7. 136 136
      Source/CMakeLists.txt
  8. 31 31
      Source/Extras/CMakeLists.txt
  9. 30 30
      Source/Extras/OgreBatchConverter/CMakeLists.txt
  10. 55 55
      Source/Samples/CMakeLists.txt
  11. 750 750
      Source/ThirdParty/Assimp/CMakeLists.txt
  12. 55 55
      Source/ThirdParty/Bullet/CMakeLists.txt
  13. 55 55
      Source/ThirdParty/Civetweb/CMakeLists.txt
  14. 84 84
      Source/ThirdParty/FreeType/CMakeLists.txt
  15. 33 33
      Source/ThirdParty/JO/CMakeLists.txt
  16. 657 681
      Source/ThirdParty/LICENSES
  17. 75 75
      Source/ThirdParty/Lua/CMakeLists.txt
  18. 37 37
      Source/ThirdParty/MojoShader/CMakeLists.txt
  19. 33 33
      Source/ThirdParty/PugiXml/CMakeLists.txt
  20. 33 33
      Source/ThirdParty/StanHull/CMakeLists.txt
  21. 70 70
      Source/ThirdParty/kNet/CMakeLists.txt
  22. 35 35
      Source/Tools/AssetImporter/CMakeLists.txt
  23. 30 30
      Source/Tools/OgreImporter/CMakeLists.txt
  24. 125 125
      Source/Tools/PackageTool/CMakeLists.txt
  25. 37 37
      Source/Tools/RampGenerator/CMakeLists.txt
  26. 30 30
      Source/Tools/ScriptCompiler/CMakeLists.txt
  27. 30 30
      Source/Tools/SpritePacker/CMakeLists.txt
  28. 49 49
      Source/Tools/Urho3DPlayer/CMakeLists.txt
  29. 535 535
      Source/Urho3D/CMakeLists.txt
  30. 7 2
      Source/Urho3D/Graphics/AnimationController.cpp
  31. 2 1
      Source/Urho3D/Graphics/IndexBuffer.cpp
  32. 2 0
      Source/Urho3D/Graphics/IndexBuffer.h
  33. 3 2
      Source/Urho3D/Graphics/OpenGL/OGLIndexBuffer.cpp
  34. 4 1
      Source/Urho3D/Graphics/OpenGL/OGLTexture.cpp
  35. 3 2
      Source/Urho3D/Graphics/OpenGL/OGLVertexBuffer.cpp
  36. 2 1
      Source/Urho3D/Graphics/VertexBuffer.cpp
  37. 2 0
      Source/Urho3D/Graphics/VertexBuffer.h

+ 1875 - 1875
CMake/Modules/Urho3D-CMake-common.cmake

@@ -1,1875 +1,1875 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Limit the supported build configurations
-set (URHO3D_BUILD_CONFIGURATIONS Release RelWithDebInfo Debug)
-set (DOC_STRING "Specify CMake build configuration (single-configuration generator only), possible values are Release (default), RelWithDebInfo, and Debug")
-if (CMAKE_CONFIGURATION_TYPES)
-    # For multi-configurations generator, such as VS and Xcode
-    set (CMAKE_CONFIGURATION_TYPES ${URHO3D_BUILD_CONFIGURATIONS} CACHE STRING ${DOC_STRING} FORCE)
-    unset (CMAKE_BUILD_TYPE)
-else ()
-    # For single-configuration generator, such as Unix Makefile generator
-    if (CMAKE_BUILD_TYPE STREQUAL "")
-        # If not specified then default to Release
-        set (CMAKE_BUILD_TYPE Release)
-    endif ()
-    set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING ${DOC_STRING} FORCE)
-endif ()
-
-# Define other useful variables not defined by CMake
-if (CMAKE_GENERATOR STREQUAL Xcode)
-    set (XCODE TRUE)
-elseif (CMAKE_GENERATOR STREQUAL Ninja)
-    set (NINJA TRUE)
-elseif (CMAKE_GENERATOR MATCHES Visual)
-    set (VS TRUE)
-endif ()
-
-# Rightfully we could have performed this inside a CMake/iOS toolchain file but we don't have one nor need for one for now
-if (IOS)
-    set (CMAKE_CROSSCOMPILING TRUE)
-    set (CMAKE_XCODE_EFFECTIVE_PLATFORMS -iphoneos -iphonesimulator)
-    set (CMAKE_OSX_SYSROOT iphoneos)    # Set Base SDK to "Latest iOS"
-    # This is a CMake hack in order to make standard CMake check modules that use try_compile() internally work on iOS platform
-    # The injected "flags" are not compiler flags, they are actually CMake variables meant for another CMake subprocess that builds the source file being passed in the try_compile() command
-    # CAVEAT: these injected "flags" must always be kept at the end of the string variable, i.e. when adding more compiler flags later on then those new flags must be prepended in front of these flags instead
-    set (CMAKE_REQUIRED_FLAGS ";-DSmileyHack=byYaoWT;-DCMAKE_MACOSX_BUNDLE=1;-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=0")
-    if (NOT IOS_SYSROOT)
-        execute_process (COMMAND xcodebuild -version -sdk ${CMAKE_OSX_SYSROOT} Path OUTPUT_VARIABLE IOS_SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE)   # Obtain iOS sysroot path
-        set (IOS_SYSROOT ${IOS_SYSROOT} CACHE INTERNAL "Path to iOS system root")
-    endif ()
-    set (CMAKE_FIND_ROOT_PATH ${IOS_SYSROOT})
-    if (IPHONEOS_DEPLOYMENT_TARGET)
-        set (CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${IPHONEOS_DEPLOYMENT_TARGET})
-    endif ()
-    set (CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
-    # Workaround what appears to be a bug in CMake/Xcode generator, ensure the CMAKE_OSX_DEPLOYMENT_TARGET is set to empty for iOS build
-    set (CMAKE_OSX_DEPLOYMENT_TARGET)
-    unset (CMAKE_OSX_DEPLOYMENT_TARGET CACHE)
-elseif (XCODE)
-    set (CMAKE_OSX_SYSROOT macosx)    # Set Base SDK to "Latest OS X"
-    if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
-        # If not set, set to current running build system OS version by default
-        execute_process (COMMAND sw_vers -productVersion OUTPUT_VARIABLE CURRENT_OSX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
-        string (REGEX REPLACE ^\([^.]+\\.[^.]+\).* \\1 CMAKE_OSX_DEPLOYMENT_TARGET ${CURRENT_OSX_VERSION})
-        set (CMAKE_OSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET} CACHE INTERNAL "OSX deployment target")
-    endif ()
-endif ()
-
-include (CheckHost)
-include (CheckCompilerToolchain)
-
-# Extra linker flags for linking against indirect dependencies (linking shared lib with dependencies)
-if (RPI)
-    # Extra linker flags for Raspbian because it installs VideoCore libraries in the "/opt/vc/lib" directory (no harm in doing so for other distros)
-    set (INDIRECT_DEPS_EXE_LINKER_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} -Wl,-rpath-link,\"${RPI_SYSROOT}/opt/vc/lib\"")      # RPI_SYSROOT is empty when not cross-compiling
-endif ()
-if (ARM AND CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_CROSSCOMPILING)
-    # Cannot do this in the toolchain file because CMAKE_LIBRARY_ARCHITECTURE is not yet defined when CMake is processing toolchain file
-    set (INDIRECT_DEPS_EXE_LINKER_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} -Wl,-rpath-link,\"${ARM_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}\":\"${ARM_SYSROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE}\"")
-endif ()
-set (CMAKE_REQUIRED_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}")
-set (CMAKE_EXE_LINKER_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
-
-# Define all supported build options
-include (CMakeDependentOption)
-option (URHO3D_C++11 "Enable C++11 standard")
-cmake_dependent_option (IOS "Setup build for iOS platform" FALSE "XCODE" FALSE)
-cmake_dependent_option (URHO3D_64BIT "Enable 64-bit build, the default is set based on the native ABI of the chosen compiler toolchain" ${NATIVE_64BIT} "NOT MSVC AND NOT ANDROID AND NOT (ARM AND NOT IOS) AND NOT WEB AND NOT POWERPC" ${NATIVE_64BIT})     # Intentionally only enable the option for iOS but not for tvOS as the latter is 64-bit only
-option (URHO3D_ANGELSCRIPT "Enable AngelScript scripting support" TRUE)
-option (URHO3D_LUA "Enable additional Lua scripting support" TRUE)
-option (URHO3D_NAVIGATION "Enable navigation support" TRUE)
-cmake_dependent_option (URHO3D_NETWORK "Enable networking support" TRUE "NOT WEB" FALSE)
-option (URHO3D_PHYSICS "Enable physics support" TRUE)
-option (URHO3D_URHO2D "Enable 2D graphics and physics support" TRUE)
-if (ARM AND NOT ANDROID AND NOT RPI AND NOT IOS AND NOT TVOS)
-    set (ARM_ABI_FLAGS "" CACHE STRING "Specify ABI compiler flags (ARM on Linux cross-compiling build only); e.g. Orange-Pi Mini 2 could use '-mcpu=cortex-a7 -mfpu=neon-vfpv4'")
-endif ()
-if (IOS OR (RPI AND "${RPI_ABI}" MATCHES NEON) OR (ARM AND (URHO3D_64BIT OR "${ARM_ABI_FLAGS}" MATCHES neon)))    # Stringify in case RPI_ABI/ARM_ABI_FLAGS is not set explicitly
-    # The 'NEON' CMake variable is already set by android.toolchain.cmake when the chosen ANDROID_ABI uses NEON
-    set (NEON TRUE)
-endif ()
-# For Raspbery Pi, find Broadcom VideoCore IV firmware
-if (RPI)
-    # TODO: this logic is earmarked to be moved into SDL's CMakeLists.txt when refactoring the library dependency handling
-    find_package (VideoCore REQUIRED)
-    include_directories (${VIDEOCORE_INCLUDE_DIRS})
-    link_directories (${VIDEOCORE_LIBRARY_DIRS})
-endif ()
-if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
-    set (URHO3D_LIB_TYPE STATIC CACHE STRING "Specify Urho3D library type, possible values are STATIC (default) and SHARED")
-    # The URHO3D_OPENGL option is not available on non-Windows platforms as they should always use OpenGL, i.e. URHO3D_OPENGL variable will always be forced to TRUE
-    if (MSVC)
-        # On MSVC compiler, default to false (i.e. prefers Direct3D)
-        # OpenGL can be manually enabled with -DURHO3D_OPENGL=1, but Windows graphics card drivers are usually better optimized for Direct3D
-        set (DEFAULT_OPENGL FALSE)
-    else ()
-        # On non-MSVC compiler on Windows platform, default to true to enable use of OpenGL instead of Direct3D
-        # Direct3D can be manually enabled with -DURHO3D_OPENGL=0, but it is likely to fail unless the MinGW-w64 distribution is used due to dependency to Direct3D headers and libs
-        set (DEFAULT_OPENGL TRUE)
-    endif ()
-    cmake_dependent_option (URHO3D_OPENGL "Use OpenGL instead of Direct3D (Windows platform only)" ${DEFAULT_OPENGL} "WIN32" TRUE)      # Force the variable to TRUE when not WIN32
-    # On Windows platform Direct3D11 can be optionally chosen
-    # Using Direct3D11 on non-MSVC compiler may require copying and renaming Microsoft official libraries (.lib to .a), else link failures or non-functioning graphics may result
-    cmake_dependent_option (URHO3D_D3D11 "Use Direct3D11 instead of Direct3D9 (Windows platform only); overrides URHO3D_OPENGL option" FALSE "WIN32" FALSE)
-    if (NOT ARM)
-        # It is not possible to turn SSE off on 64-bit MSVC and it appears it is also not able to do so safely on 64-bit GCC
-        cmake_dependent_option (URHO3D_SSE "Enable SSE/SSE2 instruction set (32-bit Web and Intel platforms only, including Android on Intel Atom); default to true on Intel and false on Web platform; the effective SSE level could be higher, see also URHO3D_DEPLOYMENT_TARGET and CMAKE_OSX_DEPLOYMENT_TARGET build options" ${HAVE_SSE2} "NOT URHO3D_64BIT" TRUE)
-    endif ()
-    cmake_dependent_option (URHO3D_3DNOW "Enable 3DNow! instruction set (Linux platform only); should only be used for older CPU with (legacy) 3DNow! support" ${HAVE_3DNOW} "NOT WIN32 AND NOT APPLE AND NOT WEB AND NOT ARM AND NOT URHO3D_SSE" FALSE)
-    cmake_dependent_option (URHO3D_MMX "Enable MMX instruction set (32-bit Linux platform only); the MMX is effectively enabled when 3DNow! or SSE is enabled; should only be used for older CPU with MMX support" ${HAVE_MMX} "NOT WIN32 AND NOT APPLE AND NOT WEB AND NOT ARM AND NOT URHO3D_64BIT AND NOT URHO3D_SSE AND NOT URHO3D_3DNOW" FALSE)
-    # For completeness sake - this option is intentionally not documented as we do not officially support PowerPC (yet)
-    cmake_dependent_option (URHO3D_ALTIVEC "Enable AltiVec instruction set (PowerPC only)" ${HAVE_ALTIVEC} POWERPC FALSE)
-    cmake_dependent_option (URHO3D_LUAJIT "Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)" FALSE "NOT WEB" 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/LuaJIT only)" FALSE "URHO3D_LUA OR URHO3D_LUAJIT" FALSE)
-    if (CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_CONFIGURATION_TYPES)
-        set (URHO3D_DEFAULT_LUA_RAW FALSE)
-    else ()
-        set (URHO3D_DEFAULT_LUA_RAW TRUE)
-    endif ()
-    cmake_dependent_option (URHO3D_LUA_RAW_SCRIPT_LOADER "Prefer loading raw script files from the file system before falling back on Urho3D resource cache. Useful for debugging (e.g. breakpoints), but less performant (Lua/LuaJIT only)" ${URHO3D_DEFAULT_LUA_RAW} "URHO3D_LUA OR URHO3D_LUAJIT" FALSE)
-    option (URHO3D_SAMPLES "Build sample applications" TRUE)
-    option (URHO3D_UPDATE_SOURCE_TREE "Enable commands to copy back some of the generated build artifacts from build tree to source tree to facilitate devs to push them as part of a commit (for library devs with push right only)")
-    option (URHO3D_BINDINGS "Enable API binding generation support for script subystems")
-    cmake_dependent_option (URHO3D_CLANG_TOOLS "Build Clang tools (native on host system only)" FALSE "NOT ANDROID AND NOT ARM AND NOT WEB" FALSE)
-    mark_as_advanced (URHO3D_UPDATE_SOURCE_TREE URHO3D_BINDINGS URHO3D_CLANG_TOOLS)
-    cmake_dependent_option (URHO3D_TOOLS "Build tools (native, RPI, and generic ARM only)" TRUE "NOT IOS AND NOT ANDROID AND NOT WEB" FALSE)
-    cmake_dependent_option (URHO3D_EXTRAS "Build extras (native, RPI, and generic ARM only)" FALSE "NOT IOS AND NOT ANDROID AND NOT WEB" FALSE)
-    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_PCH "Enable PCH support" TRUE)
-    cmake_dependent_option (URHO3D_DATABASE_ODBC "Enable Database support with ODBC, requires vendor-specific ODBC driver" FALSE "NOT IOS AND NOT ANDROID AND NOT WEB;NOT MSVC OR NOT MSVC_VERSION VERSION_LESS 1900" FALSE)
-    option (URHO3D_DATABASE_SQLITE "Enable Database support with SQLite embedded")
-    cmake_dependent_option (URHO3D_MINIDUMPS "Enable minidumps on crash (VS only)" TRUE "MSVC" FALSE)
-    option (URHO3D_FILEWATCHER "Enable filewatcher support" TRUE)
-    option (URHO3D_TESTING "Enable testing support")
-    cmake_dependent_option (URHO3D_STATIC_RUNTIME "Use static C/C++ runtime libraries and eliminate the need for runtime DLLs installation (VS only)" FALSE "MSVC" FALSE)
-    if (((URHO3D_LUA AND NOT URHO3D_LUAJIT) OR URHO3D_DATABASE_SQLITE) AND NOT ANDROID AND NOT IOS AND NOT WEB AND NOT WIN32)
-        # Find GNU Readline development library for Lua interpreter and SQLite's isql
-        find_package (Readline)
-    endif ()
-    if (CPACK_SYSTEM_NAME STREQUAL Linux)
-        cmake_dependent_option (URHO3D_USE_LIB64_RPM "Enable 64-bit RPM CPack generator using /usr/lib64 and disable all other generators (Debian-based host only)" FALSE "URHO3D_64BIT AND NOT HAS_LIB64" FALSE)
-        cmake_dependent_option (URHO3D_USE_LIB_DEB "Enable 64-bit DEB CPack generator using /usr/lib and disable all other generators (Redhat-based host only)" FALSE "URHO3D_64BIT AND HAS_LIB64" FALSE)
-    endif ()
-    # Set to search in 'lib' or 'lib64' based on the chosen ABI
-    if (NOT CMAKE_HOST_WIN32)
-        set_property (GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${URHO3D_64BIT})
-    endif ()
-else ()
-    set (URHO3D_LIB_TYPE "" CACHE STRING "Specify Urho3D library type, possible values are STATIC and SHARED")
-    set (URHO3D_HOME "" CACHE PATH "Path to Urho3D build tree or SDK installation location (downstream project only)")
-    if (URHO3D_PCH OR URHO3D_UPDATE_SOURCE_TREE OR URHO3D_TOOLS)
-        # Just reference it to suppress "unused variable" CMake warning on downstream projects using this CMake module
-    endif ()
-    if (CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
-        set (URHO3D_SSE ${HAVE_SSE2})
-    else ()
-        # All Urho3D downstream projects require Urho3D library, so find Urho3D library here now
-        find_package (Urho3D REQUIRED)
-        include_directories (${URHO3D_INCLUDE_DIRS})
-    endif ()
-endif ()
-option (URHO3D_PACKAGING "Enable resources packaging support, on Web platform default to 1, on other platforms default to 0" ${WEB})
-option (URHO3D_PROFILING "Enable profiling support" TRUE)
-option (URHO3D_LOGGING "Enable logging support" TRUE)
-# Emscripten thread support is yet experimental; default false
-if (NOT WEB)
-    option (URHO3D_THREADING "Enable thread support, on Web platform default to 0, on other platforms default to 1" TRUE)
-else ()
-    option (URHO3D_THREADING "Enable thread support, on Web platform default to 0, on other platforms default to 1" FALSE)
-endif ()
-if (URHO3D_TESTING)
-    if (WEB)
-        set (DEFAULT_TIMEOUT 10)
-        if (EMSCRIPTEN)
-            set (EMSCRIPTEN_EMRUN_BROWSER firefox CACHE STRING "Specify the particular browser to be spawned by emrun during testing (Emscripten cross-compiling build only), use 'emrun --list_browsers' command to get the list of possible values")
-        endif ()
-    else ()
-        set (DEFAULT_TIMEOUT 5)
-    endif ()
-    set (URHO3D_TEST_TIMEOUT ${DEFAULT_TIMEOUT} CACHE STRING "Number of seconds to test run the executables (when testing support is enabled only), default to 10 on Web platform and 5 on other platforms")
-else ()
-    unset (URHO3D_TEST_TIMEOUT CACHE)
-    if (EMSCRIPTEN_EMRUN_BROWSER)   # Suppress unused variable warning at the same time
-        unset (EMSCRIPTEN_EMRUN_BROWSER CACHE)
-    endif ()
-endif ()
-cmake_dependent_option (URHO3D_WIN32_CONSOLE "Use console main() as entry point when setting up Windows executable targets (Windows platform only)" FALSE "WIN32" FALSE)
-cmake_dependent_option (URHO3D_MACOSX_BUNDLE "Use MACOSX_BUNDLE when setting up Mac OS X executable targets (Xcode native build only)" FALSE "XCODE AND NOT IOS" FALSE)
-if (CMAKE_CROSSCOMPILING AND NOT ANDROID AND NOT IOS)
-    set (URHO3D_SCP_TO_TARGET "" CACHE STRING "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")
-else ()
-    unset (URHO3D_SCP_TO_TARGET CACHE)
-endif ()
-if (ANDROID)
-    set (ANDROID TRUE CACHE INTERNAL "Setup build for Android platform")
-    cmake_dependent_option (ANDROID_NDK_GDB "Enable ndk-gdb for debugging (Android build only)" FALSE "CMAKE_BUILD_TYPE STREQUAL Debug" FALSE)
-else ()
-    unset (ANDROID_NDK_GDB CACHE)
-endif ()
-if (MINGW AND CMAKE_CROSSCOMPILING)
-    set (MINGW_PREFIX "" CACHE STRING "Prefix path to MinGW cross-compiler tools (MinGW cross-compiling build only)")
-    set (MINGW_SYSROOT "" CACHE PATH "Path to MinGW system root (MinGW build only); should only be used when the system root could not be auto-detected")
-    # When cross-compiling then we are most probably in Unix-alike host environment which should not have problem to handle long include dirs
-    # This change is required to keep ccache happy because it does not like the CMake generated include response file
-    foreach (lang C CXX)
-        foreach (cat OBJECTS INCLUDES)
-            unset (CMAKE_${lang}_USE_RESPONSE_FILE_FOR_${cat})
-        endforeach ()
-    endforeach ()
-endif ()
-if (RPI)
-    if (NOT RPI_SUPPORTED_ABIS)
-        set (RPI_SUPPORTED_ABIS armeabi-v6)
-        if (CMAKE_CROSSCOMPILING)
-            # We have no way to know for sure so just give all the available options to user
-            list (APPEND RPI_SUPPORTED_ABIS armeabi-v7a "armeabi-v7a with NEON" "armeabi-v7a with VFPV4")
-        else ()
-            # If not cross-compiling then we should be on the host system (device) itself, so below command is safe to be executed
-            execute_process (COMMAND uname -m OUTPUT_VARIABLE HOST_MACHINE ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
-            if (HOST_MACHINE MATCHES ^armv7)
-                list (APPEND RPI_SUPPORTED_ABIS armeabi-v7a "armeabi-v7a with NEON" "armeabi-v7a with VFPV4")
-                if (NOT RPI_ABI)
-                    set (RPI_ABI armeabi-v7a)   # Set default to this specific target device
-                endif ()
-            endif ()
-        endif ()
-        set (RPI_SUPPORTED_ABIS ${RPI_SUPPORTED_ABIS} CACHE INTERNAL "Supported target ABIs for RPI build")
-    endif ()
-    if (CMAKE_CROSSCOMPILING)
-        set (RPI_PREFIX "" CACHE STRING "Prefix path to Raspberry Pi cross-compiler tools (RPI cross-compiling build only)")
-        set (RPI_SYSROOT "" CACHE PATH "Path to Raspberry Pi system root (RPI cross-compiling build only)")
-    endif ()
-    if (RPI_ABI)
-        list (FIND RPI_SUPPORTED_ABIS ${RPI_ABI} RPI_ABI_FOUND_INDEX)
-        if (RPI_ABI_FOUND_INDEX EQUAL -1)
-            string (REPLACE ";" "\", \"" PRINTABLE_RPI_SUPPORTED_ABIS "${RPI_SUPPORTED_ABIS}")  # Stringify for string replace to work
-            if (NOT CMAKE_CROSSCOMPILING)
-                set (MSG_STR " by this Raspberry Pi device")
-            endif ()
-            message (FATAL_ERROR "Specified RPI_ABI = \"${RPI_ABI}\" is not supported${MSG_STR}. Supported values are: \"${PRINTABLE_RPI_SUPPORTED_ABIS}\".")
-        endif()
-    else ()
-        set (RPI_ABI armeabi-v6)
-    endif ()
-    set (RPI_ABI ${RPI_ABI} CACHE STRING "Specify target ABI (RPI build only), possible values are armeabi-v6 (default for RPI 1), armeabi-v7a (default for RPI 2), armeabi-v7a with NEON, and armeabi-v7a with VFPV4" FORCE)
-endif ()
-if (EMSCRIPTEN)     # CMAKE_CROSSCOMPILING is always true for Emscripten
-    set (EMSCRIPTEN_ROOT_PATH "" CACHE PATH "Root path to Emscripten cross-compiler tools (Emscripten cross-compiling build only)")
-    set (EMSCRIPTEN_SYSROOT "" CACHE PATH "Path to Emscripten system root (Emscripten cross-compiling build only)")
-    option (EMSCRIPTEN_ALLOW_MEMORY_GROWTH "Enable memory growing based on application demand (Emscripten cross-compiling build only)")
-    math (EXPR EMSCRIPTEN_TOTAL_MEMORY "128 * 1024 * 1024")     # This option is ignored when EMSCRIPTEN_ALLOW_MEMORY_GROWTH option is set
-    set (EMSCRIPTEN_TOTAL_MEMORY ${EMSCRIPTEN_TOTAL_MEMORY} CACHE STRING "Specify the total size of memory to be used (Emscripten cross-compiling build only); default to 128 MB, this option is ignored when EMSCRIPTEN_ALLOW_MEMORY_GROWTH=1")
-    set (EMSCRIPTEN_SHARE_DATA FALSE CACHE BOOL "Enable sharing data file support (Emscripten cross-compiling build only)")
-    set (EMSCRIPTEN_SYSTEM_LIBS "" CACHE STRING "Specify a semicolon-separated list of additional system libraries that should be pre-built using embuilder.py, by default 'dlmalloc', 'libc', 'libcxxabi', and 'gl' will be pre-built, so they should not be listed again (Emscripten cross-compiling build only); when using CMake CLI on Unix-like host systems, the semicolon may need to be properly escaped; see usage of embuilder.py to get the full list of supported system libraries")
-endif ()
-# Constrain the build option values in cmake-gui, if applicable
-if (CMAKE_VERSION VERSION_GREATER 2.8 OR CMAKE_VERSION VERSION_EQUAL 2.8)
-    set_property (CACHE URHO3D_LIB_TYPE PROPERTY STRINGS STATIC SHARED)
-    if (NOT CMAKE_CONFIGURATION_TYPES)
-        set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${URHO3D_BUILD_CONFIGURATIONS})
-    endif ()
-    if (RPI)
-        set_property (CACHE RPI_ABI PROPERTY STRINGS ${RPI_SUPPORTED_ABIS})
-    endif ()
-endif()
-
-# Union all the sysroot variables into one so it can be referred to generically later
-# TODO: to be replaced with CMAKE_SYSROOT later if it is more beneficial
-set (SYSROOT ${ANDROID_SYSROOT} ${RPI_SYSROOT} ${ARM_SYSROOT} ${MINGW_SYSROOT} ${IOS_SYSROOT} ${EMSCRIPTEN_SYSROOT} CACHE INTERNAL "Path to system root of the cross-compiling target")  # SYSROOT is empty for native build
-
-# Clang tools building
-if (URHO3D_CLANG_TOOLS OR URHO3D_BINDINGS)
-    # Ensure LLVM/Clang is installed
-    find_program (LLVM_CONFIG NAMES llvm-config llvm-config-64 llvm-config-32 HINTS $ENV{LLVM_CLANG_ROOT}/bin DOC "LLVM config tool" NO_CMAKE_FIND_ROOT_PATH)
-    if (NOT LLVM_CONFIG)
-        message (FATAL_ERROR "Could not find LLVM/Clang installation")
-    endif ()
-endif ()
-if (URHO3D_CLANG_TOOLS)
-    # Require C++11 standard and no precompiled-header
-    set (URHO3D_C++11 1)
-    set (URHO3D_PCH 0)
-    set (URHO3D_LIB_TYPE SHARED)
-    # Set build options that would maximise the AST of Urho3D library
-    foreach (OPT URHO3D_ANGELSCRIPT URHO3D_LUA URHO3D_FILEWATCHER URHO3D_PROFILING URHO3D_LOGGING URHO3D_NAVIGATION URHO3D_NETWORK URHO3D_PHYSICS URHO3D_URHO2D URHO3D_DATABASE_SQLITE)
-        set (${OPT} 1)
-    endforeach()
-    foreach (OPT URHO3D_TESTING URHO3D_LUAJIT URHO3D_DATABASE_ODBC)
-        set (${OPT} 0)
-    endforeach()
-endif ()
-
-# Enable testing
-if (URHO3D_TESTING)
-    enable_testing ()
-endif ()
-
-# Enable coverity scan modeling
-if ($ENV{COVERITY_SCAN_BRANCH})
-    add_definitions (-DCOVERITY_SCAN_MODEL)
-endif ()
-
-# Enable/disable SIMD instruction set for STB image (do it here instead of in the STB CMakeLists.txt because the header files are exposed to Urho3D library user)
-if (NEON)
-    if (NOT XCODE)
-        add_definitions (-DSTBI_NEON)   # Cannot define it directly for Xcode due to universal binary support, we define it in the setup_target() macro instead for Xcode
-    endif ()
-elseif (NOT URHO3D_SSE)
-    add_definitions (-DSTBI_NO_SIMD)    # GCC/Clang/MinGW will switch this off automatically except MSVC, but no harm to make it explicit for all
-endif ()
-
-# Enable structured exception handling and minidumps on MSVC only.
-if (MSVC AND URHO3D_MINIDUMPS)
-    add_definitions (-DURHO3D_MINIDUMPS)
-endif ()
-
-# By default use the MSVC dynamic runtime. To eliminate the need to distribute the runtime installer,
-# this can be switched off if not using Urho3D as a shared library.
-if (MSVC AND URHO3D_STATIC_RUNTIME)
-    set (RELEASE_RUNTIME /MT)
-    set (DEBUG_RUNTIME /MTd)
-endif ()
-
-# By default Windows platform setups main executable as Windows application with WinMain() as entry point
-# this build option overrides the default to set the main executable as console application with main() as entry point instead
-if (URHO3D_WIN32_CONSOLE)
-    add_definitions (-DURHO3D_WIN32_CONSOLE)
-endif ()
-
-# Enable file watcher support for automatic resource reloads by default.
-if (URHO3D_FILEWATCHER)
-    add_definitions (-DURHO3D_FILEWATCHER)
-endif ()
-
-# Enable profiling by default. If disabled, autoprofileblocks become no-ops and the Profiler subsystem is not instantiated.
-if (URHO3D_PROFILING)
-    add_definitions (-DURHO3D_PROFILING)
-endif ()
-
-# Enable logging by default. If disabled, LOGXXXX macros become no-ops and the Log subsystem is not instantiated.
-if (URHO3D_LOGGING)
-    add_definitions (-DURHO3D_LOGGING)
-endif ()
-
-# Enable threading by default, except for Emscripten.
-if (URHO3D_THREADING)
-    add_definitions (-DURHO3D_THREADING)
-endif ()
-
-# Add definitions for Emscripten
-if (EMSCRIPTEN)
-    add_definitions (-DNO_POPEN)
-endif ()
-
-# URHO3D_D3D11 overrides URHO3D_OPENGL option
-if (URHO3D_D3D11)
-    set (URHO3D_OPENGL 0)
-endif ()
-
-# Add definitions for GLEW
-if (NOT ANDROID AND NOT ARM AND NOT WEB AND URHO3D_OPENGL)
-    add_definitions (-DGLEW_STATIC -DGLEW_NO_GLU)
-endif ()
-
-# Default library type is STATIC
-if (URHO3D_LIB_TYPE)
-    string (TOUPPER ${URHO3D_LIB_TYPE} URHO3D_LIB_TYPE)
-endif ()
-if (NOT URHO3D_LIB_TYPE STREQUAL SHARED)
-    set (URHO3D_LIB_TYPE STATIC)
-    if (MSVC)
-        # This define will be baked into the export header for MSVC compiler
-        set (URHO3D_STATIC_DEFINE 1)
-    else ()
-        add_definitions (-DURHO3D_STATIC_DEFINE)
-    endif ()
-endif ()
-
-# Add definition for AngelScript
-if (URHO3D_ANGELSCRIPT)
-    add_definitions (-DURHO3D_ANGELSCRIPT)
-    # Force C++11 if using Emscripten + AngelScript (required by the generic bindings generation)
-    if (EMSCRIPTEN OR (ARM AND NATIVE_64BIT))
-        set (URHO3D_C++11 1)
-    endif ()
-endif ()
-
-# Add definition for Lua and LuaJIT
-if (URHO3D_LUAJIT)
-    set (JIT JIT)
-    # Implied URHO3D_LUA
-    set (URHO3D_LUA 1)
-endif ()
-if (URHO3D_LUA)
-    add_definitions (-DURHO3D_LUA)
-    # Optionally enable Lua / C++ wrapper safety checks
-    if (NOT URHO3D_SAFE_LUA)
-        add_definitions (-DTOLUA_RELEASE)
-    endif ()
-endif ()
-if (URHO3D_LUA_RAW_SCRIPT_LOADER)
-    add_definitions (-DURHO3D_LUA_RAW_SCRIPT_LOADER)
-endif ()
-
-# Add definition for Navigation
-if (URHO3D_NAVIGATION)
-    add_definitions (-DURHO3D_NAVIGATION)
-endif ()
-
-# Add definition for Network
-if (URHO3D_NETWORK)
-    add_definitions (-DURHO3D_NETWORK)
-endif ()
-
-# Add definition for Physics
-if (URHO3D_PHYSICS)
-    add_definitions (-DURHO3D_PHYSICS)
-endif ()
-
-# Add definition for Urho2D
-if (URHO3D_URHO2D)
-    add_definitions (-DURHO3D_URHO2D)
-endif ()
-
-# Add definition for Database
-if (URHO3D_DATABASE_ODBC)
-    set (URHO3D_DATABASE_SQLITE 0)
-    find_package (ODBC REQUIRED)
-    set (URHO3D_C++11 1)
-endif ()
-if (URHO3D_DATABASE_SQLITE OR URHO3D_DATABASE_ODBC)
-    set (URHO3D_DATABASE 1)
-    add_definitions (-DURHO3D_DATABASE)
-endif ()
-
-# TODO: The logic below is earmarked to be moved into SDL's CMakeLists.txt when refactoring the library dependency handling, until then ensure the DirectX package is not being searched again in external projects such as when building LuaJIT library
-if (WIN32 AND NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
-    set (DIRECTX_REQUIRED_COMPONENTS)
-    set (DIRECTX_OPTIONAL_COMPONENTS DInput DSound XAudio2 XInput)
-    if (NOT URHO3D_OPENGL)
-        if (URHO3D_D3D11)
-            list (APPEND DIRECTX_REQUIRED_COMPONENTS D3D11)
-        else ()
-            list (APPEND DIRECTX_REQUIRED_COMPONENTS D3D)
-        endif ()
-    endif ()
-    find_package (DirectX REQUIRED ${DIRECTX_REQUIRED_COMPONENTS} OPTIONAL_COMPONENTS ${DIRECTX_OPTIONAL_COMPONENTS})
-    if (DIRECTX_FOUND)
-        include_directories (${DIRECTX_INCLUDE_DIRS})   # These variables may be empty when WinSDK or MinGW is being used
-        link_directories (${DIRECTX_LIBRARY_DIRS})
-    endif ()
-endif ()
-
-# Platform and compiler specific options
-if (URHO3D_C++11)
-    add_definitions (-DURHO3D_CXX11)   # Note the define is NOT 'URHO3D_C++11'!
-    if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
-        # Use gnu++11/gnu++0x instead of c++11/c++0x as the latter does not work as expected when cross compiling
-        if (VERIFIED_SUPPORTED_STANDARD)
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=${VERIFIED_SUPPORTED_STANDARD}")
-        else ()
-            foreach (STANDARD gnu++11 gnu++0x)  # Fallback to gnu++0x on older GCC version
-                execute_process (COMMAND ${CMAKE_COMMAND} -E echo COMMAND ${CMAKE_CXX_COMPILER} -std=${STANDARD} -E - RESULT_VARIABLE GCC_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
-                if (GCC_EXIT_CODE EQUAL 0)
-                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=${STANDARD}")
-                    set (VERIFIED_SUPPORTED_STANDARD ${STANDARD} CACHE INTERNAL "GNU extension of C++11 standard that is verified to be supported by the chosen compiler")
-                    break ()
-                endif ()
-            endforeach ()
-            if (NOT GCC_EXIT_CODE EQUAL 0)
-                message (FATAL_ERROR "Your GCC version ${COMPILER_VERSION} is too old to enable C++11 standard")
-            endif ()
-        endif ()
-    elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
-        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-    elseif (MSVC80)
-        message (FATAL_ERROR "Your MSVC version is too told to enable C++11 standard")
-    endif ()
-endif ()
-if (APPLE)
-    if (IOS)
-        # IOS-specific setup
-        add_definitions (-DIOS)
-        if (URHO3D_64BIT)
-            if (DEFINED ENV{XCODE_64BIT_ONLY})                  # This environment variable is set automatically when ccache is just being cleared in Travis CI VM
-                set (CMAKE_OSX_ARCHITECTURES "arm64 x86_64")    # This is a hack to temporarily only build 64-bit archs to reduce overall build time for one build
-            else ()
-                set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD))
-            endif ()
-        else ()
-            set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
-        endif ()
-    else ()
-        if (XCODE)
-            # OSX-specific setup
-            if (URHO3D_64BIT)
-                if (DEFINED ENV{XCODE_64BIT_ONLY})
-                    set (CMAKE_OSX_ARCHITECTURES x86_64)
-                else ()
-                    set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_64_BIT))
-                endif ()
-            else ()
-                set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
-            endif ()
-        endif ()
-    endif ()
-    # Common OSX and iOS bundle setup
-    if (IOS OR URHO3D_MACOSX_BUNDLE)
-        # Only set the bundle properties to its default when they are not explicitly specified by user
-        if (NOT MACOSX_BUNDLE_GUI_IDENTIFIER)
-            set (MACOSX_BUNDLE_GUI_IDENTIFIER com.github.urho3d.\${PRODUCT_NAME:rfc1034identifier:lower})
-        endif ()
-        if (NOT MACOSX_BUNDLE_BUNDLE_NAME)
-            set (MACOSX_BUNDLE_BUNDLE_NAME \${PRODUCT_NAME})
-        endif ()
-    endif ()
-endif ()
-if (MSVC)
-    # VS-specific setup
-    add_definitions (-D_CRT_SECURE_NO_WARNINGS)
-    set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_RUNTIME}")
-    set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_RUNTIME} /fp:fast /Zi /GS-")
-    set (CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELWITHDEBINFO})
-    set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_RUNTIME}")
-    set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_RUNTIME} /fp:fast /Zi /GS- /D _SECURE_SCL=0")
-    set (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
-    # In Visual Studio, SSE2 flag is redundant if already compiling as 64bit; it is already the default for VS2012 (onward) on 32bit
-    # Instead, we must turn SSE/SSE2 off explicitly if user really intends to turn it off
-    if (URHO3D_SSE)
-        if (NOT URHO3D_64BIT AND MSVC_VERSION LESS 1700)
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
-        endif ()
-    else ()
-        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:IA32")
-        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:IA32")
-    endif ()
-    set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF /DEBUG")
-    set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF")
-else ()
-    # GCC/Clang-specific setup
-    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof")
-    if (NOT ANDROID)    # Most of the flags are already setup in android.toolchain.cmake module
-        if (ARM AND CMAKE_SYSTEM_NAME STREQUAL Linux)
-            # Common compiler flags for aarch64-linux-gnu and arm-linux-gnueabihf, we do not support Windows on arm for now
-            set (ARM_CFLAGS "${ARM_CFLAGS} -fsigned-char -pipe")
-            if (NOT URHO3D_64BIT)
-                # We only support armhf distros, so turn on hard-float by default
-                set (ARM_CFLAGS "${ARM_CFLAGS} -mfloat-abi=hard -Wno-psabi")
-            endif ()
-            # The configuration is done here instead of in CMake toolchain file because we also support native build which does not use toolchain file at all
-            if (RPI)
-                # RPI-specific setup
-                add_definitions (-DRPI)
-                if (RPI_ABI MATCHES ^armeabi-v7a)
-                    set (ARM_CFLAGS "${ARM_CFLAGS} -mcpu=cortex-a7")
-                    if (RPI_ABI MATCHES NEON)
-                        set (ARM_CFLAGS "${ARM_CFLAGS} -mfpu=neon-vfpv4")
-                    elseif (RPI_ABI MATCHES VFPV4)
-                        set (ARM_CFLAGS "${ARM_CFLAGS} -mfpu=vfpv4")
-                    else ()
-                        set (ARM_CFLAGS "${ARM_CFLAGS} -mfpu=vfpv4-d16")
-                    endif ()
-                else ()
-                    set (ARM_CFLAGS "${ARM_CFLAGS} -mcpu=arm1176jzf-s -mfpu=vfp")
-                endif ()
-            else ()
-                # Generic ARM-specific setup
-                add_definitions (-DGENERIC_ARM)
-                if (URHO3D_64BIT)
-                    # aarch64 has only one valid arch so far
-                    set (ARM_CFLAGS "${ARM_CFLAGS} -march=armv8-a")
-                elseif (URHO3D_ANGELSCRIPT)
-                    # Angelscript seems to fail to compile using Thumb states, so force to use ARM states by default
-                    set (ARM_CFLAGS "${ARM_CFLAGS} -marm")
-                endif ()
-                if (ARM_ABI_FLAGS)
-                    # Instead of guessing all the possible ABIs, user would have to specify the ABI compiler flags explicitly via ARM_ABI_FLAGS build option
-                    set (ARM_CFLAGS "${ARM_CFLAGS} ${ARM_ABI_FLAGS}")
-                endif ()
-            endif ()
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM_CFLAGS}")
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARM_CFLAGS}")
-        else ()
-            if (URHO3D_SSE AND NOT XCODE AND NOT WEB)
-                # This may influence the effective SSE level when URHO3D_SSE is on as well
-                set (URHO3D_DEPLOYMENT_TARGET native CACHE STRING "Specify the minimum CPU type on which the target binaries are to be deployed (Linux, MinGW, and non-Xcode OSX native build only), see GCC/Clang's -march option for possible values; Use 'generic' for targeting a wide range of generic processors")
-                if (NOT URHO3D_DEPLOYMENT_TARGET STREQUAL generic)
-                    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${URHO3D_DEPLOYMENT_TARGET}")
-                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${URHO3D_DEPLOYMENT_TARGET}")
-                endif ()
-            endif ()
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
-            # We don't add these flags directly here for Xcode because we support Mach-O universal binary build
-            # The compiler flags will be added later conditionally when the effective arch is i386 during build time (using XCODE_ATTRIBUTE target property)
-            if (NOT XCODE)
-                if (NOT URHO3D_64BIT)
-                    # Not the compiler native ABI, this could only happen on multilib-capable compilers
-                    if (NATIVE_64BIT)
-                        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
-                        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
-                    endif ()
-                    # The effective SSE level could be higher, see also URHO3D_DEPLOYMENT_TARGET and CMAKE_OSX_DEPLOYMENT_TARGET build options
-                    # The -mfpmath=sse is not set in global scope but it may be set in local scope when building LuaJIT sub-library for x86 arch
-                    if (URHO3D_SSE)
-                        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse -msse2")
-                        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2")
-                    endif ()
-                endif ()
-                if (NOT URHO3D_SSE)
-                    if (URHO3D_64BIT OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
-                        # Clang enables SSE support for i386 ABI by default, so use the '-mno-sse' compiler flag to nullify that and make it consistent with GCC
-                        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mno-sse")
-                        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-sse")
-                    endif ()
-                    if (URHO3D_MMX)
-                        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmmx")
-                        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmmx")
-                    endif()
-                    if (URHO3D_3DNOW)
-                        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m3dnow")
-                        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m3dnow")
-                    endif ()
-                endif ()
-                # For completeness sake only as we do not support PowerPC (yet)
-                if (URHO3D_ALTIVEC)
-                    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maltivec")
-                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec")
-                endif ()
-            endif ()
-        endif ()
-        if (WEB)
-            if (EMSCRIPTEN)
-                # Emscripten-specific setup
-                set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-warn-absolute-paths -Wno-unknown-warning-option")
-                set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-warn-absolute-paths -Wno-unknown-warning-option")
-                if (URHO3D_THREADING)
-                    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_PTHREADS=1")
-                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_PTHREADS=1")
-                endif ()
-                # Prior to version 1.31.3 emcc does not consistently add the cpp standard and remove Emscripten-specific compiler flags
-                # before passing on the work to the underlying LLVM/Clang compiler, this has resulted in preprocessing error when enabling the PCH and ccache
-                # (See https://github.com/kripken/emscripten/issues/3365 for more detail)
-                if (EMCC_VERSION VERSION_LESS 1.31.3)
-                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
-                endif ()
-                set (CMAKE_C_FLAGS_RELEASE "-Oz -DNDEBUG")
-                set (CMAKE_CXX_FLAGS_RELEASE "-Oz -DNDEBUG")
-                # CMake does not treat Emscripten as a valid platform yet, certain platform-specific variables cannot be set in the
-                # toolchain file as they get overwritten by CMake internally as per Linux platform default, so set them here for now
-                set (CMAKE_EXECUTABLE_SUFFIX_C .html)
-                set (CMAKE_EXECUTABLE_SUFFIX_CXX .html)
-                # Linker flags
-                if (EMSCRIPTEN_ALLOW_MEMORY_GROWTH)
-                    set (MEMORY_LINKER_FLAGS "-s ALLOW_MEMORY_GROWTH=1")
-                else ()
-                    set (MEMORY_LINKER_FLAGS "-s TOTAL_MEMORY=${EMSCRIPTEN_TOTAL_MEMORY}")
-                endif ()
-                set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MEMORY_LINKER_FLAGS} -s NO_EXIT_RUNTIME=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1")
-                set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -O3 -s AGGRESSIVE_VARIABLE_ELIMINATION=1")     # Remove variables to make the -O3 regalloc easier
-                set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -g4")     # Preserve LLVM debug information, show line number debug comments, and generate source maps
-                if (URHO3D_TESTING)
-                    set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --emrun")  # Inject code into the generated Module object to enable capture of stdout, stderr and exit()
-                endif ()
-            endif ()
-        elseif (MINGW)
-            # MinGW-specific setup
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc -fno-keep-inline-dllexport")
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -static-libgcc -static-libstdc++ -fno-keep-inline-dllexport")
-            if (NOT URHO3D_64BIT)
-                # Prevent auto-vectorize optimization when using -O3, unless stack realign is being enforced globally
-                if (URHO3D_SSE)
-                    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mstackrealign")
-                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mstackrealign")
-                    add_definitions (-DSTBI_MINGW_ENABLE_SSE2)
-                else ()
-                    if (DEFINED ENV{TRAVIS})
-                        # TODO: Remove this workaround when Travis CI VM has been migrated to Ubuntu 14.04 LTS
-                        set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-tree-slp-vectorize -fno-tree-vectorize")
-                        set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-slp-vectorize -fno-tree-vectorize")
-                    else ()
-                        set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-tree-loop-vectorize -fno-tree-slp-vectorize -fno-tree-vectorize")
-                        set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-loop-vectorize -fno-tree-slp-vectorize -fno-tree-vectorize")
-                    endif ()
-                endif ()
-            endif ()
-        else ()
-            # Not Android and not Emscripten and not MinGW derivative
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")     # This will emit '-DREENTRANT' to compiler and '-lpthread' to linker on Linux and Mac OSX platform
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") # However, it may emit other equivalent compiler define and/or linker flag on other *nix platforms
-        endif ()
-        set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG -D_DEBUG")
-        set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -D_DEBUG")
-    endif ()
-    if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
-        # Clang-specific
-        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments")
-        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
-        if (NINJA OR "$ENV{USE_CCACHE}")    # Stringify to guard against undefined environment variable
-            # When ccache support is on, these flags keep the color diagnostics pipe through ccache output and suppress Clang warning due ccache internal preprocessing step
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
-        endif ()
-        # Temporary workaround for Travis CI VM as Ubuntu 12.04 LTS still uses old glibc header files that do not have the necessary patch for Clang to work correctly
-        # TODO: Remove this workaround when Travis CI VM has been migrated to Ubuntu 14.04 LTS
-        if (DEFINED ENV{TRAVIS} AND "$ENV{LINUX}")
-            add_definitions (-D__extern_always_inline=inline)
-        endif ()
-    else ()
-        # GCC-specific
-        if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9.1)
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=auto")
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto")
-        endif ()
-    endif ()
-endif ()
-# LuaJIT specific - extra linker flags for linking against LuaJIT (adapted from LuaJIT's original Makefile)
-if (URHO3D_LUAJIT)
-    if (URHO3D_64BIT AND APPLE AND NOT IOS)
-        # 64-bit Mac OS X: it simply won't work without these flags; if you are reading this comment then you may want to know the following also
-        # it's recommended to rebase all (self-compiled) shared libraries which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua), see: man rebase
-        set (LUAJIT_EXE_LINKER_FLAGS_APPLE "-pagezero_size 10000 -image_base 100000000")
-        set (LUAJIT_SHARED_LINKER_FLAGS_APPLE "-image_base 7fff04c4a000")
-        if (NOT XCODE)
-            set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LUAJIT_EXE_LINKER_FLAGS_APPLE}")
-            set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LUAJIT_SHARED_LINKER_FLAGS_APPLE}")
-        endif ()
-    elseif (URHO3D_LIB_TYPE STREQUAL STATIC AND NOT WIN32 AND NOT APPLE)    # The original condition also checks: AND NOT SunOS AND NOT PS3
-        # We assume user may want to load C modules compiled for plain Lua with require(), so we have to ensure all the public symbols are exported when linking with Urho3D (and therefore LuaJIT) statically
-        # Note: this implies that loading such modules on Windows platform may only work with SHARED library type
-        set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-E")
-    endif ()
-endif ()
-
-# Macro for setting common output directories
-include (CMakeParseArguments)
-macro (set_output_directories OUTPUT_PATH)
-    cmake_parse_arguments (ARG LOCAL "" "" ${ARGN})
-    if (ARG_LOCAL)
-        unset (SCOPE)
-        unset (OUTPUT_DIRECTORY_PROPERTIES)
-    else ()
-        set (SCOPE CMAKE_)
-    endif ()
-    foreach (TYPE ${ARG_UNPARSED_ARGUMENTS})
-        set (${SCOPE}${TYPE}_OUTPUT_DIRECTORY ${OUTPUT_PATH})
-        list (APPEND OUTPUT_DIRECTORY_PROPERTIES ${TYPE}_OUTPUT_DIRECTORY ${${TYPE}_OUTPUT_DIRECTORY})
-        foreach (CONFIG ${CMAKE_CONFIGURATION_TYPES})
-            string (TOUPPER ${CONFIG} CONFIG)
-            set (${SCOPE}${TYPE}_OUTPUT_DIRECTORY_${CONFIG} ${OUTPUT_PATH})
-            list (APPEND OUTPUT_DIRECTORY_PROPERTIES ${TYPE}_OUTPUT_DIRECTORY_${CONFIG} ${${TYPE}_OUTPUT_DIRECTORY_${CONFIG}})
-        endforeach ()
-        if (TYPE STREQUAL RUNTIME AND NOT ${OUTPUT_PATH} STREQUAL .)
-            file (RELATIVE_PATH REL_OUTPUT_PATH ${CMAKE_BINARY_DIR} ${OUTPUT_PATH})
-            set (DEST_RUNTIME_DIR ${REL_OUTPUT_PATH})
-        endif ()
-    endforeach ()
-    if (ARG_LOCAL)
-        list (APPEND TARGET_PROPERTIES ${OUTPUT_DIRECTORY_PROPERTIES})
-    endif ()
-endmacro ()
-
-# Set common binary output directory for all platforms if not already set (note that this module can be included in an external project which already has DEST_RUNTIME_DIR preset)
-if (NOT DEST_RUNTIME_DIR)
-    set_output_directories (${CMAKE_BINARY_DIR}/bin RUNTIME PDB)
-endif ()
-
-# Macro for setting symbolic link on platform that supports it
-macro (create_symlink SOURCE DESTINATION)
-    # Make absolute paths so they work more reliably on cmake-gui
-    if (IS_ABSOLUTE ${SOURCE})
-        set (ABS_SOURCE ${SOURCE})
-    else ()
-        set (ABS_SOURCE ${CMAKE_SOURCE_DIR}/${SOURCE})
-    endif ()
-    if (IS_ABSOLUTE ${DESTINATION})
-        set (ABS_DESTINATION ${DESTINATION})
-    else ()
-        set (ABS_DESTINATION ${CMAKE_BINARY_DIR}/${DESTINATION})
-    endif ()
-    if (CMAKE_HOST_WIN32)
-        if (IS_DIRECTORY ${ABS_SOURCE})
-            set (SLASH_D /D)
-        else ()
-            unset (SLASH_D)
-        endif ()
-        if (HAS_MKLINK)
-            if (NOT EXISTS ${ABS_DESTINATION})
-                # Have to use string-REPLACE as file-TO_NATIVE_PATH does not work as expected with MinGW on "backward slash" host system
-                string (REPLACE / \\ BACKWARD_ABS_DESTINATION ${ABS_DESTINATION})
-                string (REPLACE / \\ BACKWARD_ABS_SOURCE ${ABS_SOURCE})
-                execute_process (COMMAND cmd /C mklink ${SLASH_D} ${BACKWARD_ABS_DESTINATION} ${BACKWARD_ABS_SOURCE} OUTPUT_QUIET ERROR_QUIET)
-            endif ()
-        elseif (${ARGN} STREQUAL FALLBACK_TO_COPY)
-            if (SLASH_D)
-                set (COMMAND COMMAND ${CMAKE_COMMAND} -E copy_directory ${ABS_SOURCE} ${ABS_DESTINATION})
-            else ()
-                set (COMMAND COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ABS_SOURCE} ${ABS_DESTINATION})
-            endif ()
-            # Fallback to copy only one time
-            execute_process (${COMMAND})
-            if (TARGET ${TARGET_NAME})
-                # Fallback to copy every time the target is built
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD ${COMMAND})
-            endif ()
-        else ()
-            message (WARNING "Unable to create symbolic link on this host system, you may need to manually copy file/dir from \"${SOURCE}\" to \"${DESTINATION}\"")
-        endif ()
-    else ()
-        execute_process (COMMAND ${CMAKE_COMMAND} -E create_symlink ${ABS_SOURCE} ${ABS_DESTINATION})
-    endif ()
-endmacro ()
-
-include (GenerateExportHeader)
-
-# Macro for precompiling header (On MSVC, the dummy C++ or C implementation file for precompiling the header file would be generated if not already exists)
-# This macro should be called before the CMake target has been added
-# Typically, user should indirectly call this macro by using the 'PCH' option when calling define_source_files() macro
-macro (enable_pch HEADER_PATHNAME)
-    # No op when PCH support is not enabled
-    if (URHO3D_PCH)
-        # Get the optional LANG parameter to indicate whether the header should be treated as C or C++ header, default to C++
-        if ("${ARGN}" STREQUAL C)   # Stringify as the LANG paramater could be empty
-            set (EXT c)
-            set (LANG C)
-            set (LANG_H c-header)
-        else ()
-            # This is the default
-            set (EXT cpp)
-            set (LANG CXX)
-            set (LANG_H c++-header)
-        endif ()
-        # Relative path is resolved using CMAKE_CURRENT_SOURCE_DIR
-        if (IS_ABSOLUTE ${HEADER_PATHNAME})
-            set (ABS_HEADER_PATHNAME ${HEADER_PATHNAME})
-        else ()
-            set (ABS_HEADER_PATHNAME ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER_PATHNAME})
-        endif ()
-        # Determine the precompiled header output filename
-        get_filename_component (HEADER_FILENAME ${HEADER_PATHNAME} NAME)
-        if (CMAKE_COMPILER_IS_GNUCXX)
-            # GNU g++
-            set (PCH_FILENAME ${HEADER_FILENAME}.gch)
-        else ()
-            # Clang or MSVC
-            set (PCH_FILENAME ${HEADER_FILENAME}.pch)
-        endif ()
-
-        if (MSVC)
-            get_filename_component (NAME_WE ${HEADER_FILENAME} NAME_WE)
-            if (TARGET ${TARGET_NAME})
-                if (VS)
-                    # VS is multi-config, the exact path is only known during actual build time based on effective build config
-                    set (PCH_PATHNAME "$(IntDir)${PCH_FILENAME}")
-                else ()
-                    set (PCH_PATHNAME ${CMAKE_CURRENT_BINARY_DIR}/${PCH_FILENAME})
-                endif ()
-                foreach (FILE ${SOURCE_FILES})
-                    if (FILE MATCHES \\.${EXT}$)
-                        if (FILE MATCHES ${NAME_WE}\\.${EXT}$)
-                            # Precompiling header file
-                            set_property (SOURCE ${FILE} APPEND_STRING PROPERTY COMPILE_FLAGS " /Fp${PCH_PATHNAME} /Yc${HEADER_FILENAME}")     # Need a leading space for appending
-                        else ()
-                            # Using precompiled header file
-                            set_property (SOURCE ${FILE} APPEND_STRING PROPERTY COMPILE_FLAGS " /Fp${PCH_PATHNAME} /Yu${HEADER_FILENAME} /FI${HEADER_FILENAME}")
-                        endif ()
-                    endif ()
-                endforeach ()
-                unset (${TARGET_NAME}_HEADER_PATHNAME)
-            else ()
-                # The target has not been created yet, so set an internal variable to come back here again later
-                set (${TARGET_NAME}_HEADER_PATHNAME ${ARGV})
-                # But proceed to add the dummy C++ or C implementation file if necessary
-                set (${LANG}_FILENAME ${NAME_WE}.${EXT})
-                get_filename_component (PATH ${HEADER_PATHNAME} PATH)
-                if (PATH)
-                    set (PATH ${PATH}/)
-                endif ()
-                list (FIND SOURCE_FILES ${PATH}${${LANG}_FILENAME} ${LANG}_FILENAME_FOUND)
-                if (${LANG}_FILENAME_FOUND STREQUAL -1)
-                    if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${${LANG}_FILENAME})
-                        # Only generate it once so that its timestamp is not touched unnecessarily
-                        file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/${${LANG}_FILENAME} "// This is a generated file. DO NOT EDIT!\n\n#include \"${HEADER_FILENAME}\"")
-                    endif ()
-                    list (INSERT SOURCE_FILES 0 ${${LANG}_FILENAME})
-                endif ()
-            endif ()
-        elseif (XCODE)
-            if (TARGET ${TARGET_NAME})
-                # Precompiling and using precompiled header file
-                set_target_properties (${TARGET_NAME} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER ${ABS_HEADER_PATHNAME})
-                unset (${TARGET_NAME}_HEADER_PATHNAME)
-            else ()
-                # The target has not been created yet, so set an internal variable to come back here again later
-                set (${TARGET_NAME}_HEADER_PATHNAME ${ARGV})
-            endif ()
-        else ()
-            # GCC or Clang
-            if (TARGET ${TARGET_NAME})
-                # Precompiling header file
-                get_directory_property (COMPILE_DEFINITIONS COMPILE_DEFINITIONS)
-                get_directory_property (INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES)
-                get_target_property (TYPE ${TARGET_NAME} TYPE)
-                if (TYPE MATCHES SHARED)
-                    list (APPEND COMPILE_DEFINITIONS ${TARGET_NAME}_EXPORTS)
-                    # todo: Reevaluate the replacement of this deprecated function (since CMake 2.8.12) when the CMake minimum required version is set to 2.8.12
-                    # At the moment it seems using the function is the "only way" to get the export flags into a CMake variable
-                    # Additionally, CMake implementation of 'VISIBILITY_INLINES_HIDDEN' has a bug (tested in 2.8.12.2) that it erroneously sets the flag for C compiler too
-                    add_compiler_export_flags (COMPILER_EXPORT_FLAGS)
-                    # To cater for MinGW which already uses PIC for all codes
-                    if (NOT MINGW)
-                        set (COMPILER_EXPORT_FLAGS "${COMPILER_EXPORT_FLAGS} -fPIC")
-                    endif ()
-                elseif (PROJECT_NAME STREQUAL Urho3D AND NOT ${TARGET_NAME} STREQUAL Urho3D AND URHO3D_LIB_TYPE STREQUAL SHARED)
-                    # If it is one of the Urho3D library dependency then use the same PIC flag as Urho3D library
-                    if (NOT MINGW)
-                        set (COMPILER_EXPORT_FLAGS -fPIC)
-                    endif ()
-                endif ()
-                string (REPLACE ";" " -D" COMPILE_DEFINITIONS "-D${COMPILE_DEFINITIONS}")
-                string (REPLACE "\"" "\\\"" COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS})
-                string (REPLACE ";" "\" -I\"" INCLUDE_DIRECTORIES "-I\"${INCLUDE_DIRECTORIES}\"")
-                # Make sure the precompiled headers are not stale by creating custom rules to re-compile the header as necessary
-                file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PCH_FILENAME})
-                foreach (CONFIG ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})   # These two vars are mutually exclusive
-                    # Generate *.rsp containing configuration specific compiler flags
-                    string (TOUPPER ${CONFIG} UPPERCASE_CONFIG)
-                    file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new "${COMPILE_DEFINITIONS} ${CLANG_${LANG}_FLAGS} ${CMAKE_${LANG}_FLAGS} ${CMAKE_${LANG}_FLAGS_${UPPERCASE_CONFIG}} ${COMPILER_EXPORT_FLAGS} ${INCLUDE_DIRECTORIES} -c -x ${LANG_H}")
-                    execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp)
-                    file (REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new)
-                    # Determine the dependency list
-                    execute_process (COMMAND ${CMAKE_${LANG}_COMPILER} @${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp -MTdeps -MM -o ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.deps ${ABS_HEADER_PATHNAME} RESULT_VARIABLE ${LANG}_COMPILER_EXIT_CODE)
-                    if (NOT ${LANG}_COMPILER_EXIT_CODE EQUAL 0)
-                        message (FATAL_ERROR
-                            "The configured compiler toolchain in the build tree is not able to handle all the compiler flags required to build the project with PCH enabled. "
-                            "Please kindly update your compiler toolchain to its latest version. "
-                            "If you are using MinGW then make sure it is MinGW-W64 instead of MinGW-W32 or TDM-GCC (Code::Blocks default). "
-                            "Or disable the PCH build support by passing the '-DURHO3D_PCH=0' when retrying to configure/generate the build tree. "
-                            "However, if you think there is something wrong with our build system then kindly file a bug report to the project devs.")
-                    endif ()
-                    file (STRINGS ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.deps DEPS)
-                    string (REGEX REPLACE "^deps: *| *\\; *" ";" DEPS ${DEPS})
-                    string (REGEX REPLACE "\\\\ " "\ " DEPS "${DEPS}")  # Need to stringify the second time to preserve the semicolons
-                    # Create the rule that depends on the included headers
-                    add_custom_command (OUTPUT ${HEADER_FILENAME}.${CONFIG}.pch.trigger
-                        COMMAND ${CMAKE_${LANG}_COMPILER} @${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp -o ${PCH_FILENAME}/${PCH_FILENAME}.${CONFIG} ${ABS_HEADER_PATHNAME}
-                        COMMAND ${CMAKE_COMMAND} -E touch ${HEADER_FILENAME}.${CONFIG}.pch.trigger
-                        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp ${DEPS}
-                        COMMENT "Precompiling header file '${HEADER_FILENAME}' for ${CONFIG} configuration")
-                endforeach ()
-                # Using precompiled header file
-                if ($ENV{COVERITY_SCAN_BRANCH})
-                    # Coverity scan does not support PCH so workaround by including the actual header file
-                    set (ABS_PATH_PCH ${ABS_HEADER_PATHNAME})
-                else ()
-                    set (ABS_PATH_PCH ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME})
-                endif ()
-                set (CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS} -include \"${ABS_PATH_PCH}\"")
-                unset (${TARGET_NAME}_HEADER_PATHNAME)
-            else ()
-                # The target has not been created yet, so set an internal variable to come back here again later
-                set (${TARGET_NAME}_HEADER_PATHNAME ${ARGV})
-                # But proceed to add the dummy source file(s) to trigger the custom command output rule
-                if (CMAKE_CONFIGURATION_TYPES)
-                    # Multi-config, trigger all rules and let the compiler to choose which precompiled header is suitable to use
-                    foreach (CONFIG ${CMAKE_CONFIGURATION_TYPES})
-                        list (APPEND TRIGGERS ${HEADER_FILENAME}.${CONFIG}.pch.trigger)
-                    endforeach ()
-                else ()
-                    # Single-config, just trigger the corresponding rule matching the current build configuration
-                    set (TRIGGERS ${HEADER_FILENAME}.${CMAKE_BUILD_TYPE}.pch.trigger)
-                endif ()
-                list (APPEND SOURCE_FILES ${TRIGGERS})
-            endif ()
-        endif ()
-    endif ()
-endmacro ()
-
-# Macro for setting up dependency lib for compilation and linking of a target
-macro (setup_target)
-    # Include directories
-    include_directories (${INCLUDE_DIRS})
-    # Link libraries
-    define_dependency_libs (${TARGET_NAME})
-    target_link_libraries (${TARGET_NAME} ${ABSOLUTE_PATH_LIBS} ${LIBS})
-    # Enable PCH if requested
-    if (${TARGET_NAME}_HEADER_PATHNAME)
-        enable_pch (${${TARGET_NAME}_HEADER_PATHNAME})
-    endif ()
-    # Set additional linker dependencies (only work for Makefile-based generator according to CMake documentation)
-    if (LINK_DEPENDS)
-        string (REPLACE ";" "\;" LINK_DEPENDS "${LINK_DEPENDS}")        # Stringify for string replacement
-        list (APPEND TARGET_PROPERTIES LINK_DEPENDS "${LINK_DEPENDS}")  # Stringify with semicolons already escaped
-        unset (LINK_DEPENDS)
-    endif ()
-    # Extra compiler flags for Xcode which are dynamically changed based on active arch in order to support Mach-O universal binary targets
-    # We don't add the ABI flag for Xcode because it automatically passes '-arch i386' compiler flag when targeting 32 bit which does the same thing as '-m32'
-    if (XCODE)
-        # Speed up build when in Debug configuration by building active arch only
-        list (FIND TARGET_PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH ATTRIBUTE_ALREADY_SET)
-        if (ATTRIBUTE_ALREADY_SET EQUAL -1)
-            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<$<CONFIG:Debug>:YES>)
-        endif ()
-        if (NEON)
-            if (IOS)
-                set (SDK iphoneos)
-            elseif (TVOS)
-                set (SDK appletvos)
-            endif ()
-            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_OTHER_CFLAGS[sdk=${SDK}*] "-DSTBI_NEON $(OTHER_CFLAGS)")
-            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_OTHER_CPLUSPLUSFLAGS[sdk=${SDK}*] "-DSTBI_NEON $(OTHER_CPLUSPLUSFLAGS)")
-        elseif (NOT URHO3D_SSE)
-            # Nullify the Clang default so that it is consistent with GCC
-            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_OTHER_CFLAGS[arch=i386] "-mno-sse $(OTHER_CFLAGS)")
-            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_OTHER_CPLUSPLUSFLAGS[arch=i386] "-mno-sse $(OTHER_CPLUSPLUSFLAGS)")
-        endif ()
-    endif ()
-    if (TARGET_PROPERTIES)
-        set_target_properties (${TARGET_NAME} PROPERTIES ${TARGET_PROPERTIES})
-        unset (TARGET_PROPERTIES)
-    endif ()
-
-    # Workaround CMake/Xcode generator bug where it always appends '/build' path element to SYMROOT attribute and as such the items in Products are always rendered as red in the Xcode IDE as if they are not yet built
-    if (NOT DEFINED ENV{TRAVIS})
-        if (XCODE AND NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
-            file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/build)
-            get_target_property (LOCATION ${TARGET_NAME} LOCATION)
-            string (REGEX REPLACE "^.*\\$\\(CONFIGURATION\\)" $(CONFIGURATION) SYMLINK ${LOCATION})
-            get_filename_component (DIRECTORY ${SYMLINK} PATH)
-            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                COMMAND mkdir -p ${DIRECTORY} && ln -sf $<TARGET_FILE:${TARGET_NAME}> ${DIRECTORY}/$<TARGET_FILE_NAME:${TARGET_NAME}>
-                WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build)
-        endif ()
-    endif ()
-endmacro ()
-
-# Macro for checking the SOURCE_FILES variable is properly initialized
-macro (check_source_files)
-    if (NOT SOURCE_FILES)
-        message (FATAL_ERROR "Could not configure and generate the project file because no source files have been defined yet. "
-            "You can define the source files explicitly by setting the SOURCE_FILES variable in your CMakeLists.txt; or "
-            "by calling the define_source_files() macro which would by default glob all the C++ source files found in the same scope of "
-            "CMakeLists.txt where the macro is being called and the macro would set the SOURCE_FILES variable automatically. "
-            "If your source files are not located in the same directory as the CMakeLists.txt or your source files are "
-            "more than just C++ language then you probably have to pass in extra arguments when calling the macro in order to make it works. "
-            "See the define_source_files() macro definition in the CMake/Modules/Urho3D-CMake-common.cmake for more detail.")
-    endif ()
-endmacro ()
-
-# Macro for setting up a library target
-# Macro arguments:
-#  NODEPS - setup library target without defining Urho3D dependency libraries (applicable for downstream projects)
-#  STATIC/SHARED/MODULE/EXCLUDE_FROM_ALL - see CMake help on add_library() command
-# CMake variables:
-#  SOURCE_FILES - list of source files
-#  INCLUDE_DIRS - list of directories for include search path
-#  LIBS - list of dependent libraries that are built internally in the project
-#  ABSOLUTE_PATH_LIBS - list of dependent libraries that are external to the project
-#  LINK_DEPENDS - list of additional files on which a target binary depends for linking (Makefile-based generator only)
-#  TARGET_PROPERTIES - list of target properties
-macro (setup_library)
-    cmake_parse_arguments (ARG NODEPS "" "" ${ARGN})
-    check_source_files ()
-    add_library (${TARGET_NAME} ${ARG_UNPARSED_ARGUMENTS} ${SOURCE_FILES})
-    get_target_property (LIB_TYPE ${TARGET_NAME} TYPE)
-    if (NOT ARG_NODEPS AND NOT PROJECT_NAME STREQUAL Urho3D)
-        define_dependency_libs (Urho3D)
-    endif ()
-    if (XCODE AND LUAJIT_SHARED_LINKER_FLAGS_APPLE AND LIB_TYPE STREQUAL SHARED_LIBRARY)
-        list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=x86_64] "${LUAJIT_SHARED_LINKER_FLAGS_APPLE} $(OTHER_LDFLAGS)")    # Xcode universal build linker flags when targeting 64-bit OSX with LuaJIT enabled
-    endif ()
-    setup_target ()
-
-    # Setup the compiler flags for building shared library
-    if (LIB_TYPE STREQUAL SHARED_LIBRARY)
-        # Hide the symbols that are not explicitly marked for export
-        add_compiler_export_flags ()
-    endif ()
-
-    if (PROJECT_NAME STREQUAL Urho3D)
-        # Accumulate all the dependent static libraries that are used in building the Urho3D library itself
-        if (NOT ${TARGET_NAME} STREQUAL Urho3D AND LIB_TYPE STREQUAL STATIC_LIBRARY)
-            set (STATIC_LIBRARY_TARGETS ${STATIC_LIBRARY_TARGETS} ${TARGET_NAME} PARENT_SCOPE)
-        endif ()
-    elseif (URHO3D_SCP_TO_TARGET)
-        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${URHO3D_SCP_TO_TARGET} || exit 0
-            COMMENT "Scp-ing ${TARGET_NAME} library to target system")
-    endif ()
-endmacro ()
-
-# Macro for setting up an executable target
-# Macro arguments:
-#  PRIVATE - setup executable target without installing it
-#  TOOL - setup a tool executable target
-#  NODEPS - setup executable target without defining Urho3D dependency libraries
-#  WIN32/MACOSX_BUNDLE/EXCLUDE_FROM_ALL - see CMake help on add_executable() command
-# CMake variables:
-#  SOURCE_FILES - list of source files
-#  INCLUDE_DIRS - list of directories for include search path
-#  LIBS - list of dependent libraries that are built internally in the project
-#  ABSOLUTE_PATH_LIBS - list of dependent libraries that are external to the project
-#  LINK_DEPENDS - list of additional files on which a target binary depends for linking (Makefile-based generator only)
-#  TARGET_PROPERTIES - list of target properties
-macro (setup_executable)
-    cmake_parse_arguments (ARG "PRIVATE;TOOL;NODEPS" "" "" ${ARGN})
-    check_source_files ()
-    add_executable (${TARGET_NAME} ${ARG_UNPARSED_ARGUMENTS} ${SOURCE_FILES})
-    set (RUNTIME_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
-    if (ARG_PRIVATE)
-        set_output_directories (. LOCAL RUNTIME PDB)
-        set (RUNTIME_DIR .)
-    endif ()
-    if (ARG_TOOL)
-        list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH YES)
-        if (NOT ARG_PRIVATE AND NOT DEST_RUNTIME_DIR MATCHES tool)
-            set_output_directories (${CMAKE_BINARY_DIR}/bin/tool LOCAL RUNTIME PDB)
-            set (RUNTIME_DIR ${CMAKE_BINARY_DIR}/bin/tool)
-        endif ()
-    endif ()
-    if (NOT ARG_NODEPS)
-        define_dependency_libs (Urho3D)
-    endif ()
-    if (XCODE AND LUAJIT_EXE_LINKER_FLAGS_APPLE)
-        list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=x86_64] "${LUAJIT_EXE_LINKER_FLAGS_APPLE} $(OTHER_LDFLAGS)")    # Xcode universal build linker flags when targeting 64-bit OSX with LuaJIT enabled
-    endif ()
-    setup_target ()
-
-    if (URHO3D_SCP_TO_TARGET)
-        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${URHO3D_SCP_TO_TARGET} || exit 0
-            COMMENT "Scp-ing ${TARGET_NAME} executable to target system")
-    endif ()
-    if (WIN32 AND NOT ARG_NODEPS AND URHO3D_LIB_TYPE STREQUAL SHARED AND RUNTIME_DIR)
-        # Make a copy of the Urho3D DLL to the runtime directory in the build tree
-        if (TARGET Urho3D)
-            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Urho3D> ${RUNTIME_DIR})
-        else ()
-            foreach (DLL ${URHO3D_DLL})
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DLL} ${RUNTIME_DIR})
-            endforeach ()
-        endif ()
-    endif ()
-    if (DIRECT3D_DLL AND NOT ARG_NODEPS AND RUNTIME_DIR)
-        # Make a copy of the D3D DLL to the runtime directory in the build tree
-        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DIRECT3D_DLL} ${RUNTIME_DIR})
-    endif ()
-    # Need to check if the destination variable is defined first because this macro could be called by downstream project that does not wish to install anything
-    if (NOT ARG_PRIVATE)
-        if (WEB AND DEST_BUNDLE_DIR)
-            # todo: Just use generator-expression when CMake minimum version is 3.0
-            if (CMAKE_VERSION VERSION_LESS 3.0)
-                get_target_property (LOCATION ${TARGET_NAME} LOCATION)
-                get_filename_component (LOCATION ${LOCATION} DIRECTORY)
-            else ()
-                set (LOCATION $<TARGET_FILE_DIR:${TARGET_NAME}>)
-            endif ()
-            unset (FILES)
-            foreach (EXT data html html.map html.mem js)
-                list (APPEND FILES ${LOCATION}/${TARGET_NAME}.${EXT})
-            endforeach ()
-            install (FILES ${FILES} DESTINATION ${DEST_BUNDLE_DIR} OPTIONAL)    # We get html.map or html.mem depend on the build configuration
-        elseif (DEST_RUNTIME_DIR AND (DEST_BUNDLE_DIR OR NOT IOS))
-            install (TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${DEST_RUNTIME_DIR} BUNDLE DESTINATION ${DEST_BUNDLE_DIR})
-            if (WIN32 AND NOT ARG_NODEPS AND URHO3D_LIB_TYPE STREQUAL SHARED AND NOT URHO3D_DLL_INSTALLED)
-                if (TARGET Urho3D)
-                    install (FILES $<TARGET_FILE:Urho3D> DESTINATION ${DEST_RUNTIME_DIR})
-                else ()
-                    install (FILES ${URHO3D_DLL} DESTINATION ${DEST_RUNTIME_DIR})
-                endif ()
-                set (URHO3D_DLL_INSTALLED TRUE)
-            endif ()
-            if (DIRECT3D_DLL AND NOT DIRECT3D_DLL_INSTALLED)
-                # Make a copy of the D3D DLL to the runtime directory in the installed location
-                install (FILES ${DIRECT3D_DLL} DESTINATION ${DEST_RUNTIME_DIR})
-                set (DIRECT3D_DLL_INSTALLED TRUE)
-            endif ()
-        endif ()
-    endif ()
-endmacro ()
-
-# Macro for finding file in Urho3D build tree or Urho3D SDK
-macro (find_Urho3D_file VAR NAME)
-    # Pass the arguments to the actual find command
-    cmake_parse_arguments (ARG "" "DOC;MSG_MODE" "HINTS;PATHS;PATH_SUFFIXES" ${ARGN})
-    find_file (${VAR} ${NAME} HINTS ${ARG_HINTS} PATHS ${ARG_PATHS} PATH_SUFFIXES ${ARG_PATH_SUFFIXES} DOC ${ARG_DOC} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-    mark_as_advanced (${VAR})  # Hide it from cmake-gui in non-advanced mode
-    if (NOT ${VAR} AND ARG_MSG_MODE)
-        message (${ARG_MSG_MODE}
-            "Could not find ${VAR} file in the Urho3D build tree or Urho3D SDK. "
-            "Please reconfigure and rebuild your Urho3D build tree or reinstall the SDK for the correct target platform.")
-    endif ()
-endmacro ()
-
-# Macro for finding tool in Urho3D build tree or Urho3D SDK
-macro (find_Urho3D_tool VAR NAME)
-    # Pass the arguments to the actual find command
-    cmake_parse_arguments (ARG "" "DOC;MSG_MODE" "HINTS;PATHS;PATH_SUFFIXES" ${ARGN})
-    find_program (${VAR} ${NAME} HINTS ${ARG_HINTS} PATHS ${ARG_PATHS} PATH_SUFFIXES ${ARG_PATH_SUFFIXES} DOC ${ARG_DOC} NO_DEFAULT_PATH)
-    mark_as_advanced (${VAR})  # Hide it from cmake-gui in non-advanced mode
-    if (NOT ${VAR})
-        set (${VAR} ${CMAKE_BINARY_DIR}/bin/tool/${NAME})
-        if (ARG_MSG_MODE AND NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
-            message (${ARG_MSG_MODE}
-                "Could not find ${VAR} tool in the Urho3D build tree or Urho3D SDK. Your project may not build successfully without this tool. "
-                "You may have to first rebuild the Urho3D in its build tree or reinstall Urho3D SDK to get this tool built or installed properly. "
-                "Alternatively, copy the ${VAR} executable manually into bin/tool subdirectory in your own project build tree.")
-        endif ()
-    endif ()
-endmacro ()
-
-# Macro for setting up an executable target with resources to copy/package/bundle/preload
-# Macro arguments:
-#  NODEPS - setup executable target without defining Urho3D dependency libraries
-#  NOBUNDLE - do not use MACOSX_BUNDLE even when URHO3D_MACOSX_BUNDLE build option is enabled
-#  WIN32/MACOSX_BUNDLE/EXCLUDE_FROM_ALL - see CMake help on add_executable() command
-# CMake variables:
-#  RESOURCE_DIRS - list of resource directories (will be packaged into *.pak when URHO3D_PACKAGING build option is set)
-#  RESOURCE_FILES - list of additional resource files (will not be packaged into *.pak in any case)
-#  SOURCE_FILES - list of source files
-#  INCLUDE_DIRS - list of directories for include search path
-#  LIBS - list of dependent libraries that are built internally in the project
-#  ABSOLUTE_PATH_LIBS - list of dependent libraries that are external to the project
-#  LINK_DEPENDS - list of additional files on which a target binary depends for linking (Makefile-based generator only)
-#  TARGET_PROPERTIES - list of target properties
-macro (setup_main_executable)
-    cmake_parse_arguments (ARG "NOBUNDLE;MACOSX_BUNDLE;WIN32" "" "" ${ARGN})
-
-    # Define resources
-    if (NOT RESOURCE_DIRS)
-        # If the macro caller has not defined the resource dirs then set them based on Urho3D project convention
-        foreach (DIR ${CMAKE_SOURCE_DIR}/bin/CoreData ${CMAKE_SOURCE_DIR}/bin/Data)
-            # Do not assume downstream project always follows Urho3D project convention, so double check if this directory exists before using it
-            if (IS_DIRECTORY ${DIR})
-                list (APPEND RESOURCE_DIRS ${DIR})
-            endif ()
-        endforeach ()
-    endif ()
-    if (URHO3D_PACKAGING AND RESOURCE_DIRS)
-        # Populate all the variables required by resource packaging
-        foreach (DIR ${RESOURCE_DIRS})
-            get_filename_component (NAME ${DIR} NAME)
-            if (ANDROID)
-                set (RESOURCE_${DIR}_PATHNAME ${CMAKE_BINARY_DIR}/assets/${NAME}.pak)
-            else ()
-                set (RESOURCE_${DIR}_PATHNAME ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${NAME}.pak)
-            endif ()
-            list (APPEND RESOURCE_PAKS ${RESOURCE_${DIR}_PATHNAME})
-            if (EMSCRIPTEN AND NOT EMSCRIPTEN_SHARE_DATA)
-                # Set the custom EMCC_OPTION property to preload the *.pak individually
-                set_source_files_properties (${RESOURCE_${DIR}_PATHNAME} PROPERTIES EMCC_OPTION preload-file EMCC_FILE_ALIAS "@/${NAME}.pak --use-preload-cache")
-            endif ()
-        endforeach ()
-        # Urho3D project builds the PackageTool as required; downstream project uses PackageTool found in the Urho3D build tree or Urho3D SDK
-        find_Urho3d_tool (PACKAGE_TOOL PackageTool
-            HINTS ${CMAKE_BINARY_DIR}/bin/tool ${URHO3D_HOME}/bin/tool
-            DOC "Path to PackageTool" MSG_MODE WARNING)
-        if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
-            set (PACKAGING_DEP DEPENDS PackageTool)
-        endif ()
-        set (PACKAGING_COMMENT " and packaging")
-        set_property (SOURCE ${RESOURCE_PAKS} PROPERTY GENERATED TRUE)
-        if (WEB)
-            if (EMSCRIPTEN)
-                # Check if shell-file is already added in source files list by downstream project
-                if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
-                    foreach (FILE ${SOURCE_FILES})
-                        get_property (EMCC_OPTION SOURCE ${FILE} PROPERTY EMCC_OPTION)
-                        if (EMCC_OPTION STREQUAL shell-file)
-                            set (SHELL_HTML_FOUND TRUE)
-                            break ()
-                        endif ()
-                    endforeach ()
-                endif ()
-                if (NOT SHELL_HTML_FOUND)
-                    # Use custom Urho3D shell.html
-                    set (SHELL_HTML ${CMAKE_BINARY_DIR}/Source/shell.html)
-                    list (APPEND SOURCE_FILES ${SHELL_HTML})
-                    set_source_files_properties (${SHELL_HTML} PROPERTIES EMCC_OPTION shell-file)
-                endif ()
-                # Set the custom EMCC_OPTION property to peload the generated shared data file
-                if (EMSCRIPTEN_SHARE_DATA)
-                    set (SHARED_RESOURCE_JS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_PROJECT_NAME}.js)
-                    list (APPEND SOURCE_FILES ${SHARED_RESOURCE_JS} ${SHARED_RESOURCE_JS}.data)
-                    set_source_files_properties (${SHARED_RESOURCE_JS} PROPERTIES GENERATED TRUE EMCC_OPTION pre-js)
-                    # Need to check if the destination variable is defined first because this macro could be called by downstream project that does not wish to install anything
-                    if (DEST_BUNDLE_DIR)
-                        install (FILES ${SHARED_RESOURCE_JS} ${SHARED_RESOURCE_JS}.data DESTINATION ${DEST_BUNDLE_DIR})
-                    endif ()
-                endif ()
-            endif ()
-        endif ()
-    endif ()
-    if (XCODE)
-        if (NOT RESOURCE_FILES)
-            # Default app bundle icon
-            set (RESOURCE_FILES ${CMAKE_SOURCE_DIR}/bin/Data/Textures/UrhoIcon.icns)
-            if (IOS)
-                # Default app icon on the iOS home screen
-                list (APPEND RESOURCE_FILES ${CMAKE_SOURCE_DIR}/bin/Data/Textures/UrhoIcon.png)
-            endif ()
-        endif ()
-        # Group them together under 'Resources' in Xcode IDE
-        source_group (Resources FILES ${RESOURCE_DIRS} ${RESOURCE_PAKS} ${RESOURCE_FILES})
-        # But only use either paks or dirs
-        if (RESOURCE_PAKS)
-            set_source_files_properties (${RESOURCE_PAKS} ${RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
-        else ()
-            set_source_files_properties (${RESOURCE_DIRS} ${RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
-        endif ()
-    endif ()
-    list (APPEND SOURCE_FILES ${RESOURCE_DIRS} ${RESOURCE_PAKS} ${RESOURCE_FILES})
-
-    if (ANDROID)
-        # Add SDL native init function, SDL_Main() entry point must be defined by one of the source files in ${SOURCE_FILES}
-        find_Urho3D_file (ANDROID_MAIN_C_PATH SDL_android_main.c
-            HINTS ${URHO3D_HOME}/include/Urho3D/ThirdParty/SDL/android ${CMAKE_SOURCE_DIR}/Source/ThirdParty/SDL/src/main/android
-            DOC "Path to SDL_android_main.c" MSG_MODE FATAL_ERROR)
-        list (APPEND SOURCE_FILES ${ANDROID_MAIN_C_PATH})
-        # Setup shared library output path
-        set_output_directories (${ANDROID_LIBRARY_OUTPUT_PATH} LIBRARY)
-        # Setup target as main shared library
-        setup_library (SHARED)
-        if (DEST_LIBRARY_DIR)
-            install (TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DEST_LIBRARY_DIR} ARCHIVE DESTINATION ${DEST_LIBRARY_DIR})
-        endif ()
-        # Copy other dependent shared libraries to Android library output path
-        foreach (FILE ${ABSOLUTE_PATH_LIBS})
-            get_filename_component (EXT ${FILE} EXT)
-            if (EXT STREQUAL .so)
-                get_filename_component (NAME ${FILE} NAME)
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                    COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${FILE} ${ANDROID_LIBRARY_OUTPUT_PATH}
-                    COMMENT "Copying ${NAME} to library output directory")
-            endif ()
-        endforeach ()
-        if (ANDROID_NDK_GDB)
-            # Copy the library while it still has debug symbols for ndk-gdb
-            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${TARGET_NAME}> ${NDK_GDB_SOLIB_PATH}
-                COMMENT "Copying lib${TARGET_NAME}.so with debug symbols to ${NDK_GDB_SOLIB_PATH} directory")
-        endif ()
-        # Strip target main shared library
-        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-            COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${TARGET_NAME}>
-            COMMENT "Stripping lib${TARGET_NAME}.so in library output directory")
-        # When performing packaging, include the final apk file
-        if (CMAKE_PROJECT_NAME STREQUAL Urho3D AND NOT APK_INCLUDED)
-            install (FILES ${LIBRARY_OUTPUT_PATH_ROOT}/bin/Urho3D-debug.apk DESTINATION ${DEST_RUNTIME_DIR} OPTIONAL)
-            set (APK_INCLUDED 1)
-        endif ()
-    else ()
-        # Setup target as executable
-        if (WIN32)
-            if (NOT URHO3D_WIN32_CONSOLE OR ARG_WIN32)
-                set (EXE_TYPE WIN32)
-            endif ()
-            list (APPEND TARGET_PROPERTIES DEBUG_POSTFIX _d)
-        elseif (IOS)
-            set (EXE_TYPE MACOSX_BUNDLE)
-            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY 1,2 MACOSX_BUNDLE_INFO_PLIST iOSBundleInfo.plist.template)
-        elseif (APPLE)
-            if ((URHO3D_MACOSX_BUNDLE OR ARG_MACOSX_BUNDLE) AND NOT ARG_NOBUNDLE)
-                set (EXE_TYPE MACOSX_BUNDLE)
-                list (APPEND TARGET_PROPERTIES MACOSX_BUNDLE_INFO_PLIST MacOSXBundleInfo.plist.template)
-            endif ()
-        elseif (WEB)
-            if (EMSCRIPTEN)
-                # Pass additional source files to linker with the supported flags, such as: js-library, pre-js, post-js, embed-file, preload-file, shell-file
-                foreach (FILE ${SOURCE_FILES})
-                    get_property (EMCC_OPTION SOURCE ${FILE} PROPERTY EMCC_OPTION)
-                    if (EMCC_OPTION)
-                        list (APPEND LINK_DEPENDS ${FILE})
-                        unset (EMCC_FILE_ALIAS)
-                        unset (EMCC_EXCLUDE_FILE)
-                        if (EMCC_OPTION STREQUAL embed-file OR EMCC_OPTION STREQUAL preload-file)
-                            get_property (EMCC_FILE_ALIAS SOURCE ${FILE} PROPERTY EMCC_FILE_ALIAS)
-                            get_property (EMCC_EXCLUDE_FILE SOURCE ${FILE} PROPERTY EMCC_EXCLUDE_FILE)
-                            if (EMCC_EXCLUDE_FILE)
-                                set (EMCC_EXCLUDE_FILE " --exclude-file ${EMCC_EXCLUDE_FILE}")
-                            endif ()
-                        endif ()
-                        set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --${EMCC_OPTION} ${FILE}${EMCC_FILE_ALIAS}${EMCC_EXCLUDE_FILE}")
-                    endif ()
-                endforeach ()
-            endif ()
-        endif ()
-        setup_executable (${EXE_TYPE} ${ARG_UNPARSED_ARGUMENTS})
-    endif ()
-
-    # Define a custom target for resource modification checking and resource packaging (if enabled)
-    if ((EXE_TYPE STREQUAL MACOSX_BUNDLE OR URHO3D_PACKAGING) AND RESOURCE_DIRS)
-        # Share a same custom target that checks for a same resource dirs list
-        foreach (DIR ${RESOURCE_DIRS})
-            string (MD5 MD5 ${DIR})
-            set (MD5ALL ${MD5ALL}${MD5})
-            if (CMAKE_HOST_WIN32)
-                # On Windows host, always assumes there are changes so resource dirs would be repackaged in each build, however, still make sure the *.pak timestamp is not altered unnecessarily
-                if (URHO3D_PACKAGING)
-                    set (PACKAGING_COMMAND && echo Packaging ${DIR}... && ${PACKAGE_TOOL} ${DIR} ${RESOURCE_${DIR}_PATHNAME}.new -c -q && ${CMAKE_COMMAND} -E copy_if_different ${RESOURCE_${DIR}_PATHNAME}.new ${RESOURCE_${DIR}_PATHNAME} && ${CMAKE_COMMAND} -E remove ${RESOURCE_${DIR}_PATHNAME}.new)
-                endif ()
-                list (APPEND COMMANDS COMMAND ${CMAKE_COMMAND} -E touch ${DIR} ${PACKAGING_COMMAND})
-            else ()
-                # On Unix-like hosts, detect the changes in the resource directory recursively so they are only repackaged and/or rebundled (Xcode only) as necessary
-                if (URHO3D_PACKAGING)
-                    set (PACKAGING_COMMAND && echo Packaging ${DIR}... && ${PACKAGE_TOOL} ${DIR} ${RESOURCE_${DIR}_PATHNAME} -c -q)
-                    set (OUTPUT_COMMAND test -e ${RESOURCE_${DIR}_PATHNAME} || \( true ${PACKAGING_COMMAND} \))
-                else ()
-                    set (OUTPUT_COMMAND true)   # Nothing to output
-                endif ()
-                list (APPEND COMMANDS COMMAND echo Checking ${DIR}... && bash -c \"\(\( `find ${DIR} -newer ${DIR} |wc -l` \)\)\" && touch -cm ${DIR} ${PACKAGING_COMMAND} || ${OUTPUT_COMMAND})
-            endif ()
-        endforeach ()
-        string (MD5 MD5ALL ${MD5ALL})
-        # Ensure the resource check is done before building the main executable target
-        if (NOT RESOURCE_CHECK_${MD5ALL})
-            set (RESOURCE_CHECK RESOURCE_CHECK)
-            while (TARGET ${RESOURCE_CHECK})
-                string (RANDOM RANDOM)
-                set (RESOURCE_CHECK RESOURCE_CHECK_${RANDOM})
-            endwhile ()
-            set (RESOURCE_CHECK_${MD5ALL} ${RESOURCE_CHECK} CACHE INTERNAL "Resource check hash map")
-        endif ()
-        if (NOT TARGET ${RESOURCE_CHECK_${MD5ALL}})
-            add_custom_target (${RESOURCE_CHECK_${MD5ALL}} ALL ${COMMANDS} ${PACKAGING_DEP} COMMENT "Checking${PACKAGING_COMMENT} resource directories")
-        endif ()
-        add_dependencies (${TARGET_NAME} ${RESOURCE_CHECK_${MD5ALL}})
-    endif ()
-
-    # Define a custom command for generating a shared data file (if enabled)
-    if (EMSCRIPTEN_SHARE_DATA AND RESOURCE_PAKS)
-        # When sharing a single data file, all main targets are assumed to use a same set of resource paks
-        foreach (FILE ${RESOURCE_PAKS})
-            get_filename_component (NAME ${FILE} NAME)
-            list (APPEND PAK_NAMES ${NAME})
-        endforeach ()
-        if (CMAKE_BUILD_TYPE STREQUAL Debug AND EMCC_VERSION VERSION_GREATER 1.32.2)
-            set (SEPARATE_METADATA --separate-metadata)
-        endif ()
-        add_custom_command (OUTPUT ${SHARED_RESOURCE_JS}.data
-            COMMAND ${EMPACKAGER} ${SHARED_RESOURCE_JS}.data --preload ${PAK_NAMES} --js-output=${SHARED_RESOURCE_JS} --use-preload-cache ${SEPARATE_METADATA}
-            DEPENDS RESOURCE_CHECK ${RESOURCE_PAKS}
-            WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-            COMMENT "Generating shared data file")
-    endif ()
-endmacro ()
-
-# Macro for adjusting target output name by dropping _suffix from the target name
-macro (adjust_target_name)
-    if (TARGET_NAME MATCHES _.*$)
-        string (REGEX REPLACE _.*$ "" OUTPUT_NAME ${TARGET_NAME})
-        set_target_properties (${TARGET_NAME} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME})
-    endif ()
-endmacro ()
-
-# Macro for setting up a test case
-macro (setup_test)
-    if (URHO3D_TESTING)
-        cmake_parse_arguments (ARG "" NAME OPTIONS ${ARGN})
-        if (NOT ARG_NAME)
-            set (ARG_NAME ${TARGET_NAME})
-        endif ()
-        list (APPEND ARG_OPTIONS -timeout ${URHO3D_TEST_TIMEOUT})
-        if (WEB)
-            if (EMSCRIPTEN)
-                if (DEFINED ENV{CI})
-                    # The latency on CI server could be very high at time, so add some adjustment
-                    # If it is not enough causing a test case failure then so be it because it is better that than wait for it and still ends up in build error due to time limit
-                    set (EMRUN_TIMEOUT_ADJUSTMENT + 8 * \\${URHO3D_TEST_TIMEOUT})
-                    set (EMRUN_TIMEOUT_RETURNCODE --timeout_returncode 0)
-                endif ()
-                math (EXPR EMRUN_TIMEOUT "2 * ${URHO3D_TEST_TIMEOUT} ${EMRUN_TIMEOUT_ADJUSTMENT}")
-                add_test (NAME ${ARG_NAME} COMMAND ${EMRUN} --browser ${EMSCRIPTEN_EMRUN_BROWSER} --timeout ${EMRUN_TIMEOUT} ${EMRUN_TIMEOUT_RETURNCODE} --kill_exit ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET_NAME}.html ${ARG_OPTIONS})
-            endif ()
-        else ()
-            add_test (NAME ${ARG_NAME} COMMAND ${TARGET_NAME} ${ARG_OPTIONS})
-        endif ()
-    endif ()
-endmacro ()
-
-# *** THIS IS A DEPRECATED MACRO ***
-# Macro for defining external library dependencies
-# The purpose of this macro is emulate CMake to set the external library dependencies transitively
-# It works for both targets setup within Urho3D project and downstream projects that uses Urho3D as external static/shared library
-# *** THIS IS A DEPRECATED MACRO ***
-macro (define_dependency_libs TARGET)
-    # ThirdParty/SDL external dependency
-    if (${TARGET} MATCHES SDL|Urho3D)
-        if (WIN32)
-            list (APPEND LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid)
-        elseif (APPLE)
-            list (APPEND LIBS iconv)
-        elseif (ANDROID)
-            list (APPEND LIBS dl log android)
-        else ()
-            # Linux
-            if (NOT WEB)
-                list (APPEND LIBS dl m rt)
-            endif ()
-            if (RPI)
-                list (APPEND ABSOLUTE_PATH_LIBS ${VIDEOCORE_LIBRARIES})
-            endif ()
-        endif ()
-    endif ()
-
-    # ThirdParty/kNet & ThirdParty/Civetweb external dependency
-    if (${TARGET} MATCHES Civetweb|kNet|Urho3D)
-        if (WIN32)
-            list (APPEND LIBS ws2_32)
-        endif ()
-    endif ()
-
-    # Urho3D/LuaJIT external dependency
-    if (URHO3D_LUAJIT AND ${TARGET} MATCHES LuaJIT|Urho3D)
-        if (NOT WIN32 AND NOT WEB)
-            list (APPEND LIBS dl m)
-        endif ()
-    endif ()
-
-    # Urho3D external dependency
-    if (${TARGET} STREQUAL Urho3D)
-        # Core
-        if (WIN32)
-            list (APPEND LIBS winmm)
-            if (URHO3D_MINIDUMPS)
-                list (APPEND LIBS dbghelp)
-            endif ()
-        elseif (APPLE)
-            if (IOS OR TVOS)
-                list (APPEND LIBS "-framework AudioToolbox" "-framework AVFoundation" "-framework CoreAudio" "-framework CoreGraphics" "-framework CoreMotion" "-framework Foundation" "-framework GameController" "-framework OpenGLES" "-framework QuartzCore" "-framework UIKit")
-            else ()
-                list (APPEND LIBS "-framework AudioToolbox" "-framework Carbon" "-framework Cocoa" "-framework CoreAudio" "-framework CoreServices" "-framework CoreVideo" "-framework ForceFeedback" "-framework IOKit" "-framework OpenGL")
-            endif ()
-        endif ()
-
-        # Graphics
-        if (URHO3D_OPENGL)
-            if (APPLE)
-                # Do nothing
-            elseif (WIN32)
-                list (APPEND LIBS opengl32)
-            elseif (ANDROID OR ARM)
-                list (APPEND LIBS GLESv1_CM GLESv2)
-            else ()
-                list (APPEND LIBS GL)
-            endif ()
-        elseif (DIRECT3D_LIBRARIES)
-            list (APPEND LIBS ${DIRECT3D_LIBRARIES})
-        endif ()
-
-        # Database
-        if (URHO3D_DATABASE_ODBC)
-            list (APPEND LIBS ${ODBC_LIBRARIES})
-        endif ()
-
-        # This variable value can either be 'Urho3D' target or an absolute path to an actual static/shared Urho3D library or empty (if we are building the library itself)
-        # The former would cause CMake not only to link against the Urho3D library but also to add a dependency to Urho3D target
-        if (URHO3D_LIBRARIES)
-            if (WIN32 AND URHO3D_LIBRARIES_DBG AND URHO3D_LIBRARIES_REL AND TARGET ${TARGET_NAME})
-                # Special handling when both debug and release libraries are found
-                target_link_libraries (${TARGET_NAME} debug ${URHO3D_LIBRARIES_DBG} optimized ${URHO3D_LIBRARIES_REL})
-            else ()
-                if (TARGET ${TARGET}_universal)
-                    add_dependencies (${TARGET_NAME} ${TARGET}_universal)
-                endif ()
-                list (APPEND ABSOLUTE_PATH_LIBS ${URHO3D_LIBRARIES})
-            endif ()
-        endif ()
-    endif ()
-endmacro ()
-
-# Macro for sorting and removing duplicate values
-macro (remove_duplicate LIST_NAME)
-    if (${LIST_NAME})
-        list (SORT ${LIST_NAME})
-        list (REMOVE_DUPLICATES ${LIST_NAME})
-    endif ()
-endmacro ()
-
-# Macro for setting a list from another with option to sort and remove duplicate values
-macro (set_list TO_LIST FROM_LIST)
-    set (${TO_LIST} ${${FROM_LIST}})
-    if (${ARGN} STREQUAL REMOVE_DUPLICATE)
-        remove_duplicate (${TO_LIST})
-    endif ()
-endmacro ()
-
-# Macro for defining source files with optional arguments as follows:
-#  GLOB_CPP_PATTERNS <list> - Use the provided globbing patterns for CPP_FILES instead of the default *.cpp
-#  GLOB_H_PATTERNS <list> - Use the provided globbing patterns for H_FILES instead of the default *.h
-#  EXCLUDE_PATTERNS <list> - Use the provided patterns for excluding matched source files
-#  EXTRA_CPP_FILES <list> - Include the provided list of files into CPP_FILES result
-#  EXTRA_H_FILES <list> - Include the provided list of files into H_FILES result
-#  PCH <list> - Enable precompiled header support on the defined source files using the specified header file, the list is "<path/to/header> [C++|C]"
-#  PARENT_SCOPE - Glob source files in current directory but set the result in parent-scope's variable ${DIR}_CPP_FILES and ${DIR}_H_FILES instead
-#  RECURSE - Option to glob recursively
-#  GROUP - Option to group source files based on its relative path to the corresponding parent directory (only works when PARENT_SCOPE option is not in use)
-macro (define_source_files)
-    # Source files are defined by globbing source files in current source directory and also by including the extra source files if provided
-    cmake_parse_arguments (ARG "PARENT_SCOPE;RECURSE;GROUP" "" "PCH;EXTRA_CPP_FILES;EXTRA_H_FILES;GLOB_CPP_PATTERNS;GLOB_H_PATTERNS;EXCLUDE_PATTERNS" ${ARGN})
-    if (NOT ARG_GLOB_CPP_PATTERNS)
-        set (ARG_GLOB_CPP_PATTERNS *.cpp)    # Default glob pattern
-    endif ()
-    if (NOT ARG_GLOB_H_PATTERNS)
-        set (ARG_GLOB_H_PATTERNS *.h)
-    endif ()
-    if (ARG_RECURSE)
-        set (ARG_RECURSE _RECURSE)
-    else ()
-        unset (ARG_RECURSE)
-    endif ()
-    file (GLOB${ARG_RECURSE} CPP_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${ARG_GLOB_CPP_PATTERNS})
-    file (GLOB${ARG_RECURSE} H_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${ARG_GLOB_H_PATTERNS})
-    if (ARG_EXCLUDE_PATTERNS)
-        set (CPP_FILES_WITH_SENTINEL ";${CPP_FILES};")  # Stringify the lists
-        set (H_FILES_WITH_SENTINEL ";${H_FILES};")
-        foreach (PATTERN ${ARG_EXCLUDE_PATTERNS})
-            foreach (LOOP RANGE 1)
-                string (REGEX REPLACE ";${PATTERN};" ";;" CPP_FILES_WITH_SENTINEL "${CPP_FILES_WITH_SENTINEL}")
-                string (REGEX REPLACE ";${PATTERN};" ";;" H_FILES_WITH_SENTINEL "${H_FILES_WITH_SENTINEL}")
-            endforeach ()
-        endforeach ()
-        set (CPP_FILES ${CPP_FILES_WITH_SENTINEL})      # Convert strings back to lists, extra sentinels are harmless
-        set (H_FILES ${H_FILES_WITH_SENTINEL})
-    endif ()
-    list (APPEND CPP_FILES ${ARG_EXTRA_CPP_FILES})
-    list (APPEND H_FILES ${ARG_EXTRA_H_FILES})
-    set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
-
-    # Optionally enable PCH
-    if (ARG_PCH)
-        enable_pch (${ARG_PCH})
-    endif ()
-
-    # Optionally accumulate source files at parent scope
-    if (ARG_PARENT_SCOPE)
-        get_filename_component (NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
-        set (${NAME}_CPP_FILES ${CPP_FILES} PARENT_SCOPE)
-        set (${NAME}_H_FILES ${H_FILES} PARENT_SCOPE)
-    # Optionally put source files into further sub-group (only works when PARENT_SCOPE option is not in use)
-    elseif (ARG_GROUP)
-        foreach (CPP_FILE ${CPP_FILES})
-            get_filename_component (PATH ${CPP_FILE} PATH)
-            if (PATH)
-                string (REPLACE / \\ PATH ${PATH})
-                source_group ("Source Files\\${PATH}" FILES ${CPP_FILE})
-            endif ()
-        endforeach ()
-        foreach (H_FILE ${H_FILES})
-            get_filename_component (PATH ${H_FILE} PATH)
-            if (PATH)
-                string (REPLACE / \\ PATH ${PATH})
-                source_group ("Header Files\\${PATH}" FILES ${H_FILE})
-            endif ()
-        endforeach ()
-    endif ()
-endmacro ()
-
-# Macro for setting up header files installation for the SDK and the build tree (only support subset of install command arguments)
-#  FILES <list> - File list to be installed
-#  DIRECTORY <list> - Directory list to be installed
-#  FILES_MATCHING - Option to perform file pattern matching on DIRECTORY list
-#  USE_FILE_SYMLINK - Option to use file symlinks on the matched files found in the DIRECTORY list
-#  BUILD_TREE_ONLY - Option to install the header files into the build tree only
-#  PATTERN <list> - Pattern list to be used in file pattern matching option
-#  BASE <value> - An absolute base path to be prepended to the destination path when installing to build tree, default to build tree
-#  DESTINATION <value> - A relative destination path to be installed to
-#  ACCUMULATE <value> - Accumulate the header files into the specified CMake variable, implies USE_FILE_SYMLINK when input list is a directory
-macro (install_header_files)
-    # Need to check if the destination variable is defined first because this macro could be called by downstream project that does not wish to install anything
-    if (DEST_INCLUDE_DIR)
-        # Parse the arguments for the underlying install command for the SDK
-        cmake_parse_arguments (ARG "FILES_MATCHING;USE_FILE_SYMLINK;BUILD_TREE_ONLY" "BASE;DESTINATION;ACCUMULATE" "FILES;DIRECTORY;PATTERN" ${ARGN})
-        unset (INSTALL_MATCHING)
-        if (ARG_FILES)
-            set (INSTALL_TYPE FILES)
-            set (INSTALL_SOURCES ${ARG_FILES})
-        elseif (ARG_DIRECTORY)
-            set (INSTALL_TYPE DIRECTORY)
-            set (INSTALL_SOURCES ${ARG_DIRECTORY})
-            if (ARG_FILES_MATCHING)
-                set (INSTALL_MATCHING FILES_MATCHING)
-                # Our macro supports PATTERN <list> but CMake's install command does not, so convert the list to: PATTERN <value1> PATTERN <value2> ...
-                foreach (PATTERN ${ARG_PATTERN})
-                    list (APPEND INSTALL_MATCHING PATTERN ${PATTERN})
-                endforeach ()
-            endif ()
-        else ()
-            message (FATAL_ERROR "Couldn't setup install command because the install type is not specified.")
-        endif ()
-        if (NOT ARG_DESTINATION)
-            message (FATAL_ERROR "Couldn't setup install command because the install destination is not specified.")
-        endif ()
-        if (NOT ARG_BUILD_TREE_ONLY AND NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
-            install (${INSTALL_TYPE} ${INSTALL_SOURCES} DESTINATION ${ARG_DESTINATION} ${INSTALL_MATCHING})
-        endif ()
-
-        # Reparse the arguments for the create_symlink macro to "install" the header files in the build tree
-        if (NOT ARG_BASE)
-            set (ARG_BASE ${CMAKE_BINARY_DIR})  # Use build tree as base path
-        endif ()
-        foreach (INSTALL_SOURCE ${INSTALL_SOURCES})
-            if (NOT IS_ABSOLUTE ${INSTALL_SOURCE})
-                set (INSTALL_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/${INSTALL_SOURCE})
-            endif ()
-            if (INSTALL_SOURCE MATCHES /$)
-                # Source is a directory
-                if (ARG_USE_FILE_SYMLINK OR ARG_ACCUMULATE OR BASH_ON_WINDOWS)
-                    # Use file symlink for each individual files in the source directory
-                    if (IS_SYMLINK ${ARG_DESTINATION} AND NOT CMAKE_HOST_WIN32)
-                        execute_process (COMMAND ${CMAKE_COMMAND} -E remove ${ARG_DESTINATION})
-                    endif ()
-                    set (GLOBBING_EXPRESSION RELATIVE ${INSTALL_SOURCE})
-                    if (ARG_FILES_MATCHING)
-                        foreach (PATTERN ${ARG_PATTERN})
-                            list (APPEND GLOBBING_EXPRESSION ${INSTALL_SOURCE}${PATTERN})
-                        endforeach ()
-                    else ()
-                        list (APPEND GLOBBING_EXPRESSION ${INSTALL_SOURCE}*)
-                    endif ()
-                    file (GLOB_RECURSE NAMES ${GLOBBING_EXPRESSION})
-                    foreach (NAME ${NAMES})
-                        get_filename_component (PATH ${ARG_DESTINATION}/${NAME} PATH)
-                        # Recreate the source directory structure in the destination path
-                        if (NOT EXISTS ${ARG_BASE}/${PATH})
-                            file (MAKE_DIRECTORY ${ARG_BASE}/${PATH})
-                        endif ()
-                        create_symlink (${INSTALL_SOURCE}${NAME} ${ARG_DESTINATION}/${NAME} FALLBACK_TO_COPY)
-                        if (ARG_ACCUMULATE)
-                            list (APPEND ${ARG_ACCUMULATE} ${ARG_DESTINATION}/${NAME})
-                        endif ()
-                    endforeach ()
-                else ()
-                    # Use a single symlink pointing to the source directory
-                    if (NOT IS_SYMLINK ${ARG_DESTINATION} AND NOT CMAKE_HOST_WIN32)
-                        execute_process (COMMAND ${CMAKE_COMMAND} -E remove_directory ${ARG_DESTINATION})
-                    endif ()
-                    create_symlink (${INSTALL_SOURCE} ${ARG_DESTINATION} FALLBACK_TO_COPY)
-                endif ()
-            else ()
-                # Source is a file (it could also be actually a directory to be treated as a "file", i.e. for creating symlink pointing to the directory)
-                get_filename_component (NAME ${INSTALL_SOURCE} NAME)
-                create_symlink (${INSTALL_SOURCE} ${ARG_DESTINATION}/${NAME} FALLBACK_TO_COPY)
-                if (ARG_ACCUMULATE)
-                    list (APPEND ${ARG_ACCUMULATE} ${ARG_DESTINATION}/${NAME})
-                endif ()
-            endif ()
-        endforeach ()
-    endif ()
-endmacro ()
-
-# Trim the leading white space in the compiler flags, if any
-string (REGEX REPLACE "^ +" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
-string (REGEX REPLACE "^ +" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
-
-# Set common project structure for some platforms
-if (ANDROID)
-    # Enable Android ndk-gdb
-    if (ANDROID_NDK_GDB)
-        set (NDK_GDB_SOLIB_PATH ${CMAKE_BINARY_DIR}/obj/local/${ANDROID_NDK_ABI_NAME}/)
-        file (MAKE_DIRECTORY ${NDK_GDB_SOLIB_PATH})
-        set (NDK_GDB_JNI ${CMAKE_BINARY_DIR}/jni)
-        set (NDK_GDB_MK "# This is a generated file. DO NOT EDIT!\n\nAPP_ABI := ${ANDROID_NDK_ABI_NAME}\n")
-        foreach (MK Android.mk Application.mk)
-            if (NOT EXISTS ${NDK_GDB_JNI}/${MK})
-                file (WRITE ${NDK_GDB_JNI}/${MK} ${NDK_GDB_MK})
-            endif ()
-        endforeach ()
-        get_directory_property (INCLUDE_DIRECTORIES DIRECTORY ${PROJECT_SOURCE_DIR} INCLUDE_DIRECTORIES)
-        string (REPLACE ";" " " INCLUDE_DIRECTORIES "${INCLUDE_DIRECTORIES}")   # Note: need to always "stringify" a variable in list context for replace to work correctly
-        set (NDK_GDB_SETUP "# This is a generated file. DO NOT EDIT!\n\nset solib-search-path ${NDK_GDB_SOLIB_PATH}\ndirectory ${INCLUDE_DIRECTORIES}\n")
-        file (WRITE ${ANDROID_LIBRARY_OUTPUT_PATH}/gdb.setup ${NDK_GDB_SETUP})
-        file (COPY ${ANDROID_NDK}/prebuilt/android-${ANDROID_ARCH_NAME}/gdbserver/gdbserver DESTINATION ${ANDROID_LIBRARY_OUTPUT_PATH})
-    else ()
-        file (REMOVE ${ANDROID_LIBRARY_OUTPUT_PATH}/gdbserver)
-    endif ()
-    # Create symbolic links in the build tree
-    file (MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/Android/assets)
-    if (NOT URHO3D_PACKAGING)
-        foreach (I CoreData Data)
-            if (NOT EXISTS ${CMAKE_SOURCE_DIR}/Android/assets/${I})
-                create_symlink (${CMAKE_SOURCE_DIR}/bin/${I} ${CMAKE_SOURCE_DIR}/Android/assets/${I} FALLBACK_TO_COPY)
-            endif ()
-        endforeach ()
-    endif ()
-    foreach (I AndroidManifest.xml build.xml custom_rules.xml project.properties src res assets jni)
-        if (EXISTS ${CMAKE_SOURCE_DIR}/Android/${I} AND NOT EXISTS ${CMAKE_BINARY_DIR}/${I})    # No-ops when 'Android' is used as build tree
-            create_symlink (${CMAKE_SOURCE_DIR}/Android/${I} ${CMAKE_BINARY_DIR}/${I} FALLBACK_TO_COPY)
-        endif ()
-    endforeach ()
-elseif (WEB)
-    # Create Urho3D custom HTML shell that also embeds our own project logo
-    if (EMSCRIPTEN)
-        if (NOT EXISTS ${CMAKE_BINARY_DIR}/Source/shell.html)
-            file (READ ${EMSCRIPTEN_ROOT_PATH}/src/shell.html SHELL_HTML)
-            string (REPLACE "<!doctype html>" "<!-- This is a generated file. DO NOT EDIT!-->\n\n<!doctype html>" SHELL_HTML "${SHELL_HTML}")     # Stringify to preserve semicolons
-            string (REPLACE "<body>" "<body>\n\n<a href=\"https://urho3d.github.io\" title=\"Urho3D Homepage\"><img src=\"https://urho3d.github.io/assets/images/logo.png\" alt=\"link to https://urho3d.github.io\" height=\"80\" width=\"320\" /></a>\n" SHELL_HTML "${SHELL_HTML}")
-            file (WRITE ${CMAKE_BINARY_DIR}/Source/shell.html "${SHELL_HTML}")
-        endif ()
-    endif ()
-else ()
-    # Ensure the output directory exist before creating the symlinks
-    file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-    # Create symbolic links in the build tree
-    foreach (I Autoload CoreData Data)
-        if (NOT EXISTS ${CMAKE_BINARY_DIR}/bin/${I})
-            create_symlink (${CMAKE_SOURCE_DIR}/bin/${I} ${CMAKE_BINARY_DIR}/bin/${I} FALLBACK_TO_COPY)
-        endif ()
-    endforeach ()
-    # Warn user if PATH environment variable has not been correctly set for using ccache
-    if (NOT CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_WIN32 AND "$ENV{USE_CCACHE}")
-        if (APPLE)
-            set (WHEREIS brew info ccache)
-        else ()
-            set (WHEREIS whereis -b ccache)
-        endif ()
-        execute_process (COMMAND ${WHEREIS} COMMAND grep -o \\S*lib\\S* RESULT_VARIABLE EXIT_CODE OUTPUT_VARIABLE CCACHE_SYMLINK ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
-        if (EXIT_CODE EQUAL 0 AND NOT $ENV{PATH} MATCHES "${CCACHE_SYMLINK}")  # Need to stringify because CCACHE_SYMLINK variable could be empty when the command failed
-            message (WARNING "The lib directory containing the ccache symlinks (${CCACHE_SYMLINK}) has not been added in the PATH environment variable. "
-                "This is required to enable ccache support for native compiler toolchain. CMake has been configured to use the actual compiler toolchain instead of ccache. "
-                "In order to rectify this, the build tree must be regenerated after the PATH environment variable has been adjusted accordingly.")
-        endif ()
-    endif ()
-endif ()
-
-# Post-CMake fixes
-if (IOS)
-    # TODO: can be removed when CMake minimum required has reached 2.8.12
-    if (CMAKE_VERSION VERSION_LESS 2.8.12)
-        # Due to a bug in the CMake/Xcode generator (fixed in 2.8.12) where it has wrongly assumed the IOS bundle structure to be the same as MacOSX bundle structure,
-        # below temporary fix is required in order to solve the auto-linking issue when dependent libraries are changed
-        list (APPEND POST_CMAKE_FIXES COMMAND sed -i '' 's/\\/Contents\\/MacOS//g' ${CMAKE_BINARY_DIR}/CMakeScripts/XCODE_DEPEND_HELPER.make || exit 0)
-    endif ()
-    # TODO: can be removed when CMake minimum required has reached 3.4
-    if (CMAKE_VERSION VERSION_LESS 3.4)
-        # Due to a bug in the CMake/Xcode generator (fixed in 3.4) that prevents iOS targets (library and bundle) to be installed correctly
-        # (see http://public.kitware.com/Bug/bug_relationship_graph.php?bug_id=12506&graph=dependency),
-        # below temporary fix is required to work around the bug
-        list (APPEND POST_CMAKE_FIXES COMMAND sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' ${CMAKE_BINARY_DIR}/CMakeScripts/install_postBuildPhase.make* || exit 0)
-    endif ()
-endif ()
-if (POST_CMAKE_FIXES)
-    add_custom_target (POST_CMAKE_FIXES ALL ${POST_CMAKE_FIXES} COMMENT "Applying post-cmake fixes")
-endif ()
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Limit the supported build configurations
+set (URHO3D_BUILD_CONFIGURATIONS Release RelWithDebInfo Debug)
+set (DOC_STRING "Specify CMake build configuration (single-configuration generator only), possible values are Release (default), RelWithDebInfo, and Debug")
+if (CMAKE_CONFIGURATION_TYPES)
+    # For multi-configurations generator, such as VS and Xcode
+    set (CMAKE_CONFIGURATION_TYPES ${URHO3D_BUILD_CONFIGURATIONS} CACHE STRING ${DOC_STRING} FORCE)
+    unset (CMAKE_BUILD_TYPE)
+else ()
+    # For single-configuration generator, such as Unix Makefile generator
+    if (CMAKE_BUILD_TYPE STREQUAL "")
+        # If not specified then default to Release
+        set (CMAKE_BUILD_TYPE Release)
+    endif ()
+    set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING ${DOC_STRING} FORCE)
+endif ()
+
+# Define other useful variables not defined by CMake
+if (CMAKE_GENERATOR STREQUAL Xcode)
+    set (XCODE TRUE)
+elseif (CMAKE_GENERATOR STREQUAL Ninja)
+    set (NINJA TRUE)
+elseif (CMAKE_GENERATOR MATCHES Visual)
+    set (VS TRUE)
+endif ()
+
+# Rightfully we could have performed this inside a CMake/iOS toolchain file but we don't have one nor need for one for now
+if (IOS)
+    set (CMAKE_CROSSCOMPILING TRUE)
+    set (CMAKE_XCODE_EFFECTIVE_PLATFORMS -iphoneos -iphonesimulator)
+    set (CMAKE_OSX_SYSROOT iphoneos)    # Set Base SDK to "Latest iOS"
+    # This is a CMake hack in order to make standard CMake check modules that use try_compile() internally work on iOS platform
+    # The injected "flags" are not compiler flags, they are actually CMake variables meant for another CMake subprocess that builds the source file being passed in the try_compile() command
+    # CAVEAT: these injected "flags" must always be kept at the end of the string variable, i.e. when adding more compiler flags later on then those new flags must be prepended in front of these flags instead
+    set (CMAKE_REQUIRED_FLAGS ";-DSmileyHack=byYaoWT;-DCMAKE_MACOSX_BUNDLE=1;-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=0")
+    if (NOT IOS_SYSROOT)
+        execute_process (COMMAND xcodebuild -version -sdk ${CMAKE_OSX_SYSROOT} Path OUTPUT_VARIABLE IOS_SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE)   # Obtain iOS sysroot path
+        set (IOS_SYSROOT ${IOS_SYSROOT} CACHE INTERNAL "Path to iOS system root")
+    endif ()
+    set (CMAKE_FIND_ROOT_PATH ${IOS_SYSROOT})
+    if (IPHONEOS_DEPLOYMENT_TARGET)
+        set (CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${IPHONEOS_DEPLOYMENT_TARGET})
+    endif ()
+    set (CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
+    # Workaround what appears to be a bug in CMake/Xcode generator, ensure the CMAKE_OSX_DEPLOYMENT_TARGET is set to empty for iOS build
+    set (CMAKE_OSX_DEPLOYMENT_TARGET)
+    unset (CMAKE_OSX_DEPLOYMENT_TARGET CACHE)
+elseif (XCODE)
+    set (CMAKE_OSX_SYSROOT macosx)    # Set Base SDK to "Latest OS X"
+    if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
+        # If not set, set to current running build system OS version by default
+        execute_process (COMMAND sw_vers -productVersion OUTPUT_VARIABLE CURRENT_OSX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+        string (REGEX REPLACE ^\([^.]+\\.[^.]+\).* \\1 CMAKE_OSX_DEPLOYMENT_TARGET ${CURRENT_OSX_VERSION})
+        set (CMAKE_OSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET} CACHE INTERNAL "OSX deployment target")
+    endif ()
+endif ()
+
+include (CheckHost)
+include (CheckCompilerToolchain)
+
+# Extra linker flags for linking against indirect dependencies (linking shared lib with dependencies)
+if (RPI)
+    # Extra linker flags for Raspbian because it installs VideoCore libraries in the "/opt/vc/lib" directory (no harm in doing so for other distros)
+    set (INDIRECT_DEPS_EXE_LINKER_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} -Wl,-rpath-link,\"${RPI_SYSROOT}/opt/vc/lib\"")      # RPI_SYSROOT is empty when not cross-compiling
+endif ()
+if (ARM AND CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_CROSSCOMPILING)
+    # Cannot do this in the toolchain file because CMAKE_LIBRARY_ARCHITECTURE is not yet defined when CMake is processing toolchain file
+    set (INDIRECT_DEPS_EXE_LINKER_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} -Wl,-rpath-link,\"${ARM_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}\":\"${ARM_SYSROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE}\"")
+endif ()
+set (CMAKE_REQUIRED_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}")
+set (CMAKE_EXE_LINKER_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
+
+# Define all supported build options
+include (CMakeDependentOption)
+option (URHO3D_C++11 "Enable C++11 standard")
+cmake_dependent_option (IOS "Setup build for iOS platform" FALSE "XCODE" FALSE)
+cmake_dependent_option (URHO3D_64BIT "Enable 64-bit build, the default is set based on the native ABI of the chosen compiler toolchain" ${NATIVE_64BIT} "NOT MSVC AND NOT ANDROID AND NOT (ARM AND NOT IOS) AND NOT WEB AND NOT POWERPC" ${NATIVE_64BIT})     # Intentionally only enable the option for iOS but not for tvOS as the latter is 64-bit only
+option (URHO3D_ANGELSCRIPT "Enable AngelScript scripting support" TRUE)
+option (URHO3D_LUA "Enable additional Lua scripting support" TRUE)
+option (URHO3D_NAVIGATION "Enable navigation support" TRUE)
+cmake_dependent_option (URHO3D_NETWORK "Enable networking support" TRUE "NOT WEB" FALSE)
+option (URHO3D_PHYSICS "Enable physics support" TRUE)
+option (URHO3D_URHO2D "Enable 2D graphics and physics support" TRUE)
+if (ARM AND NOT ANDROID AND NOT RPI AND NOT IOS AND NOT TVOS)
+    set (ARM_ABI_FLAGS "" CACHE STRING "Specify ABI compiler flags (ARM on Linux cross-compiling build only); e.g. Orange-Pi Mini 2 could use '-mcpu=cortex-a7 -mfpu=neon-vfpv4'")
+endif ()
+if (IOS OR (RPI AND "${RPI_ABI}" MATCHES NEON) OR (ARM AND (URHO3D_64BIT OR "${ARM_ABI_FLAGS}" MATCHES neon)))    # Stringify in case RPI_ABI/ARM_ABI_FLAGS is not set explicitly
+    # The 'NEON' CMake variable is already set by android.toolchain.cmake when the chosen ANDROID_ABI uses NEON
+    set (NEON TRUE)
+endif ()
+# For Raspbery Pi, find Broadcom VideoCore IV firmware
+if (RPI)
+    # TODO: this logic is earmarked to be moved into SDL's CMakeLists.txt when refactoring the library dependency handling
+    find_package (VideoCore REQUIRED)
+    include_directories (${VIDEOCORE_INCLUDE_DIRS})
+    link_directories (${VIDEOCORE_LIBRARY_DIRS})
+endif ()
+if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
+    set (URHO3D_LIB_TYPE STATIC CACHE STRING "Specify Urho3D library type, possible values are STATIC (default) and SHARED")
+    # The URHO3D_OPENGL option is not available on non-Windows platforms as they should always use OpenGL, i.e. URHO3D_OPENGL variable will always be forced to TRUE
+    if (MSVC)
+        # On MSVC compiler, default to false (i.e. prefers Direct3D)
+        # OpenGL can be manually enabled with -DURHO3D_OPENGL=1, but Windows graphics card drivers are usually better optimized for Direct3D
+        set (DEFAULT_OPENGL FALSE)
+    else ()
+        # On non-MSVC compiler on Windows platform, default to true to enable use of OpenGL instead of Direct3D
+        # Direct3D can be manually enabled with -DURHO3D_OPENGL=0, but it is likely to fail unless the MinGW-w64 distribution is used due to dependency to Direct3D headers and libs
+        set (DEFAULT_OPENGL TRUE)
+    endif ()
+    cmake_dependent_option (URHO3D_OPENGL "Use OpenGL instead of Direct3D (Windows platform only)" ${DEFAULT_OPENGL} "WIN32" TRUE)      # Force the variable to TRUE when not WIN32
+    # On Windows platform Direct3D11 can be optionally chosen
+    # Using Direct3D11 on non-MSVC compiler may require copying and renaming Microsoft official libraries (.lib to .a), else link failures or non-functioning graphics may result
+    cmake_dependent_option (URHO3D_D3D11 "Use Direct3D11 instead of Direct3D9 (Windows platform only); overrides URHO3D_OPENGL option" FALSE "WIN32" FALSE)
+    if (NOT ARM)
+        # It is not possible to turn SSE off on 64-bit MSVC and it appears it is also not able to do so safely on 64-bit GCC
+        cmake_dependent_option (URHO3D_SSE "Enable SSE/SSE2 instruction set (32-bit Web and Intel platforms only, including Android on Intel Atom); default to true on Intel and false on Web platform; the effective SSE level could be higher, see also URHO3D_DEPLOYMENT_TARGET and CMAKE_OSX_DEPLOYMENT_TARGET build options" ${HAVE_SSE2} "NOT URHO3D_64BIT" TRUE)
+    endif ()
+    cmake_dependent_option (URHO3D_3DNOW "Enable 3DNow! instruction set (Linux platform only); should only be used for older CPU with (legacy) 3DNow! support" ${HAVE_3DNOW} "NOT WIN32 AND NOT APPLE AND NOT WEB AND NOT ARM AND NOT URHO3D_SSE" FALSE)
+    cmake_dependent_option (URHO3D_MMX "Enable MMX instruction set (32-bit Linux platform only); the MMX is effectively enabled when 3DNow! or SSE is enabled; should only be used for older CPU with MMX support" ${HAVE_MMX} "NOT WIN32 AND NOT APPLE AND NOT WEB AND NOT ARM AND NOT URHO3D_64BIT AND NOT URHO3D_SSE AND NOT URHO3D_3DNOW" FALSE)
+    # For completeness sake - this option is intentionally not documented as we do not officially support PowerPC (yet)
+    cmake_dependent_option (URHO3D_ALTIVEC "Enable AltiVec instruction set (PowerPC only)" ${HAVE_ALTIVEC} POWERPC FALSE)
+    cmake_dependent_option (URHO3D_LUAJIT "Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)" FALSE "NOT WEB" 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/LuaJIT only)" FALSE "URHO3D_LUA OR URHO3D_LUAJIT" FALSE)
+    if (CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_CONFIGURATION_TYPES)
+        set (URHO3D_DEFAULT_LUA_RAW FALSE)
+    else ()
+        set (URHO3D_DEFAULT_LUA_RAW TRUE)
+    endif ()
+    cmake_dependent_option (URHO3D_LUA_RAW_SCRIPT_LOADER "Prefer loading raw script files from the file system before falling back on Urho3D resource cache. Useful for debugging (e.g. breakpoints), but less performant (Lua/LuaJIT only)" ${URHO3D_DEFAULT_LUA_RAW} "URHO3D_LUA OR URHO3D_LUAJIT" FALSE)
+    option (URHO3D_SAMPLES "Build sample applications" TRUE)
+    option (URHO3D_UPDATE_SOURCE_TREE "Enable commands to copy back some of the generated build artifacts from build tree to source tree to facilitate devs to push them as part of a commit (for library devs with push right only)")
+    option (URHO3D_BINDINGS "Enable API binding generation support for script subystems")
+    cmake_dependent_option (URHO3D_CLANG_TOOLS "Build Clang tools (native on host system only)" FALSE "NOT ANDROID AND NOT ARM AND NOT WEB" FALSE)
+    mark_as_advanced (URHO3D_UPDATE_SOURCE_TREE URHO3D_BINDINGS URHO3D_CLANG_TOOLS)
+    cmake_dependent_option (URHO3D_TOOLS "Build tools (native, RPI, and generic ARM only)" TRUE "NOT IOS AND NOT ANDROID AND NOT WEB" FALSE)
+    cmake_dependent_option (URHO3D_EXTRAS "Build extras (native, RPI, and generic ARM only)" FALSE "NOT IOS AND NOT ANDROID AND NOT WEB" FALSE)
+    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_PCH "Enable PCH support" TRUE)
+    cmake_dependent_option (URHO3D_DATABASE_ODBC "Enable Database support with ODBC, requires vendor-specific ODBC driver" FALSE "NOT IOS AND NOT ANDROID AND NOT WEB;NOT MSVC OR NOT MSVC_VERSION VERSION_LESS 1900" FALSE)
+    option (URHO3D_DATABASE_SQLITE "Enable Database support with SQLite embedded")
+    cmake_dependent_option (URHO3D_MINIDUMPS "Enable minidumps on crash (VS only)" TRUE "MSVC" FALSE)
+    option (URHO3D_FILEWATCHER "Enable filewatcher support" TRUE)
+    option (URHO3D_TESTING "Enable testing support")
+    cmake_dependent_option (URHO3D_STATIC_RUNTIME "Use static C/C++ runtime libraries and eliminate the need for runtime DLLs installation (VS only)" FALSE "MSVC" FALSE)
+    if (((URHO3D_LUA AND NOT URHO3D_LUAJIT) OR URHO3D_DATABASE_SQLITE) AND NOT ANDROID AND NOT IOS AND NOT WEB AND NOT WIN32)
+        # Find GNU Readline development library for Lua interpreter and SQLite's isql
+        find_package (Readline)
+    endif ()
+    if (CPACK_SYSTEM_NAME STREQUAL Linux)
+        cmake_dependent_option (URHO3D_USE_LIB64_RPM "Enable 64-bit RPM CPack generator using /usr/lib64 and disable all other generators (Debian-based host only)" FALSE "URHO3D_64BIT AND NOT HAS_LIB64" FALSE)
+        cmake_dependent_option (URHO3D_USE_LIB_DEB "Enable 64-bit DEB CPack generator using /usr/lib and disable all other generators (Redhat-based host only)" FALSE "URHO3D_64BIT AND HAS_LIB64" FALSE)
+    endif ()
+    # Set to search in 'lib' or 'lib64' based on the chosen ABI
+    if (NOT CMAKE_HOST_WIN32)
+        set_property (GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${URHO3D_64BIT})
+    endif ()
+else ()
+    set (URHO3D_LIB_TYPE "" CACHE STRING "Specify Urho3D library type, possible values are STATIC and SHARED")
+    set (URHO3D_HOME "" CACHE PATH "Path to Urho3D build tree or SDK installation location (downstream project only)")
+    if (URHO3D_PCH OR URHO3D_UPDATE_SOURCE_TREE OR URHO3D_TOOLS)
+        # Just reference it to suppress "unused variable" CMake warning on downstream projects using this CMake module
+    endif ()
+    if (CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
+        set (URHO3D_SSE ${HAVE_SSE2})
+    else ()
+        # All Urho3D downstream projects require Urho3D library, so find Urho3D library here now
+        find_package (Urho3D REQUIRED)
+        include_directories (${URHO3D_INCLUDE_DIRS})
+    endif ()
+endif ()
+option (URHO3D_PACKAGING "Enable resources packaging support, on Web platform default to 1, on other platforms default to 0" ${WEB})
+option (URHO3D_PROFILING "Enable profiling support" TRUE)
+option (URHO3D_LOGGING "Enable logging support" TRUE)
+# Emscripten thread support is yet experimental; default false
+if (NOT WEB)
+    option (URHO3D_THREADING "Enable thread support, on Web platform default to 0, on other platforms default to 1" TRUE)
+else ()
+    option (URHO3D_THREADING "Enable thread support, on Web platform default to 0, on other platforms default to 1" FALSE)
+endif ()
+if (URHO3D_TESTING)
+    if (WEB)
+        set (DEFAULT_TIMEOUT 10)
+        if (EMSCRIPTEN)
+            set (EMSCRIPTEN_EMRUN_BROWSER firefox CACHE STRING "Specify the particular browser to be spawned by emrun during testing (Emscripten cross-compiling build only), use 'emrun --list_browsers' command to get the list of possible values")
+        endif ()
+    else ()
+        set (DEFAULT_TIMEOUT 5)
+    endif ()
+    set (URHO3D_TEST_TIMEOUT ${DEFAULT_TIMEOUT} CACHE STRING "Number of seconds to test run the executables (when testing support is enabled only), default to 10 on Web platform and 5 on other platforms")
+else ()
+    unset (URHO3D_TEST_TIMEOUT CACHE)
+    if (EMSCRIPTEN_EMRUN_BROWSER)   # Suppress unused variable warning at the same time
+        unset (EMSCRIPTEN_EMRUN_BROWSER CACHE)
+    endif ()
+endif ()
+cmake_dependent_option (URHO3D_WIN32_CONSOLE "Use console main() as entry point when setting up Windows executable targets (Windows platform only)" FALSE "WIN32" FALSE)
+cmake_dependent_option (URHO3D_MACOSX_BUNDLE "Use MACOSX_BUNDLE when setting up Mac OS X executable targets (Xcode native build only)" FALSE "XCODE AND NOT IOS" FALSE)
+if (CMAKE_CROSSCOMPILING AND NOT ANDROID AND NOT IOS)
+    set (URHO3D_SCP_TO_TARGET "" CACHE STRING "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")
+else ()
+    unset (URHO3D_SCP_TO_TARGET CACHE)
+endif ()
+if (ANDROID)
+    set (ANDROID TRUE CACHE INTERNAL "Setup build for Android platform")
+    cmake_dependent_option (ANDROID_NDK_GDB "Enable ndk-gdb for debugging (Android build only)" FALSE "CMAKE_BUILD_TYPE STREQUAL Debug" FALSE)
+else ()
+    unset (ANDROID_NDK_GDB CACHE)
+endif ()
+if (MINGW AND CMAKE_CROSSCOMPILING)
+    set (MINGW_PREFIX "" CACHE STRING "Prefix path to MinGW cross-compiler tools (MinGW cross-compiling build only)")
+    set (MINGW_SYSROOT "" CACHE PATH "Path to MinGW system root (MinGW build only); should only be used when the system root could not be auto-detected")
+    # When cross-compiling then we are most probably in Unix-alike host environment which should not have problem to handle long include dirs
+    # This change is required to keep ccache happy because it does not like the CMake generated include response file
+    foreach (lang C CXX)
+        foreach (cat OBJECTS INCLUDES)
+            unset (CMAKE_${lang}_USE_RESPONSE_FILE_FOR_${cat})
+        endforeach ()
+    endforeach ()
+endif ()
+if (RPI)
+    if (NOT RPI_SUPPORTED_ABIS)
+        set (RPI_SUPPORTED_ABIS armeabi-v6)
+        if (CMAKE_CROSSCOMPILING)
+            # We have no way to know for sure so just give all the available options to user
+            list (APPEND RPI_SUPPORTED_ABIS armeabi-v7a "armeabi-v7a with NEON" "armeabi-v7a with VFPV4")
+        else ()
+            # If not cross-compiling then we should be on the host system (device) itself, so below command is safe to be executed
+            execute_process (COMMAND uname -m OUTPUT_VARIABLE HOST_MACHINE ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+            if (HOST_MACHINE MATCHES ^armv7)
+                list (APPEND RPI_SUPPORTED_ABIS armeabi-v7a "armeabi-v7a with NEON" "armeabi-v7a with VFPV4")
+                if (NOT RPI_ABI)
+                    set (RPI_ABI armeabi-v7a)   # Set default to this specific target device
+                endif ()
+            endif ()
+        endif ()
+        set (RPI_SUPPORTED_ABIS ${RPI_SUPPORTED_ABIS} CACHE INTERNAL "Supported target ABIs for RPI build")
+    endif ()
+    if (CMAKE_CROSSCOMPILING)
+        set (RPI_PREFIX "" CACHE STRING "Prefix path to Raspberry Pi cross-compiler tools (RPI cross-compiling build only)")
+        set (RPI_SYSROOT "" CACHE PATH "Path to Raspberry Pi system root (RPI cross-compiling build only)")
+    endif ()
+    if (RPI_ABI)
+        list (FIND RPI_SUPPORTED_ABIS ${RPI_ABI} RPI_ABI_FOUND_INDEX)
+        if (RPI_ABI_FOUND_INDEX EQUAL -1)
+            string (REPLACE ";" "\", \"" PRINTABLE_RPI_SUPPORTED_ABIS "${RPI_SUPPORTED_ABIS}")  # Stringify for string replace to work
+            if (NOT CMAKE_CROSSCOMPILING)
+                set (MSG_STR " by this Raspberry Pi device")
+            endif ()
+            message (FATAL_ERROR "Specified RPI_ABI = \"${RPI_ABI}\" is not supported${MSG_STR}. Supported values are: \"${PRINTABLE_RPI_SUPPORTED_ABIS}\".")
+        endif()
+    else ()
+        set (RPI_ABI armeabi-v6)
+    endif ()
+    set (RPI_ABI ${RPI_ABI} CACHE STRING "Specify target ABI (RPI build only), possible values are armeabi-v6 (default for RPI 1), armeabi-v7a (default for RPI 2), armeabi-v7a with NEON, and armeabi-v7a with VFPV4" FORCE)
+endif ()
+if (EMSCRIPTEN)     # CMAKE_CROSSCOMPILING is always true for Emscripten
+    set (EMSCRIPTEN_ROOT_PATH "" CACHE PATH "Root path to Emscripten cross-compiler tools (Emscripten cross-compiling build only)")
+    set (EMSCRIPTEN_SYSROOT "" CACHE PATH "Path to Emscripten system root (Emscripten cross-compiling build only)")
+    option (EMSCRIPTEN_ALLOW_MEMORY_GROWTH "Enable memory growing based on application demand (Emscripten cross-compiling build only)")
+    math (EXPR EMSCRIPTEN_TOTAL_MEMORY "128 * 1024 * 1024")     # This option is ignored when EMSCRIPTEN_ALLOW_MEMORY_GROWTH option is set
+    set (EMSCRIPTEN_TOTAL_MEMORY ${EMSCRIPTEN_TOTAL_MEMORY} CACHE STRING "Specify the total size of memory to be used (Emscripten cross-compiling build only); default to 128 MB, this option is ignored when EMSCRIPTEN_ALLOW_MEMORY_GROWTH=1")
+    set (EMSCRIPTEN_SHARE_DATA FALSE CACHE BOOL "Enable sharing data file support (Emscripten cross-compiling build only)")
+    set (EMSCRIPTEN_SYSTEM_LIBS "" CACHE STRING "Specify a semicolon-separated list of additional system libraries that should be pre-built using embuilder.py, by default 'dlmalloc', 'libc', 'libcxxabi', and 'gl' will be pre-built, so they should not be listed again (Emscripten cross-compiling build only); when using CMake CLI on Unix-like host systems, the semicolon may need to be properly escaped; see usage of embuilder.py to get the full list of supported system libraries")
+endif ()
+# Constrain the build option values in cmake-gui, if applicable
+if (CMAKE_VERSION VERSION_GREATER 2.8 OR CMAKE_VERSION VERSION_EQUAL 2.8)
+    set_property (CACHE URHO3D_LIB_TYPE PROPERTY STRINGS STATIC SHARED)
+    if (NOT CMAKE_CONFIGURATION_TYPES)
+        set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${URHO3D_BUILD_CONFIGURATIONS})
+    endif ()
+    if (RPI)
+        set_property (CACHE RPI_ABI PROPERTY STRINGS ${RPI_SUPPORTED_ABIS})
+    endif ()
+endif()
+
+# Union all the sysroot variables into one so it can be referred to generically later
+# TODO: to be replaced with CMAKE_SYSROOT later if it is more beneficial
+set (SYSROOT ${ANDROID_SYSROOT} ${RPI_SYSROOT} ${ARM_SYSROOT} ${MINGW_SYSROOT} ${IOS_SYSROOT} ${EMSCRIPTEN_SYSROOT} CACHE INTERNAL "Path to system root of the cross-compiling target")  # SYSROOT is empty for native build
+
+# Clang tools building
+if (URHO3D_CLANG_TOOLS OR URHO3D_BINDINGS)
+    # Ensure LLVM/Clang is installed
+    find_program (LLVM_CONFIG NAMES llvm-config llvm-config-64 llvm-config-32 HINTS $ENV{LLVM_CLANG_ROOT}/bin DOC "LLVM config tool" NO_CMAKE_FIND_ROOT_PATH)
+    if (NOT LLVM_CONFIG)
+        message (FATAL_ERROR "Could not find LLVM/Clang installation")
+    endif ()
+endif ()
+if (URHO3D_CLANG_TOOLS)
+    # Require C++11 standard and no precompiled-header
+    set (URHO3D_C++11 1)
+    set (URHO3D_PCH 0)
+    set (URHO3D_LIB_TYPE SHARED)
+    # Set build options that would maximise the AST of Urho3D library
+    foreach (OPT URHO3D_ANGELSCRIPT URHO3D_LUA URHO3D_FILEWATCHER URHO3D_PROFILING URHO3D_LOGGING URHO3D_NAVIGATION URHO3D_NETWORK URHO3D_PHYSICS URHO3D_URHO2D URHO3D_DATABASE_SQLITE)
+        set (${OPT} 1)
+    endforeach()
+    foreach (OPT URHO3D_TESTING URHO3D_LUAJIT URHO3D_DATABASE_ODBC)
+        set (${OPT} 0)
+    endforeach()
+endif ()
+
+# Enable testing
+if (URHO3D_TESTING)
+    enable_testing ()
+endif ()
+
+# Enable coverity scan modeling
+if ($ENV{COVERITY_SCAN_BRANCH})
+    add_definitions (-DCOVERITY_SCAN_MODEL)
+endif ()
+
+# Enable/disable SIMD instruction set for STB image (do it here instead of in the STB CMakeLists.txt because the header files are exposed to Urho3D library user)
+if (NEON)
+    if (NOT XCODE)
+        add_definitions (-DSTBI_NEON)   # Cannot define it directly for Xcode due to universal binary support, we define it in the setup_target() macro instead for Xcode
+    endif ()
+elseif (NOT URHO3D_SSE)
+    add_definitions (-DSTBI_NO_SIMD)    # GCC/Clang/MinGW will switch this off automatically except MSVC, but no harm to make it explicit for all
+endif ()
+
+# Enable structured exception handling and minidumps on MSVC only.
+if (MSVC AND URHO3D_MINIDUMPS)
+    add_definitions (-DURHO3D_MINIDUMPS)
+endif ()
+
+# By default use the MSVC dynamic runtime. To eliminate the need to distribute the runtime installer,
+# this can be switched off if not using Urho3D as a shared library.
+if (MSVC AND URHO3D_STATIC_RUNTIME)
+    set (RELEASE_RUNTIME /MT)
+    set (DEBUG_RUNTIME /MTd)
+endif ()
+
+# By default Windows platform setups main executable as Windows application with WinMain() as entry point
+# this build option overrides the default to set the main executable as console application with main() as entry point instead
+if (URHO3D_WIN32_CONSOLE)
+    add_definitions (-DURHO3D_WIN32_CONSOLE)
+endif ()
+
+# Enable file watcher support for automatic resource reloads by default.
+if (URHO3D_FILEWATCHER)
+    add_definitions (-DURHO3D_FILEWATCHER)
+endif ()
+
+# Enable profiling by default. If disabled, autoprofileblocks become no-ops and the Profiler subsystem is not instantiated.
+if (URHO3D_PROFILING)
+    add_definitions (-DURHO3D_PROFILING)
+endif ()
+
+# Enable logging by default. If disabled, LOGXXXX macros become no-ops and the Log subsystem is not instantiated.
+if (URHO3D_LOGGING)
+    add_definitions (-DURHO3D_LOGGING)
+endif ()
+
+# Enable threading by default, except for Emscripten.
+if (URHO3D_THREADING)
+    add_definitions (-DURHO3D_THREADING)
+endif ()
+
+# Add definitions for Emscripten
+if (EMSCRIPTEN)
+    add_definitions (-DNO_POPEN)
+endif ()
+
+# URHO3D_D3D11 overrides URHO3D_OPENGL option
+if (URHO3D_D3D11)
+    set (URHO3D_OPENGL 0)
+endif ()
+
+# Add definitions for GLEW
+if (NOT ANDROID AND NOT ARM AND NOT WEB AND URHO3D_OPENGL)
+    add_definitions (-DGLEW_STATIC -DGLEW_NO_GLU)
+endif ()
+
+# Default library type is STATIC
+if (URHO3D_LIB_TYPE)
+    string (TOUPPER ${URHO3D_LIB_TYPE} URHO3D_LIB_TYPE)
+endif ()
+if (NOT URHO3D_LIB_TYPE STREQUAL SHARED)
+    set (URHO3D_LIB_TYPE STATIC)
+    if (MSVC)
+        # This define will be baked into the export header for MSVC compiler
+        set (URHO3D_STATIC_DEFINE 1)
+    else ()
+        add_definitions (-DURHO3D_STATIC_DEFINE)
+    endif ()
+endif ()
+
+# Add definition for AngelScript
+if (URHO3D_ANGELSCRIPT)
+    add_definitions (-DURHO3D_ANGELSCRIPT)
+    # Force C++11 if using Emscripten + AngelScript (required by the generic bindings generation)
+    if (EMSCRIPTEN OR (ARM AND NATIVE_64BIT))
+        set (URHO3D_C++11 1)
+    endif ()
+endif ()
+
+# Add definition for Lua and LuaJIT
+if (URHO3D_LUAJIT)
+    set (JIT JIT)
+    # Implied URHO3D_LUA
+    set (URHO3D_LUA 1)
+endif ()
+if (URHO3D_LUA)
+    add_definitions (-DURHO3D_LUA)
+    # Optionally enable Lua / C++ wrapper safety checks
+    if (NOT URHO3D_SAFE_LUA)
+        add_definitions (-DTOLUA_RELEASE)
+    endif ()
+endif ()
+if (URHO3D_LUA_RAW_SCRIPT_LOADER)
+    add_definitions (-DURHO3D_LUA_RAW_SCRIPT_LOADER)
+endif ()
+
+# Add definition for Navigation
+if (URHO3D_NAVIGATION)
+    add_definitions (-DURHO3D_NAVIGATION)
+endif ()
+
+# Add definition for Network
+if (URHO3D_NETWORK)
+    add_definitions (-DURHO3D_NETWORK)
+endif ()
+
+# Add definition for Physics
+if (URHO3D_PHYSICS)
+    add_definitions (-DURHO3D_PHYSICS)
+endif ()
+
+# Add definition for Urho2D
+if (URHO3D_URHO2D)
+    add_definitions (-DURHO3D_URHO2D)
+endif ()
+
+# Add definition for Database
+if (URHO3D_DATABASE_ODBC)
+    set (URHO3D_DATABASE_SQLITE 0)
+    find_package (ODBC REQUIRED)
+    set (URHO3D_C++11 1)
+endif ()
+if (URHO3D_DATABASE_SQLITE OR URHO3D_DATABASE_ODBC)
+    set (URHO3D_DATABASE 1)
+    add_definitions (-DURHO3D_DATABASE)
+endif ()
+
+# TODO: The logic below is earmarked to be moved into SDL's CMakeLists.txt when refactoring the library dependency handling, until then ensure the DirectX package is not being searched again in external projects such as when building LuaJIT library
+if (WIN32 AND NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
+    set (DIRECTX_REQUIRED_COMPONENTS)
+    set (DIRECTX_OPTIONAL_COMPONENTS DInput DSound XAudio2 XInput)
+    if (NOT URHO3D_OPENGL)
+        if (URHO3D_D3D11)
+            list (APPEND DIRECTX_REQUIRED_COMPONENTS D3D11)
+        else ()
+            list (APPEND DIRECTX_REQUIRED_COMPONENTS D3D)
+        endif ()
+    endif ()
+    find_package (DirectX REQUIRED ${DIRECTX_REQUIRED_COMPONENTS} OPTIONAL_COMPONENTS ${DIRECTX_OPTIONAL_COMPONENTS})
+    if (DIRECTX_FOUND)
+        include_directories (${DIRECTX_INCLUDE_DIRS})   # These variables may be empty when WinSDK or MinGW is being used
+        link_directories (${DIRECTX_LIBRARY_DIRS})
+    endif ()
+endif ()
+
+# Platform and compiler specific options
+if (URHO3D_C++11)
+    add_definitions (-DURHO3D_CXX11)   # Note the define is NOT 'URHO3D_C++11'!
+    if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
+        # Use gnu++11/gnu++0x instead of c++11/c++0x as the latter does not work as expected when cross compiling
+        if (VERIFIED_SUPPORTED_STANDARD)
+            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=${VERIFIED_SUPPORTED_STANDARD}")
+        else ()
+            foreach (STANDARD gnu++11 gnu++0x)  # Fallback to gnu++0x on older GCC version
+                execute_process (COMMAND ${CMAKE_COMMAND} -E echo COMMAND ${CMAKE_CXX_COMPILER} -std=${STANDARD} -E - RESULT_VARIABLE GCC_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
+                if (GCC_EXIT_CODE EQUAL 0)
+                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=${STANDARD}")
+                    set (VERIFIED_SUPPORTED_STANDARD ${STANDARD} CACHE INTERNAL "GNU extension of C++11 standard that is verified to be supported by the chosen compiler")
+                    break ()
+                endif ()
+            endforeach ()
+            if (NOT GCC_EXIT_CODE EQUAL 0)
+                message (FATAL_ERROR "Your GCC version ${COMPILER_VERSION} is too old to enable C++11 standard")
+            endif ()
+        endif ()
+    elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
+        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+    elseif (MSVC80)
+        message (FATAL_ERROR "Your MSVC version is too told to enable C++11 standard")
+    endif ()
+endif ()
+if (APPLE)
+    if (IOS)
+        # IOS-specific setup
+        add_definitions (-DIOS)
+        if (URHO3D_64BIT)
+            if (DEFINED ENV{XCODE_64BIT_ONLY})                  # This environment variable is set automatically when ccache is just being cleared in Travis CI VM
+                set (CMAKE_OSX_ARCHITECTURES "arm64 x86_64")    # This is a hack to temporarily only build 64-bit archs to reduce overall build time for one build
+            else ()
+                set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD))
+            endif ()
+        else ()
+            set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
+        endif ()
+    else ()
+        if (XCODE)
+            # OSX-specific setup
+            if (URHO3D_64BIT)
+                if (DEFINED ENV{XCODE_64BIT_ONLY})
+                    set (CMAKE_OSX_ARCHITECTURES x86_64)
+                else ()
+                    set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_64_BIT))
+                endif ()
+            else ()
+                set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
+            endif ()
+        endif ()
+    endif ()
+    # Common OSX and iOS bundle setup
+    if (IOS OR URHO3D_MACOSX_BUNDLE)
+        # Only set the bundle properties to its default when they are not explicitly specified by user
+        if (NOT MACOSX_BUNDLE_GUI_IDENTIFIER)
+            set (MACOSX_BUNDLE_GUI_IDENTIFIER com.github.urho3d.\${PRODUCT_NAME:rfc1034identifier:lower})
+        endif ()
+        if (NOT MACOSX_BUNDLE_BUNDLE_NAME)
+            set (MACOSX_BUNDLE_BUNDLE_NAME \${PRODUCT_NAME})
+        endif ()
+    endif ()
+endif ()
+if (MSVC)
+    # VS-specific setup
+    add_definitions (-D_CRT_SECURE_NO_WARNINGS)
+    set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_RUNTIME}")
+    set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_RUNTIME} /fp:fast /Zi /GS-")
+    set (CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELWITHDEBINFO})
+    set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_RUNTIME}")
+    set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_RUNTIME} /fp:fast /Zi /GS- /D _SECURE_SCL=0")
+    set (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
+    # In Visual Studio, SSE2 flag is redundant if already compiling as 64bit; it is already the default for VS2012 (onward) on 32bit
+    # Instead, we must turn SSE/SSE2 off explicitly if user really intends to turn it off
+    if (URHO3D_SSE)
+        if (NOT URHO3D_64BIT AND MSVC_VERSION LESS 1700)
+            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
+            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
+        endif ()
+    else ()
+        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:IA32")
+        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:IA32")
+    endif ()
+    set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF /DEBUG")
+    set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF")
+else ()
+    # GCC/Clang-specific setup
+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof")
+    if (NOT ANDROID)    # Most of the flags are already setup in android.toolchain.cmake module
+        if (ARM AND CMAKE_SYSTEM_NAME STREQUAL Linux)
+            # Common compiler flags for aarch64-linux-gnu and arm-linux-gnueabihf, we do not support Windows on arm for now
+            set (ARM_CFLAGS "${ARM_CFLAGS} -fsigned-char -pipe")
+            if (NOT URHO3D_64BIT)
+                # We only support armhf distros, so turn on hard-float by default
+                set (ARM_CFLAGS "${ARM_CFLAGS} -mfloat-abi=hard -Wno-psabi")
+            endif ()
+            # The configuration is done here instead of in CMake toolchain file because we also support native build which does not use toolchain file at all
+            if (RPI)
+                # RPI-specific setup
+                add_definitions (-DRPI)
+                if (RPI_ABI MATCHES ^armeabi-v7a)
+                    set (ARM_CFLAGS "${ARM_CFLAGS} -mcpu=cortex-a7")
+                    if (RPI_ABI MATCHES NEON)
+                        set (ARM_CFLAGS "${ARM_CFLAGS} -mfpu=neon-vfpv4")
+                    elseif (RPI_ABI MATCHES VFPV4)
+                        set (ARM_CFLAGS "${ARM_CFLAGS} -mfpu=vfpv4")
+                    else ()
+                        set (ARM_CFLAGS "${ARM_CFLAGS} -mfpu=vfpv4-d16")
+                    endif ()
+                else ()
+                    set (ARM_CFLAGS "${ARM_CFLAGS} -mcpu=arm1176jzf-s -mfpu=vfp")
+                endif ()
+            else ()
+                # Generic ARM-specific setup
+                add_definitions (-DGENERIC_ARM)
+                if (URHO3D_64BIT)
+                    # aarch64 has only one valid arch so far
+                    set (ARM_CFLAGS "${ARM_CFLAGS} -march=armv8-a")
+                elseif (URHO3D_ANGELSCRIPT)
+                    # Angelscript seems to fail to compile using Thumb states, so force to use ARM states by default
+                    set (ARM_CFLAGS "${ARM_CFLAGS} -marm")
+                endif ()
+                if (ARM_ABI_FLAGS)
+                    # Instead of guessing all the possible ABIs, user would have to specify the ABI compiler flags explicitly via ARM_ABI_FLAGS build option
+                    set (ARM_CFLAGS "${ARM_CFLAGS} ${ARM_ABI_FLAGS}")
+                endif ()
+            endif ()
+            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM_CFLAGS}")
+            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARM_CFLAGS}")
+        else ()
+            if (URHO3D_SSE AND NOT XCODE AND NOT WEB)
+                # This may influence the effective SSE level when URHO3D_SSE is on as well
+                set (URHO3D_DEPLOYMENT_TARGET native CACHE STRING "Specify the minimum CPU type on which the target binaries are to be deployed (Linux, MinGW, and non-Xcode OSX native build only), see GCC/Clang's -march option for possible values; Use 'generic' for targeting a wide range of generic processors")
+                if (NOT URHO3D_DEPLOYMENT_TARGET STREQUAL generic)
+                    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${URHO3D_DEPLOYMENT_TARGET}")
+                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${URHO3D_DEPLOYMENT_TARGET}")
+                endif ()
+            endif ()
+            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
+            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
+            # We don't add these flags directly here for Xcode because we support Mach-O universal binary build
+            # The compiler flags will be added later conditionally when the effective arch is i386 during build time (using XCODE_ATTRIBUTE target property)
+            if (NOT XCODE)
+                if (NOT URHO3D_64BIT)
+                    # Not the compiler native ABI, this could only happen on multilib-capable compilers
+                    if (NATIVE_64BIT)
+                        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
+                        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
+                    endif ()
+                    # The effective SSE level could be higher, see also URHO3D_DEPLOYMENT_TARGET and CMAKE_OSX_DEPLOYMENT_TARGET build options
+                    # The -mfpmath=sse is not set in global scope but it may be set in local scope when building LuaJIT sub-library for x86 arch
+                    if (URHO3D_SSE)
+                        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse -msse2")
+                        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2")
+                    endif ()
+                endif ()
+                if (NOT URHO3D_SSE)
+                    if (URHO3D_64BIT OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+                        # Clang enables SSE support for i386 ABI by default, so use the '-mno-sse' compiler flag to nullify that and make it consistent with GCC
+                        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mno-sse")
+                        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-sse")
+                    endif ()
+                    if (URHO3D_MMX)
+                        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmmx")
+                        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmmx")
+                    endif()
+                    if (URHO3D_3DNOW)
+                        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m3dnow")
+                        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m3dnow")
+                    endif ()
+                endif ()
+                # For completeness sake only as we do not support PowerPC (yet)
+                if (URHO3D_ALTIVEC)
+                    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maltivec")
+                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec")
+                endif ()
+            endif ()
+        endif ()
+        if (WEB)
+            if (EMSCRIPTEN)
+                # Emscripten-specific setup
+                set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-warn-absolute-paths -Wno-unknown-warning-option")
+                set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-warn-absolute-paths -Wno-unknown-warning-option")
+                if (URHO3D_THREADING)
+                    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_PTHREADS=1")
+                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_PTHREADS=1")
+                endif ()
+                # Prior to version 1.31.3 emcc does not consistently add the cpp standard and remove Emscripten-specific compiler flags
+                # before passing on the work to the underlying LLVM/Clang compiler, this has resulted in preprocessing error when enabling the PCH and ccache
+                # (See https://github.com/kripken/emscripten/issues/3365 for more detail)
+                if (EMCC_VERSION VERSION_LESS 1.31.3)
+                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
+                endif ()
+                set (CMAKE_C_FLAGS_RELEASE "-Oz -DNDEBUG")
+                set (CMAKE_CXX_FLAGS_RELEASE "-Oz -DNDEBUG")
+                # CMake does not treat Emscripten as a valid platform yet, certain platform-specific variables cannot be set in the
+                # toolchain file as they get overwritten by CMake internally as per Linux platform default, so set them here for now
+                set (CMAKE_EXECUTABLE_SUFFIX_C .html)
+                set (CMAKE_EXECUTABLE_SUFFIX_CXX .html)
+                # Linker flags
+                if (EMSCRIPTEN_ALLOW_MEMORY_GROWTH)
+                    set (MEMORY_LINKER_FLAGS "-s ALLOW_MEMORY_GROWTH=1")
+                else ()
+                    set (MEMORY_LINKER_FLAGS "-s TOTAL_MEMORY=${EMSCRIPTEN_TOTAL_MEMORY}")
+                endif ()
+                set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MEMORY_LINKER_FLAGS} -s NO_EXIT_RUNTIME=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1")
+                set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -O3 -s AGGRESSIVE_VARIABLE_ELIMINATION=1")     # Remove variables to make the -O3 regalloc easier
+                set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -g4")     # Preserve LLVM debug information, show line number debug comments, and generate source maps
+                if (URHO3D_TESTING)
+                    set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --emrun")  # Inject code into the generated Module object to enable capture of stdout, stderr and exit()
+                endif ()
+            endif ()
+        elseif (MINGW)
+            # MinGW-specific setup
+            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc -fno-keep-inline-dllexport")
+            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -static-libgcc -static-libstdc++ -fno-keep-inline-dllexport")
+            if (NOT URHO3D_64BIT)
+                # Prevent auto-vectorize optimization when using -O3, unless stack realign is being enforced globally
+                if (URHO3D_SSE)
+                    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mstackrealign")
+                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mstackrealign")
+                    add_definitions (-DSTBI_MINGW_ENABLE_SSE2)
+                else ()
+                    if (DEFINED ENV{TRAVIS})
+                        # TODO: Remove this workaround when Travis CI VM has been migrated to Ubuntu 14.04 LTS
+                        set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-tree-slp-vectorize -fno-tree-vectorize")
+                        set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-slp-vectorize -fno-tree-vectorize")
+                    else ()
+                        set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-tree-loop-vectorize -fno-tree-slp-vectorize -fno-tree-vectorize")
+                        set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-loop-vectorize -fno-tree-slp-vectorize -fno-tree-vectorize")
+                    endif ()
+                endif ()
+            endif ()
+        else ()
+            # Not Android and not Emscripten and not MinGW derivative
+            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")     # This will emit '-DREENTRANT' to compiler and '-lpthread' to linker on Linux and Mac OSX platform
+            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") # However, it may emit other equivalent compiler define and/or linker flag on other *nix platforms
+        endif ()
+        set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG -D_DEBUG")
+        set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -D_DEBUG")
+    endif ()
+    if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+        # Clang-specific
+        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments")
+        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
+        if (NINJA OR "$ENV{USE_CCACHE}")    # Stringify to guard against undefined environment variable
+            # When ccache support is on, these flags keep the color diagnostics pipe through ccache output and suppress Clang warning due ccache internal preprocessing step
+            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
+            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
+        endif ()
+        # Temporary workaround for Travis CI VM as Ubuntu 12.04 LTS still uses old glibc header files that do not have the necessary patch for Clang to work correctly
+        # TODO: Remove this workaround when Travis CI VM has been migrated to Ubuntu 14.04 LTS
+        if (DEFINED ENV{TRAVIS} AND "$ENV{LINUX}")
+            add_definitions (-D__extern_always_inline=inline)
+        endif ()
+    else ()
+        # GCC-specific
+        if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9.1)
+            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=auto")
+            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto")
+        endif ()
+    endif ()
+endif ()
+# LuaJIT specific - extra linker flags for linking against LuaJIT (adapted from LuaJIT's original Makefile)
+if (URHO3D_LUAJIT)
+    if (URHO3D_64BIT AND APPLE AND NOT IOS)
+        # 64-bit Mac OS X: it simply won't work without these flags; if you are reading this comment then you may want to know the following also
+        # it's recommended to rebase all (self-compiled) shared libraries which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua), see: man rebase
+        set (LUAJIT_EXE_LINKER_FLAGS_APPLE "-pagezero_size 10000 -image_base 100000000")
+        set (LUAJIT_SHARED_LINKER_FLAGS_APPLE "-image_base 7fff04c4a000")
+        if (NOT XCODE)
+            set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LUAJIT_EXE_LINKER_FLAGS_APPLE}")
+            set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LUAJIT_SHARED_LINKER_FLAGS_APPLE}")
+        endif ()
+    elseif (URHO3D_LIB_TYPE STREQUAL STATIC AND NOT WIN32 AND NOT APPLE)    # The original condition also checks: AND NOT SunOS AND NOT PS3
+        # We assume user may want to load C modules compiled for plain Lua with require(), so we have to ensure all the public symbols are exported when linking with Urho3D (and therefore LuaJIT) statically
+        # Note: this implies that loading such modules on Windows platform may only work with SHARED library type
+        set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-E")
+    endif ()
+endif ()
+
+# Macro for setting common output directories
+include (CMakeParseArguments)
+macro (set_output_directories OUTPUT_PATH)
+    cmake_parse_arguments (ARG LOCAL "" "" ${ARGN})
+    if (ARG_LOCAL)
+        unset (SCOPE)
+        unset (OUTPUT_DIRECTORY_PROPERTIES)
+    else ()
+        set (SCOPE CMAKE_)
+    endif ()
+    foreach (TYPE ${ARG_UNPARSED_ARGUMENTS})
+        set (${SCOPE}${TYPE}_OUTPUT_DIRECTORY ${OUTPUT_PATH})
+        list (APPEND OUTPUT_DIRECTORY_PROPERTIES ${TYPE}_OUTPUT_DIRECTORY ${${TYPE}_OUTPUT_DIRECTORY})
+        foreach (CONFIG ${CMAKE_CONFIGURATION_TYPES})
+            string (TOUPPER ${CONFIG} CONFIG)
+            set (${SCOPE}${TYPE}_OUTPUT_DIRECTORY_${CONFIG} ${OUTPUT_PATH})
+            list (APPEND OUTPUT_DIRECTORY_PROPERTIES ${TYPE}_OUTPUT_DIRECTORY_${CONFIG} ${${TYPE}_OUTPUT_DIRECTORY_${CONFIG}})
+        endforeach ()
+        if (TYPE STREQUAL RUNTIME AND NOT ${OUTPUT_PATH} STREQUAL .)
+            file (RELATIVE_PATH REL_OUTPUT_PATH ${CMAKE_BINARY_DIR} ${OUTPUT_PATH})
+            set (DEST_RUNTIME_DIR ${REL_OUTPUT_PATH})
+        endif ()
+    endforeach ()
+    if (ARG_LOCAL)
+        list (APPEND TARGET_PROPERTIES ${OUTPUT_DIRECTORY_PROPERTIES})
+    endif ()
+endmacro ()
+
+# Set common binary output directory for all platforms if not already set (note that this module can be included in an external project which already has DEST_RUNTIME_DIR preset)
+if (NOT DEST_RUNTIME_DIR)
+    set_output_directories (${CMAKE_BINARY_DIR}/bin RUNTIME PDB)
+endif ()
+
+# Macro for setting symbolic link on platform that supports it
+macro (create_symlink SOURCE DESTINATION)
+    # Make absolute paths so they work more reliably on cmake-gui
+    if (IS_ABSOLUTE ${SOURCE})
+        set (ABS_SOURCE ${SOURCE})
+    else ()
+        set (ABS_SOURCE ${CMAKE_SOURCE_DIR}/${SOURCE})
+    endif ()
+    if (IS_ABSOLUTE ${DESTINATION})
+        set (ABS_DESTINATION ${DESTINATION})
+    else ()
+        set (ABS_DESTINATION ${CMAKE_BINARY_DIR}/${DESTINATION})
+    endif ()
+    if (CMAKE_HOST_WIN32)
+        if (IS_DIRECTORY ${ABS_SOURCE})
+            set (SLASH_D /D)
+        else ()
+            unset (SLASH_D)
+        endif ()
+        if (HAS_MKLINK)
+            if (NOT EXISTS ${ABS_DESTINATION})
+                # Have to use string-REPLACE as file-TO_NATIVE_PATH does not work as expected with MinGW on "backward slash" host system
+                string (REPLACE / \\ BACKWARD_ABS_DESTINATION ${ABS_DESTINATION})
+                string (REPLACE / \\ BACKWARD_ABS_SOURCE ${ABS_SOURCE})
+                execute_process (COMMAND cmd /C mklink ${SLASH_D} ${BACKWARD_ABS_DESTINATION} ${BACKWARD_ABS_SOURCE} OUTPUT_QUIET ERROR_QUIET)
+            endif ()
+        elseif (${ARGN} STREQUAL FALLBACK_TO_COPY)
+            if (SLASH_D)
+                set (COMMAND COMMAND ${CMAKE_COMMAND} -E copy_directory ${ABS_SOURCE} ${ABS_DESTINATION})
+            else ()
+                set (COMMAND COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ABS_SOURCE} ${ABS_DESTINATION})
+            endif ()
+            # Fallback to copy only one time
+            execute_process (${COMMAND})
+            if (TARGET ${TARGET_NAME})
+                # Fallback to copy every time the target is built
+                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD ${COMMAND})
+            endif ()
+        else ()
+            message (WARNING "Unable to create symbolic link on this host system, you may need to manually copy file/dir from \"${SOURCE}\" to \"${DESTINATION}\"")
+        endif ()
+    else ()
+        execute_process (COMMAND ${CMAKE_COMMAND} -E create_symlink ${ABS_SOURCE} ${ABS_DESTINATION})
+    endif ()
+endmacro ()
+
+include (GenerateExportHeader)
+
+# Macro for precompiling header (On MSVC, the dummy C++ or C implementation file for precompiling the header file would be generated if not already exists)
+# This macro should be called before the CMake target has been added
+# Typically, user should indirectly call this macro by using the 'PCH' option when calling define_source_files() macro
+macro (enable_pch HEADER_PATHNAME)
+    # No op when PCH support is not enabled
+    if (URHO3D_PCH)
+        # Get the optional LANG parameter to indicate whether the header should be treated as C or C++ header, default to C++
+        if ("${ARGN}" STREQUAL C)   # Stringify as the LANG paramater could be empty
+            set (EXT c)
+            set (LANG C)
+            set (LANG_H c-header)
+        else ()
+            # This is the default
+            set (EXT cpp)
+            set (LANG CXX)
+            set (LANG_H c++-header)
+        endif ()
+        # Relative path is resolved using CMAKE_CURRENT_SOURCE_DIR
+        if (IS_ABSOLUTE ${HEADER_PATHNAME})
+            set (ABS_HEADER_PATHNAME ${HEADER_PATHNAME})
+        else ()
+            set (ABS_HEADER_PATHNAME ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER_PATHNAME})
+        endif ()
+        # Determine the precompiled header output filename
+        get_filename_component (HEADER_FILENAME ${HEADER_PATHNAME} NAME)
+        if (CMAKE_COMPILER_IS_GNUCXX)
+            # GNU g++
+            set (PCH_FILENAME ${HEADER_FILENAME}.gch)
+        else ()
+            # Clang or MSVC
+            set (PCH_FILENAME ${HEADER_FILENAME}.pch)
+        endif ()
+
+        if (MSVC)
+            get_filename_component (NAME_WE ${HEADER_FILENAME} NAME_WE)
+            if (TARGET ${TARGET_NAME})
+                if (VS)
+                    # VS is multi-config, the exact path is only known during actual build time based on effective build config
+                    set (PCH_PATHNAME "$(IntDir)${PCH_FILENAME}")
+                else ()
+                    set (PCH_PATHNAME ${CMAKE_CURRENT_BINARY_DIR}/${PCH_FILENAME})
+                endif ()
+                foreach (FILE ${SOURCE_FILES})
+                    if (FILE MATCHES \\.${EXT}$)
+                        if (FILE MATCHES ${NAME_WE}\\.${EXT}$)
+                            # Precompiling header file
+                            set_property (SOURCE ${FILE} APPEND_STRING PROPERTY COMPILE_FLAGS " /Fp${PCH_PATHNAME} /Yc${HEADER_FILENAME}")     # Need a leading space for appending
+                        else ()
+                            # Using precompiled header file
+                            set_property (SOURCE ${FILE} APPEND_STRING PROPERTY COMPILE_FLAGS " /Fp${PCH_PATHNAME} /Yu${HEADER_FILENAME} /FI${HEADER_FILENAME}")
+                        endif ()
+                    endif ()
+                endforeach ()
+                unset (${TARGET_NAME}_HEADER_PATHNAME)
+            else ()
+                # The target has not been created yet, so set an internal variable to come back here again later
+                set (${TARGET_NAME}_HEADER_PATHNAME ${ARGV})
+                # But proceed to add the dummy C++ or C implementation file if necessary
+                set (${LANG}_FILENAME ${NAME_WE}.${EXT})
+                get_filename_component (PATH ${HEADER_PATHNAME} PATH)
+                if (PATH)
+                    set (PATH ${PATH}/)
+                endif ()
+                list (FIND SOURCE_FILES ${PATH}${${LANG}_FILENAME} ${LANG}_FILENAME_FOUND)
+                if (${LANG}_FILENAME_FOUND STREQUAL -1)
+                    if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${${LANG}_FILENAME})
+                        # Only generate it once so that its timestamp is not touched unnecessarily
+                        file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/${${LANG}_FILENAME} "// This is a generated file. DO NOT EDIT!\n\n#include \"${HEADER_FILENAME}\"")
+                    endif ()
+                    list (INSERT SOURCE_FILES 0 ${${LANG}_FILENAME})
+                endif ()
+            endif ()
+        elseif (XCODE)
+            if (TARGET ${TARGET_NAME})
+                # Precompiling and using precompiled header file
+                set_target_properties (${TARGET_NAME} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER ${ABS_HEADER_PATHNAME})
+                unset (${TARGET_NAME}_HEADER_PATHNAME)
+            else ()
+                # The target has not been created yet, so set an internal variable to come back here again later
+                set (${TARGET_NAME}_HEADER_PATHNAME ${ARGV})
+            endif ()
+        else ()
+            # GCC or Clang
+            if (TARGET ${TARGET_NAME})
+                # Precompiling header file
+                get_directory_property (COMPILE_DEFINITIONS COMPILE_DEFINITIONS)
+                get_directory_property (INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES)
+                get_target_property (TYPE ${TARGET_NAME} TYPE)
+                if (TYPE MATCHES SHARED)
+                    list (APPEND COMPILE_DEFINITIONS ${TARGET_NAME}_EXPORTS)
+                    # todo: Reevaluate the replacement of this deprecated function (since CMake 2.8.12) when the CMake minimum required version is set to 2.8.12
+                    # At the moment it seems using the function is the "only way" to get the export flags into a CMake variable
+                    # Additionally, CMake implementation of 'VISIBILITY_INLINES_HIDDEN' has a bug (tested in 2.8.12.2) that it erroneously sets the flag for C compiler too
+                    add_compiler_export_flags (COMPILER_EXPORT_FLAGS)
+                    # To cater for MinGW which already uses PIC for all codes
+                    if (NOT MINGW)
+                        set (COMPILER_EXPORT_FLAGS "${COMPILER_EXPORT_FLAGS} -fPIC")
+                    endif ()
+                elseif (PROJECT_NAME STREQUAL Urho3D AND NOT ${TARGET_NAME} STREQUAL Urho3D AND URHO3D_LIB_TYPE STREQUAL SHARED)
+                    # If it is one of the Urho3D library dependency then use the same PIC flag as Urho3D library
+                    if (NOT MINGW)
+                        set (COMPILER_EXPORT_FLAGS -fPIC)
+                    endif ()
+                endif ()
+                string (REPLACE ";" " -D" COMPILE_DEFINITIONS "-D${COMPILE_DEFINITIONS}")
+                string (REPLACE "\"" "\\\"" COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS})
+                string (REPLACE ";" "\" -I\"" INCLUDE_DIRECTORIES "-I\"${INCLUDE_DIRECTORIES}\"")
+                # Make sure the precompiled headers are not stale by creating custom rules to re-compile the header as necessary
+                file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PCH_FILENAME})
+                foreach (CONFIG ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})   # These two vars are mutually exclusive
+                    # Generate *.rsp containing configuration specific compiler flags
+                    string (TOUPPER ${CONFIG} UPPERCASE_CONFIG)
+                    file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new "${COMPILE_DEFINITIONS} ${CLANG_${LANG}_FLAGS} ${CMAKE_${LANG}_FLAGS} ${CMAKE_${LANG}_FLAGS_${UPPERCASE_CONFIG}} ${COMPILER_EXPORT_FLAGS} ${INCLUDE_DIRECTORIES} -c -x ${LANG_H}")
+                    execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp)
+                    file (REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new)
+                    # Determine the dependency list
+                    execute_process (COMMAND ${CMAKE_${LANG}_COMPILER} @${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp -MTdeps -MM -o ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.deps ${ABS_HEADER_PATHNAME} RESULT_VARIABLE ${LANG}_COMPILER_EXIT_CODE)
+                    if (NOT ${LANG}_COMPILER_EXIT_CODE EQUAL 0)
+                        message (FATAL_ERROR
+                            "The configured compiler toolchain in the build tree is not able to handle all the compiler flags required to build the project with PCH enabled. "
+                            "Please kindly update your compiler toolchain to its latest version. "
+                            "If you are using MinGW then make sure it is MinGW-W64 instead of MinGW-W32 or TDM-GCC (Code::Blocks default). "
+                            "Or disable the PCH build support by passing the '-DURHO3D_PCH=0' when retrying to configure/generate the build tree. "
+                            "However, if you think there is something wrong with our build system then kindly file a bug report to the project devs.")
+                    endif ()
+                    file (STRINGS ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.deps DEPS)
+                    string (REGEX REPLACE "^deps: *| *\\; *" ";" DEPS ${DEPS})
+                    string (REGEX REPLACE "\\\\ " "\ " DEPS "${DEPS}")  # Need to stringify the second time to preserve the semicolons
+                    # Create the rule that depends on the included headers
+                    add_custom_command (OUTPUT ${HEADER_FILENAME}.${CONFIG}.pch.trigger
+                        COMMAND ${CMAKE_${LANG}_COMPILER} @${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp -o ${PCH_FILENAME}/${PCH_FILENAME}.${CONFIG} ${ABS_HEADER_PATHNAME}
+                        COMMAND ${CMAKE_COMMAND} -E touch ${HEADER_FILENAME}.${CONFIG}.pch.trigger
+                        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp ${DEPS}
+                        COMMENT "Precompiling header file '${HEADER_FILENAME}' for ${CONFIG} configuration")
+                endforeach ()
+                # Using precompiled header file
+                if ($ENV{COVERITY_SCAN_BRANCH})
+                    # Coverity scan does not support PCH so workaround by including the actual header file
+                    set (ABS_PATH_PCH ${ABS_HEADER_PATHNAME})
+                else ()
+                    set (ABS_PATH_PCH ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME})
+                endif ()
+                set (CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS} -include \"${ABS_PATH_PCH}\"")
+                unset (${TARGET_NAME}_HEADER_PATHNAME)
+            else ()
+                # The target has not been created yet, so set an internal variable to come back here again later
+                set (${TARGET_NAME}_HEADER_PATHNAME ${ARGV})
+                # But proceed to add the dummy source file(s) to trigger the custom command output rule
+                if (CMAKE_CONFIGURATION_TYPES)
+                    # Multi-config, trigger all rules and let the compiler to choose which precompiled header is suitable to use
+                    foreach (CONFIG ${CMAKE_CONFIGURATION_TYPES})
+                        list (APPEND TRIGGERS ${HEADER_FILENAME}.${CONFIG}.pch.trigger)
+                    endforeach ()
+                else ()
+                    # Single-config, just trigger the corresponding rule matching the current build configuration
+                    set (TRIGGERS ${HEADER_FILENAME}.${CMAKE_BUILD_TYPE}.pch.trigger)
+                endif ()
+                list (APPEND SOURCE_FILES ${TRIGGERS})
+            endif ()
+        endif ()
+    endif ()
+endmacro ()
+
+# Macro for setting up dependency lib for compilation and linking of a target
+macro (setup_target)
+    # Include directories
+    include_directories (${INCLUDE_DIRS})
+    # Link libraries
+    define_dependency_libs (${TARGET_NAME})
+    target_link_libraries (${TARGET_NAME} ${ABSOLUTE_PATH_LIBS} ${LIBS})
+    # Enable PCH if requested
+    if (${TARGET_NAME}_HEADER_PATHNAME)
+        enable_pch (${${TARGET_NAME}_HEADER_PATHNAME})
+    endif ()
+    # Set additional linker dependencies (only work for Makefile-based generator according to CMake documentation)
+    if (LINK_DEPENDS)
+        string (REPLACE ";" "\;" LINK_DEPENDS "${LINK_DEPENDS}")        # Stringify for string replacement
+        list (APPEND TARGET_PROPERTIES LINK_DEPENDS "${LINK_DEPENDS}")  # Stringify with semicolons already escaped
+        unset (LINK_DEPENDS)
+    endif ()
+    # Extra compiler flags for Xcode which are dynamically changed based on active arch in order to support Mach-O universal binary targets
+    # We don't add the ABI flag for Xcode because it automatically passes '-arch i386' compiler flag when targeting 32 bit which does the same thing as '-m32'
+    if (XCODE)
+        # Speed up build when in Debug configuration by building active arch only
+        list (FIND TARGET_PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH ATTRIBUTE_ALREADY_SET)
+        if (ATTRIBUTE_ALREADY_SET EQUAL -1)
+            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<$<CONFIG:Debug>:YES>)
+        endif ()
+        if (NEON)
+            if (IOS)
+                set (SDK iphoneos)
+            elseif (TVOS)
+                set (SDK appletvos)
+            endif ()
+            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_OTHER_CFLAGS[sdk=${SDK}*] "-DSTBI_NEON $(OTHER_CFLAGS)")
+            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_OTHER_CPLUSPLUSFLAGS[sdk=${SDK}*] "-DSTBI_NEON $(OTHER_CPLUSPLUSFLAGS)")
+        elseif (NOT URHO3D_SSE)
+            # Nullify the Clang default so that it is consistent with GCC
+            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_OTHER_CFLAGS[arch=i386] "-mno-sse $(OTHER_CFLAGS)")
+            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_OTHER_CPLUSPLUSFLAGS[arch=i386] "-mno-sse $(OTHER_CPLUSPLUSFLAGS)")
+        endif ()
+    endif ()
+    if (TARGET_PROPERTIES)
+        set_target_properties (${TARGET_NAME} PROPERTIES ${TARGET_PROPERTIES})
+        unset (TARGET_PROPERTIES)
+    endif ()
+
+    # Workaround CMake/Xcode generator bug where it always appends '/build' path element to SYMROOT attribute and as such the items in Products are always rendered as red in the Xcode IDE as if they are not yet built
+    if (NOT DEFINED ENV{TRAVIS})
+        if (XCODE AND NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
+            file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/build)
+            get_target_property (LOCATION ${TARGET_NAME} LOCATION)
+            string (REGEX REPLACE "^.*\\$\\(CONFIGURATION\\)" $(CONFIGURATION) SYMLINK ${LOCATION})
+            get_filename_component (DIRECTORY ${SYMLINK} PATH)
+            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+                COMMAND mkdir -p ${DIRECTORY} && ln -sf $<TARGET_FILE:${TARGET_NAME}> ${DIRECTORY}/$<TARGET_FILE_NAME:${TARGET_NAME}>
+                WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build)
+        endif ()
+    endif ()
+endmacro ()
+
+# Macro for checking the SOURCE_FILES variable is properly initialized
+macro (check_source_files)
+    if (NOT SOURCE_FILES)
+        message (FATAL_ERROR "Could not configure and generate the project file because no source files have been defined yet. "
+            "You can define the source files explicitly by setting the SOURCE_FILES variable in your CMakeLists.txt; or "
+            "by calling the define_source_files() macro which would by default glob all the C++ source files found in the same scope of "
+            "CMakeLists.txt where the macro is being called and the macro would set the SOURCE_FILES variable automatically. "
+            "If your source files are not located in the same directory as the CMakeLists.txt or your source files are "
+            "more than just C++ language then you probably have to pass in extra arguments when calling the macro in order to make it works. "
+            "See the define_source_files() macro definition in the CMake/Modules/Urho3D-CMake-common.cmake for more detail.")
+    endif ()
+endmacro ()
+
+# Macro for setting up a library target
+# Macro arguments:
+#  NODEPS - setup library target without defining Urho3D dependency libraries (applicable for downstream projects)
+#  STATIC/SHARED/MODULE/EXCLUDE_FROM_ALL - see CMake help on add_library() command
+# CMake variables:
+#  SOURCE_FILES - list of source files
+#  INCLUDE_DIRS - list of directories for include search path
+#  LIBS - list of dependent libraries that are built internally in the project
+#  ABSOLUTE_PATH_LIBS - list of dependent libraries that are external to the project
+#  LINK_DEPENDS - list of additional files on which a target binary depends for linking (Makefile-based generator only)
+#  TARGET_PROPERTIES - list of target properties
+macro (setup_library)
+    cmake_parse_arguments (ARG NODEPS "" "" ${ARGN})
+    check_source_files ()
+    add_library (${TARGET_NAME} ${ARG_UNPARSED_ARGUMENTS} ${SOURCE_FILES})
+    get_target_property (LIB_TYPE ${TARGET_NAME} TYPE)
+    if (NOT ARG_NODEPS AND NOT PROJECT_NAME STREQUAL Urho3D)
+        define_dependency_libs (Urho3D)
+    endif ()
+    if (XCODE AND LUAJIT_SHARED_LINKER_FLAGS_APPLE AND LIB_TYPE STREQUAL SHARED_LIBRARY)
+        list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=x86_64] "${LUAJIT_SHARED_LINKER_FLAGS_APPLE} $(OTHER_LDFLAGS)")    # Xcode universal build linker flags when targeting 64-bit OSX with LuaJIT enabled
+    endif ()
+    setup_target ()
+
+    # Setup the compiler flags for building shared library
+    if (LIB_TYPE STREQUAL SHARED_LIBRARY)
+        # Hide the symbols that are not explicitly marked for export
+        add_compiler_export_flags ()
+    endif ()
+
+    if (PROJECT_NAME STREQUAL Urho3D)
+        # Accumulate all the dependent static libraries that are used in building the Urho3D library itself
+        if (NOT ${TARGET_NAME} STREQUAL Urho3D AND LIB_TYPE STREQUAL STATIC_LIBRARY)
+            set (STATIC_LIBRARY_TARGETS ${STATIC_LIBRARY_TARGETS} ${TARGET_NAME} PARENT_SCOPE)
+        endif ()
+    elseif (URHO3D_SCP_TO_TARGET)
+        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${URHO3D_SCP_TO_TARGET} || exit 0
+            COMMENT "Scp-ing ${TARGET_NAME} library to target system")
+    endif ()
+endmacro ()
+
+# Macro for setting up an executable target
+# Macro arguments:
+#  PRIVATE - setup executable target without installing it
+#  TOOL - setup a tool executable target
+#  NODEPS - setup executable target without defining Urho3D dependency libraries
+#  WIN32/MACOSX_BUNDLE/EXCLUDE_FROM_ALL - see CMake help on add_executable() command
+# CMake variables:
+#  SOURCE_FILES - list of source files
+#  INCLUDE_DIRS - list of directories for include search path
+#  LIBS - list of dependent libraries that are built internally in the project
+#  ABSOLUTE_PATH_LIBS - list of dependent libraries that are external to the project
+#  LINK_DEPENDS - list of additional files on which a target binary depends for linking (Makefile-based generator only)
+#  TARGET_PROPERTIES - list of target properties
+macro (setup_executable)
+    cmake_parse_arguments (ARG "PRIVATE;TOOL;NODEPS" "" "" ${ARGN})
+    check_source_files ()
+    add_executable (${TARGET_NAME} ${ARG_UNPARSED_ARGUMENTS} ${SOURCE_FILES})
+    set (RUNTIME_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+    if (ARG_PRIVATE)
+        set_output_directories (. LOCAL RUNTIME PDB)
+        set (RUNTIME_DIR .)
+    endif ()
+    if (ARG_TOOL)
+        list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH YES)
+        if (NOT ARG_PRIVATE AND NOT DEST_RUNTIME_DIR MATCHES tool)
+            set_output_directories (${CMAKE_BINARY_DIR}/bin/tool LOCAL RUNTIME PDB)
+            set (RUNTIME_DIR ${CMAKE_BINARY_DIR}/bin/tool)
+        endif ()
+    endif ()
+    if (NOT ARG_NODEPS)
+        define_dependency_libs (Urho3D)
+    endif ()
+    if (XCODE AND LUAJIT_EXE_LINKER_FLAGS_APPLE)
+        list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=x86_64] "${LUAJIT_EXE_LINKER_FLAGS_APPLE} $(OTHER_LDFLAGS)")    # Xcode universal build linker flags when targeting 64-bit OSX with LuaJIT enabled
+    endif ()
+    setup_target ()
+
+    if (URHO3D_SCP_TO_TARGET)
+        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${URHO3D_SCP_TO_TARGET} || exit 0
+            COMMENT "Scp-ing ${TARGET_NAME} executable to target system")
+    endif ()
+    if (WIN32 AND NOT ARG_NODEPS AND URHO3D_LIB_TYPE STREQUAL SHARED AND RUNTIME_DIR)
+        # Make a copy of the Urho3D DLL to the runtime directory in the build tree
+        if (TARGET Urho3D)
+            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Urho3D> ${RUNTIME_DIR})
+        else ()
+            foreach (DLL ${URHO3D_DLL})
+                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DLL} ${RUNTIME_DIR})
+            endforeach ()
+        endif ()
+    endif ()
+    if (DIRECT3D_DLL AND NOT ARG_NODEPS AND RUNTIME_DIR)
+        # Make a copy of the D3D DLL to the runtime directory in the build tree
+        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DIRECT3D_DLL} ${RUNTIME_DIR})
+    endif ()
+    # Need to check if the destination variable is defined first because this macro could be called by downstream project that does not wish to install anything
+    if (NOT ARG_PRIVATE)
+        if (WEB AND DEST_BUNDLE_DIR)
+            # todo: Just use generator-expression when CMake minimum version is 3.0
+            if (CMAKE_VERSION VERSION_LESS 3.0)
+                get_target_property (LOCATION ${TARGET_NAME} LOCATION)
+                get_filename_component (LOCATION ${LOCATION} DIRECTORY)
+            else ()
+                set (LOCATION $<TARGET_FILE_DIR:${TARGET_NAME}>)
+            endif ()
+            unset (FILES)
+            foreach (EXT data html html.map html.mem js)
+                list (APPEND FILES ${LOCATION}/${TARGET_NAME}.${EXT})
+            endforeach ()
+            install (FILES ${FILES} DESTINATION ${DEST_BUNDLE_DIR} OPTIONAL)    # We get html.map or html.mem depend on the build configuration
+        elseif (DEST_RUNTIME_DIR AND (DEST_BUNDLE_DIR OR NOT IOS))
+            install (TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${DEST_RUNTIME_DIR} BUNDLE DESTINATION ${DEST_BUNDLE_DIR})
+            if (WIN32 AND NOT ARG_NODEPS AND URHO3D_LIB_TYPE STREQUAL SHARED AND NOT URHO3D_DLL_INSTALLED)
+                if (TARGET Urho3D)
+                    install (FILES $<TARGET_FILE:Urho3D> DESTINATION ${DEST_RUNTIME_DIR})
+                else ()
+                    install (FILES ${URHO3D_DLL} DESTINATION ${DEST_RUNTIME_DIR})
+                endif ()
+                set (URHO3D_DLL_INSTALLED TRUE)
+            endif ()
+            if (DIRECT3D_DLL AND NOT DIRECT3D_DLL_INSTALLED)
+                # Make a copy of the D3D DLL to the runtime directory in the installed location
+                install (FILES ${DIRECT3D_DLL} DESTINATION ${DEST_RUNTIME_DIR})
+                set (DIRECT3D_DLL_INSTALLED TRUE)
+            endif ()
+        endif ()
+    endif ()
+endmacro ()
+
+# Macro for finding file in Urho3D build tree or Urho3D SDK
+macro (find_Urho3D_file VAR NAME)
+    # Pass the arguments to the actual find command
+    cmake_parse_arguments (ARG "" "DOC;MSG_MODE" "HINTS;PATHS;PATH_SUFFIXES" ${ARGN})
+    find_file (${VAR} ${NAME} HINTS ${ARG_HINTS} PATHS ${ARG_PATHS} PATH_SUFFIXES ${ARG_PATH_SUFFIXES} DOC ${ARG_DOC} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+    mark_as_advanced (${VAR})  # Hide it from cmake-gui in non-advanced mode
+    if (NOT ${VAR} AND ARG_MSG_MODE)
+        message (${ARG_MSG_MODE}
+            "Could not find ${VAR} file in the Urho3D build tree or Urho3D SDK. "
+            "Please reconfigure and rebuild your Urho3D build tree or reinstall the SDK for the correct target platform.")
+    endif ()
+endmacro ()
+
+# Macro for finding tool in Urho3D build tree or Urho3D SDK
+macro (find_Urho3D_tool VAR NAME)
+    # Pass the arguments to the actual find command
+    cmake_parse_arguments (ARG "" "DOC;MSG_MODE" "HINTS;PATHS;PATH_SUFFIXES" ${ARGN})
+    find_program (${VAR} ${NAME} HINTS ${ARG_HINTS} PATHS ${ARG_PATHS} PATH_SUFFIXES ${ARG_PATH_SUFFIXES} DOC ${ARG_DOC} NO_DEFAULT_PATH)
+    mark_as_advanced (${VAR})  # Hide it from cmake-gui in non-advanced mode
+    if (NOT ${VAR})
+        set (${VAR} ${CMAKE_BINARY_DIR}/bin/tool/${NAME})
+        if (ARG_MSG_MODE AND NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
+            message (${ARG_MSG_MODE}
+                "Could not find ${VAR} tool in the Urho3D build tree or Urho3D SDK. Your project may not build successfully without this tool. "
+                "You may have to first rebuild the Urho3D in its build tree or reinstall Urho3D SDK to get this tool built or installed properly. "
+                "Alternatively, copy the ${VAR} executable manually into bin/tool subdirectory in your own project build tree.")
+        endif ()
+    endif ()
+endmacro ()
+
+# Macro for setting up an executable target with resources to copy/package/bundle/preload
+# Macro arguments:
+#  NODEPS - setup executable target without defining Urho3D dependency libraries
+#  NOBUNDLE - do not use MACOSX_BUNDLE even when URHO3D_MACOSX_BUNDLE build option is enabled
+#  WIN32/MACOSX_BUNDLE/EXCLUDE_FROM_ALL - see CMake help on add_executable() command
+# CMake variables:
+#  RESOURCE_DIRS - list of resource directories (will be packaged into *.pak when URHO3D_PACKAGING build option is set)
+#  RESOURCE_FILES - list of additional resource files (will not be packaged into *.pak in any case)
+#  SOURCE_FILES - list of source files
+#  INCLUDE_DIRS - list of directories for include search path
+#  LIBS - list of dependent libraries that are built internally in the project
+#  ABSOLUTE_PATH_LIBS - list of dependent libraries that are external to the project
+#  LINK_DEPENDS - list of additional files on which a target binary depends for linking (Makefile-based generator only)
+#  TARGET_PROPERTIES - list of target properties
+macro (setup_main_executable)
+    cmake_parse_arguments (ARG "NOBUNDLE;MACOSX_BUNDLE;WIN32" "" "" ${ARGN})
+
+    # Define resources
+    if (NOT RESOURCE_DIRS)
+        # If the macro caller has not defined the resource dirs then set them based on Urho3D project convention
+        foreach (DIR ${CMAKE_SOURCE_DIR}/bin/CoreData ${CMAKE_SOURCE_DIR}/bin/Data)
+            # Do not assume downstream project always follows Urho3D project convention, so double check if this directory exists before using it
+            if (IS_DIRECTORY ${DIR})
+                list (APPEND RESOURCE_DIRS ${DIR})
+            endif ()
+        endforeach ()
+    endif ()
+    if (URHO3D_PACKAGING AND RESOURCE_DIRS)
+        # Populate all the variables required by resource packaging
+        foreach (DIR ${RESOURCE_DIRS})
+            get_filename_component (NAME ${DIR} NAME)
+            if (ANDROID)
+                set (RESOURCE_${DIR}_PATHNAME ${CMAKE_BINARY_DIR}/assets/${NAME}.pak)
+            else ()
+                set (RESOURCE_${DIR}_PATHNAME ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${NAME}.pak)
+            endif ()
+            list (APPEND RESOURCE_PAKS ${RESOURCE_${DIR}_PATHNAME})
+            if (EMSCRIPTEN AND NOT EMSCRIPTEN_SHARE_DATA)
+                # Set the custom EMCC_OPTION property to preload the *.pak individually
+                set_source_files_properties (${RESOURCE_${DIR}_PATHNAME} PROPERTIES EMCC_OPTION preload-file EMCC_FILE_ALIAS "@/${NAME}.pak --use-preload-cache")
+            endif ()
+        endforeach ()
+        # Urho3D project builds the PackageTool as required; downstream project uses PackageTool found in the Urho3D build tree or Urho3D SDK
+        find_Urho3d_tool (PACKAGE_TOOL PackageTool
+            HINTS ${CMAKE_BINARY_DIR}/bin/tool ${URHO3D_HOME}/bin/tool
+            DOC "Path to PackageTool" MSG_MODE WARNING)
+        if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
+            set (PACKAGING_DEP DEPENDS PackageTool)
+        endif ()
+        set (PACKAGING_COMMENT " and packaging")
+        set_property (SOURCE ${RESOURCE_PAKS} PROPERTY GENERATED TRUE)
+        if (WEB)
+            if (EMSCRIPTEN)
+                # Check if shell-file is already added in source files list by downstream project
+                if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
+                    foreach (FILE ${SOURCE_FILES})
+                        get_property (EMCC_OPTION SOURCE ${FILE} PROPERTY EMCC_OPTION)
+                        if (EMCC_OPTION STREQUAL shell-file)
+                            set (SHELL_HTML_FOUND TRUE)
+                            break ()
+                        endif ()
+                    endforeach ()
+                endif ()
+                if (NOT SHELL_HTML_FOUND)
+                    # Use custom Urho3D shell.html
+                    set (SHELL_HTML ${CMAKE_BINARY_DIR}/Source/shell.html)
+                    list (APPEND SOURCE_FILES ${SHELL_HTML})
+                    set_source_files_properties (${SHELL_HTML} PROPERTIES EMCC_OPTION shell-file)
+                endif ()
+                # Set the custom EMCC_OPTION property to peload the generated shared data file
+                if (EMSCRIPTEN_SHARE_DATA)
+                    set (SHARED_RESOURCE_JS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_PROJECT_NAME}.js)
+                    list (APPEND SOURCE_FILES ${SHARED_RESOURCE_JS} ${SHARED_RESOURCE_JS}.data)
+                    set_source_files_properties (${SHARED_RESOURCE_JS} PROPERTIES GENERATED TRUE EMCC_OPTION pre-js)
+                    # Need to check if the destination variable is defined first because this macro could be called by downstream project that does not wish to install anything
+                    if (DEST_BUNDLE_DIR)
+                        install (FILES ${SHARED_RESOURCE_JS} ${SHARED_RESOURCE_JS}.data DESTINATION ${DEST_BUNDLE_DIR})
+                    endif ()
+                endif ()
+            endif ()
+        endif ()
+    endif ()
+    if (XCODE)
+        if (NOT RESOURCE_FILES)
+            # Default app bundle icon
+            set (RESOURCE_FILES ${CMAKE_SOURCE_DIR}/bin/Data/Textures/UrhoIcon.icns)
+            if (IOS)
+                # Default app icon on the iOS home screen
+                list (APPEND RESOURCE_FILES ${CMAKE_SOURCE_DIR}/bin/Data/Textures/UrhoIcon.png)
+            endif ()
+        endif ()
+        # Group them together under 'Resources' in Xcode IDE
+        source_group (Resources FILES ${RESOURCE_DIRS} ${RESOURCE_PAKS} ${RESOURCE_FILES})
+        # But only use either paks or dirs
+        if (RESOURCE_PAKS)
+            set_source_files_properties (${RESOURCE_PAKS} ${RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
+        else ()
+            set_source_files_properties (${RESOURCE_DIRS} ${RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
+        endif ()
+    endif ()
+    list (APPEND SOURCE_FILES ${RESOURCE_DIRS} ${RESOURCE_PAKS} ${RESOURCE_FILES})
+
+    if (ANDROID)
+        # Add SDL native init function, SDL_Main() entry point must be defined by one of the source files in ${SOURCE_FILES}
+        find_Urho3D_file (ANDROID_MAIN_C_PATH SDL_android_main.c
+            HINTS ${URHO3D_HOME}/include/Urho3D/ThirdParty/SDL/android ${CMAKE_SOURCE_DIR}/Source/ThirdParty/SDL/src/main/android
+            DOC "Path to SDL_android_main.c" MSG_MODE FATAL_ERROR)
+        list (APPEND SOURCE_FILES ${ANDROID_MAIN_C_PATH})
+        # Setup shared library output path
+        set_output_directories (${ANDROID_LIBRARY_OUTPUT_PATH} LIBRARY)
+        # Setup target as main shared library
+        setup_library (SHARED)
+        if (DEST_LIBRARY_DIR)
+            install (TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DEST_LIBRARY_DIR} ARCHIVE DESTINATION ${DEST_LIBRARY_DIR})
+        endif ()
+        # Copy other dependent shared libraries to Android library output path
+        foreach (FILE ${ABSOLUTE_PATH_LIBS})
+            get_filename_component (EXT ${FILE} EXT)
+            if (EXT STREQUAL .so)
+                get_filename_component (NAME ${FILE} NAME)
+                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+                    COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${FILE} ${ANDROID_LIBRARY_OUTPUT_PATH}
+                    COMMENT "Copying ${NAME} to library output directory")
+            endif ()
+        endforeach ()
+        if (ANDROID_NDK_GDB)
+            # Copy the library while it still has debug symbols for ndk-gdb
+            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+                COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${TARGET_NAME}> ${NDK_GDB_SOLIB_PATH}
+                COMMENT "Copying lib${TARGET_NAME}.so with debug symbols to ${NDK_GDB_SOLIB_PATH} directory")
+        endif ()
+        # Strip target main shared library
+        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+            COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${TARGET_NAME}>
+            COMMENT "Stripping lib${TARGET_NAME}.so in library output directory")
+        # When performing packaging, include the final apk file
+        if (CMAKE_PROJECT_NAME STREQUAL Urho3D AND NOT APK_INCLUDED)
+            install (FILES ${LIBRARY_OUTPUT_PATH_ROOT}/bin/Urho3D-debug.apk DESTINATION ${DEST_RUNTIME_DIR} OPTIONAL)
+            set (APK_INCLUDED 1)
+        endif ()
+    else ()
+        # Setup target as executable
+        if (WIN32)
+            if (NOT URHO3D_WIN32_CONSOLE OR ARG_WIN32)
+                set (EXE_TYPE WIN32)
+            endif ()
+            list (APPEND TARGET_PROPERTIES DEBUG_POSTFIX _d)
+        elseif (IOS)
+            set (EXE_TYPE MACOSX_BUNDLE)
+            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY 1,2 MACOSX_BUNDLE_INFO_PLIST iOSBundleInfo.plist.template)
+        elseif (APPLE)
+            if ((URHO3D_MACOSX_BUNDLE OR ARG_MACOSX_BUNDLE) AND NOT ARG_NOBUNDLE)
+                set (EXE_TYPE MACOSX_BUNDLE)
+                list (APPEND TARGET_PROPERTIES MACOSX_BUNDLE_INFO_PLIST MacOSXBundleInfo.plist.template)
+            endif ()
+        elseif (WEB)
+            if (EMSCRIPTEN)
+                # Pass additional source files to linker with the supported flags, such as: js-library, pre-js, post-js, embed-file, preload-file, shell-file
+                foreach (FILE ${SOURCE_FILES})
+                    get_property (EMCC_OPTION SOURCE ${FILE} PROPERTY EMCC_OPTION)
+                    if (EMCC_OPTION)
+                        list (APPEND LINK_DEPENDS ${FILE})
+                        unset (EMCC_FILE_ALIAS)
+                        unset (EMCC_EXCLUDE_FILE)
+                        if (EMCC_OPTION STREQUAL embed-file OR EMCC_OPTION STREQUAL preload-file)
+                            get_property (EMCC_FILE_ALIAS SOURCE ${FILE} PROPERTY EMCC_FILE_ALIAS)
+                            get_property (EMCC_EXCLUDE_FILE SOURCE ${FILE} PROPERTY EMCC_EXCLUDE_FILE)
+                            if (EMCC_EXCLUDE_FILE)
+                                set (EMCC_EXCLUDE_FILE " --exclude-file ${EMCC_EXCLUDE_FILE}")
+                            endif ()
+                        endif ()
+                        set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --${EMCC_OPTION} ${FILE}${EMCC_FILE_ALIAS}${EMCC_EXCLUDE_FILE}")
+                    endif ()
+                endforeach ()
+            endif ()
+        endif ()
+        setup_executable (${EXE_TYPE} ${ARG_UNPARSED_ARGUMENTS})
+    endif ()
+
+    # Define a custom target for resource modification checking and resource packaging (if enabled)
+    if ((EXE_TYPE STREQUAL MACOSX_BUNDLE OR URHO3D_PACKAGING) AND RESOURCE_DIRS)
+        # Share a same custom target that checks for a same resource dirs list
+        foreach (DIR ${RESOURCE_DIRS})
+            string (MD5 MD5 ${DIR})
+            set (MD5ALL ${MD5ALL}${MD5})
+            if (CMAKE_HOST_WIN32)
+                # On Windows host, always assumes there are changes so resource dirs would be repackaged in each build, however, still make sure the *.pak timestamp is not altered unnecessarily
+                if (URHO3D_PACKAGING)
+                    set (PACKAGING_COMMAND && echo Packaging ${DIR}... && ${PACKAGE_TOOL} ${DIR} ${RESOURCE_${DIR}_PATHNAME}.new -c -q && ${CMAKE_COMMAND} -E copy_if_different ${RESOURCE_${DIR}_PATHNAME}.new ${RESOURCE_${DIR}_PATHNAME} && ${CMAKE_COMMAND} -E remove ${RESOURCE_${DIR}_PATHNAME}.new)
+                endif ()
+                list (APPEND COMMANDS COMMAND ${CMAKE_COMMAND} -E touch ${DIR} ${PACKAGING_COMMAND})
+            else ()
+                # On Unix-like hosts, detect the changes in the resource directory recursively so they are only repackaged and/or rebundled (Xcode only) as necessary
+                if (URHO3D_PACKAGING)
+                    set (PACKAGING_COMMAND && echo Packaging ${DIR}... && ${PACKAGE_TOOL} ${DIR} ${RESOURCE_${DIR}_PATHNAME} -c -q)
+                    set (OUTPUT_COMMAND test -e ${RESOURCE_${DIR}_PATHNAME} || \( true ${PACKAGING_COMMAND} \))
+                else ()
+                    set (OUTPUT_COMMAND true)   # Nothing to output
+                endif ()
+                list (APPEND COMMANDS COMMAND echo Checking ${DIR}... && bash -c \"\(\( `find ${DIR} -newer ${DIR} |wc -l` \)\)\" && touch -cm ${DIR} ${PACKAGING_COMMAND} || ${OUTPUT_COMMAND})
+            endif ()
+        endforeach ()
+        string (MD5 MD5ALL ${MD5ALL})
+        # Ensure the resource check is done before building the main executable target
+        if (NOT RESOURCE_CHECK_${MD5ALL})
+            set (RESOURCE_CHECK RESOURCE_CHECK)
+            while (TARGET ${RESOURCE_CHECK})
+                string (RANDOM RANDOM)
+                set (RESOURCE_CHECK RESOURCE_CHECK_${RANDOM})
+            endwhile ()
+            set (RESOURCE_CHECK_${MD5ALL} ${RESOURCE_CHECK} CACHE INTERNAL "Resource check hash map")
+        endif ()
+        if (NOT TARGET ${RESOURCE_CHECK_${MD5ALL}})
+            add_custom_target (${RESOURCE_CHECK_${MD5ALL}} ALL ${COMMANDS} ${PACKAGING_DEP} COMMENT "Checking${PACKAGING_COMMENT} resource directories")
+        endif ()
+        add_dependencies (${TARGET_NAME} ${RESOURCE_CHECK_${MD5ALL}})
+    endif ()
+
+    # Define a custom command for generating a shared data file (if enabled)
+    if (EMSCRIPTEN_SHARE_DATA AND RESOURCE_PAKS)
+        # When sharing a single data file, all main targets are assumed to use a same set of resource paks
+        foreach (FILE ${RESOURCE_PAKS})
+            get_filename_component (NAME ${FILE} NAME)
+            list (APPEND PAK_NAMES ${NAME})
+        endforeach ()
+        if (CMAKE_BUILD_TYPE STREQUAL Debug AND EMCC_VERSION VERSION_GREATER 1.32.2)
+            set (SEPARATE_METADATA --separate-metadata)
+        endif ()
+        add_custom_command (OUTPUT ${SHARED_RESOURCE_JS}.data
+            COMMAND ${EMPACKAGER} ${SHARED_RESOURCE_JS}.data --preload ${PAK_NAMES} --js-output=${SHARED_RESOURCE_JS} --use-preload-cache ${SEPARATE_METADATA}
+            DEPENDS RESOURCE_CHECK ${RESOURCE_PAKS}
+            WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+            COMMENT "Generating shared data file")
+    endif ()
+endmacro ()
+
+# Macro for adjusting target output name by dropping _suffix from the target name
+macro (adjust_target_name)
+    if (TARGET_NAME MATCHES _.*$)
+        string (REGEX REPLACE _.*$ "" OUTPUT_NAME ${TARGET_NAME})
+        set_target_properties (${TARGET_NAME} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME})
+    endif ()
+endmacro ()
+
+# Macro for setting up a test case
+macro (setup_test)
+    if (URHO3D_TESTING)
+        cmake_parse_arguments (ARG "" NAME OPTIONS ${ARGN})
+        if (NOT ARG_NAME)
+            set (ARG_NAME ${TARGET_NAME})
+        endif ()
+        list (APPEND ARG_OPTIONS -timeout ${URHO3D_TEST_TIMEOUT})
+        if (WEB)
+            if (EMSCRIPTEN)
+                if (DEFINED ENV{CI})
+                    # The latency on CI server could be very high at time, so add some adjustment
+                    # If it is not enough causing a test case failure then so be it because it is better that than wait for it and still ends up in build error due to time limit
+                    set (EMRUN_TIMEOUT_ADJUSTMENT + 8 * \\${URHO3D_TEST_TIMEOUT})
+                    set (EMRUN_TIMEOUT_RETURNCODE --timeout_returncode 0)
+                endif ()
+                math (EXPR EMRUN_TIMEOUT "2 * ${URHO3D_TEST_TIMEOUT} ${EMRUN_TIMEOUT_ADJUSTMENT}")
+                add_test (NAME ${ARG_NAME} COMMAND ${EMRUN} --browser ${EMSCRIPTEN_EMRUN_BROWSER} --timeout ${EMRUN_TIMEOUT} ${EMRUN_TIMEOUT_RETURNCODE} --kill_exit ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET_NAME}.html ${ARG_OPTIONS})
+            endif ()
+        else ()
+            add_test (NAME ${ARG_NAME} COMMAND ${TARGET_NAME} ${ARG_OPTIONS})
+        endif ()
+    endif ()
+endmacro ()
+
+# *** THIS IS A DEPRECATED MACRO ***
+# Macro for defining external library dependencies
+# The purpose of this macro is emulate CMake to set the external library dependencies transitively
+# It works for both targets setup within Urho3D project and downstream projects that uses Urho3D as external static/shared library
+# *** THIS IS A DEPRECATED MACRO ***
+macro (define_dependency_libs TARGET)
+    # ThirdParty/SDL external dependency
+    if (${TARGET} MATCHES SDL|Urho3D)
+        if (WIN32)
+            list (APPEND LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid)
+        elseif (APPLE)
+            list (APPEND LIBS iconv)
+        elseif (ANDROID)
+            list (APPEND LIBS dl log android)
+        else ()
+            # Linux
+            if (NOT WEB)
+                list (APPEND LIBS dl m rt)
+            endif ()
+            if (RPI)
+                list (APPEND ABSOLUTE_PATH_LIBS ${VIDEOCORE_LIBRARIES})
+            endif ()
+        endif ()
+    endif ()
+
+    # ThirdParty/kNet & ThirdParty/Civetweb external dependency
+    if (${TARGET} MATCHES Civetweb|kNet|Urho3D)
+        if (WIN32)
+            list (APPEND LIBS ws2_32)
+        endif ()
+    endif ()
+
+    # Urho3D/LuaJIT external dependency
+    if (URHO3D_LUAJIT AND ${TARGET} MATCHES LuaJIT|Urho3D)
+        if (NOT WIN32 AND NOT WEB)
+            list (APPEND LIBS dl m)
+        endif ()
+    endif ()
+
+    # Urho3D external dependency
+    if (${TARGET} STREQUAL Urho3D)
+        # Core
+        if (WIN32)
+            list (APPEND LIBS winmm)
+            if (URHO3D_MINIDUMPS)
+                list (APPEND LIBS dbghelp)
+            endif ()
+        elseif (APPLE)
+            if (IOS OR TVOS)
+                list (APPEND LIBS "-framework AudioToolbox" "-framework AVFoundation" "-framework CoreAudio" "-framework CoreGraphics" "-framework CoreMotion" "-framework Foundation" "-framework GameController" "-framework OpenGLES" "-framework QuartzCore" "-framework UIKit")
+            else ()
+                list (APPEND LIBS "-framework AudioToolbox" "-framework Carbon" "-framework Cocoa" "-framework CoreAudio" "-framework CoreServices" "-framework CoreVideo" "-framework ForceFeedback" "-framework IOKit" "-framework OpenGL")
+            endif ()
+        endif ()
+
+        # Graphics
+        if (URHO3D_OPENGL)
+            if (APPLE)
+                # Do nothing
+            elseif (WIN32)
+                list (APPEND LIBS opengl32)
+            elseif (ANDROID OR ARM)
+                list (APPEND LIBS GLESv1_CM GLESv2)
+            else ()
+                list (APPEND LIBS GL)
+            endif ()
+        elseif (DIRECT3D_LIBRARIES)
+            list (APPEND LIBS ${DIRECT3D_LIBRARIES})
+        endif ()
+
+        # Database
+        if (URHO3D_DATABASE_ODBC)
+            list (APPEND LIBS ${ODBC_LIBRARIES})
+        endif ()
+
+        # This variable value can either be 'Urho3D' target or an absolute path to an actual static/shared Urho3D library or empty (if we are building the library itself)
+        # The former would cause CMake not only to link against the Urho3D library but also to add a dependency to Urho3D target
+        if (URHO3D_LIBRARIES)
+            if (WIN32 AND URHO3D_LIBRARIES_DBG AND URHO3D_LIBRARIES_REL AND TARGET ${TARGET_NAME})
+                # Special handling when both debug and release libraries are found
+                target_link_libraries (${TARGET_NAME} debug ${URHO3D_LIBRARIES_DBG} optimized ${URHO3D_LIBRARIES_REL})
+            else ()
+                if (TARGET ${TARGET}_universal)
+                    add_dependencies (${TARGET_NAME} ${TARGET}_universal)
+                endif ()
+                list (APPEND ABSOLUTE_PATH_LIBS ${URHO3D_LIBRARIES})
+            endif ()
+        endif ()
+    endif ()
+endmacro ()
+
+# Macro for sorting and removing duplicate values
+macro (remove_duplicate LIST_NAME)
+    if (${LIST_NAME})
+        list (SORT ${LIST_NAME})
+        list (REMOVE_DUPLICATES ${LIST_NAME})
+    endif ()
+endmacro ()
+
+# Macro for setting a list from another with option to sort and remove duplicate values
+macro (set_list TO_LIST FROM_LIST)
+    set (${TO_LIST} ${${FROM_LIST}})
+    if (${ARGN} STREQUAL REMOVE_DUPLICATE)
+        remove_duplicate (${TO_LIST})
+    endif ()
+endmacro ()
+
+# Macro for defining source files with optional arguments as follows:
+#  GLOB_CPP_PATTERNS <list> - Use the provided globbing patterns for CPP_FILES instead of the default *.cpp
+#  GLOB_H_PATTERNS <list> - Use the provided globbing patterns for H_FILES instead of the default *.h
+#  EXCLUDE_PATTERNS <list> - Use the provided patterns for excluding matched source files
+#  EXTRA_CPP_FILES <list> - Include the provided list of files into CPP_FILES result
+#  EXTRA_H_FILES <list> - Include the provided list of files into H_FILES result
+#  PCH <list> - Enable precompiled header support on the defined source files using the specified header file, the list is "<path/to/header> [C++|C]"
+#  PARENT_SCOPE - Glob source files in current directory but set the result in parent-scope's variable ${DIR}_CPP_FILES and ${DIR}_H_FILES instead
+#  RECURSE - Option to glob recursively
+#  GROUP - Option to group source files based on its relative path to the corresponding parent directory (only works when PARENT_SCOPE option is not in use)
+macro (define_source_files)
+    # Source files are defined by globbing source files in current source directory and also by including the extra source files if provided
+    cmake_parse_arguments (ARG "PARENT_SCOPE;RECURSE;GROUP" "" "PCH;EXTRA_CPP_FILES;EXTRA_H_FILES;GLOB_CPP_PATTERNS;GLOB_H_PATTERNS;EXCLUDE_PATTERNS" ${ARGN})
+    if (NOT ARG_GLOB_CPP_PATTERNS)
+        set (ARG_GLOB_CPP_PATTERNS *.cpp)    # Default glob pattern
+    endif ()
+    if (NOT ARG_GLOB_H_PATTERNS)
+        set (ARG_GLOB_H_PATTERNS *.h)
+    endif ()
+    if (ARG_RECURSE)
+        set (ARG_RECURSE _RECURSE)
+    else ()
+        unset (ARG_RECURSE)
+    endif ()
+    file (GLOB${ARG_RECURSE} CPP_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${ARG_GLOB_CPP_PATTERNS})
+    file (GLOB${ARG_RECURSE} H_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${ARG_GLOB_H_PATTERNS})
+    if (ARG_EXCLUDE_PATTERNS)
+        set (CPP_FILES_WITH_SENTINEL ";${CPP_FILES};")  # Stringify the lists
+        set (H_FILES_WITH_SENTINEL ";${H_FILES};")
+        foreach (PATTERN ${ARG_EXCLUDE_PATTERNS})
+            foreach (LOOP RANGE 1)
+                string (REGEX REPLACE ";${PATTERN};" ";;" CPP_FILES_WITH_SENTINEL "${CPP_FILES_WITH_SENTINEL}")
+                string (REGEX REPLACE ";${PATTERN};" ";;" H_FILES_WITH_SENTINEL "${H_FILES_WITH_SENTINEL}")
+            endforeach ()
+        endforeach ()
+        set (CPP_FILES ${CPP_FILES_WITH_SENTINEL})      # Convert strings back to lists, extra sentinels are harmless
+        set (H_FILES ${H_FILES_WITH_SENTINEL})
+    endif ()
+    list (APPEND CPP_FILES ${ARG_EXTRA_CPP_FILES})
+    list (APPEND H_FILES ${ARG_EXTRA_H_FILES})
+    set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
+
+    # Optionally enable PCH
+    if (ARG_PCH)
+        enable_pch (${ARG_PCH})
+    endif ()
+
+    # Optionally accumulate source files at parent scope
+    if (ARG_PARENT_SCOPE)
+        get_filename_component (NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+        set (${NAME}_CPP_FILES ${CPP_FILES} PARENT_SCOPE)
+        set (${NAME}_H_FILES ${H_FILES} PARENT_SCOPE)
+    # Optionally put source files into further sub-group (only works when PARENT_SCOPE option is not in use)
+    elseif (ARG_GROUP)
+        foreach (CPP_FILE ${CPP_FILES})
+            get_filename_component (PATH ${CPP_FILE} PATH)
+            if (PATH)
+                string (REPLACE / \\ PATH ${PATH})
+                source_group ("Source Files\\${PATH}" FILES ${CPP_FILE})
+            endif ()
+        endforeach ()
+        foreach (H_FILE ${H_FILES})
+            get_filename_component (PATH ${H_FILE} PATH)
+            if (PATH)
+                string (REPLACE / \\ PATH ${PATH})
+                source_group ("Header Files\\${PATH}" FILES ${H_FILE})
+            endif ()
+        endforeach ()
+    endif ()
+endmacro ()
+
+# Macro for setting up header files installation for the SDK and the build tree (only support subset of install command arguments)
+#  FILES <list> - File list to be installed
+#  DIRECTORY <list> - Directory list to be installed
+#  FILES_MATCHING - Option to perform file pattern matching on DIRECTORY list
+#  USE_FILE_SYMLINK - Option to use file symlinks on the matched files found in the DIRECTORY list
+#  BUILD_TREE_ONLY - Option to install the header files into the build tree only
+#  PATTERN <list> - Pattern list to be used in file pattern matching option
+#  BASE <value> - An absolute base path to be prepended to the destination path when installing to build tree, default to build tree
+#  DESTINATION <value> - A relative destination path to be installed to
+#  ACCUMULATE <value> - Accumulate the header files into the specified CMake variable, implies USE_FILE_SYMLINK when input list is a directory
+macro (install_header_files)
+    # Need to check if the destination variable is defined first because this macro could be called by downstream project that does not wish to install anything
+    if (DEST_INCLUDE_DIR)
+        # Parse the arguments for the underlying install command for the SDK
+        cmake_parse_arguments (ARG "FILES_MATCHING;USE_FILE_SYMLINK;BUILD_TREE_ONLY" "BASE;DESTINATION;ACCUMULATE" "FILES;DIRECTORY;PATTERN" ${ARGN})
+        unset (INSTALL_MATCHING)
+        if (ARG_FILES)
+            set (INSTALL_TYPE FILES)
+            set (INSTALL_SOURCES ${ARG_FILES})
+        elseif (ARG_DIRECTORY)
+            set (INSTALL_TYPE DIRECTORY)
+            set (INSTALL_SOURCES ${ARG_DIRECTORY})
+            if (ARG_FILES_MATCHING)
+                set (INSTALL_MATCHING FILES_MATCHING)
+                # Our macro supports PATTERN <list> but CMake's install command does not, so convert the list to: PATTERN <value1> PATTERN <value2> ...
+                foreach (PATTERN ${ARG_PATTERN})
+                    list (APPEND INSTALL_MATCHING PATTERN ${PATTERN})
+                endforeach ()
+            endif ()
+        else ()
+            message (FATAL_ERROR "Couldn't setup install command because the install type is not specified.")
+        endif ()
+        if (NOT ARG_DESTINATION)
+            message (FATAL_ERROR "Couldn't setup install command because the install destination is not specified.")
+        endif ()
+        if (NOT ARG_BUILD_TREE_ONLY AND NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
+            install (${INSTALL_TYPE} ${INSTALL_SOURCES} DESTINATION ${ARG_DESTINATION} ${INSTALL_MATCHING})
+        endif ()
+
+        # Reparse the arguments for the create_symlink macro to "install" the header files in the build tree
+        if (NOT ARG_BASE)
+            set (ARG_BASE ${CMAKE_BINARY_DIR})  # Use build tree as base path
+        endif ()
+        foreach (INSTALL_SOURCE ${INSTALL_SOURCES})
+            if (NOT IS_ABSOLUTE ${INSTALL_SOURCE})
+                set (INSTALL_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/${INSTALL_SOURCE})
+            endif ()
+            if (INSTALL_SOURCE MATCHES /$)
+                # Source is a directory
+                if (ARG_USE_FILE_SYMLINK OR ARG_ACCUMULATE OR BASH_ON_WINDOWS)
+                    # Use file symlink for each individual files in the source directory
+                    if (IS_SYMLINK ${ARG_DESTINATION} AND NOT CMAKE_HOST_WIN32)
+                        execute_process (COMMAND ${CMAKE_COMMAND} -E remove ${ARG_DESTINATION})
+                    endif ()
+                    set (GLOBBING_EXPRESSION RELATIVE ${INSTALL_SOURCE})
+                    if (ARG_FILES_MATCHING)
+                        foreach (PATTERN ${ARG_PATTERN})
+                            list (APPEND GLOBBING_EXPRESSION ${INSTALL_SOURCE}${PATTERN})
+                        endforeach ()
+                    else ()
+                        list (APPEND GLOBBING_EXPRESSION ${INSTALL_SOURCE}*)
+                    endif ()
+                    file (GLOB_RECURSE NAMES ${GLOBBING_EXPRESSION})
+                    foreach (NAME ${NAMES})
+                        get_filename_component (PATH ${ARG_DESTINATION}/${NAME} PATH)
+                        # Recreate the source directory structure in the destination path
+                        if (NOT EXISTS ${ARG_BASE}/${PATH})
+                            file (MAKE_DIRECTORY ${ARG_BASE}/${PATH})
+                        endif ()
+                        create_symlink (${INSTALL_SOURCE}${NAME} ${ARG_DESTINATION}/${NAME} FALLBACK_TO_COPY)
+                        if (ARG_ACCUMULATE)
+                            list (APPEND ${ARG_ACCUMULATE} ${ARG_DESTINATION}/${NAME})
+                        endif ()
+                    endforeach ()
+                else ()
+                    # Use a single symlink pointing to the source directory
+                    if (NOT IS_SYMLINK ${ARG_DESTINATION} AND NOT CMAKE_HOST_WIN32)
+                        execute_process (COMMAND ${CMAKE_COMMAND} -E remove_directory ${ARG_DESTINATION})
+                    endif ()
+                    create_symlink (${INSTALL_SOURCE} ${ARG_DESTINATION} FALLBACK_TO_COPY)
+                endif ()
+            else ()
+                # Source is a file (it could also be actually a directory to be treated as a "file", i.e. for creating symlink pointing to the directory)
+                get_filename_component (NAME ${INSTALL_SOURCE} NAME)
+                create_symlink (${INSTALL_SOURCE} ${ARG_DESTINATION}/${NAME} FALLBACK_TO_COPY)
+                if (ARG_ACCUMULATE)
+                    list (APPEND ${ARG_ACCUMULATE} ${ARG_DESTINATION}/${NAME})
+                endif ()
+            endif ()
+        endforeach ()
+    endif ()
+endmacro ()
+
+# Trim the leading white space in the compiler flags, if any
+string (REGEX REPLACE "^ +" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+string (REGEX REPLACE "^ +" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+
+# Set common project structure for some platforms
+if (ANDROID)
+    # Enable Android ndk-gdb
+    if (ANDROID_NDK_GDB)
+        set (NDK_GDB_SOLIB_PATH ${CMAKE_BINARY_DIR}/obj/local/${ANDROID_NDK_ABI_NAME}/)
+        file (MAKE_DIRECTORY ${NDK_GDB_SOLIB_PATH})
+        set (NDK_GDB_JNI ${CMAKE_BINARY_DIR}/jni)
+        set (NDK_GDB_MK "# This is a generated file. DO NOT EDIT!\n\nAPP_ABI := ${ANDROID_NDK_ABI_NAME}\n")
+        foreach (MK Android.mk Application.mk)
+            if (NOT EXISTS ${NDK_GDB_JNI}/${MK})
+                file (WRITE ${NDK_GDB_JNI}/${MK} ${NDK_GDB_MK})
+            endif ()
+        endforeach ()
+        get_directory_property (INCLUDE_DIRECTORIES DIRECTORY ${PROJECT_SOURCE_DIR} INCLUDE_DIRECTORIES)
+        string (REPLACE ";" " " INCLUDE_DIRECTORIES "${INCLUDE_DIRECTORIES}")   # Note: need to always "stringify" a variable in list context for replace to work correctly
+        set (NDK_GDB_SETUP "# This is a generated file. DO NOT EDIT!\n\nset solib-search-path ${NDK_GDB_SOLIB_PATH}\ndirectory ${INCLUDE_DIRECTORIES}\n")
+        file (WRITE ${ANDROID_LIBRARY_OUTPUT_PATH}/gdb.setup ${NDK_GDB_SETUP})
+        file (COPY ${ANDROID_NDK}/prebuilt/android-${ANDROID_ARCH_NAME}/gdbserver/gdbserver DESTINATION ${ANDROID_LIBRARY_OUTPUT_PATH})
+    else ()
+        file (REMOVE ${ANDROID_LIBRARY_OUTPUT_PATH}/gdbserver)
+    endif ()
+    # Create symbolic links in the build tree
+    file (MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/Android/assets)
+    if (NOT URHO3D_PACKAGING)
+        foreach (I CoreData Data)
+            if (NOT EXISTS ${CMAKE_SOURCE_DIR}/Android/assets/${I})
+                create_symlink (${CMAKE_SOURCE_DIR}/bin/${I} ${CMAKE_SOURCE_DIR}/Android/assets/${I} FALLBACK_TO_COPY)
+            endif ()
+        endforeach ()
+    endif ()
+    foreach (I AndroidManifest.xml build.xml custom_rules.xml project.properties src res assets jni)
+        if (EXISTS ${CMAKE_SOURCE_DIR}/Android/${I} AND NOT EXISTS ${CMAKE_BINARY_DIR}/${I})    # No-ops when 'Android' is used as build tree
+            create_symlink (${CMAKE_SOURCE_DIR}/Android/${I} ${CMAKE_BINARY_DIR}/${I} FALLBACK_TO_COPY)
+        endif ()
+    endforeach ()
+elseif (WEB)
+    # Create Urho3D custom HTML shell that also embeds our own project logo
+    if (EMSCRIPTEN)
+        if (NOT EXISTS ${CMAKE_BINARY_DIR}/Source/shell.html)
+            file (READ ${EMSCRIPTEN_ROOT_PATH}/src/shell.html SHELL_HTML)
+            string (REPLACE "<!doctype html>" "<!-- This is a generated file. DO NOT EDIT!-->\n\n<!doctype html>" SHELL_HTML "${SHELL_HTML}")     # Stringify to preserve semicolons
+            string (REPLACE "<body>" "<body>\n\n<a href=\"https://urho3d.github.io\" title=\"Urho3D Homepage\"><img src=\"https://urho3d.github.io/assets/images/logo.png\" alt=\"link to https://urho3d.github.io\" height=\"80\" width=\"320\" /></a>\n" SHELL_HTML "${SHELL_HTML}")
+            file (WRITE ${CMAKE_BINARY_DIR}/Source/shell.html "${SHELL_HTML}")
+        endif ()
+    endif ()
+else ()
+    # Ensure the output directory exist before creating the symlinks
+    file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+    # Create symbolic links in the build tree
+    foreach (I Autoload CoreData Data)
+        if (NOT EXISTS ${CMAKE_BINARY_DIR}/bin/${I})
+            create_symlink (${CMAKE_SOURCE_DIR}/bin/${I} ${CMAKE_BINARY_DIR}/bin/${I} FALLBACK_TO_COPY)
+        endif ()
+    endforeach ()
+    # Warn user if PATH environment variable has not been correctly set for using ccache
+    if (NOT CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_WIN32 AND "$ENV{USE_CCACHE}")
+        if (APPLE)
+            set (WHEREIS brew info ccache)
+        else ()
+            set (WHEREIS whereis -b ccache)
+        endif ()
+        execute_process (COMMAND ${WHEREIS} COMMAND grep -o \\S*lib\\S* RESULT_VARIABLE EXIT_CODE OUTPUT_VARIABLE CCACHE_SYMLINK ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+        if (EXIT_CODE EQUAL 0 AND NOT $ENV{PATH} MATCHES "${CCACHE_SYMLINK}")  # Need to stringify because CCACHE_SYMLINK variable could be empty when the command failed
+            message (WARNING "The lib directory containing the ccache symlinks (${CCACHE_SYMLINK}) has not been added in the PATH environment variable. "
+                "This is required to enable ccache support for native compiler toolchain. CMake has been configured to use the actual compiler toolchain instead of ccache. "
+                "In order to rectify this, the build tree must be regenerated after the PATH environment variable has been adjusted accordingly.")
+        endif ()
+    endif ()
+endif ()
+
+# Post-CMake fixes
+if (IOS)
+    # TODO: can be removed when CMake minimum required has reached 2.8.12
+    if (CMAKE_VERSION VERSION_LESS 2.8.12)
+        # Due to a bug in the CMake/Xcode generator (fixed in 2.8.12) where it has wrongly assumed the IOS bundle structure to be the same as MacOSX bundle structure,
+        # below temporary fix is required in order to solve the auto-linking issue when dependent libraries are changed
+        list (APPEND POST_CMAKE_FIXES COMMAND sed -i '' 's/\\/Contents\\/MacOS//g' ${CMAKE_BINARY_DIR}/CMakeScripts/XCODE_DEPEND_HELPER.make || exit 0)
+    endif ()
+    # TODO: can be removed when CMake minimum required has reached 3.4
+    if (CMAKE_VERSION VERSION_LESS 3.4)
+        # Due to a bug in the CMake/Xcode generator (fixed in 3.4) that prevents iOS targets (library and bundle) to be installed correctly
+        # (see http://public.kitware.com/Bug/bug_relationship_graph.php?bug_id=12506&graph=dependency),
+        # below temporary fix is required to work around the bug
+        list (APPEND POST_CMAKE_FIXES COMMAND sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' ${CMAKE_BINARY_DIR}/CMakeScripts/install_postBuildPhase.make* || exit 0)
+    endif ()
+endif ()
+if (POST_CMAKE_FIXES)
+    add_custom_target (POST_CMAKE_FIXES ALL ${POST_CMAKE_FIXES} COMMENT "Applying post-cmake fixes")
+endif ()

+ 1 - 1
CMakeLists.txt

@@ -99,7 +99,7 @@ if (MATCHED)
     set (CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
     set (CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
     set (CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3})
     set (CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3})
 endif ()
 endif ()
-set (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/License.txt)
+set (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
 set (CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
 set (CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
 set (CPACK_GENERATOR TGZ)
 set (CPACK_GENERATOR TGZ)
 if (ANDROID)
 if (ANDROID)

+ 1 - 1
Docs/Reference.dox

@@ -3522,7 +3522,7 @@ Third, there are requirements for new code that come from Urho3D striving to be
 
 
 \section ContributionThirdParty Third party library considerations
 \section ContributionThirdParty Third party library considerations
 
 
-- When you add a new third-party library, insert its license statement to the License.txt in the root directory. Only libraries with permissive licenses such as BSD/MIT/zlib are accepted, because complying for example with the LGPL is difficult on mobile platforms, and would leave the application in a legal grey area.
+- When you add a new third-party library, insert its license statement to the LICENSE in the Source\ThirdParty directory. Only libraries with permissive licenses such as BSD/MIT/zlib are accepted, because complying for example with the LGPL is difficult on mobile platforms, and would leave the application in a legal grey area.
 
 
 - Prefer small and well-focused libraries for the Urho3D runtime. For example we use stb_image instead of FreeImage to load images, as it's assumed that the application developer can control the data and do offline conversion to supported formats as necessary.
 - Prefer small and well-focused libraries for the Urho3D runtime. For example we use stb_image instead of FreeImage to load images, as it's assumed that the application developer can control the data and do offline conversion to supported formats as necessary.
 
 

+ 21 - 0
LICENSE

@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2008-2016 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.

+ 1 - 1
README.md

@@ -9,7 +9,7 @@
 Main website: [https://urho3d.github.io/](https://urho3d.github.io/)
 Main website: [https://urho3d.github.io/](https://urho3d.github.io/)
 
 
 ##License
 ##License
-Licensed under the MIT license, see [License.txt](https://github.com/urho3d/Urho3D/blob/master/License.txt) for details.
+Licensed under the MIT license, see [LICENSE](https://github.com/urho3d/Urho3D/blob/master/LICENSE) for details.
 
 
 ##Credits
 ##Credits
 Urho3D development, contributions and bugfixes by:
 Urho3D development, contributions and bugfixes by:

+ 2 - 2
Rakefile

@@ -630,8 +630,8 @@ EOF'" or abort 'Failed to create release directory remotely'
       system "curl -H 'Accept: application/json' -X PUT -d 'default=bsd&default=solaris&default=others' -d \"api_key=$SF_API\" https://sourceforge.net/projects/%s/files/%s/#{ENV['RELEASE_TAG']}/Urho3D-#{ENV['RELEASE_TAG']}-Source.tar.gz" % ENV['TRAVIS_REPO_SLUG'].split('/') or abort 'Failed to set source tarball as default download'
       system "curl -H 'Accept: application/json' -X PUT -d 'default=bsd&default=solaris&default=others' -d \"api_key=$SF_API\" https://sourceforge.net/projects/%s/files/%s/#{ENV['RELEASE_TAG']}/Urho3D-#{ENV['RELEASE_TAG']}-Source.tar.gz" % ENV['TRAVIS_REPO_SLUG'].split('/') or abort 'Failed to set source tarball as default download'
     end
     end
     # Sync readme and license files, just in case they are updated in the repo
     # Sync readme and license files, just in case they are updated in the repo
-    system 'for f in README.md License.txt; do mtime=$(git log --format=%ai -n1 $f); touch -d "$mtime" $f; done' or abort 'Failed to acquire file modified time'
-    system 'rsync -e ssh -az README.md License.txt [email protected]:/home/frs/project/$TRAVIS_REPO_SLUG' or abort 'Failed to sync readme and license files'
+    system 'for f in README.md LICENSE; do mtime=$(git log --format=%ai -n1 $f); touch -d "$mtime" $f; done' or abort 'Failed to acquire file modified time'
+    system 'rsync -e ssh -az README.md LICENSE [email protected]:/home/frs/project/$TRAVIS_REPO_SLUG' or abort 'Failed to sync readme and license files'
     # Mark that the site has been updated
     # Mark that the site has been updated
     File.open('.site_updated', 'w') {}
     File.open('.site_updated', 'w') {}
   end
   end

+ 136 - 136
Source/CMakeLists.txt

@@ -1,136 +1,136 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Check existence of stdint.h for LibCpuId
-include (CheckIncludeFiles)
-check_include_files (stdint.h HAVE_STDINT_H)
-if (HAVE_STDINT_H)
-    add_definitions (-DHAVE_STDINT_H)
-endif ()
-
-# Setup RPATH settings
-if (URHO3D_LIB_TYPE STREQUAL SHARED AND NOT WIN32 AND NOT ANDROID AND NOT IOS AND NOT WEB)
-    # Add RPATH entries when building
-    set (CMAKE_SKIP_BUILD_RPATH FALSE)
-    # But don't set them yet in the build tree
-    set (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
-    if (APPLE)
-        if (CMAKE_VERSION VERSION_GREATER 2.8.12 OR CMAKE_VERSION VERSION_EQUAL 2.8.12)
-            set (CMAKE_MACOSX_RPATH TRUE)
-        endif ()
-        set (ORIGIN @loader_path)
-    else ()
-        set (ORIGIN $ORIGIN)
-    endif ()
-    # When installing/packaging set the first RPATH entry to the library location relative to the executable
-    set (CMAKE_INSTALL_RPATH ${ORIGIN}/../lib${LIB_SUFFIX}/${PATH_SUFFIX})    # The library location is based on SDK install destination
-    # The second entry to the library location relative to the executable in the tool directory
-    list (APPEND CMAKE_INSTALL_RPATH ${ORIGIN}/../../lib${LIB_SUFFIX}/${PATH_SUFFIX})    # The tools are installed one directory further down from normal executable
-    # The last entry to the install destination of the library, if the destination location is not in the system default search path
-    list (FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} isSystemDir)
-    if (isSystemDir STREQUAL -1)
-        list (APPEND CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${DEST_LIBRARY_DIR})
-    endif ()
-endif ()
-
-# Add targets
-foreach (TARGET FreeType JO LZ4 PugiXml rapidjson SDL StanHull STB)
-    add_subdirectory (ThirdParty/${TARGET})
-endforeach ()
-
-if (URHO3D_ANGELSCRIPT)
-    add_subdirectory (ThirdParty/AngelScript)
-    if (EMSCRIPTEN OR (ARM AND NATIVE_64BIT))
-        add_subdirectory (ThirdParty/boost)
-    endif ()
-endif ()
-
-if (URHO3D_LUA)
-    add_subdirectory (ThirdParty/Lua${JIT})
-    add_subdirectory (ThirdParty/toluapp/src/lib)
-endif ()
-
-if (URHO3D_NETWORK)
-    add_subdirectory (ThirdParty/Civetweb)
-    add_subdirectory (ThirdParty/kNet)
-endif ()
-
-if (URHO3D_DATABASE_ODBC)
-    add_subdirectory (ThirdParty/nanodbc)
-endif ()
-if (URHO3D_DATABASE_SQLITE)
-    add_subdirectory (ThirdParty/SQLite)
-endif ()
-
-if (URHO3D_NAVIGATION)
-    add_subdirectory (ThirdParty/Detour)
-    add_subdirectory (ThirdParty/DetourCrowd)
-    add_subdirectory (ThirdParty/DetourTileCache)
-    add_subdirectory (ThirdParty/Recast)
-endif ()
-
-if (URHO3D_URHO2D)
-    add_subdirectory (ThirdParty/Box2D)
-    if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spine)
-        add_subdirectory (ThirdParty/spine)
-        # Add definition for Spine
-        add_definitions (-DURHO3D_SPINE)
-    endif ()
-endif ()
-
-if (URHO3D_PHYSICS)
-    add_subdirectory (ThirdParty/Bullet)
-endif ()
-
-if (NOT ANDROID AND NOT ARM AND NOT WEB)
-    if (URHO3D_OPENGL)
-        add_subdirectory (ThirdParty/GLEW)
-    elseif (NOT URHO3D_D3D11)
-        add_subdirectory (ThirdParty/MojoShader)
-    endif ()
-    if (NOT CMAKE_SYSTEM_NAME STREQUAL Linux)
-        add_subdirectory (ThirdParty/LibCpuId)
-    endif ()
-endif ()
-
-# Urho3D game engine library
-add_subdirectory (Urho3D)
-
-# Urho3D Clang tools
-if (URHO3D_CLANG_TOOLS)
-    add_subdirectory (Clang-Tools)
-endif ()
-
-# Urho3D tools
-add_subdirectory (Tools)
-
-# Urho3D samples
-# Samples are built on iOS platform too when enabled. Currently there is no available mechanism to package each sample apps into individual *.apk
-# for Android platform, so we deploy all samples into one apk and use a simple list view activity launcher to select the sample to run
-if (URHO3D_SAMPLES)
-    add_subdirectory (Samples)
-endif ()
-
-# Urho3D extras
-if (URHO3D_EXTRAS)
-    add_subdirectory (Extras)
-endif ()
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Check existence of stdint.h for LibCpuId
+include (CheckIncludeFiles)
+check_include_files (stdint.h HAVE_STDINT_H)
+if (HAVE_STDINT_H)
+    add_definitions (-DHAVE_STDINT_H)
+endif ()
+
+# Setup RPATH settings
+if (URHO3D_LIB_TYPE STREQUAL SHARED AND NOT WIN32 AND NOT ANDROID AND NOT IOS AND NOT WEB)
+    # Add RPATH entries when building
+    set (CMAKE_SKIP_BUILD_RPATH FALSE)
+    # But don't set them yet in the build tree
+    set (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+    if (APPLE)
+        if (CMAKE_VERSION VERSION_GREATER 2.8.12 OR CMAKE_VERSION VERSION_EQUAL 2.8.12)
+            set (CMAKE_MACOSX_RPATH TRUE)
+        endif ()
+        set (ORIGIN @loader_path)
+    else ()
+        set (ORIGIN $ORIGIN)
+    endif ()
+    # When installing/packaging set the first RPATH entry to the library location relative to the executable
+    set (CMAKE_INSTALL_RPATH ${ORIGIN}/../lib${LIB_SUFFIX}/${PATH_SUFFIX})    # The library location is based on SDK install destination
+    # The second entry to the library location relative to the executable in the tool directory
+    list (APPEND CMAKE_INSTALL_RPATH ${ORIGIN}/../../lib${LIB_SUFFIX}/${PATH_SUFFIX})    # The tools are installed one directory further down from normal executable
+    # The last entry to the install destination of the library, if the destination location is not in the system default search path
+    list (FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} isSystemDir)
+    if (isSystemDir STREQUAL -1)
+        list (APPEND CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${DEST_LIBRARY_DIR})
+    endif ()
+endif ()
+
+# Add targets
+foreach (TARGET FreeType JO LZ4 PugiXml rapidjson SDL StanHull STB)
+    add_subdirectory (ThirdParty/${TARGET})
+endforeach ()
+
+if (URHO3D_ANGELSCRIPT)
+    add_subdirectory (ThirdParty/AngelScript)
+    if (EMSCRIPTEN OR (ARM AND NATIVE_64BIT))
+        add_subdirectory (ThirdParty/boost)
+    endif ()
+endif ()
+
+if (URHO3D_LUA)
+    add_subdirectory (ThirdParty/Lua${JIT})
+    add_subdirectory (ThirdParty/toluapp/src/lib)
+endif ()
+
+if (URHO3D_NETWORK)
+    add_subdirectory (ThirdParty/Civetweb)
+    add_subdirectory (ThirdParty/kNet)
+endif ()
+
+if (URHO3D_DATABASE_ODBC)
+    add_subdirectory (ThirdParty/nanodbc)
+endif ()
+if (URHO3D_DATABASE_SQLITE)
+    add_subdirectory (ThirdParty/SQLite)
+endif ()
+
+if (URHO3D_NAVIGATION)
+    add_subdirectory (ThirdParty/Detour)
+    add_subdirectory (ThirdParty/DetourCrowd)
+    add_subdirectory (ThirdParty/DetourTileCache)
+    add_subdirectory (ThirdParty/Recast)
+endif ()
+
+if (URHO3D_URHO2D)
+    add_subdirectory (ThirdParty/Box2D)
+    if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spine)
+        add_subdirectory (ThirdParty/spine)
+        # Add definition for Spine
+        add_definitions (-DURHO3D_SPINE)
+    endif ()
+endif ()
+
+if (URHO3D_PHYSICS)
+    add_subdirectory (ThirdParty/Bullet)
+endif ()
+
+if (NOT ANDROID AND NOT ARM AND NOT WEB)
+    if (URHO3D_OPENGL)
+        add_subdirectory (ThirdParty/GLEW)
+    elseif (NOT URHO3D_D3D11)
+        add_subdirectory (ThirdParty/MojoShader)
+    endif ()
+    if (NOT CMAKE_SYSTEM_NAME STREQUAL Linux)
+        add_subdirectory (ThirdParty/LibCpuId)
+    endif ()
+endif ()
+
+# Urho3D game engine library
+add_subdirectory (Urho3D)
+
+# Urho3D Clang tools
+if (URHO3D_CLANG_TOOLS)
+    add_subdirectory (Clang-Tools)
+endif ()
+
+# Urho3D tools
+add_subdirectory (Tools)
+
+# Urho3D samples
+# Samples are built on iOS platform too when enabled. Currently there is no available mechanism to package each sample apps into individual *.apk
+# for Android platform, so we deploy all samples into one apk and use a simple list view activity launcher to select the sample to run
+if (URHO3D_SAMPLES)
+    add_subdirectory (Samples)
+endif ()
+
+# Urho3D extras
+if (URHO3D_EXTRAS)
+    add_subdirectory (Extras)
+endif ()

+ 31 - 31
Source/Extras/CMakeLists.txt

@@ -1,31 +1,31 @@
-#
-# Copyright (c) 2008-2016 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-Extras)
-
-# Find Urho3D library
-find_package (Urho3D REQUIRED)
-include_directories (${URHO3D_INCLUDE_DIRS})
-
-# Urho3D extras
-add_subdirectory (OgreBatchConverter)
+#
+# Copyright (c) 2008-2016 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-Extras)
+
+# Find Urho3D library
+find_package (Urho3D REQUIRED)
+include_directories (${URHO3D_INCLUDE_DIRS})
+
+# Urho3D extras
+add_subdirectory (OgreBatchConverter)

+ 30 - 30
Source/Extras/OgreBatchConverter/CMakeLists.txt

@@ -1,30 +1,30 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME OgreBatchConverter)
-
-# Define source files
-define_source_files ()
-
-# Setup target
-setup_executable (TOOL)
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME OgreBatchConverter)
+
+# Define source files
+define_source_files ()
+
+# Setup target
+setup_executable (TOOL)

+ 55 - 55
Source/Samples/CMakeLists.txt

@@ -1,55 +1,55 @@
-#
-# Copyright (c) 2008-2016 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-Samples)
-
-# Find Urho3D library
-find_package (Urho3D REQUIRED)
-include_directories (${URHO3D_INCLUDE_DIRS})
-
-# Include common to all samples
-set (COMMON_SAMPLE_H_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Sample.h" "${CMAKE_CURRENT_SOURCE_DIR}/Sample.inl")
-
-# Define dependency libs
-set (INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
-
-# Macro for adding sample subdirectory
-macro (add_sample_subdirectory SOURCE_DIR)
-    if (DEFINED ENV{included_sample})
-        if (DEFINED ENV{INCLUDED_SAMPLE_${SOURCE_DIR}})
-            add_subdirectory (${SOURCE_DIR} ${ARGN})
-        endif ()
-    elseif (NOT DEFINED ENV{EXCLUDED_SAMPLE_${SOURCE_DIR}})
-        add_subdirectory (${SOURCE_DIR} ${ARGN})
-    endif ()
-endmacro ()
-
-# Add samples
-file (GLOB_RECURSE DIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CMakeLists.txt)
-list (SORT DIRS)
-foreach (DIR ${DIRS})
-    get_filename_component (DIR ${DIR} PATH)
-    if (DIR)
-        add_sample_subdirectory (${DIR})
-    endif ()
-endforeach ()
+#
+# Copyright (c) 2008-2016 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-Samples)
+
+# Find Urho3D library
+find_package (Urho3D REQUIRED)
+include_directories (${URHO3D_INCLUDE_DIRS})
+
+# Include common to all samples
+set (COMMON_SAMPLE_H_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Sample.h" "${CMAKE_CURRENT_SOURCE_DIR}/Sample.inl")
+
+# Define dependency libs
+set (INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
+
+# Macro for adding sample subdirectory
+macro (add_sample_subdirectory SOURCE_DIR)
+    if (DEFINED ENV{included_sample})
+        if (DEFINED ENV{INCLUDED_SAMPLE_${SOURCE_DIR}})
+            add_subdirectory (${SOURCE_DIR} ${ARGN})
+        endif ()
+    elseif (NOT DEFINED ENV{EXCLUDED_SAMPLE_${SOURCE_DIR}})
+        add_subdirectory (${SOURCE_DIR} ${ARGN})
+    endif ()
+endmacro ()
+
+# Add samples
+file (GLOB_RECURSE DIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CMakeLists.txt)
+list (SORT DIRS)
+foreach (DIR ${DIRS})
+    get_filename_component (DIR ${DIR} PATH)
+    if (DIR)
+        add_sample_subdirectory (${DIR})
+    endif ()
+endforeach ()

+ 750 - 750
Source/ThirdParty/Assimp/CMakeLists.txt

@@ -1,750 +1,750 @@
-#
-# Listing and grouping of all the source files.
-# 1) Set the file lists for each component
-# 2) Create a Source Group for each component, for IDE project orginization
-# 3) Add libassimp using the file lists (eliminates duplication of file names between
-#    source groups and library command)
-#
-
-# Modified by Lasse Oorni and Yao Wei Tjong for Urho3D
-
-if (MINGW)
-    # The IFCReaderGen.cpp.obj has too many sections in DEBUG configuration build
-    # Since GCC does not support /bigobj compiler flags as in MSVC, we use optimization flags to reduce the object file size
-    set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O1")
-    set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O1")
-endif ()
-
-INCLUDE_DIRECTORIES( code )
-INCLUDE_DIRECTORIES( include )
-INCLUDE_DIRECTORIES( code/BoostWorkaround )
-INCLUDE_DIRECTORIES( contrib/unzip )
-ADD_DEFINITIONS( -DASSIMP_BUILD_BOOST_WORKAROUND )
-
-SET( HEADER_PATH include/assimp )
-
-SET( COMPILER_HEADERS
-  ${HEADER_PATH}/Compiler/pushpack1.h
-  ${HEADER_PATH}/Compiler/poppack1.h
-  ${HEADER_PATH}/Compiler/pstdint.h
-)
-SOURCE_GROUP( Compiler FILES ${COMPILER_HEADERS})
-
-SET( PUBLIC_HEADERS
-  ${HEADER_PATH}/anim.h
-  ${HEADER_PATH}/ai_assert.h
-  ${HEADER_PATH}/camera.h
-  ${HEADER_PATH}/color4.h
-  ${HEADER_PATH}/color4.inl
-  ${HEADER_PATH}/config.h
-  ${HEADER_PATH}/defs.h
-  ${HEADER_PATH}/cfileio.h
-  ${HEADER_PATH}/light.h
-  ${HEADER_PATH}/material.h
-  ${HEADER_PATH}/material.inl
-  ${HEADER_PATH}/matrix3x3.h
-  ${HEADER_PATH}/matrix3x3.inl
-  ${HEADER_PATH}/matrix4x4.h
-  ${HEADER_PATH}/matrix4x4.inl
-  ${HEADER_PATH}/mesh.h
-  ${HEADER_PATH}/postprocess.h
-  ${HEADER_PATH}/quaternion.h
-  ${HEADER_PATH}/quaternion.inl
-  ${HEADER_PATH}/scene.h
-  ${HEADER_PATH}/metadata.h
-  ${HEADER_PATH}/texture.h
-  ${HEADER_PATH}/types.h
-  ${HEADER_PATH}/vector2.h
-  ${HEADER_PATH}/vector2.inl
-  ${HEADER_PATH}/vector3.h
-  ${HEADER_PATH}/vector3.inl
-  ${HEADER_PATH}/version.h
-  ${HEADER_PATH}/cimport.h
-  ${HEADER_PATH}/importerdesc.h
-  ${HEADER_PATH}/Importer.hpp
-  ${HEADER_PATH}/DefaultLogger.hpp
-  ${HEADER_PATH}/ProgressHandler.hpp
-  ${HEADER_PATH}/IOStream.hpp
-  ${HEADER_PATH}/IOSystem.hpp
-  ${HEADER_PATH}/Logger.hpp
-  ${HEADER_PATH}/LogStream.hpp
-  ${HEADER_PATH}/NullLogger.hpp
-  ${HEADER_PATH}/cexport.h
-  ${HEADER_PATH}/Exporter.hpp
-)
-
-SET( Core_SRCS
-  code/Assimp.cpp
-)
-
-SET( Boost_SRCS
-  code/BoostWorkaround/boost/math/common_factor_rt.hpp
-  code/BoostWorkaround/boost/foreach.hpp
-  code/BoostWorkaround/boost/format.hpp
-  code/BoostWorkaround/boost/scoped_array.hpp
-  code/BoostWorkaround/boost/scoped_ptr.hpp
-  code/BoostWorkaround/boost/shared_array.hpp
-  code/BoostWorkaround/boost/shared_ptr.hpp
-  code/BoostWorkaround/boost/make_shared.hpp
-  code/BoostWorkaround/boost/static_assert.hpp
-  code/BoostWorkaround/boost/tuple/tuple.hpp
-)
-SOURCE_GROUP(Boost FILES ${Boost_SRCS})
-
-SET( Logging_SRCS
-  ${HEADER_PATH}/DefaultLogger.hpp
-  ${HEADER_PATH}/LogStream.hpp
-  ${HEADER_PATH}/Logger.hpp
-  ${HEADER_PATH}/NullLogger.hpp
-  code/Win32DebugLogStream.h
-  code/DefaultLogger.cpp
-  code/FileLogStream.h
-  code/StdOStreamLogStream.h
-)
-SOURCE_GROUP(Logging FILES ${Logging_SRCS})
-
-SET( Common_SRCS
-  code/fast_atof.h
-  code/qnan.h
-  code/BaseImporter.cpp
-  code/BaseImporter.h
-  code/BaseProcess.cpp
-  code/BaseProcess.h
-  code/Importer.h
-  code/ScenePrivate.h
-  code/PostStepRegistry.cpp
-  code/ImporterRegistry.cpp
-  code/ByteSwapper.h
-  code/DefaultProgressHandler.h
-  code/DefaultIOStream.cpp
-  code/DefaultIOStream.h
-  code/DefaultIOSystem.cpp
-  code/DefaultIOSystem.h
-  code/CInterfaceIOWrapper.h
-  code/Hash.h
-  code/Importer.cpp
-  code/IFF.h
-  code/MemoryIOWrapper.h
-  code/ParsingUtils.h
-  code/StreamReader.h
-  code/StreamWriter.h
-  code/StringComparison.h
-  code/SGSpatialSort.cpp
-  code/SGSpatialSort.h
-  code/VertexTriangleAdjacency.cpp
-  code/VertexTriangleAdjacency.h
-  code/GenericProperty.h
-  code/SpatialSort.cpp
-  code/SpatialSort.h
-  code/SceneCombiner.cpp
-  code/SceneCombiner.h
-  code/ScenePreprocessor.cpp
-  code/ScenePreprocessor.h
-  code/SkeletonMeshBuilder.cpp
-  code/SkeletonMeshBuilder.h
-  code/SplitByBoneCountProcess.cpp
-  code/SplitByBoneCountProcess.h
-  code/SmoothingGroups.h
-  code/StandardShapes.cpp
-  code/StandardShapes.h
-  code/TargetAnimation.cpp
-  code/TargetAnimation.h
-  code/RemoveComments.cpp
-  code/RemoveComments.h
-  code/Subdivision.cpp
-  code/Subdivision.h
-  code/Vertex.h
-  code/LineSplitter.h
-  code/TinyFormatter.h
-  code/Profiler.h
-  code/LogAux.h
-  code/Bitmap.cpp
-  code/Bitmap.h
-  code/XMLTools.h
-  code/Version.cpp
-)
-SOURCE_GROUP(Common FILES ${Common_SRCS})
-
-IF ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER )
-  SET( C4D_SRCS
-    code/C4DImporter.cpp
-    code/C4DImporter.h
-  )
-  SOURCE_GROUP( C4D FILES ${C4D_SRCS})
-ENDIF ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER )
-
-# macro to add the CMake Option ADD_ASSIMP_IMPORTER_<name> which enables compile of loader
-# this way selective loaders can be compiled (reduces filesize + compile time)
-MACRO(ADD_ASSIMP_IMPORTER name)
-  OPTION(ASSIMP_BUILD_${name}_IMPORTER "build the ${name} importer" TRUE)
-  IF(ASSIMP_BUILD_${name}_IMPORTER)
-    LIST(APPEND ASSIMP_LOADER_SRCS ${ARGN})
-    SET(ASSIMP_IMPORTERS_ENABLED "${ASSIMP_IMPORTERS_ENABLED} ${name}")
-    SET(${name}_SRCS ${ARGN})
-    SOURCE_GROUP(${name} FILES ${ARGN})
-  ELSE()
-    SET(${name}_SRC "")
-    SET(ASSIMP_IMPORTERS_DISABLED "${ASSIMP_IMPORTERS_DISABLED} ${name}")
-    add_definitions(-DASSIMP_BUILD_NO_${name}_IMPORTER)
-  ENDIF()
-ENDMACRO()
-
-SET(ASSIMP_LOADER_SRCS "")
-SET(ASSIMP_IMPORTERS_ENABLED "") # list of enabled importers
-SET(ASSIMP_IMPORTERS_DISABLED "") # disabled list (used to print)
-
-ADD_ASSIMP_IMPORTER(3DS
-  code/3DSConverter.cpp
-  code/3DSHelper.h
-  code/3DSLoader.cpp
-  code/3DSLoader.h
-  code/3DSExporter.h
-  code/3DSExporter.cpp
-)
-
-ADD_ASSIMP_IMPORTER(AC
-  code/ACLoader.cpp
-  code/ACLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(ASE
-  code/ASELoader.cpp
-  code/ASELoader.h
-  code/ASEParser.cpp
-  code/ASEParser.h
-)
-
-ADD_ASSIMP_IMPORTER(ASSBIN
-  code/AssbinExporter.h
-  code/AssbinExporter.cpp
-  code/AssbinLoader.h
-  code/AssbinLoader.cpp
-)
-
-ADD_ASSIMP_IMPORTER(ASSXML
-  code/AssxmlExporter.h
-  code/AssxmlExporter.cpp
-)
-
-ADD_ASSIMP_IMPORTER(B3D
-  code/B3DImporter.cpp
-  code/B3DImporter.h
-)
-
-ADD_ASSIMP_IMPORTER(BVH
-  code/BVHLoader.cpp
-  code/BVHLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(COLLADA
-  code/ColladaHelper.h
-  code/ColladaLoader.cpp
-  code/ColladaLoader.h
-  code/ColladaParser.cpp
-  code/ColladaParser.h
-  code/ColladaExporter.h
-  code/ColladaExporter.cpp
-)
-
-ADD_ASSIMP_IMPORTER(DXF
-  code/DXFLoader.cpp
-  code/DXFLoader.h
-  code/DXFHelper.h
-)
-
-ADD_ASSIMP_IMPORTER(CSM
-  code/CSMLoader.cpp
-  code/CSMLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(HMP
-  code/HMPFileData.h
-  code/HMPLoader.cpp
-  code/HMPLoader.h
-  code/HalfLifeFileData.h
-)
-
-#FIXME: allow to set IRRMESH by option
-ADD_ASSIMP_IMPORTER(IRR
-  code/IRRLoader.cpp
-  code/IRRLoader.h
-  code/IRRMeshLoader.cpp
-  code/IRRMeshLoader.h
-  code/IRRShared.cpp
-  code/IRRShared.h
-)
-
-ADD_ASSIMP_IMPORTER(LWO
-  code/LWOAnimation.cpp
-  code/LWOAnimation.h
-  code/LWOBLoader.cpp
-  code/LWOFileData.h
-  code/LWOLoader.cpp
-  code/LWOLoader.h
-  code/LWOMaterial.cpp
-)
-
-ADD_ASSIMP_IMPORTER(LWS
-  code/LWSLoader.cpp
-  code/LWSLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(MD2
-  code/MD2FileData.h
-  code/MD2Loader.cpp
-  code/MD2Loader.h
-  code/MD2NormalTable.h
-)
-
-ADD_ASSIMP_IMPORTER(MD3
-  code/MD3FileData.h
-  code/MD3Loader.cpp
-  code/MD3Loader.h
-)
-
-ADD_ASSIMP_IMPORTER(MD5
-  code/MD5Loader.cpp
-  code/MD5Loader.h
-  code/MD5Parser.cpp
-  code/MD5Parser.h
-)
-
-ADD_ASSIMP_IMPORTER(MDC
-  code/MDCFileData.h
-  code/MDCLoader.cpp
-  code/MDCLoader.h
-  code/MDCNormalTable.h
-)
-
-ADD_ASSIMP_IMPORTER(MDL
-  code/MDLDefaultColorMap.h
-  code/MDLFileData.h
-  code/MDLLoader.cpp
-  code/MDLLoader.h
-  code/MDLMaterialLoader.cpp
-)
-
-SET( MaterialSystem_SRCS
-  code/MaterialSystem.cpp
-  code/MaterialSystem.h
-)
-SOURCE_GROUP( MaterialSystem FILES ${MaterialSystem_SRCS})
-
-ADD_ASSIMP_IMPORTER(NFF
-  code/NFFLoader.cpp
-  code/NFFLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(NDO
-  code/NDOLoader.cpp
-  code/NDOLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(OFF
-  code/OFFLoader.cpp
-  code/OFFLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(OBJ
-  code/ObjFileData.h
-  code/ObjFileImporter.cpp
-  code/ObjFileImporter.h
-  code/ObjFileMtlImporter.cpp
-  code/ObjFileMtlImporter.h
-  code/ObjFileParser.cpp
-  code/ObjFileParser.h
-  code/ObjTools.h
-  code/ObjExporter.h
-  code/ObjExporter.cpp
-)
-
-ADD_ASSIMP_IMPORTER(OGRE
-  code/OgreImporter.h
-  code/OgreStructs.h
-  code/OgreParsingUtils.h
-  code/OgreBinarySerializer.h
-  code/OgreXmlSerializer.h
-  code/OgreImporter.cpp
-  code/OgreStructs.cpp
-  code/OgreBinarySerializer.cpp
-  code/OgreXmlSerializer.cpp
-  code/OgreMaterial.cpp
-)
-
-ADD_ASSIMP_IMPORTER(OPENGEX
-  code/OpenGEXExporter.cpp
-  code/OpenGEXExporter.h
-  code/OpenGEXImporter.cpp
-  code/OpenGEXImporter.h
-  code/OpenGEXStructs.h
-)
-
-ADD_ASSIMP_IMPORTER(PLY
-  code/PlyLoader.cpp
-  code/PlyLoader.h
-  code/PlyParser.cpp
-  code/PlyParser.h
-  code/PlyExporter.cpp
-  code/PlyExporter.h
-)
-
-ADD_ASSIMP_IMPORTER(MS3D
-  code/MS3DLoader.cpp
-  code/MS3DLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(COB
-  code/COBLoader.cpp
-  code/COBLoader.h
-  code/COBScene.h
-)
-
-ADD_ASSIMP_IMPORTER(BLEND
-  code/BlenderLoader.cpp
-  code/BlenderLoader.h
-  code/BlenderDNA.cpp
-  code/BlenderDNA.h
-  code/BlenderDNA.inl
-  code/BlenderScene.cpp
-  code/BlenderScene.h
-  code/BlenderSceneGen.h
-  code/BlenderIntermediate.h
-  code/BlenderModifier.h
-  code/BlenderModifier.cpp
-  code/BlenderBMesh.h
-  code/BlenderBMesh.cpp
-  code/BlenderTessellator.h
-  code/BlenderTessellator.cpp
-)
-
-ADD_ASSIMP_IMPORTER(IFC
-  code/IFCLoader.cpp
-  code/IFCLoader.h
-  code/IFCReaderGen.cpp
-  code/IFCReaderGen.h
-  code/IFCUtil.h
-  code/IFCUtil.cpp
-  code/IFCGeometry.cpp
-  code/IFCMaterial.cpp
-  code/IFCProfile.cpp
-  code/IFCCurve.cpp
-  code/IFCBoolean.cpp
-  code/IFCOpenings.cpp
-  code/STEPFile.h
-  code/STEPFileReader.h
-  code/STEPFileReader.cpp
-  code/STEPFileEncoding.cpp
-  code/STEPFileEncoding.h
-)
-
-ADD_ASSIMP_IMPORTER(XGL
-  code/XGLLoader.cpp
-  code/XGLLoader.h
-)
-
-
-ADD_ASSIMP_IMPORTER(FBX
-  code/FBXImporter.cpp
-  code/FBXCompileConfig.h
-  code/FBXImporter.h
-  code/FBXParser.cpp
-  code/FBXParser.h
-  code/FBXTokenizer.cpp
-  code/FBXTokenizer.h
-  code/FBXImportSettings.h
-  code/FBXConverter.h
-  code/FBXConverter.cpp
-  code/FBXUtil.h
-  code/FBXUtil.cpp
-  code/FBXDocument.h
-  code/FBXDocument.cpp
-  code/FBXProperties.h
-  code/FBXProperties.cpp
-  code/FBXMeshGeometry.cpp
-  code/FBXMaterial.cpp
-  code/FBXModel.cpp
-  code/FBXAnimation.cpp
-  code/FBXNodeAttribute.cpp
-  code/FBXDeformer.cpp
-  code/FBXBinaryTokenizer.cpp
-  code/FBXDocumentUtil.cpp
-)
-
-SET( PostProcessing_SRCS
-  code/CalcTangentsProcess.cpp
-  code/CalcTangentsProcess.h
-  code/ComputeUVMappingProcess.cpp
-  code/ComputeUVMappingProcess.h
-  code/ConvertToLHProcess.cpp
-  code/ConvertToLHProcess.h
-  code/FindDegenerates.cpp
-  code/FindDegenerates.h
-  code/FindInstancesProcess.cpp
-  code/FindInstancesProcess.h
-  code/FindInvalidDataProcess.cpp
-  code/FindInvalidDataProcess.h
-  code/FixNormalsStep.cpp
-  code/FixNormalsStep.h
-  code/GenFaceNormalsProcess.cpp
-  code/GenFaceNormalsProcess.h
-  code/GenVertexNormalsProcess.cpp
-  code/GenVertexNormalsProcess.h
-  code/PretransformVertices.cpp
-  code/PretransformVertices.h
-  code/ImproveCacheLocality.cpp
-  code/ImproveCacheLocality.h
-  code/JoinVerticesProcess.cpp
-  code/JoinVerticesProcess.h
-  code/LimitBoneWeightsProcess.cpp
-  code/LimitBoneWeightsProcess.h
-  code/RemoveRedundantMaterials.cpp
-  code/RemoveRedundantMaterials.h
-  code/RemoveVCProcess.cpp
-  code/RemoveVCProcess.h
-  code/SortByPTypeProcess.cpp
-  code/SortByPTypeProcess.h
-  code/SplitLargeMeshes.cpp
-  code/SplitLargeMeshes.h
-  code/TextureTransform.cpp
-  code/TextureTransform.h
-  code/TriangulateProcess.cpp
-  code/TriangulateProcess.h
-  code/ValidateDataStructure.cpp
-  code/ValidateDataStructure.h
-  code/OptimizeGraph.cpp
-  code/OptimizeGraph.h
-  code/OptimizeMeshes.cpp
-  code/OptimizeMeshes.h
-  code/DeboneProcess.cpp
-  code/DeboneProcess.h
-  code/ProcessHelper.h
-  code/ProcessHelper.cpp
-  code/PolyTools.h
-  code/MakeVerboseFormat.cpp
-  code/MakeVerboseFormat.h
-)
-SOURCE_GROUP( PostProcessing FILES ${PostProcessing_SRCS})
-
-ADD_ASSIMP_IMPORTER(Q3D
-  code/Q3DLoader.cpp
-  code/Q3DLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(Q3BSP
-  code/Q3BSPFileData.h
-  code/Q3BSPFileParser.h
-  code/Q3BSPFileParser.cpp
-  code/Q3BSPFileImporter.h
-  code/Q3BSPFileImporter.cpp
-  code/Q3BSPZipArchive.h
-  code/Q3BSPZipArchive.cpp
-)
-
-ADD_ASSIMP_IMPORTER(RAW
-  code/RawLoader.cpp
-  code/RawLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(SMD
-  code/SMDLoader.cpp
-  code/SMDLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(STL
-  code/STLLoader.cpp
-  code/STLLoader.h
-  code/STLExporter.h
-  code/STLExporter.cpp
-)
-
-ADD_ASSIMP_IMPORTER(TERRAGEN
-  code/TerragenLoader.cpp
-  code/TerragenLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(3D
-  code/UnrealLoader.cpp
-  code/UnrealLoader.h
-)
-
-ADD_ASSIMP_IMPORTER(X
-  code/XFileHelper.h
-  code/XFileImporter.cpp
-  code/XFileImporter.h
-  code/XFileParser.cpp
-  code/XFileParser.h
-  code/XFileExporter.h
-  code/XFileExporter.cpp
-)
-
-SET( Step_SRCS
-  code/StepExporter.h
-  code/StepExporter.cpp
-)
-SOURCE_GROUP( Step FILES ${Step_SRCS})
-
-SET( Exporter_SRCS
-  code/Exporter.cpp
-  code/AssimpCExport.cpp
-  code/BlobIOSystem.h
-)
-SOURCE_GROUP( Exporter FILES ${Exporter_SRCS})
-
-SET( Extra_SRCS
-  code/MD4FileData.h
-)
-SOURCE_GROUP( Extra FILES ${Extra_SRCS})
-
-SET( IrrXML_SRCS
-  code/irrXMLWrapper.h
-  contrib/irrXML/CXMLReaderImpl.h
-  contrib/irrXML/heapsort.h
-  contrib/irrXML/irrArray.h
-  contrib/irrXML/irrString.h
-  contrib/irrXML/irrTypes.h
-  contrib/irrXML/irrXML.cpp
-  contrib/irrXML/irrXML.h
-)
-SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS})
-
-SET( ConvertUTF_SRCS
-  contrib/ConvertUTF/ConvertUTF.h
-  contrib/ConvertUTF/ConvertUTF.c
-)
-SOURCE_GROUP( ConvertUTF FILES ${ConvertUTF_SRCS})
-
-SET( Clipper_SRCS
-  contrib/clipper/clipper.hpp
-  contrib/clipper/clipper.cpp
-)
-SOURCE_GROUP( Clipper FILES ${Clipper_SRCS})
-
-
-SET( Poly2Tri_SRCS
-  contrib/poly2tri/poly2tri/common/shapes.cc
-  contrib/poly2tri/poly2tri/common/shapes.h
-  contrib/poly2tri/poly2tri/common/utils.h
-  contrib/poly2tri/poly2tri/sweep/advancing_front.h
-  contrib/poly2tri/poly2tri/sweep/advancing_front.cc
-  contrib/poly2tri/poly2tri/sweep/cdt.cc
-  contrib/poly2tri/poly2tri/sweep/cdt.h
-  contrib/poly2tri/poly2tri/sweep/sweep.cc
-  contrib/poly2tri/poly2tri/sweep/sweep.h
-  contrib/poly2tri/poly2tri/sweep/sweep_context.cc
-  contrib/poly2tri/poly2tri/sweep/sweep_context.h
-)
-SOURCE_GROUP( Poly2Tri FILES ${Poly2Tri_SRCS})
-
-SET( unzip_SRCS
-  contrib/unzip/crypt.h
-  contrib/unzip/ioapi.c
-  contrib/unzip/ioapi.h
-  contrib/unzip/unzip.c
-  contrib/unzip/unzip.h
-)
-SOURCE_GROUP( unzip FILES ${unzip_SRCS})
-
-SET( zlib_SRCS
-  contrib/zlib/adler32.c
-  contrib/zlib/compress.c
-  contrib/zlib/crc32.c
-  contrib/zlib/crc32.h
-  contrib/zlib/deflate.c
-  contrib/zlib/deflate.h
-#  contrib/zlib/gzclose.c
-#  contrib/zlib/gzguts.h
-#  contrib/zlib/gzlib.c
-#  contrib/zlib/gzread.c
-#  contrib/zlib/gzwrite.c
-  contrib/zlib/infback.c
-  contrib/zlib/inffast.c
-  contrib/zlib/inffast.h
-  contrib/zlib/inffixed.h
-  contrib/zlib/inflate.c
-  contrib/zlib/inflate.h
-  contrib/zlib/inftrees.c
-  contrib/zlib/inftrees.h
-  contrib/zlib/trees.c
-  contrib/zlib/trees.h
-  contrib/zlib/uncompr.c
-  contrib/zlib/zconf.h
-  contrib/zlib/zlib.h
-  contrib/zlib/zutil.c
-  contrib/zlib/zutil.h
-)
-SOURCE_GROUP( zlib FILES ${zlib_SRCS})
-
-SET ( openddl_parser_SRCS
-  contrib/openddlparser/code/OpenDDLParser.cpp
-  contrib/openddlparser/code/DDLNode.cpp
-  contrib/openddlparser/code/Value.cpp
-  contrib/openddlparser/include/openddlparser/OpenDDLParser.h
-  contrib/openddlparser/include/openddlparser/OpenDDLParserUtils.h
-  contrib/openddlparser/include/openddlparser/OpenDDLCommon.h
-  contrib/openddlparser/include/openddlparser/DDLNode.h
-  contrib/openddlparser/include/openddlparser/Value.h
-)
-SOURCE_GROUP( openddl_parser FILES ${openddl_parser_SRCS})
-
-# VC2010 fixes
-if(MSVC10)
-  option( VC10_STDINT_FIX "Fix for VC10 Compiler regarding pstdint.h redefinition errors" OFF )
-  if( VC10_STDINT_FIX )
-    ADD_DEFINITIONS( -D_STDINT )
-  endif( VC10_STDINT_FIX )
-endif(MSVC10)
-
-if ( MSVC )
-  ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
-  ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
-endif ( MSVC )
-
-# Urho3D: disable status prints
-# MESSAGE(STATUS "Enabled formats:${ASSIMP_IMPORTERS_ENABLED}")
-# MESSAGE(STATUS "Disabled formats:${ASSIMP_IMPORTERS_DISABLED}")
-
-SET( SOURCE_FILES
-  # Assimp Files
-  ${Core_SRCS}
-  ${Common_SRCS}
-  ${Logging_SRCS}
-  ${Exporter_SRCS}
-  ${PostProcessing_SRCS}
-  ${MaterialSystem_SRCS}
-  ${Step_SRCS}
-
-  # Model Support
-  ${ASSIMP_LOADER_SRCS}
-
-  # Third-party libraries
-  ${IrrXML_SRCS}
-  ${ConvertUTF_SRCS}
-  ${unzip_SRCS}
-  ${zlib_SRCS}
-  ${Poly2Tri_SRCS}
-  ${Clipper_SRCS}
-  ${openddl_parser_SRCS}
-  # Necessary to show the headers in the project when using the VC++ generator:
-  ${Boost_SRCS}
-
-  ${PUBLIC_HEADERS}
-  ${COMPILER_HEADERS}
-
-)
-add_definitions( -DOPENDDLPARSER_BUILD )
-
-INCLUDE_DIRECTORIES(
-  contrib/openddlparser/include
-)
-
-# Urho3D: set the corresponding "no importer" define
-IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
-  SET( SOURCE_FILES ${SOURCE_FILES} ${C4D_SRCS})
-  INCLUDE_DIRECTORIES(${C4D_INCLUDES})
-ELSE (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
-  add_definitions(-DASSIMP_BUILD_NO_C4D_IMPORTER)
-ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
-
-set (TARGET_NAME Assimp)
-list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH YES)   # Since we only build AssetImporter as a single-arch native tool, there is no point to build Assimp as universal binary library
-setup_library ()
+#
+# Listing and grouping of all the source files.
+# 1) Set the file lists for each component
+# 2) Create a Source Group for each component, for IDE project orginization
+# 3) Add libassimp using the file lists (eliminates duplication of file names between
+#    source groups and library command)
+#
+
+# Modified by Lasse Oorni and Yao Wei Tjong for Urho3D
+
+if (MINGW)
+    # The IFCReaderGen.cpp.obj has too many sections in DEBUG configuration build
+    # Since GCC does not support /bigobj compiler flags as in MSVC, we use optimization flags to reduce the object file size
+    set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O1")
+    set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O1")
+endif ()
+
+INCLUDE_DIRECTORIES( code )
+INCLUDE_DIRECTORIES( include )
+INCLUDE_DIRECTORIES( code/BoostWorkaround )
+INCLUDE_DIRECTORIES( contrib/unzip )
+ADD_DEFINITIONS( -DASSIMP_BUILD_BOOST_WORKAROUND )
+
+SET( HEADER_PATH include/assimp )
+
+SET( COMPILER_HEADERS
+  ${HEADER_PATH}/Compiler/pushpack1.h
+  ${HEADER_PATH}/Compiler/poppack1.h
+  ${HEADER_PATH}/Compiler/pstdint.h
+)
+SOURCE_GROUP( Compiler FILES ${COMPILER_HEADERS})
+
+SET( PUBLIC_HEADERS
+  ${HEADER_PATH}/anim.h
+  ${HEADER_PATH}/ai_assert.h
+  ${HEADER_PATH}/camera.h
+  ${HEADER_PATH}/color4.h
+  ${HEADER_PATH}/color4.inl
+  ${HEADER_PATH}/config.h
+  ${HEADER_PATH}/defs.h
+  ${HEADER_PATH}/cfileio.h
+  ${HEADER_PATH}/light.h
+  ${HEADER_PATH}/material.h
+  ${HEADER_PATH}/material.inl
+  ${HEADER_PATH}/matrix3x3.h
+  ${HEADER_PATH}/matrix3x3.inl
+  ${HEADER_PATH}/matrix4x4.h
+  ${HEADER_PATH}/matrix4x4.inl
+  ${HEADER_PATH}/mesh.h
+  ${HEADER_PATH}/postprocess.h
+  ${HEADER_PATH}/quaternion.h
+  ${HEADER_PATH}/quaternion.inl
+  ${HEADER_PATH}/scene.h
+  ${HEADER_PATH}/metadata.h
+  ${HEADER_PATH}/texture.h
+  ${HEADER_PATH}/types.h
+  ${HEADER_PATH}/vector2.h
+  ${HEADER_PATH}/vector2.inl
+  ${HEADER_PATH}/vector3.h
+  ${HEADER_PATH}/vector3.inl
+  ${HEADER_PATH}/version.h
+  ${HEADER_PATH}/cimport.h
+  ${HEADER_PATH}/importerdesc.h
+  ${HEADER_PATH}/Importer.hpp
+  ${HEADER_PATH}/DefaultLogger.hpp
+  ${HEADER_PATH}/ProgressHandler.hpp
+  ${HEADER_PATH}/IOStream.hpp
+  ${HEADER_PATH}/IOSystem.hpp
+  ${HEADER_PATH}/Logger.hpp
+  ${HEADER_PATH}/LogStream.hpp
+  ${HEADER_PATH}/NullLogger.hpp
+  ${HEADER_PATH}/cexport.h
+  ${HEADER_PATH}/Exporter.hpp
+)
+
+SET( Core_SRCS
+  code/Assimp.cpp
+)
+
+SET( Boost_SRCS
+  code/BoostWorkaround/boost/math/common_factor_rt.hpp
+  code/BoostWorkaround/boost/foreach.hpp
+  code/BoostWorkaround/boost/format.hpp
+  code/BoostWorkaround/boost/scoped_array.hpp
+  code/BoostWorkaround/boost/scoped_ptr.hpp
+  code/BoostWorkaround/boost/shared_array.hpp
+  code/BoostWorkaround/boost/shared_ptr.hpp
+  code/BoostWorkaround/boost/make_shared.hpp
+  code/BoostWorkaround/boost/static_assert.hpp
+  code/BoostWorkaround/boost/tuple/tuple.hpp
+)
+SOURCE_GROUP(Boost FILES ${Boost_SRCS})
+
+SET( Logging_SRCS
+  ${HEADER_PATH}/DefaultLogger.hpp
+  ${HEADER_PATH}/LogStream.hpp
+  ${HEADER_PATH}/Logger.hpp
+  ${HEADER_PATH}/NullLogger.hpp
+  code/Win32DebugLogStream.h
+  code/DefaultLogger.cpp
+  code/FileLogStream.h
+  code/StdOStreamLogStream.h
+)
+SOURCE_GROUP(Logging FILES ${Logging_SRCS})
+
+SET( Common_SRCS
+  code/fast_atof.h
+  code/qnan.h
+  code/BaseImporter.cpp
+  code/BaseImporter.h
+  code/BaseProcess.cpp
+  code/BaseProcess.h
+  code/Importer.h
+  code/ScenePrivate.h
+  code/PostStepRegistry.cpp
+  code/ImporterRegistry.cpp
+  code/ByteSwapper.h
+  code/DefaultProgressHandler.h
+  code/DefaultIOStream.cpp
+  code/DefaultIOStream.h
+  code/DefaultIOSystem.cpp
+  code/DefaultIOSystem.h
+  code/CInterfaceIOWrapper.h
+  code/Hash.h
+  code/Importer.cpp
+  code/IFF.h
+  code/MemoryIOWrapper.h
+  code/ParsingUtils.h
+  code/StreamReader.h
+  code/StreamWriter.h
+  code/StringComparison.h
+  code/SGSpatialSort.cpp
+  code/SGSpatialSort.h
+  code/VertexTriangleAdjacency.cpp
+  code/VertexTriangleAdjacency.h
+  code/GenericProperty.h
+  code/SpatialSort.cpp
+  code/SpatialSort.h
+  code/SceneCombiner.cpp
+  code/SceneCombiner.h
+  code/ScenePreprocessor.cpp
+  code/ScenePreprocessor.h
+  code/SkeletonMeshBuilder.cpp
+  code/SkeletonMeshBuilder.h
+  code/SplitByBoneCountProcess.cpp
+  code/SplitByBoneCountProcess.h
+  code/SmoothingGroups.h
+  code/StandardShapes.cpp
+  code/StandardShapes.h
+  code/TargetAnimation.cpp
+  code/TargetAnimation.h
+  code/RemoveComments.cpp
+  code/RemoveComments.h
+  code/Subdivision.cpp
+  code/Subdivision.h
+  code/Vertex.h
+  code/LineSplitter.h
+  code/TinyFormatter.h
+  code/Profiler.h
+  code/LogAux.h
+  code/Bitmap.cpp
+  code/Bitmap.h
+  code/XMLTools.h
+  code/Version.cpp
+)
+SOURCE_GROUP(Common FILES ${Common_SRCS})
+
+IF ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER )
+  SET( C4D_SRCS
+    code/C4DImporter.cpp
+    code/C4DImporter.h
+  )
+  SOURCE_GROUP( C4D FILES ${C4D_SRCS})
+ENDIF ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER )
+
+# macro to add the CMake Option ADD_ASSIMP_IMPORTER_<name> which enables compile of loader
+# this way selective loaders can be compiled (reduces filesize + compile time)
+MACRO(ADD_ASSIMP_IMPORTER name)
+  OPTION(ASSIMP_BUILD_${name}_IMPORTER "build the ${name} importer" TRUE)
+  IF(ASSIMP_BUILD_${name}_IMPORTER)
+    LIST(APPEND ASSIMP_LOADER_SRCS ${ARGN})
+    SET(ASSIMP_IMPORTERS_ENABLED "${ASSIMP_IMPORTERS_ENABLED} ${name}")
+    SET(${name}_SRCS ${ARGN})
+    SOURCE_GROUP(${name} FILES ${ARGN})
+  ELSE()
+    SET(${name}_SRC "")
+    SET(ASSIMP_IMPORTERS_DISABLED "${ASSIMP_IMPORTERS_DISABLED} ${name}")
+    add_definitions(-DASSIMP_BUILD_NO_${name}_IMPORTER)
+  ENDIF()
+ENDMACRO()
+
+SET(ASSIMP_LOADER_SRCS "")
+SET(ASSIMP_IMPORTERS_ENABLED "") # list of enabled importers
+SET(ASSIMP_IMPORTERS_DISABLED "") # disabled list (used to print)
+
+ADD_ASSIMP_IMPORTER(3DS
+  code/3DSConverter.cpp
+  code/3DSHelper.h
+  code/3DSLoader.cpp
+  code/3DSLoader.h
+  code/3DSExporter.h
+  code/3DSExporter.cpp
+)
+
+ADD_ASSIMP_IMPORTER(AC
+  code/ACLoader.cpp
+  code/ACLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(ASE
+  code/ASELoader.cpp
+  code/ASELoader.h
+  code/ASEParser.cpp
+  code/ASEParser.h
+)
+
+ADD_ASSIMP_IMPORTER(ASSBIN
+  code/AssbinExporter.h
+  code/AssbinExporter.cpp
+  code/AssbinLoader.h
+  code/AssbinLoader.cpp
+)
+
+ADD_ASSIMP_IMPORTER(ASSXML
+  code/AssxmlExporter.h
+  code/AssxmlExporter.cpp
+)
+
+ADD_ASSIMP_IMPORTER(B3D
+  code/B3DImporter.cpp
+  code/B3DImporter.h
+)
+
+ADD_ASSIMP_IMPORTER(BVH
+  code/BVHLoader.cpp
+  code/BVHLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(COLLADA
+  code/ColladaHelper.h
+  code/ColladaLoader.cpp
+  code/ColladaLoader.h
+  code/ColladaParser.cpp
+  code/ColladaParser.h
+  code/ColladaExporter.h
+  code/ColladaExporter.cpp
+)
+
+ADD_ASSIMP_IMPORTER(DXF
+  code/DXFLoader.cpp
+  code/DXFLoader.h
+  code/DXFHelper.h
+)
+
+ADD_ASSIMP_IMPORTER(CSM
+  code/CSMLoader.cpp
+  code/CSMLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(HMP
+  code/HMPFileData.h
+  code/HMPLoader.cpp
+  code/HMPLoader.h
+  code/HalfLifeFileData.h
+)
+
+#FIXME: allow to set IRRMESH by option
+ADD_ASSIMP_IMPORTER(IRR
+  code/IRRLoader.cpp
+  code/IRRLoader.h
+  code/IRRMeshLoader.cpp
+  code/IRRMeshLoader.h
+  code/IRRShared.cpp
+  code/IRRShared.h
+)
+
+ADD_ASSIMP_IMPORTER(LWO
+  code/LWOAnimation.cpp
+  code/LWOAnimation.h
+  code/LWOBLoader.cpp
+  code/LWOFileData.h
+  code/LWOLoader.cpp
+  code/LWOLoader.h
+  code/LWOMaterial.cpp
+)
+
+ADD_ASSIMP_IMPORTER(LWS
+  code/LWSLoader.cpp
+  code/LWSLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(MD2
+  code/MD2FileData.h
+  code/MD2Loader.cpp
+  code/MD2Loader.h
+  code/MD2NormalTable.h
+)
+
+ADD_ASSIMP_IMPORTER(MD3
+  code/MD3FileData.h
+  code/MD3Loader.cpp
+  code/MD3Loader.h
+)
+
+ADD_ASSIMP_IMPORTER(MD5
+  code/MD5Loader.cpp
+  code/MD5Loader.h
+  code/MD5Parser.cpp
+  code/MD5Parser.h
+)
+
+ADD_ASSIMP_IMPORTER(MDC
+  code/MDCFileData.h
+  code/MDCLoader.cpp
+  code/MDCLoader.h
+  code/MDCNormalTable.h
+)
+
+ADD_ASSIMP_IMPORTER(MDL
+  code/MDLDefaultColorMap.h
+  code/MDLFileData.h
+  code/MDLLoader.cpp
+  code/MDLLoader.h
+  code/MDLMaterialLoader.cpp
+)
+
+SET( MaterialSystem_SRCS
+  code/MaterialSystem.cpp
+  code/MaterialSystem.h
+)
+SOURCE_GROUP( MaterialSystem FILES ${MaterialSystem_SRCS})
+
+ADD_ASSIMP_IMPORTER(NFF
+  code/NFFLoader.cpp
+  code/NFFLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(NDO
+  code/NDOLoader.cpp
+  code/NDOLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(OFF
+  code/OFFLoader.cpp
+  code/OFFLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(OBJ
+  code/ObjFileData.h
+  code/ObjFileImporter.cpp
+  code/ObjFileImporter.h
+  code/ObjFileMtlImporter.cpp
+  code/ObjFileMtlImporter.h
+  code/ObjFileParser.cpp
+  code/ObjFileParser.h
+  code/ObjTools.h
+  code/ObjExporter.h
+  code/ObjExporter.cpp
+)
+
+ADD_ASSIMP_IMPORTER(OGRE
+  code/OgreImporter.h
+  code/OgreStructs.h
+  code/OgreParsingUtils.h
+  code/OgreBinarySerializer.h
+  code/OgreXmlSerializer.h
+  code/OgreImporter.cpp
+  code/OgreStructs.cpp
+  code/OgreBinarySerializer.cpp
+  code/OgreXmlSerializer.cpp
+  code/OgreMaterial.cpp
+)
+
+ADD_ASSIMP_IMPORTER(OPENGEX
+  code/OpenGEXExporter.cpp
+  code/OpenGEXExporter.h
+  code/OpenGEXImporter.cpp
+  code/OpenGEXImporter.h
+  code/OpenGEXStructs.h
+)
+
+ADD_ASSIMP_IMPORTER(PLY
+  code/PlyLoader.cpp
+  code/PlyLoader.h
+  code/PlyParser.cpp
+  code/PlyParser.h
+  code/PlyExporter.cpp
+  code/PlyExporter.h
+)
+
+ADD_ASSIMP_IMPORTER(MS3D
+  code/MS3DLoader.cpp
+  code/MS3DLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(COB
+  code/COBLoader.cpp
+  code/COBLoader.h
+  code/COBScene.h
+)
+
+ADD_ASSIMP_IMPORTER(BLEND
+  code/BlenderLoader.cpp
+  code/BlenderLoader.h
+  code/BlenderDNA.cpp
+  code/BlenderDNA.h
+  code/BlenderDNA.inl
+  code/BlenderScene.cpp
+  code/BlenderScene.h
+  code/BlenderSceneGen.h
+  code/BlenderIntermediate.h
+  code/BlenderModifier.h
+  code/BlenderModifier.cpp
+  code/BlenderBMesh.h
+  code/BlenderBMesh.cpp
+  code/BlenderTessellator.h
+  code/BlenderTessellator.cpp
+)
+
+ADD_ASSIMP_IMPORTER(IFC
+  code/IFCLoader.cpp
+  code/IFCLoader.h
+  code/IFCReaderGen.cpp
+  code/IFCReaderGen.h
+  code/IFCUtil.h
+  code/IFCUtil.cpp
+  code/IFCGeometry.cpp
+  code/IFCMaterial.cpp
+  code/IFCProfile.cpp
+  code/IFCCurve.cpp
+  code/IFCBoolean.cpp
+  code/IFCOpenings.cpp
+  code/STEPFile.h
+  code/STEPFileReader.h
+  code/STEPFileReader.cpp
+  code/STEPFileEncoding.cpp
+  code/STEPFileEncoding.h
+)
+
+ADD_ASSIMP_IMPORTER(XGL
+  code/XGLLoader.cpp
+  code/XGLLoader.h
+)
+
+
+ADD_ASSIMP_IMPORTER(FBX
+  code/FBXImporter.cpp
+  code/FBXCompileConfig.h
+  code/FBXImporter.h
+  code/FBXParser.cpp
+  code/FBXParser.h
+  code/FBXTokenizer.cpp
+  code/FBXTokenizer.h
+  code/FBXImportSettings.h
+  code/FBXConverter.h
+  code/FBXConverter.cpp
+  code/FBXUtil.h
+  code/FBXUtil.cpp
+  code/FBXDocument.h
+  code/FBXDocument.cpp
+  code/FBXProperties.h
+  code/FBXProperties.cpp
+  code/FBXMeshGeometry.cpp
+  code/FBXMaterial.cpp
+  code/FBXModel.cpp
+  code/FBXAnimation.cpp
+  code/FBXNodeAttribute.cpp
+  code/FBXDeformer.cpp
+  code/FBXBinaryTokenizer.cpp
+  code/FBXDocumentUtil.cpp
+)
+
+SET( PostProcessing_SRCS
+  code/CalcTangentsProcess.cpp
+  code/CalcTangentsProcess.h
+  code/ComputeUVMappingProcess.cpp
+  code/ComputeUVMappingProcess.h
+  code/ConvertToLHProcess.cpp
+  code/ConvertToLHProcess.h
+  code/FindDegenerates.cpp
+  code/FindDegenerates.h
+  code/FindInstancesProcess.cpp
+  code/FindInstancesProcess.h
+  code/FindInvalidDataProcess.cpp
+  code/FindInvalidDataProcess.h
+  code/FixNormalsStep.cpp
+  code/FixNormalsStep.h
+  code/GenFaceNormalsProcess.cpp
+  code/GenFaceNormalsProcess.h
+  code/GenVertexNormalsProcess.cpp
+  code/GenVertexNormalsProcess.h
+  code/PretransformVertices.cpp
+  code/PretransformVertices.h
+  code/ImproveCacheLocality.cpp
+  code/ImproveCacheLocality.h
+  code/JoinVerticesProcess.cpp
+  code/JoinVerticesProcess.h
+  code/LimitBoneWeightsProcess.cpp
+  code/LimitBoneWeightsProcess.h
+  code/RemoveRedundantMaterials.cpp
+  code/RemoveRedundantMaterials.h
+  code/RemoveVCProcess.cpp
+  code/RemoveVCProcess.h
+  code/SortByPTypeProcess.cpp
+  code/SortByPTypeProcess.h
+  code/SplitLargeMeshes.cpp
+  code/SplitLargeMeshes.h
+  code/TextureTransform.cpp
+  code/TextureTransform.h
+  code/TriangulateProcess.cpp
+  code/TriangulateProcess.h
+  code/ValidateDataStructure.cpp
+  code/ValidateDataStructure.h
+  code/OptimizeGraph.cpp
+  code/OptimizeGraph.h
+  code/OptimizeMeshes.cpp
+  code/OptimizeMeshes.h
+  code/DeboneProcess.cpp
+  code/DeboneProcess.h
+  code/ProcessHelper.h
+  code/ProcessHelper.cpp
+  code/PolyTools.h
+  code/MakeVerboseFormat.cpp
+  code/MakeVerboseFormat.h
+)
+SOURCE_GROUP( PostProcessing FILES ${PostProcessing_SRCS})
+
+ADD_ASSIMP_IMPORTER(Q3D
+  code/Q3DLoader.cpp
+  code/Q3DLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(Q3BSP
+  code/Q3BSPFileData.h
+  code/Q3BSPFileParser.h
+  code/Q3BSPFileParser.cpp
+  code/Q3BSPFileImporter.h
+  code/Q3BSPFileImporter.cpp
+  code/Q3BSPZipArchive.h
+  code/Q3BSPZipArchive.cpp
+)
+
+ADD_ASSIMP_IMPORTER(RAW
+  code/RawLoader.cpp
+  code/RawLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(SMD
+  code/SMDLoader.cpp
+  code/SMDLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(STL
+  code/STLLoader.cpp
+  code/STLLoader.h
+  code/STLExporter.h
+  code/STLExporter.cpp
+)
+
+ADD_ASSIMP_IMPORTER(TERRAGEN
+  code/TerragenLoader.cpp
+  code/TerragenLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(3D
+  code/UnrealLoader.cpp
+  code/UnrealLoader.h
+)
+
+ADD_ASSIMP_IMPORTER(X
+  code/XFileHelper.h
+  code/XFileImporter.cpp
+  code/XFileImporter.h
+  code/XFileParser.cpp
+  code/XFileParser.h
+  code/XFileExporter.h
+  code/XFileExporter.cpp
+)
+
+SET( Step_SRCS
+  code/StepExporter.h
+  code/StepExporter.cpp
+)
+SOURCE_GROUP( Step FILES ${Step_SRCS})
+
+SET( Exporter_SRCS
+  code/Exporter.cpp
+  code/AssimpCExport.cpp
+  code/BlobIOSystem.h
+)
+SOURCE_GROUP( Exporter FILES ${Exporter_SRCS})
+
+SET( Extra_SRCS
+  code/MD4FileData.h
+)
+SOURCE_GROUP( Extra FILES ${Extra_SRCS})
+
+SET( IrrXML_SRCS
+  code/irrXMLWrapper.h
+  contrib/irrXML/CXMLReaderImpl.h
+  contrib/irrXML/heapsort.h
+  contrib/irrXML/irrArray.h
+  contrib/irrXML/irrString.h
+  contrib/irrXML/irrTypes.h
+  contrib/irrXML/irrXML.cpp
+  contrib/irrXML/irrXML.h
+)
+SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS})
+
+SET( ConvertUTF_SRCS
+  contrib/ConvertUTF/ConvertUTF.h
+  contrib/ConvertUTF/ConvertUTF.c
+)
+SOURCE_GROUP( ConvertUTF FILES ${ConvertUTF_SRCS})
+
+SET( Clipper_SRCS
+  contrib/clipper/clipper.hpp
+  contrib/clipper/clipper.cpp
+)
+SOURCE_GROUP( Clipper FILES ${Clipper_SRCS})
+
+
+SET( Poly2Tri_SRCS
+  contrib/poly2tri/poly2tri/common/shapes.cc
+  contrib/poly2tri/poly2tri/common/shapes.h
+  contrib/poly2tri/poly2tri/common/utils.h
+  contrib/poly2tri/poly2tri/sweep/advancing_front.h
+  contrib/poly2tri/poly2tri/sweep/advancing_front.cc
+  contrib/poly2tri/poly2tri/sweep/cdt.cc
+  contrib/poly2tri/poly2tri/sweep/cdt.h
+  contrib/poly2tri/poly2tri/sweep/sweep.cc
+  contrib/poly2tri/poly2tri/sweep/sweep.h
+  contrib/poly2tri/poly2tri/sweep/sweep_context.cc
+  contrib/poly2tri/poly2tri/sweep/sweep_context.h
+)
+SOURCE_GROUP( Poly2Tri FILES ${Poly2Tri_SRCS})
+
+SET( unzip_SRCS
+  contrib/unzip/crypt.h
+  contrib/unzip/ioapi.c
+  contrib/unzip/ioapi.h
+  contrib/unzip/unzip.c
+  contrib/unzip/unzip.h
+)
+SOURCE_GROUP( unzip FILES ${unzip_SRCS})
+
+SET( zlib_SRCS
+  contrib/zlib/adler32.c
+  contrib/zlib/compress.c
+  contrib/zlib/crc32.c
+  contrib/zlib/crc32.h
+  contrib/zlib/deflate.c
+  contrib/zlib/deflate.h
+#  contrib/zlib/gzclose.c
+#  contrib/zlib/gzguts.h
+#  contrib/zlib/gzlib.c
+#  contrib/zlib/gzread.c
+#  contrib/zlib/gzwrite.c
+  contrib/zlib/infback.c
+  contrib/zlib/inffast.c
+  contrib/zlib/inffast.h
+  contrib/zlib/inffixed.h
+  contrib/zlib/inflate.c
+  contrib/zlib/inflate.h
+  contrib/zlib/inftrees.c
+  contrib/zlib/inftrees.h
+  contrib/zlib/trees.c
+  contrib/zlib/trees.h
+  contrib/zlib/uncompr.c
+  contrib/zlib/zconf.h
+  contrib/zlib/zlib.h
+  contrib/zlib/zutil.c
+  contrib/zlib/zutil.h
+)
+SOURCE_GROUP( zlib FILES ${zlib_SRCS})
+
+SET ( openddl_parser_SRCS
+  contrib/openddlparser/code/OpenDDLParser.cpp
+  contrib/openddlparser/code/DDLNode.cpp
+  contrib/openddlparser/code/Value.cpp
+  contrib/openddlparser/include/openddlparser/OpenDDLParser.h
+  contrib/openddlparser/include/openddlparser/OpenDDLParserUtils.h
+  contrib/openddlparser/include/openddlparser/OpenDDLCommon.h
+  contrib/openddlparser/include/openddlparser/DDLNode.h
+  contrib/openddlparser/include/openddlparser/Value.h
+)
+SOURCE_GROUP( openddl_parser FILES ${openddl_parser_SRCS})
+
+# VC2010 fixes
+if(MSVC10)
+  option( VC10_STDINT_FIX "Fix for VC10 Compiler regarding pstdint.h redefinition errors" OFF )
+  if( VC10_STDINT_FIX )
+    ADD_DEFINITIONS( -D_STDINT )
+  endif( VC10_STDINT_FIX )
+endif(MSVC10)
+
+if ( MSVC )
+  ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
+  ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
+endif ( MSVC )
+
+# Urho3D: disable status prints
+# MESSAGE(STATUS "Enabled formats:${ASSIMP_IMPORTERS_ENABLED}")
+# MESSAGE(STATUS "Disabled formats:${ASSIMP_IMPORTERS_DISABLED}")
+
+SET( SOURCE_FILES
+  # Assimp Files
+  ${Core_SRCS}
+  ${Common_SRCS}
+  ${Logging_SRCS}
+  ${Exporter_SRCS}
+  ${PostProcessing_SRCS}
+  ${MaterialSystem_SRCS}
+  ${Step_SRCS}
+
+  # Model Support
+  ${ASSIMP_LOADER_SRCS}
+
+  # Third-party libraries
+  ${IrrXML_SRCS}
+  ${ConvertUTF_SRCS}
+  ${unzip_SRCS}
+  ${zlib_SRCS}
+  ${Poly2Tri_SRCS}
+  ${Clipper_SRCS}
+  ${openddl_parser_SRCS}
+  # Necessary to show the headers in the project when using the VC++ generator:
+  ${Boost_SRCS}
+
+  ${PUBLIC_HEADERS}
+  ${COMPILER_HEADERS}
+
+)
+add_definitions( -DOPENDDLPARSER_BUILD )
+
+INCLUDE_DIRECTORIES(
+  contrib/openddlparser/include
+)
+
+# Urho3D: set the corresponding "no importer" define
+IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
+  SET( SOURCE_FILES ${SOURCE_FILES} ${C4D_SRCS})
+  INCLUDE_DIRECTORIES(${C4D_INCLUDES})
+ELSE (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
+  add_definitions(-DASSIMP_BUILD_NO_C4D_IMPORTER)
+ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
+
+set (TARGET_NAME Assimp)
+list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH YES)   # Since we only build AssetImporter as a single-arch native tool, there is no point to build Assimp as universal binary library
+setup_library ()

+ 55 - 55
Source/ThirdParty/Bullet/CMakeLists.txt

@@ -1,55 +1,55 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME Bullet)
-
-# Workaround for MinGW 6.1.0 and above where it throws ICE (internal compilation error) when -O3 is used
-if (MINGW AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.1.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 6.1.0))  # 6.1.0 is the last known bad version
-    string (REPLACE -O3 -O2 CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
-endif ()
-
-# Define source files
-file (GLOB CPP_FILES src/BulletCollision/BroadphaseCollision/*.cpp
-    src/BulletCollision/CollisionDispatch/*.cpp src/BulletCollision/CollisionShapes/*.cpp
-    src/BulletCollision/Gimpact/*.cpp src/BulletCollision/NarrowPhaseCollision/*.cpp
-    src/BulletDynamics/Character/*.cpp src/BulletDynamics/ConstraintSolver/*.cpp
-    src/BulletDynamics/Dynamics/*.cpp src/BulletDynamics/Featherstone/*.cpp
-    src/BulletDynamics/MLCPSolvers/*.cpp src/BulletDynamics/Vehicle/*.cpp src/BulletSoftBody/*.cpp
-    src/LinearMath/*.cpp)
-file (GLOB H_FILES *.h src/BulletCollision/BroadphaseCollision/*.h
-    src/BulletCollision/CollisionDispatch/*.h src/BulletCollision/CollisionShapes/*.h
-    src/BulletCollision/Gimpact/*.h src/BulletCollision/NarrowPhaseCollision/*.h
-    src/BulletDynamics/Character/*.h src/BulletDynamics/ConstraintSolver/*.h
-    src/BulletDynamics/Dynamics/*.h src/BulletDynamics/Featherstone/*.h
-    src/BulletDynamics/MLCPSolvers/*.h src/BulletDynamics/Vehicle/*.h src/BulletSoftBody/*.h
-    src/LinearMath/*.h)
-set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
-
-# Define dependency libs
-set (INCLUDE_DIRS src)
-
-# Setup target
-setup_library ()
-
-# Install headers for building and using the Urho3D library (install dependency for Urho3D/Physics/PhysicsWorld.h, Urho3D/Physics/RigidBody.h, and Urho3D/Physics/PhysicsUtils.h)
-install_header_files (DIRECTORY src/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/Bullet FILES_MATCHING PATTERN *.h)  # Note: the trailing slash is significant
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME Bullet)
+
+# Workaround for MinGW 6.1.0 and above where it throws ICE (internal compilation error) when -O3 is used
+if (MINGW AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.1.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 6.1.0))  # 6.1.0 is the last known bad version
+    string (REPLACE -O3 -O2 CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
+endif ()
+
+# Define source files
+file (GLOB CPP_FILES src/BulletCollision/BroadphaseCollision/*.cpp
+    src/BulletCollision/CollisionDispatch/*.cpp src/BulletCollision/CollisionShapes/*.cpp
+    src/BulletCollision/Gimpact/*.cpp src/BulletCollision/NarrowPhaseCollision/*.cpp
+    src/BulletDynamics/Character/*.cpp src/BulletDynamics/ConstraintSolver/*.cpp
+    src/BulletDynamics/Dynamics/*.cpp src/BulletDynamics/Featherstone/*.cpp
+    src/BulletDynamics/MLCPSolvers/*.cpp src/BulletDynamics/Vehicle/*.cpp src/BulletSoftBody/*.cpp
+    src/LinearMath/*.cpp)
+file (GLOB H_FILES *.h src/BulletCollision/BroadphaseCollision/*.h
+    src/BulletCollision/CollisionDispatch/*.h src/BulletCollision/CollisionShapes/*.h
+    src/BulletCollision/Gimpact/*.h src/BulletCollision/NarrowPhaseCollision/*.h
+    src/BulletDynamics/Character/*.h src/BulletDynamics/ConstraintSolver/*.h
+    src/BulletDynamics/Dynamics/*.h src/BulletDynamics/Featherstone/*.h
+    src/BulletDynamics/MLCPSolvers/*.h src/BulletDynamics/Vehicle/*.h src/BulletSoftBody/*.h
+    src/LinearMath/*.h)
+set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
+
+# Define dependency libs
+set (INCLUDE_DIRS src)
+
+# Setup target
+setup_library ()
+
+# Install headers for building and using the Urho3D library (install dependency for Urho3D/Physics/PhysicsWorld.h, Urho3D/Physics/RigidBody.h, and Urho3D/Physics/PhysicsUtils.h)
+install_header_files (DIRECTORY src/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/Bullet FILES_MATCHING PATTERN *.h)  # Note: the trailing slash is significant

+ 55 - 55
Source/ThirdParty/Civetweb/CMakeLists.txt

@@ -1,55 +1,55 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME Civetweb)
-
-# Define preprocessor macros
-if (WIN32)
-    include (CheckStructHasMember)
-    check_struct_has_member (struct\ timespec tv_sec time.h HAVE_STRUCT_TIMESPEC_TV_SEC)
-    if (HAVE_STRUCT_TIMESPEC_TV_SEC)
-        include (CheckSymbolExists)
-        check_symbol_exists (_TIMESPEC_DEFINED time.h HAVE__TIMESPEC_DEFINED)
-        if (NOT HAVE__TIMESPEC_DEFINED)
-            add_definitions (-D_TIMESPEC_DEFINED)
-        endif ()
-    endif ()
-elseif (APPLE)
-    if (CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.12 AND IPHONEOS_DEPLOYMENT_TARGET VERSION_LESS 10.0 AND APPLETVOS_DEPLOYMENT_TARGET VERSION_LESS 10.0)
-        add_definitions (-D_DARWIN_FEATURE_CLOCK_GETTIME=0)
-    else ()
-        add_definitions (-DHAVE_CLOCK_GETTIME)
-    endif ()
-endif ()
-
-# Define source files
-define_source_files (GLOB_CPP_PATTERNS src/*.c GLOB_H_PATTERNS include/*.h)
-
-# Define include directory
-set (INCLUDE_DIRS include)
-
-# Setup target
-setup_library ()
-
-# Install headers for building the Urho3D library
-install_header_files (DIRECTORY include/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/Civetweb FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY)  # Note: the trailing slash is significant
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME Civetweb)
+
+# Define preprocessor macros
+if (WIN32)
+    include (CheckStructHasMember)
+    check_struct_has_member (struct\ timespec tv_sec time.h HAVE_STRUCT_TIMESPEC_TV_SEC)
+    if (HAVE_STRUCT_TIMESPEC_TV_SEC)
+        include (CheckSymbolExists)
+        check_symbol_exists (_TIMESPEC_DEFINED time.h HAVE__TIMESPEC_DEFINED)
+        if (NOT HAVE__TIMESPEC_DEFINED)
+            add_definitions (-D_TIMESPEC_DEFINED)
+        endif ()
+    endif ()
+elseif (APPLE)
+    if (CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.12 AND IPHONEOS_DEPLOYMENT_TARGET VERSION_LESS 10.0 AND APPLETVOS_DEPLOYMENT_TARGET VERSION_LESS 10.0)
+        add_definitions (-D_DARWIN_FEATURE_CLOCK_GETTIME=0)
+    else ()
+        add_definitions (-DHAVE_CLOCK_GETTIME)
+    endif ()
+endif ()
+
+# Define source files
+define_source_files (GLOB_CPP_PATTERNS src/*.c GLOB_H_PATTERNS include/*.h)
+
+# Define include directory
+set (INCLUDE_DIRS include)
+
+# Setup target
+setup_library ()
+
+# Install headers for building the Urho3D library
+install_header_files (DIRECTORY include/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/Civetweb FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY)  # Note: the trailing slash is significant

+ 84 - 84
Source/ThirdParty/FreeType/CMakeLists.txt

@@ -1,84 +1,84 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME FreeType)
-
-add_definitions (-DFT2_BUILD_LIBRARY)
-
-# Rename z_verbose and z_error symbols to prevent Clang duplicate symbol linker error (clash with Assimp) on debug build
-if (XCODE OR CMAKE_BUILD_TYPE STREQUAL Debug)
-    add_definitions (-Dz_verbose=ft2_z_verbose -Dz_error=ft2_z_error)
-endif ()
-
-# Define source files
-set (SOURCE_FILES
-    src/autofit/autofit.c
-    src/base/ftbase.c
-    src/base/ftbbox.c
-    src/base/ftbitmap.c
-    src/base/ftfstype.c
-    src/base/ftgasp.c
-    src/base/ftglyph.c
-    src/base/ftgxval.c
-    src/base/ftinit.c
-    src/base/ftlcdfil.c
-    src/base/ftmm.c
-    src/base/ftotval.c
-    src/base/ftpatent.c
-    src/base/ftpfr.c
-    src/base/ftstroke.c
-    src/base/ftsynth.c
-    src/base/ftsystem.c
-    src/base/fttype1.c
-    src/base/ftwinfnt.c
-    src/bdf/bdf.c
-    src/bzip2/ftbzip2.c
-    src/cache/ftcache.c
-    src/cff/cff.c
-    src/cid/type1cid.c
-    src/gxvalid/gxvalid.c
-    src/gzip/ftgzip.c
-    src/lzw/ftlzw.c
-    src/otvalid/otvalid.c
-    src/pcf/pcf.c
-    src/pfr/pfr.c
-    src/psaux/psaux.c
-    src/pshinter/pshinter.c
-    src/psnames/psmodule.c
-    src/raster/raster.c
-    src/sfnt/sfnt.c
-    src/smooth/smooth.c
-    src/truetype/truetype.c
-    src/type1/type1.c
-    src/type42/type42.c
-    src/winfonts/winfnt.c)
-
-# Define dependency libs
-set (INCLUDE_DIRS include)
-
-# Setup target
-setup_library ()
-
-# Install headers for building the Urho3D library
-install_header_files (DIRECTORY include/freetype DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY)
-install_header_files (FILES include/ft2build.h DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY)
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME FreeType)
+
+add_definitions (-DFT2_BUILD_LIBRARY)
+
+# Rename z_verbose and z_error symbols to prevent Clang duplicate symbol linker error (clash with Assimp) on debug build
+if (XCODE OR CMAKE_BUILD_TYPE STREQUAL Debug)
+    add_definitions (-Dz_verbose=ft2_z_verbose -Dz_error=ft2_z_error)
+endif ()
+
+# Define source files
+set (SOURCE_FILES
+    src/autofit/autofit.c
+    src/base/ftbase.c
+    src/base/ftbbox.c
+    src/base/ftbitmap.c
+    src/base/ftfstype.c
+    src/base/ftgasp.c
+    src/base/ftglyph.c
+    src/base/ftgxval.c
+    src/base/ftinit.c
+    src/base/ftlcdfil.c
+    src/base/ftmm.c
+    src/base/ftotval.c
+    src/base/ftpatent.c
+    src/base/ftpfr.c
+    src/base/ftstroke.c
+    src/base/ftsynth.c
+    src/base/ftsystem.c
+    src/base/fttype1.c
+    src/base/ftwinfnt.c
+    src/bdf/bdf.c
+    src/bzip2/ftbzip2.c
+    src/cache/ftcache.c
+    src/cff/cff.c
+    src/cid/type1cid.c
+    src/gxvalid/gxvalid.c
+    src/gzip/ftgzip.c
+    src/lzw/ftlzw.c
+    src/otvalid/otvalid.c
+    src/pcf/pcf.c
+    src/pfr/pfr.c
+    src/psaux/psaux.c
+    src/pshinter/pshinter.c
+    src/psnames/psmodule.c
+    src/raster/raster.c
+    src/sfnt/sfnt.c
+    src/smooth/smooth.c
+    src/truetype/truetype.c
+    src/type1/type1.c
+    src/type42/type42.c
+    src/winfonts/winfnt.c)
+
+# Define dependency libs
+set (INCLUDE_DIRS include)
+
+# Setup target
+setup_library ()
+
+# Install headers for building the Urho3D library
+install_header_files (DIRECTORY include/freetype DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY)
+install_header_files (FILES include/ft2build.h DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY)

+ 33 - 33
Source/ThirdParty/JO/CMakeLists.txt

@@ -1,33 +1,33 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME JO)
-
-# Define source files
-define_source_files ()
-
-# Setup target
-setup_library ()
-
-# Install headers for building the Urho3D library
-install_header_files (DIRECTORY ./ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/JO FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY)  # Note: the trailing slash is significant
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME JO)
+
+# Define source files
+define_source_files ()
+
+# Setup target
+setup_library ()
+
+# Install headers for building the Urho3D library
+install_header_files (DIRECTORY ./ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/JO FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY)  # Note: the trailing slash is significant

+ 657 - 681
License.txt → Source/ThirdParty/LICENSES

@@ -1,681 +1,657 @@
-Urho3D license
---------------
-
-Copyright (c) 2008-2016 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.
-
-
-AngelScript license
--------------------
-
-AngelCode Scripting Library
-Copyright (c) 2003-2011 Andreas Jonsson
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you
-   must not claim that you wrote the original software. If you use
-   this software in a product, an acknowledgment in the product
-   documentation would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-   must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-   distribution.
-
-The original version of this library can be located at:
-http://www.angelcode.com/angelscript/
-
-Andreas Jonsson
[email protected]
-
-
-Boost license
--------------
-
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-
-
-Box2D license
--------------
-
-Copyright (c) 2006-2013 Erin Catto http://www.gphysics.com
-
-This software is provided 'as-is', without any express or implied
-warranty.  In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
-claim that you wrote the original software. If you use this software
-in a product, an acknowledgment in the product documentation would be
-appreciated but is not required.
-2. Altered source versions must be plainly marked as such, and must not be
-misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-
-
-Bullet license
---------------
-
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the
-use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not claim
-that you wrote the original software. If you use this software in a product,
-an acknowledgment in the product documentation would be appreciated but is not
-required.
-2. Altered source versions must be plainly marked as such, and must not be
-misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-
-
-Civetweb license
-----------------
-
-Copyright (c) 2013-2015 the Civetweb developers
-Copyright (c) 2004-2013 Sergey Lyubka
-
-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.
-
-
-The FreeType Project disclaimer
--------------------------------
-
-Portions of this software are copyright © 2010 The FreeType Project
-(www.freetype.org).  All rights reserved.
-
-
-GLEW license
-------------
-
-The OpenGL Extension Wrangler Library
-Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
-Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
-Copyright (C) 2002, Lev Povalahev
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-  this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
-* The name of the author may be used to endorse or promote products
-  derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-
-
-Mesa 3-D graphics library
-Version:  7.0
-
-Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
-
-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
-BRIAN PAUL 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.
-
-
-Copyright (c) 2007 The Khronos Group Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and/or associated documentation files (the
-"Materials"), to deal in the Materials without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Materials, and to
-permit persons to whom the Materials are 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 Materials.
-
-THE MATERIALS ARE 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
-MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-
-
-kNet license
-------------
-
-Copyright The kNet Project.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-
-libcpuid license
-----------------
-
-Copyright 2008  Veselin Georgiev,
-anrieffNOSPAM @ mgail_DOT.com (convert to gmail)
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-Lua license
------------
-
-Copyright (C) 1994-2012 Lua.org, PUC-Rio.  All rights reserved.
-
-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.
-
-
-LuaJIT license
---------------
-
-LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
-
-Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-
-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.
-
-
-LZ4 license
------------
-
-LZ4 Library
-Copyright (c) 2011-2015, Yann Collet
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
-  list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice, this
-  list of conditions and the following disclaimer in the documentation and/or
-  other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-MojoShader license
-------------------
-
-Copyright (c) 2008-2011 Ryan C. Gordon.
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from
-the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
-claim that you wrote the original software. If you use this software in a
-product, an acknowledgment in the product documentation would be
-appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and must not be
-misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source distribution.
-
-   Ryan C. Gordon <[email protected]>
-
-
-Mustache license
-----------------
-
-Copyright 2015 Kevin Wojniak
-
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-
-
-nanodbc license
----------------
-
-The MIT License
-
-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.
-
-
-Oolong Engine license
----------------------
-
-Oolong Engine for the iPhone / iPod touch
-Copyright (c) 2007-2008 Wolfgang Engel  http://code.google.com/p/oolongengine/
-
-This software is provided 'as-is', without any express or implied warranty
-In no event will the authors be held liable for any damages arising from the
-use of this software. Permission is granted to anyone to use this software for
-any purpose,  including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not claim
-that you wrote the original software. If you use this software in a product, an
-acknowledgment in the product documentation would be appreciated but is not
-required.
-2. Altered source versions must be plainly marked as such, and must not be
-misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-
-
-Open Asset Import Library license
----------------------------------
-
-Open Asset Import Library (Assimp)
-Copyright (c) 2006-2010, Assimp Development Team
-All rights reserved.
-
-Redistribution and use of this software in source and binary forms,
-with or without modification, are permitted provided that the
-following conditions are met:
-
-* Redistributions of source code must retain the above
-  copyright notice, this list of conditions and the
-  following disclaimer.
-
-* Redistributions in binary form must reproduce the above
-  copyright notice, this list of conditions and the
-  following disclaimer in the documentation and/or other
-  materials provided with the distribution.
-
-* Neither the name of the ASSIMP team, nor the names of its
-  contributors may be used to endorse or promote products
-  derived from this software without specific prior
-  written permission of the ASSIMP Development Team.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-pugixml license
----------------
-
-Copyright (c) 2006-2015 Arseny Kapoulkine
-
-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.
-
-
-rapidjson license
----------------
-
-Copyright (C) 2011 Milo Yip
-
-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.
-
-
-Recast/Detour/DetourCrowd/DetourTileCache license
----------------------
-
-Copyright (c) 2009 Mikko Mononen [email protected]
-
-This software is provided 'as-is', without any express or implied
-warranty.  In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
-claim that you wrote the original software. If you use this software
-in a product, an acknowledgment in the product documentation would be
-appreciated but is not required.
-2. Altered source versions must be plainly marked as such, and must not be
-misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-
-
-SDL license
------------
-
-Simple DirectMedia Layer
-Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
-
-This software is provided 'as-is', without any express or implied
-warranty.  In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
-   claim that you wrote the original software. If you use this software
-   in a product, an acknowledgment in the product documentation would be
-   appreciated but is not required.
-2. Altered source versions must be plainly marked as such, and must not be
-   misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-
-
-Squish license
---------------
-
-Copyright (c) 2006 Simon Brown                          [email protected]
-
-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.
-
-
-StanHull license
-----------------
-
-Copyright (c) 2004 Open Dynamics Framework Group
-			www.physicstools.org
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-
-Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimer in the documentation
-and/or other materials provided with the distribution.
-
-Neither the name of the Open Dynamics Framework Group nor the names of
-its contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-tolua++ license
----------------
-
-Copyright (C) 2009 Ariel Manzur.
-
-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.
+AngelScript license
+-------------------
+
+AngelCode Scripting Library
+Copyright (c) 2003-2011 Andreas Jonsson
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you
+   must not claim that you wrote the original software. If you use
+   this software in a product, an acknowledgment in the product
+   documentation would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+   must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+   distribution.
+
+The original version of this library can be located at:
+http://www.angelcode.com/angelscript/
+
+Andreas Jonsson
[email protected]
+
+
+Boost license
+-------------
+
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+
+Box2D license
+-------------
+
+Copyright (c) 2006-2013 Erin Catto http://www.gphysics.com
+
+This software is provided 'as-is', without any express or implied
+warranty.  In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+claim that you wrote the original software. If you use this software
+in a product, an acknowledgment in the product documentation would be
+appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be
+misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+
+
+Bullet license
+--------------
+
+Bullet Continuous Collision Detection and Physics Library
+Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
+
+This software is provided 'as-is', without any express or implied warranty.
+In no event will the authors be held liable for any damages arising from the
+use of this software.
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it freely,
+subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim
+that you wrote the original software. If you use this software in a product,
+an acknowledgment in the product documentation would be appreciated but is not
+required.
+2. Altered source versions must be plainly marked as such, and must not be
+misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+
+
+Civetweb license
+----------------
+
+Copyright (c) 2013-2015 the Civetweb developers
+Copyright (c) 2004-2013 Sergey Lyubka
+
+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.
+
+
+The FreeType Project disclaimer
+-------------------------------
+
+Portions of this software are copyright © 2010 The FreeType Project
+(www.freetype.org).  All rights reserved.
+
+
+GLEW license
+------------
+
+The OpenGL Extension Wrangler Library
+Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
+Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
+Copyright (C) 2002, Lev Povalahev
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+  this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+* The name of the author may be used to endorse or promote products
+  derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Mesa 3-D graphics library
+Version:  7.0
+
+Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
+
+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
+BRIAN PAUL 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.
+
+
+Copyright (c) 2007 The Khronos Group Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and/or associated documentation files (the
+"Materials"), to deal in the Materials without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Materials, and to
+permit persons to whom the Materials are 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 Materials.
+
+THE MATERIALS ARE 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
+MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+
+
+kNet license
+------------
+
+Copyright The kNet Project.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+libcpuid license
+----------------
+
+Copyright 2008  Veselin Georgiev,
+anrieffNOSPAM @ mgail_DOT.com (convert to gmail)
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Lua license
+-----------
+
+Copyright (C) 1994-2012 Lua.org, PUC-Rio.  All rights reserved.
+
+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.
+
+
+LuaJIT license
+--------------
+
+LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
+
+Copyright (C) 2005-2014 Mike Pall. All rights reserved.
+
+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.
+
+
+LZ4 license
+-----------
+
+LZ4 Library
+Copyright (c) 2011-2015, Yann Collet
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+MojoShader license
+------------------
+
+Copyright (c) 2008-2011 Ryan C. Gordon.
+
+This software is provided 'as-is', without any express or implied warranty.
+In no event will the authors be held liable for any damages arising from
+the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+claim that you wrote the original software. If you use this software in a
+product, an acknowledgment in the product documentation would be
+appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and must not be
+misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source distribution.
+
+   Ryan C. Gordon <[email protected]>
+
+
+Mustache license
+----------------
+
+Copyright 2015 Kevin Wojniak
+
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+
+nanodbc license
+---------------
+
+The MIT License
+
+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.
+
+
+Oolong Engine license
+---------------------
+
+Oolong Engine for the iPhone / iPod touch
+Copyright (c) 2007-2008 Wolfgang Engel  http://code.google.com/p/oolongengine/
+
+This software is provided 'as-is', without any express or implied warranty
+In no event will the authors be held liable for any damages arising from the
+use of this software. Permission is granted to anyone to use this software for
+any purpose,  including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim
+that you wrote the original software. If you use this software in a product, an
+acknowledgment in the product documentation would be appreciated but is not
+required.
+2. Altered source versions must be plainly marked as such, and must not be
+misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+
+
+Open Asset Import Library license
+---------------------------------
+
+Open Asset Import Library (Assimp)
+Copyright (c) 2006-2010, Assimp Development Team
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms,
+with or without modification, are permitted provided that the
+following conditions are met:
+
+* Redistributions of source code must retain the above
+  copyright notice, this list of conditions and the
+  following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+  copyright notice, this list of conditions and the
+  following disclaimer in the documentation and/or other
+  materials provided with the distribution.
+
+* Neither the name of the ASSIMP team, nor the names of its
+  contributors may be used to endorse or promote products
+  derived from this software without specific prior
+  written permission of the ASSIMP Development Team.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+pugixml license
+---------------
+
+Copyright (c) 2006-2015 Arseny Kapoulkine
+
+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.
+
+
+rapidjson license
+---------------
+
+Copyright (C) 2011 Milo Yip
+
+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.
+
+
+Recast/Detour/DetourCrowd/DetourTileCache license
+---------------------
+
+Copyright (c) 2009 Mikko Mononen [email protected]
+
+This software is provided 'as-is', without any express or implied
+warranty.  In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+claim that you wrote the original software. If you use this software
+in a product, an acknowledgment in the product documentation would be
+appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be
+misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+
+
+SDL license
+-----------
+
+Simple DirectMedia Layer
+Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+
+This software is provided 'as-is', without any express or implied
+warranty.  In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+   claim that you wrote the original software. If you use this software
+   in a product, an acknowledgment in the product documentation would be
+   appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be
+   misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+
+
+Squish license
+--------------
+
+Copyright (c) 2006 Simon Brown                          [email protected]
+
+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.
+
+
+StanHull license
+----------------
+
+Copyright (c) 2004 Open Dynamics Framework Group
+			www.physicstools.org
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+Neither the name of the Open Dynamics Framework Group nor the names of
+its contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+tolua++ license
+---------------
+
+Copyright (C) 2009 Ariel Manzur.
+
+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.

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

@@ -1,75 +1,75 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name for Lua library
-set (TARGET_NAME Lua)
-
-# Define source files
-define_source_files (GLOB_CPP_PATTERNS src/*.c GLOB_H_PATTERNS src/*.h EXCLUDE_PATTERNS src/lua.c src/luac.c)
-
-# Define dependency libs
-if (READLINE_FOUND)
-    add_definitions (-DLUA_USE_READLINE)
-    # FIXME: temporary quick fix
-    if (RPI AND CMAKE_CROSSCOMPILING)
-        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=\"${SYSROOT}\"")
-    endif ()
-    list (APPEND INCLUDE_DIRS ${READLINE_INCLUDE_DIRS})
-    list (APPEND LIBS ${READLINE_LIBRARIES})
-endif ()
-
-# Setup target
-setup_library ()
-
-# Install headers for building and using the Urho3D library (no direct dependencies but library user may need them)
-install_header_files (DIRECTORY src/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/Lua FILES_MATCHING PATTERN *.h)  # Note: the trailing slash is significant
-
-# 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 AND NOT WEB)
-    # 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
-
-    # Define source files
-    set (SOURCE_FILES src/lua.c)
-
-    # Define dependency libs
-    set (LIBS Lua)
-    if (NOT MSVC)
-        list (APPEND LIBS m)
-    endif ()
-
-    # Setup target
-    setup_executable (NODEPS)
-    adjust_target_name ()   # Adjust to intended target output name
-
-    # Define target name for Lua compiler
-    set (TARGET_NAME luac)
-
-    # Define source files
-    set (SOURCE_FILES src/luac.c)
-
-    # Define dependency libs
-    # Same as above
-
-    # Setup target
-    setup_executable (NODEPS)
-endif ()
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name for Lua library
+set (TARGET_NAME Lua)
+
+# Define source files
+define_source_files (GLOB_CPP_PATTERNS src/*.c GLOB_H_PATTERNS src/*.h EXCLUDE_PATTERNS src/lua.c src/luac.c)
+
+# Define dependency libs
+if (READLINE_FOUND)
+    add_definitions (-DLUA_USE_READLINE)
+    # FIXME: temporary quick fix
+    if (RPI AND CMAKE_CROSSCOMPILING)
+        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=\"${SYSROOT}\"")
+    endif ()
+    list (APPEND INCLUDE_DIRS ${READLINE_INCLUDE_DIRS})
+    list (APPEND LIBS ${READLINE_LIBRARIES})
+endif ()
+
+# Setup target
+setup_library ()
+
+# Install headers for building and using the Urho3D library (no direct dependencies but library user may need them)
+install_header_files (DIRECTORY src/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/Lua FILES_MATCHING PATTERN *.h)  # Note: the trailing slash is significant
+
+# 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 AND NOT WEB)
+    # 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
+
+    # Define source files
+    set (SOURCE_FILES src/lua.c)
+
+    # Define dependency libs
+    set (LIBS Lua)
+    if (NOT MSVC)
+        list (APPEND LIBS m)
+    endif ()
+
+    # Setup target
+    setup_executable (NODEPS)
+    adjust_target_name ()   # Adjust to intended target output name
+
+    # Define target name for Lua compiler
+    set (TARGET_NAME luac)
+
+    # Define source files
+    set (SOURCE_FILES src/luac.c)
+
+    # Define dependency libs
+    # Same as above
+
+    # Setup target
+    setup_executable (NODEPS)
+endif ()

+ 37 - 37
Source/ThirdParty/MojoShader/CMakeLists.txt

@@ -1,37 +1,37 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME MojoShader)
-
-# Define source files
-define_source_files (GLOB_CPP_PATTERNS *.c)
-
-if (MSVC)
-    add_definitions (-D_CRT_SECURE_NO_WARNINGS=1 -TP)
-endif (MSVC)
-
-# Setup target
-setup_library ()
-
-# Install headers for building the Urho3D library
-install_header_files (DIRECTORY ./ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/MojoShader FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY)  # Note: the trailing slash is significant
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME MojoShader)
+
+# Define source files
+define_source_files (GLOB_CPP_PATTERNS *.c)
+
+if (MSVC)
+    add_definitions (-D_CRT_SECURE_NO_WARNINGS=1 -TP)
+endif (MSVC)
+
+# Setup target
+setup_library ()
+
+# Install headers for building the Urho3D library
+install_header_files (DIRECTORY ./ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/MojoShader FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY)  # Note: the trailing slash is significant

+ 33 - 33
Source/ThirdParty/PugiXml/CMakeLists.txt

@@ -1,33 +1,33 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME PugiXml)
-
-# Define source files
-define_source_files (GLOB_CPP_PATTERNS src/*.cpp GLOB_H_PATTERNS src/*.hpp)
-
-# Setup target
-setup_library ()
-
-# Install headers for building the Urho3D library
-install_header_files (DIRECTORY src/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/PugiXml FILES_MATCHING PATTERN *.hpp BUILD_TREE_ONLY)  # Note: the trailing slash is significant
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME PugiXml)
+
+# Define source files
+define_source_files (GLOB_CPP_PATTERNS src/*.cpp GLOB_H_PATTERNS src/*.hpp)
+
+# Setup target
+setup_library ()
+
+# Install headers for building the Urho3D library
+install_header_files (DIRECTORY src/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/PugiXml FILES_MATCHING PATTERN *.hpp BUILD_TREE_ONLY)  # Note: the trailing slash is significant

+ 33 - 33
Source/ThirdParty/StanHull/CMakeLists.txt

@@ -1,33 +1,33 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME StanHull)
-
-# Define source files
-define_source_files ()
-
-# Setup target
-setup_library ()
-
-# Install headers for building the Urho3D library
-install_header_files (DIRECTORY ./ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/StanHull FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY)  # Note: the trailing slash is significant
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME StanHull)
+
+# Define source files
+define_source_files ()
+
+# Setup target
+setup_library ()
+
+# Install headers for building the Urho3D library
+install_header_files (DIRECTORY ./ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/StanHull FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY)  # Note: the trailing slash is significant

+ 70 - 70
Source/ThirdParty/kNet/CMakeLists.txt

@@ -1,70 +1,70 @@
-# Copyright 2010 Jukka Jylänki
-
-#  Licensed under the Apache License, Version 2.0 (the "License");
-#  you may not use this file except in compliance with the License.
-#  You may obtain a copy of the License at
-
-#      http://www.apache.org/licenses/LICENSE-2.0
-
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
-# Modified by Lasse Oorni and Yao Wei Tjong for Urho3D
-
-set (TARGET_NAME kNet)
-
-file (GLOB kNetSourceFiles src/*.cpp)
-file (GLOB kNetHeaderFiles include/*.h include/kNet/*.h include/kNet/*.inl)
-
-if (WIN32)
-   file (GLOB kNetWin32SourceFiles src/win32/*.cpp)
-   file (GLOB kNetWin32HeaderFiles include/kNet/win32/*.h)
-
-   if (USE_BOOST)
-      list (REMOVE_ITEM kNetWin32SourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/win32/W32Thread.cpp)
-   endif ()
-
-   list (APPEND kNetSourceFiles ${kNetWin32SourceFiles})
-   list (APPEND kNetHeaderFiles ${kNetWin32HeaderFiles})
-
-   add_definitions (-D_WINSOCKAPI_)
-   add_definitions (-D_CRT_SECURE_NO_WARNINGS)
-   add_definitions (-DKNET_MEMORY_LEAK_CHECK)
-elseif (UNIX)
-   file (GLOB kNetUnixSourceFiles src/unix/*.cpp)
-   file (GLOB kNetUnixHeaderFiles include/*.h include/kNet/*.h include/kNet/unix/*.h)
-
-   if (USE_BOOST)
-      list (REMOVE_ITEM kNetUnixSourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/unix/UnixThread.cpp)
-   endif ()
-
-   list (APPEND kNetSourceFiles ${kNetUnixSourceFiles})
-   list (APPEND kNetHeaderFiles ${kNetUnixHeaderFiles})
-
-   # Urho3D: KNET_UNIX definition removed
-endif ()
-
-# Urho3D: set DEBUG_CPP_NAME only on Windows, Xcode project file can not be opened if this is included
-if (WIN32)
-    foreach (srcFile ${kNetSourceFiles})
-        get_filename_component (baseName ${srcFile} NAME)
-        set_source_files_properties (${srcFile} PROPERTIES COMPILE_FLAGS "-DDEBUG_CPP_NAME=\"\\\"${baseName}\"\\\"")
-    endforeach ()
-endif ()
-
-# Define source files
-set (SOURCE_FILES ${kNetSourceFiles} ${kNetHeaderFiles})
-
-# Define dependency libs
-set (INCLUDE_DIRS include)
-
-# Setup target
-setup_library ()
-
-# Install headers for building and using the Urho3D library (install dependency for Urho3D/Network/Connection.h and Urho3D/Network/Network.h)
-install_header_files (DIRECTORY include/kNet/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/kNet FILES_MATCHING PATTERN *.h *.inl USE_FILE_SYMLINK)     # Note: the trailing slash is significant
-file (GLOB kNetHeaderFiles include/*.h)
-install_header_files (FILES ${kNetHeaderFiles} DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/kNet)
+# Copyright 2010 Jukka Jylänki
+
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+
+#      http://www.apache.org/licenses/LICENSE-2.0
+
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+# Modified by Lasse Oorni and Yao Wei Tjong for Urho3D
+
+set (TARGET_NAME kNet)
+
+file (GLOB kNetSourceFiles src/*.cpp)
+file (GLOB kNetHeaderFiles include/*.h include/kNet/*.h include/kNet/*.inl)
+
+if (WIN32)
+   file (GLOB kNetWin32SourceFiles src/win32/*.cpp)
+   file (GLOB kNetWin32HeaderFiles include/kNet/win32/*.h)
+
+   if (USE_BOOST)
+      list (REMOVE_ITEM kNetWin32SourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/win32/W32Thread.cpp)
+   endif ()
+
+   list (APPEND kNetSourceFiles ${kNetWin32SourceFiles})
+   list (APPEND kNetHeaderFiles ${kNetWin32HeaderFiles})
+
+   add_definitions (-D_WINSOCKAPI_)
+   add_definitions (-D_CRT_SECURE_NO_WARNINGS)
+   add_definitions (-DKNET_MEMORY_LEAK_CHECK)
+elseif (UNIX)
+   file (GLOB kNetUnixSourceFiles src/unix/*.cpp)
+   file (GLOB kNetUnixHeaderFiles include/*.h include/kNet/*.h include/kNet/unix/*.h)
+
+   if (USE_BOOST)
+      list (REMOVE_ITEM kNetUnixSourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/unix/UnixThread.cpp)
+   endif ()
+
+   list (APPEND kNetSourceFiles ${kNetUnixSourceFiles})
+   list (APPEND kNetHeaderFiles ${kNetUnixHeaderFiles})
+
+   # Urho3D: KNET_UNIX definition removed
+endif ()
+
+# Urho3D: set DEBUG_CPP_NAME only on Windows, Xcode project file can not be opened if this is included
+if (WIN32)
+    foreach (srcFile ${kNetSourceFiles})
+        get_filename_component (baseName ${srcFile} NAME)
+        set_source_files_properties (${srcFile} PROPERTIES COMPILE_FLAGS "-DDEBUG_CPP_NAME=\"\\\"${baseName}\"\\\"")
+    endforeach ()
+endif ()
+
+# Define source files
+set (SOURCE_FILES ${kNetSourceFiles} ${kNetHeaderFiles})
+
+# Define dependency libs
+set (INCLUDE_DIRS include)
+
+# Setup target
+setup_library ()
+
+# Install headers for building and using the Urho3D library (install dependency for Urho3D/Network/Connection.h and Urho3D/Network/Network.h)
+install_header_files (DIRECTORY include/kNet/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/kNet FILES_MATCHING PATTERN *.h *.inl USE_FILE_SYMLINK)     # Note: the trailing slash is significant
+file (GLOB kNetHeaderFiles include/*.h)
+install_header_files (FILES ${kNetHeaderFiles} DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/kNet)

+ 35 - 35
Source/Tools/AssetImporter/CMakeLists.txt

@@ -1,35 +1,35 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME AssetImporter)
-
-# Define source files
-define_source_files ()
-
-# Define dependency libs
-add_subdirectory (../../ThirdParty/Assimp ../../ThirdParty/Assimp)
-set (LIBS Assimp)
-set (INCLUDE_DIRS ../../ThirdParty/Assimp/include)
-
-# Setup target
-setup_executable (TOOL)
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME AssetImporter)
+
+# Define source files
+define_source_files ()
+
+# Define dependency libs
+add_subdirectory (../../ThirdParty/Assimp ../../ThirdParty/Assimp)
+set (LIBS Assimp)
+set (INCLUDE_DIRS ../../ThirdParty/Assimp/include)
+
+# Setup target
+setup_executable (TOOL)

+ 30 - 30
Source/Tools/OgreImporter/CMakeLists.txt

@@ -1,30 +1,30 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME OgreImporter)
-
-# Define source files
-define_source_files ()
-
-# Setup target
-setup_executable (TOOL)
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME OgreImporter)
+
+# Define source files
+define_source_files ()
+
+# Setup target
+setup_executable (TOOL)

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

@@ -1,125 +1,125 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
-    # Set CMake minimum version and CMake policy required by Urho3D-CMake-common module
-    if (WIN32)
-        cmake_minimum_required (VERSION 3.2.3)      # Going forward all platforms will use this as minimum version
-    else ()
-        cmake_minimum_required (VERSION 2.8.6)
-    endif ()
-    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)
-            # INTERFACE_LINK_LIBRARIES defines the link interface
-            cmake_policy (SET CMP0022 NEW)
-        endif ()
-        if (CMAKE_VERSION VERSION_GREATER 3.0.0 OR CMAKE_VERSION VERSION_EQUAL 3.0.0)
-            # Disallow use of the LOCATION target property - so we set to OLD as we still need it
-            cmake_policy (SET CMP0026 OLD)
-            # MACOSX_RPATH is enabled by default
-            cmake_policy (SET CMP0042 NEW)
-        endif ()
-    endif ()
-
-    # Set project name
-    project (Urho3D-ExternalProject-PackageTool)
-
-    # Set CMake modules search path
-    set (CMAKE_MODULE_PATH ${BAKED_CMAKE_SOURCE_DIR}/CMake/Modules)
-
-    # Include Urho3D Cmake common module
-    include (Urho3D-CMake-common)
-
-    # Define additional source files
-    set (MINI_URHO_CPP_FILES
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/Allocator.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/HashBase.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/RefCounted.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/Str.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/VectorBase.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Context.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/EventProfiler.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Mutex.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Object.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/ProcessUtils.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Profiler.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/StringUtils.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Thread.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Timer.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Variant.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Deserializer.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/File.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/FileSystem.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Log.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/MemoryBuffer.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/PackageFile.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Serializer.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/VectorBuffer.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Color.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix3.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix3x4.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix4.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Quaternion.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Rect.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/StringHash.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector2.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector3.cpp
-        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector4.cpp
-    )
-
-    # Check existence of stdint.h for LibCpuId
-    include (CheckIncludeFiles)
-    check_include_files (stdint.h HAVE_STDINT_H)
-    if (HAVE_STDINT_H)
-        add_definitions (-DHAVE_STDINT_H)
-    endif ()
-
-    # Define that we are building mini Urho
-    add_definitions (-DMINI_URHO)
-
-    # Setup SDK-like include dir in the build tree for building the mini-urho
-    set (DEST_INCLUDE_DIR include/Urho3D)
-    file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
-
-    # Add dependency targets
-    add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LibCpuId host/LibCpuId)
-    add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LZ4 host/LZ4)
-    set (INCLUDE_DIRS ${BAKED_CMAKE_BINARY_DIR}/include ${BAKED_CMAKE_BINARY_DIR}/include/Urho3D ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
-    set (LIBS LibCpuId)
-endif ()
-
-# Define target name
-if (TARGET PackageTool)     # The target name is already taken by host-tool external project, so use a postfix for the target-tool
-    set (POSTFIX _target)
-endif ()
-set (TARGET_NAME PackageTool${POSTFIX})
-
-# Define source files
-define_source_files (EXTRA_CPP_FILES ${MINI_URHO_CPP_FILES})
-
-# Define dependency libs
-list (APPEND LIBS LZ4)
-
-# Setup target
-setup_executable (TOOL)
-adjust_target_name ()   # Remove postfix from the executable/binary name
+#
+# Copyright (c) 2008-2016 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.
+#
+
+if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
+    # Set CMake minimum version and CMake policy required by Urho3D-CMake-common module
+    if (WIN32)
+        cmake_minimum_required (VERSION 3.2.3)      # Going forward all platforms will use this as minimum version
+    else ()
+        cmake_minimum_required (VERSION 2.8.6)
+    endif ()
+    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)
+            # INTERFACE_LINK_LIBRARIES defines the link interface
+            cmake_policy (SET CMP0022 NEW)
+        endif ()
+        if (CMAKE_VERSION VERSION_GREATER 3.0.0 OR CMAKE_VERSION VERSION_EQUAL 3.0.0)
+            # Disallow use of the LOCATION target property - so we set to OLD as we still need it
+            cmake_policy (SET CMP0026 OLD)
+            # MACOSX_RPATH is enabled by default
+            cmake_policy (SET CMP0042 NEW)
+        endif ()
+    endif ()
+
+    # Set project name
+    project (Urho3D-ExternalProject-PackageTool)
+
+    # Set CMake modules search path
+    set (CMAKE_MODULE_PATH ${BAKED_CMAKE_SOURCE_DIR}/CMake/Modules)
+
+    # Include Urho3D Cmake common module
+    include (Urho3D-CMake-common)
+
+    # Define additional source files
+    set (MINI_URHO_CPP_FILES
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/Allocator.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/HashBase.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/RefCounted.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/Str.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/VectorBase.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Context.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/EventProfiler.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Mutex.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Object.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/ProcessUtils.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Profiler.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/StringUtils.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Thread.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Timer.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Variant.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Deserializer.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/File.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/FileSystem.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Log.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/MemoryBuffer.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/PackageFile.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Serializer.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/VectorBuffer.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Color.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix3.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix3x4.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix4.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Quaternion.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Rect.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/StringHash.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector2.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector3.cpp
+        ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector4.cpp
+    )
+
+    # Check existence of stdint.h for LibCpuId
+    include (CheckIncludeFiles)
+    check_include_files (stdint.h HAVE_STDINT_H)
+    if (HAVE_STDINT_H)
+        add_definitions (-DHAVE_STDINT_H)
+    endif ()
+
+    # Define that we are building mini Urho
+    add_definitions (-DMINI_URHO)
+
+    # Setup SDK-like include dir in the build tree for building the mini-urho
+    set (DEST_INCLUDE_DIR include/Urho3D)
+    file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
+
+    # Add dependency targets
+    add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LibCpuId host/LibCpuId)
+    add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LZ4 host/LZ4)
+    set (INCLUDE_DIRS ${BAKED_CMAKE_BINARY_DIR}/include ${BAKED_CMAKE_BINARY_DIR}/include/Urho3D ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
+    set (LIBS LibCpuId)
+endif ()
+
+# Define target name
+if (TARGET PackageTool)     # The target name is already taken by host-tool external project, so use a postfix for the target-tool
+    set (POSTFIX _target)
+endif ()
+set (TARGET_NAME PackageTool${POSTFIX})
+
+# Define source files
+define_source_files (EXTRA_CPP_FILES ${MINI_URHO_CPP_FILES})
+
+# Define dependency libs
+list (APPEND LIBS LZ4)
+
+# Setup target
+setup_executable (TOOL)
+adjust_target_name ()   # Remove postfix from the executable/binary name

+ 37 - 37
Source/Tools/RampGenerator/CMakeLists.txt

@@ -1,37 +1,37 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME RampGenerator)
-
-# Define preprocessor macros
-if (MINGW AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.1.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 6.1.0) AND URHO3D_LIB_TYPE STREQUAL STATIC)
-    # Workaround the "multiple definition of" linking issue in STATIC build
-else ()
-    add_definitions (-DSTB_IMAGE_WRITE_IMPLEMENTATION)
-endif ()
-
-# Define source files
-define_source_files ()
-
-# Setup target
-setup_executable (TOOL)
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME RampGenerator)
+
+# Define preprocessor macros
+if (MINGW AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.1.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 6.1.0) AND URHO3D_LIB_TYPE STREQUAL STATIC)
+    # Workaround the "multiple definition of" linking issue in STATIC build
+else ()
+    add_definitions (-DSTB_IMAGE_WRITE_IMPLEMENTATION)
+endif ()
+
+# Define source files
+define_source_files ()
+
+# Setup target
+setup_executable (TOOL)

+ 30 - 30
Source/Tools/ScriptCompiler/CMakeLists.txt

@@ -1,30 +1,30 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME ScriptCompiler)
-
-# Define source files
-define_source_files ()
-
-# Setup target
-setup_executable (TOOL)
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME ScriptCompiler)
+
+# Define source files
+define_source_files ()
+
+# Setup target
+setup_executable (TOOL)

+ 30 - 30
Source/Tools/SpritePacker/CMakeLists.txt

@@ -1,30 +1,30 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME SpritePacker)
-
-# Define source files
-define_source_files ()
-
-# Setup target
-setup_executable (TOOL)
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME SpritePacker)
+
+# Define source files
+define_source_files ()
+
+# Setup target
+setup_executable (TOOL)

+ 49 - 49
Source/Tools/Urho3DPlayer/CMakeLists.txt

@@ -1,49 +1,49 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME Urho3DPlayer)
-
-# Define source files
-define_source_files ()
-
-# Setup target with resource copying
-setup_main_executable (NOBUNDLE)
-
-# Setup test cases
-if (URHO3D_ANGELSCRIPT)
-    setup_test (NAME Editor OPTIONS Scripts/Editor.as -w)
-    setup_test (NAME NinjaSnowWar OPTIONS Scripts/NinjaSnowWar.as -w)
-    setup_test (NAME SpritesAS OPTIONS Scripts/03_Sprites.as -w)
-endif ()
-if (URHO3D_LUA)
-    setup_test (NAME SpritesLua OPTIONS LuaScripts/03_Sprites.lua -w)
-endif ()
-
-# Symlink/copy helper shell scripts or batch files to invoke Urho3DPlayer
-if (NOT IOS AND NOT ANDROID AND NOT WEB AND NOT CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
-    # Ensure the output directory exist before creating the symlinks
-    file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-    foreach (FILE Editor NinjaSnowWar PBRDemo)
-        create_symlink (${CMAKE_SOURCE_DIR}/bin/${FILE}${SCRIPT_EXT} ${CMAKE_BINARY_DIR}/bin/${FILE}${SCRIPT_EXT} FALLBACK_TO_COPY)
-    endforeach ()
-endif ()
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME Urho3DPlayer)
+
+# Define source files
+define_source_files ()
+
+# Setup target with resource copying
+setup_main_executable (NOBUNDLE)
+
+# Setup test cases
+if (URHO3D_ANGELSCRIPT)
+    setup_test (NAME Editor OPTIONS Scripts/Editor.as -w)
+    setup_test (NAME NinjaSnowWar OPTIONS Scripts/NinjaSnowWar.as -w)
+    setup_test (NAME SpritesAS OPTIONS Scripts/03_Sprites.as -w)
+endif ()
+if (URHO3D_LUA)
+    setup_test (NAME SpritesLua OPTIONS LuaScripts/03_Sprites.lua -w)
+endif ()
+
+# Symlink/copy helper shell scripts or batch files to invoke Urho3DPlayer
+if (NOT IOS AND NOT ANDROID AND NOT WEB AND NOT CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
+    # Ensure the output directory exist before creating the symlinks
+    file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+    foreach (FILE Editor NinjaSnowWar PBRDemo)
+        create_symlink (${CMAKE_SOURCE_DIR}/bin/${FILE}${SCRIPT_EXT} ${CMAKE_BINARY_DIR}/bin/${FILE}${SCRIPT_EXT} FALLBACK_TO_COPY)
+    endforeach ()
+endif ()

+ 535 - 535
Source/Urho3D/CMakeLists.txt

@@ -1,535 +1,535 @@
-#
-# Copyright (c) 2008-2016 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.
-#
-
-# Define target name
-set (TARGET_NAME Urho3D)
-
-# Generate JSON compilation database format specification
-if (URHO3D_CLANG_TOOLS OR URHO3D_BINDINGS)
-    set (CMAKE_EXPORT_COMPILE_COMMANDS 1)
-    # Clang assumes all their tools to be installed in a relative path to their libs but this is not the case for our own Clang-tools
-    # Clang has a hard-coded way to search for their headers (see http://clang.llvm.org/docs/LibTooling.html#builtin-includes)
-    # In order for our Clang-tools to work correctly we need to make this Clang's assumption to be true
-    execute_process (COMMAND ${LLVM_CONFIG} --version OUTPUT_VARIABLE LLVM_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
-    string (REGEX REPLACE "([.0123456789]+).*" \\1 LLVM_VERSION "${LLVM_VERSION}")      # Stringify against empty output variable
-    execute_process (COMMAND ${LLVM_CONFIG} --libdir OUTPUT_VARIABLE LLVM_LIBDIR OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
-    execute_process (COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin/tool/lib/clang/${LLVM_VERSION})
-    create_symlink (${LLVM_LIBDIR}/clang/${LLVM_VERSION}/include ${CMAKE_BINARY_DIR}/bin/tool/lib/clang/${LLVM_VERSION}/include FALLBACK_TO_COPY)
-    # TODO: Remove this workaround when Travis CI VM has been migrated to Ubuntu 14.04 LTS (ancient glibc header has incorrect defines)
-    if (DEFINED ENV{TRAVIS})
-        add_definitions (-D__extern_always_inline=inline)
-    endif ()
-endif ()
-
-# Check sincosf support
-if (NOT MSVC)   # There is no chance MSVC would pass this one as it does not have libm
-    include (CheckLibraryExists)
-    check_library_exists (m sincosf "" HAVE_SINCOSF)
-endif ()
-if (HAVE_SINCOSF)
-    add_definitions (-DHAVE_SINCOSF)
-else ()
-    include (CheckFunctionExists)
-    check_function_exists (__sincosf HAVE_UNDERSCORE_SINCOSF)
-    if (HAVE_UNDERSCORE_SINCOSF)
-        add_definitions (-DHAVE_UNDERSCORE_SINCOSF)
-    endif ()
-endif ()
-
-add_definitions (-DURHO3D_IS_BUILDING)
-if (ODBC_VERSION AND NOT ODBC_VERSION VERSION_LESS 3)
-    add_definitions (-DODBC_3_OR_LATER)
-endif ()
-if (ANDROID AND DEFINED ENV{ASSET_DIR_INDICATOR})
-    add_definitions (-DASSET_DIR_INDICATOR=\"$ENV{ASSET_DIR_INDICATOR}\")
-endif ()
-
-if (WIN32)
-    set (CMAKE_DEBUG_POSTFIX _d)
-endif ()
-
-# Define source files
-foreach (DIR Navigation Network Physics Urho2D)
-    string (TOUPPER URHO3D_${DIR} OPT)
-    if (NOT ${OPT})
-        list (APPEND EXCLUDED_SOURCE_DIRS ${DIR})
-    endif ()
-endforeach ()
-if (NOT URHO3D_ANGELSCRIPT)
-    list (APPEND EXCLUDED_SOURCE_DIRS AngelScript)
-endif ()
-if (NOT URHO3D_LUA)
-    list (APPEND EXCLUDED_SOURCE_DIRS LuaScript)
-endif ()
-if (URHO3D_DATABASE)
-    if (URHO3D_DATABASE_ODBC)
-        list (APPEND EXCLUDED_SOURCE_DIRS Database/SQLite)
-    else ()
-        list (APPEND EXCLUDED_SOURCE_DIRS Database/ODBC)
-    endif ()
-else ()
-    list (APPEND EXCLUDED_SOURCE_DIRS Database)
-endif ()
-if (URHO3D_OPENGL)
-    # Exclude the opposite source directory
-    list (APPEND EXCLUDED_SOURCE_DIRS Graphics/Direct3D9 Graphics/Direct3D11)
-else ()
-    list (APPEND EXCLUDED_SOURCE_DIRS Graphics/OpenGL)
-    if (URHO3D_D3D11)
-        list (APPEND EXCLUDED_SOURCE_DIRS Graphics/Direct3D9)
-    else ()
-        list (APPEND EXCLUDED_SOURCE_DIRS Graphics/Direct3D11)
-    endif ()
-endif ()
-if (APPLE AND NOT IOS)
-    set (GLOB_OBJC_PATTERN *.m)     # Should only pick up MacFileWatcher.m for MacOSX platform at the moment
-endif ()
-string (REPLACE ";" "/[^;]+;" EXCLUDE_PATTERNS "${EXCLUDED_SOURCE_DIRS};")
-define_source_files (EXCLUDE_PATTERNS ${EXCLUDE_PATTERNS} GLOB_CPP_PATTERNS *.cpp ${GLOB_OBJC_PATTERN} RECURSE GROUP PCH Precompiled.h)
-
-# Define generated source files
-if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/librevision.h)
-    execute_process (COMMAND ${CMAKE_COMMAND} -DFILENAME=${CMAKE_CURRENT_BINARY_DIR}/librevision.h -P CMake/Modules/GetUrho3DRevision.cmake
-        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_QUIET ERROR_QUIET)
-endif ()
-set (URHO3D_DEPS ${STATIC_LIBRARY_TARGETS})
-if (TARGET LuaJIT_universal)
-    list (REMOVE_ITEM URHO3D_DEPS LuaJIT)
-    set (LuaJIT_universal_symbolic LuaJIT_universal_symbolic)
-    add_custom_command (OUTPUT ${LuaJIT_universal_symbolic}
-        COMMAND xcodebuild ARCHS="$(ARCHS)" -target LuaJIT_universal -configuration $(CONFIGURATION)
-        WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
-    list (APPEND SYMBOLIC_SOURCES ${LuaJIT_universal_symbolic})
-endif ()
-add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/librevision.h
-    COMMAND ${CMAKE_COMMAND} -DFILENAME=${CMAKE_CURRENT_BINARY_DIR}/librevision.h -P CMake/Modules/GetUrho3DRevision.cmake
-    DEPENDS ${URHO3D_DEPS} ${CMAKE_SOURCE_DIR}/CMake/Modules/GetUrho3DRevision.cmake
-    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-    COMMENT "Generating GIT revision number (tag + last commit SHA-1)")
-if (EMSCRIPTEN)
-    # Emscripten will attempt to generate system libraries in LLVM bitcode (libcxxabi, gl, libc, and dlmalloc) when linking for the very first time
-    # However, currently it does so without any locking resulting in potentially multiple same generation with build system that supports concurrent build processes such as ours
-    # Workaround that by calling Emscripten builder to generate all the required system libraries (in case it is the very first time) ahead of time in an orderly fashion
-    set (EMBUILDER_SYSTEM_LIBS_symbolic EMBUILDER_SYSTEM_LIBS_symbolic)
-    list (APPEND EMSCRIPTEN_SYSTEM_LIBS dlmalloc libc libcxxabi gl)
-    add_custom_command (OUTPUT ${EMBUILDER_SYSTEM_LIBS_symbolic}
-        COMMAND ${EMBUILDER} build ${EMSCRIPTEN_SYSTEM_LIBS})
-    list (APPEND SYMBOLIC_SOURCES ${EMBUILDER_SYSTEM_LIBS_symbolic})
-endif ()
-set_source_files_properties (${SYMBOLIC_SOURCES} PROPERTIES SYMBOLIC TRUE)
-
-# Use the AutoBinder tool to generate source files for binding script subsystems
-if (URHO3D_BINDINGS)
-    # Build the Clang-tools as external project (even when we are not cross-compiling because it needs C++11 standard on) for auto-binding generation
-    include (ExternalProject)
-    if (IOS)
-        # For iOS target, ensure the host environment is cleared first; Also workaround a known CMake/Xcode generator bug which prevents it from installing binaries correctly
-        set (IOS_FIX CMAKE_COMMAND /usr/bin/env -i PATH=$ENV{PATH} ${CMAKE_COMMAND} BUILD_COMMAND bash -c "sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' CMakeScripts/install_postBuildPhase.make*")
-    endif ()
-    ExternalProject_Add (AutoBinder
-            SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/Clang-Tools
-            CMAKE_ARGS -DURHO3D_CLANG_TOOLS=AutoBinder -DDEST_RUNTIME_DIR=${CMAKE_BINARY_DIR}/bin/tool/clang -DDEST_INCLUDE_DIR=${DEST_INCLUDE_DIR} -DBAKED_CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} ${IOS_FIX})
-    file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated/generated)
-    foreach (SCRIPT AngelScript LuaScript JavaScript)
-        string (TOUPPER URHO3D_${SCRIPT} OPT)
-        if (${OPT})
-            list (APPEND SCRIPT_SUBSYSTEMS -s ${SCRIPT})
-            list (APPEND GEN_CPP_FILES ${CMAKE_CURRENT_BINARY_DIR}/generated/${SCRIPT}API.cpp)
-        endif ()
-    endforeach ()
-    string (REGEX REPLACE "[^;]+API\\.cpp" "" ANNOTATED_SOURCES "${CPP_FILES}")    # Stringify to preserve the semicolons
-    add_custom_command (OUTPUT ${GEN_CPP_FILES}
-        COMMAND ${CMAKE_BINARY_DIR}/bin/tool/clang/AutoBinder -p ${CMAKE_BINARY_DIR} -t ${CMAKE_BINARY_DIR}/bin/tool/clang/Templates -o ${CMAKE_CURRENT_BINARY_DIR}/generated ${SCRIPT_SUBSYSTEMS} ${ANNOTATED_SOURCES}
-        COMMAND ${CMAKE_COMMAND} -E touch ${GEN_CPP_FILES}   # TODO: fake the output - WIP
-        DEPENDS AutoBinder ${H_FILES}
-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-        COMMENT "Generating source files for binding script subsystems")
-endif ()
-if (URHO3D_LUA)
-    # The host tool must be built natively
-    if (CMAKE_CROSSCOMPILING OR URHO3D_LUAJIT)
-        # When cross-compiling or using LuaJIT, build the tolua++ host tool as external project using normal Lua (there is not much point using LuaJIT for the tool building even when technically it can)
-        include (ExternalProject)
-        if (IOS)
-            set (IOS_FIX CMAKE_COMMAND /usr/bin/env -i PATH=$ENV{PATH} ${CMAKE_COMMAND} BUILD_COMMAND bash -c "sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' CMakeScripts/install_postBuildPhase.make*")
-        endif ()
-        ExternalProject_Add (tolua++
-            SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/ThirdParty/toluapp/src/bin
-            CMAKE_ARGS -DDEST_RUNTIME_DIR=${CMAKE_BINARY_DIR}/bin/tool -DBAKED_CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} -DURHO3D_UPDATE_SOURCE_TREE=${URHO3D_UPDATE_SOURCE_TREE} ${IOS_FIX})
-    else ()
-        # Otherwise, build it internally as per normal
-        add_subdirectory (../ThirdParty/toluapp/src/bin ../ThirdParty/toluapp/src/bin)
-    endif ()
-    # Use the host tool to generate source files for tolua++ API binding
-    file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/LuaScript/generated)
-    file (GLOB API_PKG_FILES LuaScript/pkgs/*.pkg)
-    foreach (DIR Navigation Network Database Physics Urho2D)
-        string (TOUPPER URHO3D_${DIR} OPT)
-        if (NOT ${OPT})
-            list (REMOVE_ITEM API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/LuaScript/pkgs/${DIR}LuaAPI.pkg)
-        endif ()
-    endforeach ()
-    foreach (API_PKG_FILE ${API_PKG_FILES})
-        get_filename_component (NAME ${API_PKG_FILE} NAME)
-        string (REGEX REPLACE LuaAPI\\.pkg$ "" DIR ${NAME})
-        set (GEN_CPP_FILE LuaScript/generated/${DIR}LuaAPI.cpp)
-        list (APPEND GEN_CPP_FILES ${GEN_CPP_FILE})
-        file (GLOB PKG_FILES LuaScript/pkgs/${DIR}/*.pkg)
-        add_custom_command (OUTPUT ${GEN_CPP_FILE}
-            COMMAND ${CMAKE_BINARY_DIR}/bin/tool/tolua++ -E ${CMAKE_PROJECT_NAME} -L ToCppHook.lua -o ${CMAKE_CURRENT_BINARY_DIR}/${GEN_CPP_FILE} ${NAME}
-            DEPENDS tolua++ ${API_PKG_FILE} ${PKG_FILES} LuaScript/pkgs/ToCppHook.lua
-            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/LuaScript/pkgs
-            COMMENT "Generating tolua++ API binding on the fly for ${DIR}")
-    endforeach ()
-endif ()
-
-# Generate platform specific export header file
-if (MSVC)
-    set (PRE_EXPORT_HEADER "\n#pragma warning(disable: 4251)\n#pragma warning(disable: 4275)\n")
-endif ()
-if (URHO3D_CLANG_TOOLS)
-    set (ANNOTATE_NONSCRIPTABLE "__attribute__((annotate(\"nonscriptable\")))")
-endif ()
-generate_export_header (${TARGET_NAME} ${URHO3D_LIB_TYPE} EXPORT_MACRO_NAME URHO3D_API EXPORT_FILE_NAME Urho3D.h.new)
-execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h.new ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h)
-file (REMOVE ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h.new)
-
-# Define generated object files
-# This is a hack as it relies on internal working of CMake
-if (MSVC AND URHO3D_LIB_TYPE STREQUAL SHARED)   # MSVC linker does not have force_load/whole_archive equivalent
-    foreach (TARGET ${STATIC_LIBRARY_TARGETS})
-        get_target_property (SOURCES ${TARGET} SOURCES)
-        get_target_property (INT_DIR ${TARGET} LOCATION)
-        if (INT_DIR)
-            get_filename_component (INT_DIR ${INT_DIR} PATH)
-            if (CMAKE_GENERATOR MATCHES 2008)
-                string (REPLACE /$(OutDir) /${TARGET}.dir/$(ConfigurationName) INT_DIR ${INT_DIR})
-            elseif (VS)
-                string (REPLACE /$(Configuration) /${TARGET}.dir/$(ConfigurationName) INT_DIR ${INT_DIR})
-            endif ()
-            foreach (SOURCE ${SOURCES})
-                get_filename_component (NAME ${SOURCE} NAME)
-                if (NAME MATCHES \\.c.*$|\\.mm?$|\\.S$|\\.s$)
-                    if (VS)
-                        string (REGEX REPLACE \\.c.*$|\\.mm?$|\\.S$|\\.s$ "" NAME "${NAME}")
-                        list (APPEND OBJ_FILES ${INT_DIR}/${NAME}.obj)
-                    else ()
-                        string (REGEX REPLACE ^.*/ThirdParty/${TARGET}/ "" SOURCE "${SOURCE}")
-                        list (APPEND OBJ_FILES ${INT_DIR}/CMakeFiles/${TARGET}.dir/${SOURCE}.obj)
-                    endif ()
-                elseif (NAME MATCHES \\.o.*$)
-                    list (APPEND OBJ_FILES ${SOURCE})
-                endif ()
-            endforeach ()
-            source_group ("Object Files\\${TARGET}" FILES ${OBJ_FILES})
-            list (APPEND ALL_OBJ_FILES ${OBJ_FILES})
-            unset (OBJ_FILES)
-        endif ()
-    endforeach ()
-    set_source_files_properties (${ALL_OBJ_FILES} PROPERTIES GENERATED TRUE)
-endif ()
-
-# Aggregate all source files
-list (APPEND SOURCE_FILES ${GEN_CPP_FILES} ${ALL_OBJ_FILES} librevision.h Urho3D.h ${SYMBOLIC_SOURCES})
-
-# Define dependency libs
-# Add include directories to find the precompiled header, export header, and installed headers from thirdparty libs
-set (INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
-if (URHO3D_PHYSICS)
-    # Bullet library depends on its own include dir to be added in the header search path
-    # This is more practical than patching its header files in many places to make them work with relative path
-    list (APPEND INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Bullet)
-endif ()
-if (URHO3D_NAVIGATION)
-    # DetourTileCache and DetourCrowd libraries depend on Detour's include dir to be added in the header search path
-    list (APPEND INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Detour)
-endif ()
-if (URHO3D_LUA)
-    # Lua/LuaJIT library depends on its own include dir to be added in the header search path
-    # This is more practical than patching its header files in many places to make them work with relative path
-    list (APPEND INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Lua${JIT})
-endif ()
-# Workaround for GCC 5.4 and above when building a SHARED lib type for Linux platform to fix the undefined symbol "__cpu_model" issue (see #1519)
-if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.3.1 AND CMAKE_SYSTEM_NAME STREQUAL Linux AND URHO3D_LIB_TYPE STREQUAL SHARED)  # 5.3.1 was the last known good version
-    list (APPEND LIBS gcc)
-endif ()
-
-# Setup library output path
-if (ANDROID)
-    set (OUTPUT_PATH ${ANDROID_LIBRARY_OUTPUT_PATH})
-else ()
-    set (OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
-endif ()
-set_output_directories (${OUTPUT_PATH} ARCHIVE LIBRARY)
-
-# Setup target
-if (IOS)
-    set (EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL)
-endif ()
-setup_library (${URHO3D_LIB_TYPE} ${EXCLUDE_FROM_ALL})
-if (NOT ANDROID AND NOT WEB)
-    file (READ .soversion SOVERSION)
-    string (STRIP ${SOVERSION} SOVERSION)
-    string (REGEX MATCH "([^.]+)\\.([^.]+)\\.(.+)" MATCHED ${SOVERSION})
-    if (MATCHED)
-        set_target_properties (${TARGET_NAME} PROPERTIES VERSION ${MATCHED} SOVERSION ${CMAKE_MATCH_1})
-    else ()
-        message (FATAL_ERROR "The .soversion file is corrupted. It should contain a version number with this format major(0xFFFF).minor(0xFF).patch-level(0xFF). e.g.: 0.1.2")
-    endif ()
-elseif (EMSCRIPTEN)
-    # Emscripten does not support generation of shared library in a conventional sense, it just produces "linked" LLVM bitcode
-    set (CMAKE_SHARED_LIBRARY_SUFFIX ".bc")
-endif ()
-if (IOS)
-    # Add a custom target to 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)
-    add_custom_target (${TARGET_NAME}_universal ALL
-        COMMAND if [ '$(CONFIGURATION)' != 'Debug' ]\; then if lipo -info $<TARGET_FILE:${TARGET_NAME}> 2>/dev/null |egrep -cq 'i386.*armv7|armv7.*i386|x86_64.*arm64|arm64.*x86_64'\; then echo $<TARGET_FILE:${TARGET_NAME}> is already a Mach-O universal binary consisting of both iphoneos and iphonesimulator archs\; else mv $<TARGET_FILE:${TARGET_NAME}>{,.ori} && if lipo -info $<TARGET_FILE:${TARGET_NAME}>.ori 2>/dev/null |egrep -cq 'i386|x86_64'\; then sdk=iphoneos\; else sdk=iphonesimulator\; fi && xcodebuild -target ${TARGET_NAME} -configuration $(CONFIGURATION) -sdk $$sdk 2>&1 && mv $<TARGET_FILE:${TARGET_NAME}>{,.new} && lipo -create -output $<TARGET_FILE:${TARGET_NAME}>{,.ori,.new} && rm $<TARGET_FILE:${TARGET_NAME}>{.ori,.new}\; fi\; fi
-        DEPENDS ${TARGET_NAME}
-        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-        COMMENT "Creating Mach-O universal binary library consisting of both iphoneos and iphonesimulator archs")
-    install (FILES $<TARGET_FILE:${TARGET_NAME}> DESTINATION ${DEST_LIBRARY_DIR})
-else ()
-    install (TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${DEST_RUNTIME_DIR} LIBRARY DESTINATION ${DEST_LIBRARY_DIR} ARCHIVE DESTINATION ${DEST_LIBRARY_DIR})
-endif ()
-if (WIN32 AND URHO3D_LIB_TYPE STREQUAL SHARED)
-    set (URHO3D_DLL_INSTALLED TRUE)
-endif ()
-
-# Setup dependency frameworks and libraries
-if (MINGW)
-    set (CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INIT} -lwinmm")
-    set (CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INIT} -lwinmm")
-endif ()
-if (APPLE)
-    set (FORCE_LOAD -force_load)
-elseif (NOT MSVC)
-    set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES -Wl,--whole-archive)
-    if (WIN32 AND URHO3D_LIB_TYPE STREQUAL SHARED)
-        set_target_properties (${TARGET_NAME} PROPERTIES PREFIX "")
-    endif ()
-endif ()
-foreach (TARGET ${STATIC_LIBRARY_TARGETS})
-    get_target_property (ARCHIVE ${TARGET} LOCATION)
-    if (ARCHIVE)
-        if (NOT MSVC)
-            set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES ${FORCE_LOAD} ${ARCHIVE})    # Only works in Apple (Xcode and Makefile) and GCC while building shared library
-        endif ()
-        if (MSVC_VERSION VERSION_EQUAL 1500)
-            if (ARCHIVE MATCHES " ")
-                message (FATAL_ERROR "CMake/VS2008 generator does not support spaces in the source and/or build tree path")
-            endif ()
-            set_property (TARGET ${TARGET_NAME} APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS " ${ARCHIVE}")  # Fallback for VS2008
-        elseif (XCODE OR MSVC)
-            set_property (TARGET ${TARGET_NAME} APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS " \"${ARCHIVE}\"")  # Only works in Apple (Xcode only) and MSVC while building static library
-        else ()
-            list (APPEND ARCHIVES ${ARCHIVE})
-        endif ()
-    endif ()
-endforeach ()
-if (NOT XCODE AND NOT MSVC)
-    if (NOT APPLE)
-        set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES -Wl,--no-whole-archive)
-    endif ()
-    if (NOT URHO3D_LIB_TYPE STREQUAL SHARED)
-        if (APPLE)
-            # Apple libtool takes archives directly as input
-            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                COMMAND mv $<TARGET_FILE:${TARGET_NAME}>{,.engine}
-                COMMAND libtool -static $<TARGET_FILE:${TARGET_NAME}>.engine ${ARCHIVES} -o $<TARGET_FILE:${TARGET_NAME}>
-                COMMAND rm $<TARGET_FILE:${TARGET_NAME}>.engine
-                COMMENT "Merging all archives into a single static library using libtool")
-        elseif (EMSCRIPTEN OR CMAKE_BINARY_DIR MATCHES " ")
-            # Do it the hard way by first extracting the object (bitcode) files and appending them to final archive:
-            # a) For Emscripten build as Emscripten emar (llvm-ar) neither takes archives directly as input nor supports MRI-style script
-            # b) When the build tree path contains spaces because MRI script does not support spaces in path even with proper escape
-            get_filename_component (AR ${CMAKE_AR} NAME_WE)
-            if (CMAKE_HOST_WIN32)
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                    COMMAND ${CMAKE_COMMAND} -E remove_directory archives
-                    COMMAND ${CMAKE_COMMAND} -E echo "Merging all archives into a single static library using ${AR}")
-                foreach (ARCHIVE ${ARCHIVES})
-                    # Merge per library because Window cmd shell does not handle long argument list
-                    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory archives)
-                    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                        COMMAND ${CMAKE_AR} x ${ARCHIVE}
-                        COMMAND ${CMAKE_COMMAND} -E echo_append "\\\"${CMAKE_AR}\\\"" q \\\"$<TARGET_FILE:${TARGET_NAME}>\\\" " " >merge.bat
-                        COMMAND for /F %%i in ('dir /B *.o*') do ${CMAKE_COMMAND} -E echo_append %%i" " >>merge.bat
-                        COMMAND merge.bat WORKING_DIRECTORY archives)
-                    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E remove_directory archives)
-                endforeach ()
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_RANLIB} $<TARGET_FILE:${TARGET_NAME}>)
-            else ()
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                    COMMAND ${CMAKE_COMMAND} -E remove_directory archives
-                    COMMAND ${CMAKE_COMMAND} -E make_directory archives COMMENT "Merging all archives into a single static library using ${AR}")
-                foreach (ARCHIVE ${ARCHIVES})
-                    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_AR} x ${ARCHIVE} WORKING_DIRECTORY archives)
-                endforeach ()
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_AR} q $<TARGET_FILE:${TARGET_NAME}> `ls -1` WORKING_DIRECTORY archives)
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                    COMMAND ${CMAKE_RANLIB} $<TARGET_FILE:${TARGET_NAME}>
-                    COMMAND ${CMAKE_COMMAND} -E remove_directory archives)
-            endif ()
-        else ()
-            # GCC ar does not take archives directly as input like Apple libtool, however, it can be scripted to do so
-            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:${TARGET_NAME}> $<TARGET_FILE:${TARGET_NAME}>.engine
-                COMMAND echo CREATE $<TARGET_FILE:${TARGET_NAME}> >script.ar
-                COMMAND echo ADDLIB $<TARGET_FILE:${TARGET_NAME}>.engine >>script.ar)
-            foreach (ARCHIVE ${ARCHIVES})
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND echo ADDLIB ${ARCHIVE} >>script.ar)
-            endforeach ()
-            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                COMMAND echo SAVE >>script.ar
-                COMMAND echo END >>script.ar
-                COMMAND ${CMAKE_AR} -M <script.ar
-                COMMAND ${CMAKE_COMMAND} -E remove $<TARGET_FILE:${TARGET_NAME}>.engine script.ar
-                COMMENT "Merging all archives into a single static library using ar")
-        endif ()
-    endif ()
-endif ()
-# todo This is a deprecated property in CMake version 2.8.12 - Remove below commands when CMake minimum version is 2.8.12
-if (CMAKE_VERSION VERSION_LESS 2.8.12)
-    set_target_properties (${TARGET_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "")
-    if (URHO3D_LIB_TYPE STREQUAL SHARED)
-        if (NOT MSVC AND CMAKE_VERSION VERSION_LESS 2.8.11)
-            get_target_property (LINK_LIBRARIES ${TARGET_NAME} LINK_LIBRARIES)
-            target_link_libraries (${TARGET_NAME} LINK_PRIVATE ${LINK_LIBRARIES})
-        endif ()
-    else ()
-        set_target_properties (${TARGET_NAME} PROPERTIES LINK_LIBRARIES "")
-    endif ()
-endif ()
-# end todo
-# 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)
-if (URHO3D_LIB_TYPE STREQUAL SHARED)
-    set_target_properties (${STATIC_LIBRARY_TARGETS} PROPERTIES POSITION_INDEPENDENT_CODE true)
-    if (NOT MSVC AND NOT (MINGW AND CMAKE_CROSSCOMPILING) 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)
-    endif ()
-endif ()
-
-# Install headers for using the Urho3D library
-install_header_files (FILES ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h DESTINATION ${DEST_INCLUDE_DIR} ACCUMULATE GENERATED_HEADERS)
-install_header_files (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DEST_INCLUDE_DIR} FILES_MATCHING PATTERN *.h ACCUMULATE URHO_HEADERS)    # Note: the trailing slash is significant
-# Generate the include-all-headers header file even though we do not encourage Urho3D library users to use it
-list (SORT URHO_HEADERS)
-list (REVERSE URHO_HEADERS)
-set (OPTIONAL_SUBS AngelScript Database Lua Navigation Network Physics Urho2D)
-foreach (SUB ${OPTIONAL_SUBS})
-    if (URHO_HEADERS MATCHES "(include/Urho3D/${SUB}[^;]+)")
-        list (FIND URHO_HEADERS ${CMAKE_MATCH_1} FOUND_INDEX)
-        if (FOUND_INDEX GREATER -1)
-            list (INSERT URHO_HEADERS ${FOUND_INDEX} "#endif")
-        endif ()
-    endif ()
-endforeach ()
-list (REVERSE URHO_HEADERS)
-foreach (SUB ${OPTIONAL_SUBS})
-    if (URHO_HEADERS MATCHES "(include/Urho3D/${SUB}[^;]+)")
-        list (FIND URHO_HEADERS ${CMAKE_MATCH_1} FOUND_INDEX)
-        if (FOUND_INDEX GREATER -1)
-            string (TOUPPER ${SUB} SUB)
-            list (INSERT URHO_HEADERS ${FOUND_INDEX} "#if URHO3D_${SUB}")
-        endif ()
-    endif ()
-endforeach ()
-string (REGEX REPLACE "include/[^;]+(DebugNew|Direct3D|ODBC|OpenGL|Precompiled|SQLite|ToluaUtils)[^;]+;" "" URHO_HEADERS "${URHO_HEADERS}")
-string (REGEX REPLACE "include/([^;]+)" "#include <\\1>" URHO_HEADERS "${GENERATED_HEADERS};;${URHO_HEADERS};")
-string (REPLACE ";" \n URHO_HEADERS "${URHO_HEADERS}")
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Urho3DAll.h.in ${CMAKE_CURRENT_BINARY_DIR}/Urho3DAll.h)
-install_header_files (FILES ${CMAKE_CURRENT_BINARY_DIR}/Urho3DAll.h ${CMAKE_CURRENT_BINARY_DIR}/librevision.h DESTINATION ${DEST_INCLUDE_DIR})
-
-# Generate platform specific pkg-config file for the benefit of Urho3D library users via SDK without CMake
-get_directory_property (URHO3D_COMPILE_DEFINITIONS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
-# Remove those defines that are only used for building the library and not needed by library user
-list (REMOVE_ITEM URHO3D_COMPILE_DEFINITIONS HAVE_STDINT_H GLEW_STATIC GLEW_NO_GLU HAVE_SINCOSF HAVE_UNDERSCORE_SINCOSF URHO3D_IS_BUILDING ODBC_3_OR_LATER ASSET_DIR_INDICATOR)
-if (ABSOLUTE_PATH_LIBS)
-    string (REPLACE ";" "\" \"" URHO3D_ABS_PATH_LIBS "\"${ABSOLUTE_PATH_LIBS}\"")   # Note: need to always "stringify" a variable in list context for replace to work correctly, besides the list could be empty
-    string (REPLACE "${SYSROOT}" "\${pc_sysrootdir}" URHO3D_ABS_PATH_LIBS "${URHO3D_ABS_PATH_LIBS}")
-endif ()
-if (MSVC)
-    set (DASH /)
-    set (LIB_DIR "/LIBPATH:\"\${libdir}\"")
-    string (REPLACE ";" ".lib\" \"" URHO3D_LIBS "\"@LIB_NAME@\" \"${LIBS}.lib\"")
-    set (PC_SUFFIX .msvc)
-else ()
-    set (LIB_NAME ${TARGET_NAME})
-    if (MINGW)
-        if (CMAKE_BUILD_TYPE STREQUAL Debug)
-            set (LIB_NAME ${LIB_NAME}_d)
-        endif ()
-        if (URHO3D_LIB_TYPE STREQUAL SHARED)
-            set (LIB_NAME ${LIB_NAME}.dll)
-        endif ()
-    endif ()
-    set (DASH -)
-    set (LIB_DIR "-L\"\${libdir}\"")
-    string (REPLACE ";" " -l" URHO3D_LIBS "-l${LIB_NAME};${LIBS}")
-endif ()
-string (REPLACE ";" " ${DASH}D" URHO3D_COMPILE_DEFINITIONS "${DASH}D${URHO3D_COMPILE_DEFINITIONS}")
-get_directory_property (GLOBAL_INCLUDE_DIRS DIRECTORY ${CMAKE_SOURCE_DIR} INCLUDE_DIRECTORIES)
-if (GLOBAL_INCLUDE_DIRS)
-    string (REPLACE ";" "\" ${DASH}I\"" GLOBAL_INCLUDE_DIRS "${DASH}I\"${GLOBAL_INCLUDE_DIRS}\"")
-    string (REPLACE "${SYSROOT}" "" GLOBAL_INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS})
-endif ()
-set (ENGINE_INCLUDE_DIRS "${DASH}I\"\${includedir}\" ${DASH}I\"\${includedir}/Urho3D/ThirdParty\"")
-if (URHO3D_PHYSICS)
-    # Bullet library depends on its own include dir to be added in the header search path
-    # This is more practical than patching its header files in many places to make them work with relative path
-    set (ENGINE_INCLUDE_DIRS "${ENGINE_INCLUDE_DIRS} ${DASH}I\"\${includedir}/Urho3D/ThirdParty/Bullet\"")
-endif ()
-if (URHO3D_LUA)
-    # ditto for Lua/LuaJIT
-    set (ENGINE_INCLUDE_DIRS "${ENGINE_INCLUDE_DIRS} ${DASH}I\"\${includedir}/Urho3D/ThirdParty/Lua${JIT}\"")
-endif ()
-# todo: Reevaluate the command below when the CMake minimum required version is set to 2.8.12 (and remove only when the deprecated add_compiler_export_flags() is not used anymore)
-# Remove compiler flags that are only used for building the library
-string (REGEX REPLACE " -fvisibility[^ ]+" "" CLEANED_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
-string (REGEX REPLACE " -include \"[^\"]+\"" "" CLEANED_CMAKE_CXX_FLAGS "${CLEANED_CMAKE_CXX_FLAGS}")
-string (REPLACE "${SYSROOT}" "\${pc_sysrootdir}" CLEANED_CMAKE_CXX_FLAGS "${CLEANED_CMAKE_CXX_FLAGS}")
-string (REPLACE "${SYSROOT}" "\${pc_sysrootdir}" CLEANED_CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Urho3D.pc.in ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.pc${PC_SUFFIX} @ONLY)
-if (MSVC)
-    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -DLIB_NAME=$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}> -P ${CMAKE_SOURCE_DIR}/CMake/Modules/AdjustPkgConfigForMSVC.cmake)
-endif ()
-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})
-
-# Define post build steps
-if (ANDROID_NDK_GDB)
-    # Copy the library while it still has debug symbols for ndk-gdb
-    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${TARGET_NAME}> ${NDK_GDB_SOLIB_PATH}
-        COMMENT "Copying Urho3D library with debug symbols to ${NDK_GDB_SOLIB_PATH} directory")
-endif ()
-if (URHO3D_LIB_TYPE STREQUAL SHARED AND (ANDROID OR ARM))
-    # Strip the output shared library for embedded devices
-    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${TARGET_NAME}>
-        COMMENT "Stripping Urho3D shared library")
-endif ()
-if (URHO3D_SCP_TO_TARGET)
-    # Ensure SCP is the last command
-    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${URHO3D_SCP_TO_TARGET} || exit 0
-        COMMENT "Scp-ing Urho3D library to target system")
-endif ()
+#
+# Copyright (c) 2008-2016 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.
+#
+
+# Define target name
+set (TARGET_NAME Urho3D)
+
+# Generate JSON compilation database format specification
+if (URHO3D_CLANG_TOOLS OR URHO3D_BINDINGS)
+    set (CMAKE_EXPORT_COMPILE_COMMANDS 1)
+    # Clang assumes all their tools to be installed in a relative path to their libs but this is not the case for our own Clang-tools
+    # Clang has a hard-coded way to search for their headers (see http://clang.llvm.org/docs/LibTooling.html#builtin-includes)
+    # In order for our Clang-tools to work correctly we need to make this Clang's assumption to be true
+    execute_process (COMMAND ${LLVM_CONFIG} --version OUTPUT_VARIABLE LLVM_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
+    string (REGEX REPLACE "([.0123456789]+).*" \\1 LLVM_VERSION "${LLVM_VERSION}")      # Stringify against empty output variable
+    execute_process (COMMAND ${LLVM_CONFIG} --libdir OUTPUT_VARIABLE LLVM_LIBDIR OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
+    execute_process (COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin/tool/lib/clang/${LLVM_VERSION})
+    create_symlink (${LLVM_LIBDIR}/clang/${LLVM_VERSION}/include ${CMAKE_BINARY_DIR}/bin/tool/lib/clang/${LLVM_VERSION}/include FALLBACK_TO_COPY)
+    # TODO: Remove this workaround when Travis CI VM has been migrated to Ubuntu 14.04 LTS (ancient glibc header has incorrect defines)
+    if (DEFINED ENV{TRAVIS})
+        add_definitions (-D__extern_always_inline=inline)
+    endif ()
+endif ()
+
+# Check sincosf support
+if (NOT MSVC)   # There is no chance MSVC would pass this one as it does not have libm
+    include (CheckLibraryExists)
+    check_library_exists (m sincosf "" HAVE_SINCOSF)
+endif ()
+if (HAVE_SINCOSF)
+    add_definitions (-DHAVE_SINCOSF)
+else ()
+    include (CheckFunctionExists)
+    check_function_exists (__sincosf HAVE_UNDERSCORE_SINCOSF)
+    if (HAVE_UNDERSCORE_SINCOSF)
+        add_definitions (-DHAVE_UNDERSCORE_SINCOSF)
+    endif ()
+endif ()
+
+add_definitions (-DURHO3D_IS_BUILDING)
+if (ODBC_VERSION AND NOT ODBC_VERSION VERSION_LESS 3)
+    add_definitions (-DODBC_3_OR_LATER)
+endif ()
+if (ANDROID AND DEFINED ENV{ASSET_DIR_INDICATOR})
+    add_definitions (-DASSET_DIR_INDICATOR=\"$ENV{ASSET_DIR_INDICATOR}\")
+endif ()
+
+if (WIN32)
+    set (CMAKE_DEBUG_POSTFIX _d)
+endif ()
+
+# Define source files
+foreach (DIR Navigation Network Physics Urho2D)
+    string (TOUPPER URHO3D_${DIR} OPT)
+    if (NOT ${OPT})
+        list (APPEND EXCLUDED_SOURCE_DIRS ${DIR})
+    endif ()
+endforeach ()
+if (NOT URHO3D_ANGELSCRIPT)
+    list (APPEND EXCLUDED_SOURCE_DIRS AngelScript)
+endif ()
+if (NOT URHO3D_LUA)
+    list (APPEND EXCLUDED_SOURCE_DIRS LuaScript)
+endif ()
+if (URHO3D_DATABASE)
+    if (URHO3D_DATABASE_ODBC)
+        list (APPEND EXCLUDED_SOURCE_DIRS Database/SQLite)
+    else ()
+        list (APPEND EXCLUDED_SOURCE_DIRS Database/ODBC)
+    endif ()
+else ()
+    list (APPEND EXCLUDED_SOURCE_DIRS Database)
+endif ()
+if (URHO3D_OPENGL)
+    # Exclude the opposite source directory
+    list (APPEND EXCLUDED_SOURCE_DIRS Graphics/Direct3D9 Graphics/Direct3D11)
+else ()
+    list (APPEND EXCLUDED_SOURCE_DIRS Graphics/OpenGL)
+    if (URHO3D_D3D11)
+        list (APPEND EXCLUDED_SOURCE_DIRS Graphics/Direct3D9)
+    else ()
+        list (APPEND EXCLUDED_SOURCE_DIRS Graphics/Direct3D11)
+    endif ()
+endif ()
+if (APPLE AND NOT IOS)
+    set (GLOB_OBJC_PATTERN *.m)     # Should only pick up MacFileWatcher.m for MacOSX platform at the moment
+endif ()
+string (REPLACE ";" "/[^;]+;" EXCLUDE_PATTERNS "${EXCLUDED_SOURCE_DIRS};")
+define_source_files (EXCLUDE_PATTERNS ${EXCLUDE_PATTERNS} GLOB_CPP_PATTERNS *.cpp ${GLOB_OBJC_PATTERN} RECURSE GROUP PCH Precompiled.h)
+
+# Define generated source files
+if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/librevision.h)
+    execute_process (COMMAND ${CMAKE_COMMAND} -DFILENAME=${CMAKE_CURRENT_BINARY_DIR}/librevision.h -P CMake/Modules/GetUrho3DRevision.cmake
+        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_QUIET ERROR_QUIET)
+endif ()
+set (URHO3D_DEPS ${STATIC_LIBRARY_TARGETS})
+if (TARGET LuaJIT_universal)
+    list (REMOVE_ITEM URHO3D_DEPS LuaJIT)
+    set (LuaJIT_universal_symbolic LuaJIT_universal_symbolic)
+    add_custom_command (OUTPUT ${LuaJIT_universal_symbolic}
+        COMMAND xcodebuild ARCHS="$(ARCHS)" -target LuaJIT_universal -configuration $(CONFIGURATION)
+        WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
+    list (APPEND SYMBOLIC_SOURCES ${LuaJIT_universal_symbolic})
+endif ()
+add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/librevision.h
+    COMMAND ${CMAKE_COMMAND} -DFILENAME=${CMAKE_CURRENT_BINARY_DIR}/librevision.h -P CMake/Modules/GetUrho3DRevision.cmake
+    DEPENDS ${URHO3D_DEPS} ${CMAKE_SOURCE_DIR}/CMake/Modules/GetUrho3DRevision.cmake
+    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+    COMMENT "Generating GIT revision number (tag + last commit SHA-1)")
+if (EMSCRIPTEN)
+    # Emscripten will attempt to generate system libraries in LLVM bitcode (libcxxabi, gl, libc, and dlmalloc) when linking for the very first time
+    # However, currently it does so without any locking resulting in potentially multiple same generation with build system that supports concurrent build processes such as ours
+    # Workaround that by calling Emscripten builder to generate all the required system libraries (in case it is the very first time) ahead of time in an orderly fashion
+    set (EMBUILDER_SYSTEM_LIBS_symbolic EMBUILDER_SYSTEM_LIBS_symbolic)
+    list (APPEND EMSCRIPTEN_SYSTEM_LIBS dlmalloc libc libcxxabi gl)
+    add_custom_command (OUTPUT ${EMBUILDER_SYSTEM_LIBS_symbolic}
+        COMMAND ${EMBUILDER} build ${EMSCRIPTEN_SYSTEM_LIBS})
+    list (APPEND SYMBOLIC_SOURCES ${EMBUILDER_SYSTEM_LIBS_symbolic})
+endif ()
+set_source_files_properties (${SYMBOLIC_SOURCES} PROPERTIES SYMBOLIC TRUE)
+
+# Use the AutoBinder tool to generate source files for binding script subsystems
+if (URHO3D_BINDINGS)
+    # Build the Clang-tools as external project (even when we are not cross-compiling because it needs C++11 standard on) for auto-binding generation
+    include (ExternalProject)
+    if (IOS)
+        # For iOS target, ensure the host environment is cleared first; Also workaround a known CMake/Xcode generator bug which prevents it from installing binaries correctly
+        set (IOS_FIX CMAKE_COMMAND /usr/bin/env -i PATH=$ENV{PATH} ${CMAKE_COMMAND} BUILD_COMMAND bash -c "sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' CMakeScripts/install_postBuildPhase.make*")
+    endif ()
+    ExternalProject_Add (AutoBinder
+            SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/Clang-Tools
+            CMAKE_ARGS -DURHO3D_CLANG_TOOLS=AutoBinder -DDEST_RUNTIME_DIR=${CMAKE_BINARY_DIR}/bin/tool/clang -DDEST_INCLUDE_DIR=${DEST_INCLUDE_DIR} -DBAKED_CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} ${IOS_FIX})
+    file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated/generated)
+    foreach (SCRIPT AngelScript LuaScript JavaScript)
+        string (TOUPPER URHO3D_${SCRIPT} OPT)
+        if (${OPT})
+            list (APPEND SCRIPT_SUBSYSTEMS -s ${SCRIPT})
+            list (APPEND GEN_CPP_FILES ${CMAKE_CURRENT_BINARY_DIR}/generated/${SCRIPT}API.cpp)
+        endif ()
+    endforeach ()
+    string (REGEX REPLACE "[^;]+API\\.cpp" "" ANNOTATED_SOURCES "${CPP_FILES}")    # Stringify to preserve the semicolons
+    add_custom_command (OUTPUT ${GEN_CPP_FILES}
+        COMMAND ${CMAKE_BINARY_DIR}/bin/tool/clang/AutoBinder -p ${CMAKE_BINARY_DIR} -t ${CMAKE_BINARY_DIR}/bin/tool/clang/Templates -o ${CMAKE_CURRENT_BINARY_DIR}/generated ${SCRIPT_SUBSYSTEMS} ${ANNOTATED_SOURCES}
+        COMMAND ${CMAKE_COMMAND} -E touch ${GEN_CPP_FILES}   # TODO: fake the output - WIP
+        DEPENDS AutoBinder ${H_FILES}
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        COMMENT "Generating source files for binding script subsystems")
+endif ()
+if (URHO3D_LUA)
+    # The host tool must be built natively
+    if (CMAKE_CROSSCOMPILING OR URHO3D_LUAJIT)
+        # When cross-compiling or using LuaJIT, build the tolua++ host tool as external project using normal Lua (there is not much point using LuaJIT for the tool building even when technically it can)
+        include (ExternalProject)
+        if (IOS)
+            set (IOS_FIX CMAKE_COMMAND /usr/bin/env -i PATH=$ENV{PATH} ${CMAKE_COMMAND} BUILD_COMMAND bash -c "sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' CMakeScripts/install_postBuildPhase.make*")
+        endif ()
+        ExternalProject_Add (tolua++
+            SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/ThirdParty/toluapp/src/bin
+            CMAKE_ARGS -DDEST_RUNTIME_DIR=${CMAKE_BINARY_DIR}/bin/tool -DBAKED_CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} -DURHO3D_UPDATE_SOURCE_TREE=${URHO3D_UPDATE_SOURCE_TREE} ${IOS_FIX})
+    else ()
+        # Otherwise, build it internally as per normal
+        add_subdirectory (../ThirdParty/toluapp/src/bin ../ThirdParty/toluapp/src/bin)
+    endif ()
+    # Use the host tool to generate source files for tolua++ API binding
+    file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/LuaScript/generated)
+    file (GLOB API_PKG_FILES LuaScript/pkgs/*.pkg)
+    foreach (DIR Navigation Network Database Physics Urho2D)
+        string (TOUPPER URHO3D_${DIR} OPT)
+        if (NOT ${OPT})
+            list (REMOVE_ITEM API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/LuaScript/pkgs/${DIR}LuaAPI.pkg)
+        endif ()
+    endforeach ()
+    foreach (API_PKG_FILE ${API_PKG_FILES})
+        get_filename_component (NAME ${API_PKG_FILE} NAME)
+        string (REGEX REPLACE LuaAPI\\.pkg$ "" DIR ${NAME})
+        set (GEN_CPP_FILE LuaScript/generated/${DIR}LuaAPI.cpp)
+        list (APPEND GEN_CPP_FILES ${GEN_CPP_FILE})
+        file (GLOB PKG_FILES LuaScript/pkgs/${DIR}/*.pkg)
+        add_custom_command (OUTPUT ${GEN_CPP_FILE}
+            COMMAND ${CMAKE_BINARY_DIR}/bin/tool/tolua++ -E ${CMAKE_PROJECT_NAME} -L ToCppHook.lua -o ${CMAKE_CURRENT_BINARY_DIR}/${GEN_CPP_FILE} ${NAME}
+            DEPENDS tolua++ ${API_PKG_FILE} ${PKG_FILES} LuaScript/pkgs/ToCppHook.lua
+            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/LuaScript/pkgs
+            COMMENT "Generating tolua++ API binding on the fly for ${DIR}")
+    endforeach ()
+endif ()
+
+# Generate platform specific export header file
+if (MSVC)
+    set (PRE_EXPORT_HEADER "\n#pragma warning(disable: 4251)\n#pragma warning(disable: 4275)\n")
+endif ()
+if (URHO3D_CLANG_TOOLS)
+    set (ANNOTATE_NONSCRIPTABLE "__attribute__((annotate(\"nonscriptable\")))")
+endif ()
+generate_export_header (${TARGET_NAME} ${URHO3D_LIB_TYPE} EXPORT_MACRO_NAME URHO3D_API EXPORT_FILE_NAME Urho3D.h.new)
+execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h.new ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h)
+file (REMOVE ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h.new)
+
+# Define generated object files
+# This is a hack as it relies on internal working of CMake
+if (MSVC AND URHO3D_LIB_TYPE STREQUAL SHARED)   # MSVC linker does not have force_load/whole_archive equivalent
+    foreach (TARGET ${STATIC_LIBRARY_TARGETS})
+        get_target_property (SOURCES ${TARGET} SOURCES)
+        get_target_property (INT_DIR ${TARGET} LOCATION)
+        if (INT_DIR)
+            get_filename_component (INT_DIR ${INT_DIR} PATH)
+            if (CMAKE_GENERATOR MATCHES 2008)
+                string (REPLACE /$(OutDir) /${TARGET}.dir/$(ConfigurationName) INT_DIR ${INT_DIR})
+            elseif (VS)
+                string (REPLACE /$(Configuration) /${TARGET}.dir/$(ConfigurationName) INT_DIR ${INT_DIR})
+            endif ()
+            foreach (SOURCE ${SOURCES})
+                get_filename_component (NAME ${SOURCE} NAME)
+                if (NAME MATCHES \\.c.*$|\\.mm?$|\\.S$|\\.s$)
+                    if (VS)
+                        string (REGEX REPLACE \\.c.*$|\\.mm?$|\\.S$|\\.s$ "" NAME "${NAME}")
+                        list (APPEND OBJ_FILES ${INT_DIR}/${NAME}.obj)
+                    else ()
+                        string (REGEX REPLACE ^.*/ThirdParty/${TARGET}/ "" SOURCE "${SOURCE}")
+                        list (APPEND OBJ_FILES ${INT_DIR}/CMakeFiles/${TARGET}.dir/${SOURCE}.obj)
+                    endif ()
+                elseif (NAME MATCHES \\.o.*$)
+                    list (APPEND OBJ_FILES ${SOURCE})
+                endif ()
+            endforeach ()
+            source_group ("Object Files\\${TARGET}" FILES ${OBJ_FILES})
+            list (APPEND ALL_OBJ_FILES ${OBJ_FILES})
+            unset (OBJ_FILES)
+        endif ()
+    endforeach ()
+    set_source_files_properties (${ALL_OBJ_FILES} PROPERTIES GENERATED TRUE)
+endif ()
+
+# Aggregate all source files
+list (APPEND SOURCE_FILES ${GEN_CPP_FILES} ${ALL_OBJ_FILES} librevision.h Urho3D.h ${SYMBOLIC_SOURCES})
+
+# Define dependency libs
+# Add include directories to find the precompiled header, export header, and installed headers from thirdparty libs
+set (INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
+if (URHO3D_PHYSICS)
+    # Bullet library depends on its own include dir to be added in the header search path
+    # This is more practical than patching its header files in many places to make them work with relative path
+    list (APPEND INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Bullet)
+endif ()
+if (URHO3D_NAVIGATION)
+    # DetourTileCache and DetourCrowd libraries depend on Detour's include dir to be added in the header search path
+    list (APPEND INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Detour)
+endif ()
+if (URHO3D_LUA)
+    # Lua/LuaJIT library depends on its own include dir to be added in the header search path
+    # This is more practical than patching its header files in many places to make them work with relative path
+    list (APPEND INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Lua${JIT})
+endif ()
+# Workaround for GCC 5.4 and above when building a SHARED lib type for Linux platform to fix the undefined symbol "__cpu_model" issue (see #1519)
+if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.3.1 AND CMAKE_SYSTEM_NAME STREQUAL Linux AND URHO3D_LIB_TYPE STREQUAL SHARED)  # 5.3.1 was the last known good version
+    list (APPEND LIBS gcc)
+endif ()
+
+# Setup library output path
+if (ANDROID)
+    set (OUTPUT_PATH ${ANDROID_LIBRARY_OUTPUT_PATH})
+else ()
+    set (OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
+endif ()
+set_output_directories (${OUTPUT_PATH} ARCHIVE LIBRARY)
+
+# Setup target
+if (IOS)
+    set (EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL)
+endif ()
+setup_library (${URHO3D_LIB_TYPE} ${EXCLUDE_FROM_ALL})
+if (NOT ANDROID AND NOT WEB)
+    file (READ .soversion SOVERSION)
+    string (STRIP ${SOVERSION} SOVERSION)
+    string (REGEX MATCH "([^.]+)\\.([^.]+)\\.(.+)" MATCHED ${SOVERSION})
+    if (MATCHED)
+        set_target_properties (${TARGET_NAME} PROPERTIES VERSION ${MATCHED} SOVERSION ${CMAKE_MATCH_1})
+    else ()
+        message (FATAL_ERROR "The .soversion file is corrupted. It should contain a version number with this format major(0xFFFF).minor(0xFF).patch-level(0xFF). e.g.: 0.1.2")
+    endif ()
+elseif (EMSCRIPTEN)
+    # Emscripten does not support generation of shared library in a conventional sense, it just produces "linked" LLVM bitcode
+    set (CMAKE_SHARED_LIBRARY_SUFFIX ".bc")
+endif ()
+if (IOS)
+    # Add a custom target to 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)
+    add_custom_target (${TARGET_NAME}_universal ALL
+        COMMAND if [ '$(CONFIGURATION)' != 'Debug' ]\; then if lipo -info $<TARGET_FILE:${TARGET_NAME}> 2>/dev/null |egrep -cq 'i386.*armv7|armv7.*i386|x86_64.*arm64|arm64.*x86_64'\; then echo $<TARGET_FILE:${TARGET_NAME}> is already a Mach-O universal binary consisting of both iphoneos and iphonesimulator archs\; else mv $<TARGET_FILE:${TARGET_NAME}>{,.ori} && if lipo -info $<TARGET_FILE:${TARGET_NAME}>.ori 2>/dev/null |egrep -cq 'i386|x86_64'\; then sdk=iphoneos\; else sdk=iphonesimulator\; fi && xcodebuild -target ${TARGET_NAME} -configuration $(CONFIGURATION) -sdk $$sdk 2>&1 && mv $<TARGET_FILE:${TARGET_NAME}>{,.new} && lipo -create -output $<TARGET_FILE:${TARGET_NAME}>{,.ori,.new} && rm $<TARGET_FILE:${TARGET_NAME}>{.ori,.new}\; fi\; fi
+        DEPENDS ${TARGET_NAME}
+        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+        COMMENT "Creating Mach-O universal binary library consisting of both iphoneos and iphonesimulator archs")
+    install (FILES $<TARGET_FILE:${TARGET_NAME}> DESTINATION ${DEST_LIBRARY_DIR})
+else ()
+    install (TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${DEST_RUNTIME_DIR} LIBRARY DESTINATION ${DEST_LIBRARY_DIR} ARCHIVE DESTINATION ${DEST_LIBRARY_DIR})
+endif ()
+if (WIN32 AND URHO3D_LIB_TYPE STREQUAL SHARED)
+    set (URHO3D_DLL_INSTALLED TRUE)
+endif ()
+
+# Setup dependency frameworks and libraries
+if (MINGW)
+    set (CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INIT} -lwinmm")
+    set (CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INIT} -lwinmm")
+endif ()
+if (APPLE)
+    set (FORCE_LOAD -force_load)
+elseif (NOT MSVC)
+    set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES -Wl,--whole-archive)
+    if (WIN32 AND URHO3D_LIB_TYPE STREQUAL SHARED)
+        set_target_properties (${TARGET_NAME} PROPERTIES PREFIX "")
+    endif ()
+endif ()
+foreach (TARGET ${STATIC_LIBRARY_TARGETS})
+    get_target_property (ARCHIVE ${TARGET} LOCATION)
+    if (ARCHIVE)
+        if (NOT MSVC)
+            set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES ${FORCE_LOAD} ${ARCHIVE})    # Only works in Apple (Xcode and Makefile) and GCC while building shared library
+        endif ()
+        if (MSVC_VERSION VERSION_EQUAL 1500)
+            if (ARCHIVE MATCHES " ")
+                message (FATAL_ERROR "CMake/VS2008 generator does not support spaces in the source and/or build tree path")
+            endif ()
+            set_property (TARGET ${TARGET_NAME} APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS " ${ARCHIVE}")  # Fallback for VS2008
+        elseif (XCODE OR MSVC)
+            set_property (TARGET ${TARGET_NAME} APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS " \"${ARCHIVE}\"")  # Only works in Apple (Xcode only) and MSVC while building static library
+        else ()
+            list (APPEND ARCHIVES ${ARCHIVE})
+        endif ()
+    endif ()
+endforeach ()
+if (NOT XCODE AND NOT MSVC)
+    if (NOT APPLE)
+        set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES -Wl,--no-whole-archive)
+    endif ()
+    if (NOT URHO3D_LIB_TYPE STREQUAL SHARED)
+        if (APPLE)
+            # Apple libtool takes archives directly as input
+            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+                COMMAND mv $<TARGET_FILE:${TARGET_NAME}>{,.engine}
+                COMMAND libtool -static $<TARGET_FILE:${TARGET_NAME}>.engine ${ARCHIVES} -o $<TARGET_FILE:${TARGET_NAME}>
+                COMMAND rm $<TARGET_FILE:${TARGET_NAME}>.engine
+                COMMENT "Merging all archives into a single static library using libtool")
+        elseif (EMSCRIPTEN OR CMAKE_BINARY_DIR MATCHES " ")
+            # Do it the hard way by first extracting the object (bitcode) files and appending them to final archive:
+            # a) For Emscripten build as Emscripten emar (llvm-ar) neither takes archives directly as input nor supports MRI-style script
+            # b) When the build tree path contains spaces because MRI script does not support spaces in path even with proper escape
+            get_filename_component (AR ${CMAKE_AR} NAME_WE)
+            if (CMAKE_HOST_WIN32)
+                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+                    COMMAND ${CMAKE_COMMAND} -E remove_directory archives
+                    COMMAND ${CMAKE_COMMAND} -E echo "Merging all archives into a single static library using ${AR}")
+                foreach (ARCHIVE ${ARCHIVES})
+                    # Merge per library because Window cmd shell does not handle long argument list
+                    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory archives)
+                    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+                        COMMAND ${CMAKE_AR} x ${ARCHIVE}
+                        COMMAND ${CMAKE_COMMAND} -E echo_append "\\\"${CMAKE_AR}\\\"" q \\\"$<TARGET_FILE:${TARGET_NAME}>\\\" " " >merge.bat
+                        COMMAND for /F %%i in ('dir /B *.o*') do ${CMAKE_COMMAND} -E echo_append %%i" " >>merge.bat
+                        COMMAND merge.bat WORKING_DIRECTORY archives)
+                    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E remove_directory archives)
+                endforeach ()
+                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_RANLIB} $<TARGET_FILE:${TARGET_NAME}>)
+            else ()
+                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+                    COMMAND ${CMAKE_COMMAND} -E remove_directory archives
+                    COMMAND ${CMAKE_COMMAND} -E make_directory archives COMMENT "Merging all archives into a single static library using ${AR}")
+                foreach (ARCHIVE ${ARCHIVES})
+                    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_AR} x ${ARCHIVE} WORKING_DIRECTORY archives)
+                endforeach ()
+                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_AR} q $<TARGET_FILE:${TARGET_NAME}> `ls -1` WORKING_DIRECTORY archives)
+                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+                    COMMAND ${CMAKE_RANLIB} $<TARGET_FILE:${TARGET_NAME}>
+                    COMMAND ${CMAKE_COMMAND} -E remove_directory archives)
+            endif ()
+        else ()
+            # GCC ar does not take archives directly as input like Apple libtool, however, it can be scripted to do so
+            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+                COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:${TARGET_NAME}> $<TARGET_FILE:${TARGET_NAME}>.engine
+                COMMAND echo CREATE $<TARGET_FILE:${TARGET_NAME}> >script.ar
+                COMMAND echo ADDLIB $<TARGET_FILE:${TARGET_NAME}>.engine >>script.ar)
+            foreach (ARCHIVE ${ARCHIVES})
+                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND echo ADDLIB ${ARCHIVE} >>script.ar)
+            endforeach ()
+            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+                COMMAND echo SAVE >>script.ar
+                COMMAND echo END >>script.ar
+                COMMAND ${CMAKE_AR} -M <script.ar
+                COMMAND ${CMAKE_COMMAND} -E remove $<TARGET_FILE:${TARGET_NAME}>.engine script.ar
+                COMMENT "Merging all archives into a single static library using ar")
+        endif ()
+    endif ()
+endif ()
+# todo This is a deprecated property in CMake version 2.8.12 - Remove below commands when CMake minimum version is 2.8.12
+if (CMAKE_VERSION VERSION_LESS 2.8.12)
+    set_target_properties (${TARGET_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "")
+    if (URHO3D_LIB_TYPE STREQUAL SHARED)
+        if (NOT MSVC AND CMAKE_VERSION VERSION_LESS 2.8.11)
+            get_target_property (LINK_LIBRARIES ${TARGET_NAME} LINK_LIBRARIES)
+            target_link_libraries (${TARGET_NAME} LINK_PRIVATE ${LINK_LIBRARIES})
+        endif ()
+    else ()
+        set_target_properties (${TARGET_NAME} PROPERTIES LINK_LIBRARIES "")
+    endif ()
+endif ()
+# end todo
+# 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)
+if (URHO3D_LIB_TYPE STREQUAL SHARED)
+    set_target_properties (${STATIC_LIBRARY_TARGETS} PROPERTIES POSITION_INDEPENDENT_CODE true)
+    if (NOT MSVC AND NOT (MINGW AND CMAKE_CROSSCOMPILING) 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)
+    endif ()
+endif ()
+
+# Install headers for using the Urho3D library
+install_header_files (FILES ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h DESTINATION ${DEST_INCLUDE_DIR} ACCUMULATE GENERATED_HEADERS)
+install_header_files (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DEST_INCLUDE_DIR} FILES_MATCHING PATTERN *.h ACCUMULATE URHO_HEADERS)    # Note: the trailing slash is significant
+# Generate the include-all-headers header file even though we do not encourage Urho3D library users to use it
+list (SORT URHO_HEADERS)
+list (REVERSE URHO_HEADERS)
+set (OPTIONAL_SUBS AngelScript Database Lua Navigation Network Physics Urho2D)
+foreach (SUB ${OPTIONAL_SUBS})
+    if (URHO_HEADERS MATCHES "(include/Urho3D/${SUB}[^;]+)")
+        list (FIND URHO_HEADERS ${CMAKE_MATCH_1} FOUND_INDEX)
+        if (FOUND_INDEX GREATER -1)
+            list (INSERT URHO_HEADERS ${FOUND_INDEX} "#endif")
+        endif ()
+    endif ()
+endforeach ()
+list (REVERSE URHO_HEADERS)
+foreach (SUB ${OPTIONAL_SUBS})
+    if (URHO_HEADERS MATCHES "(include/Urho3D/${SUB}[^;]+)")
+        list (FIND URHO_HEADERS ${CMAKE_MATCH_1} FOUND_INDEX)
+        if (FOUND_INDEX GREATER -1)
+            string (TOUPPER ${SUB} SUB)
+            list (INSERT URHO_HEADERS ${FOUND_INDEX} "#if URHO3D_${SUB}")
+        endif ()
+    endif ()
+endforeach ()
+string (REGEX REPLACE "include/[^;]+(DebugNew|Direct3D|ODBC|OpenGL|Precompiled|SQLite|ToluaUtils)[^;]+;" "" URHO_HEADERS "${URHO_HEADERS}")
+string (REGEX REPLACE "include/([^;]+)" "#include <\\1>" URHO_HEADERS "${GENERATED_HEADERS};;${URHO_HEADERS};")
+string (REPLACE ";" \n URHO_HEADERS "${URHO_HEADERS}")
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Urho3DAll.h.in ${CMAKE_CURRENT_BINARY_DIR}/Urho3DAll.h)
+install_header_files (FILES ${CMAKE_CURRENT_BINARY_DIR}/Urho3DAll.h ${CMAKE_CURRENT_BINARY_DIR}/librevision.h DESTINATION ${DEST_INCLUDE_DIR})
+
+# Generate platform specific pkg-config file for the benefit of Urho3D library users via SDK without CMake
+get_directory_property (URHO3D_COMPILE_DEFINITIONS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
+# Remove those defines that are only used for building the library and not needed by library user
+list (REMOVE_ITEM URHO3D_COMPILE_DEFINITIONS HAVE_STDINT_H GLEW_STATIC GLEW_NO_GLU HAVE_SINCOSF HAVE_UNDERSCORE_SINCOSF URHO3D_IS_BUILDING ODBC_3_OR_LATER ASSET_DIR_INDICATOR)
+if (ABSOLUTE_PATH_LIBS)
+    string (REPLACE ";" "\" \"" URHO3D_ABS_PATH_LIBS "\"${ABSOLUTE_PATH_LIBS}\"")   # Note: need to always "stringify" a variable in list context for replace to work correctly, besides the list could be empty
+    string (REPLACE "${SYSROOT}" "\${pc_sysrootdir}" URHO3D_ABS_PATH_LIBS "${URHO3D_ABS_PATH_LIBS}")
+endif ()
+if (MSVC)
+    set (DASH /)
+    set (LIB_DIR "/LIBPATH:\"\${libdir}\"")
+    string (REPLACE ";" ".lib\" \"" URHO3D_LIBS "\"@LIB_NAME@\" \"${LIBS}.lib\"")
+    set (PC_SUFFIX .msvc)
+else ()
+    set (LIB_NAME ${TARGET_NAME})
+    if (MINGW)
+        if (CMAKE_BUILD_TYPE STREQUAL Debug)
+            set (LIB_NAME ${LIB_NAME}_d)
+        endif ()
+        if (URHO3D_LIB_TYPE STREQUAL SHARED)
+            set (LIB_NAME ${LIB_NAME}.dll)
+        endif ()
+    endif ()
+    set (DASH -)
+    set (LIB_DIR "-L\"\${libdir}\"")
+    string (REPLACE ";" " -l" URHO3D_LIBS "-l${LIB_NAME};${LIBS}")
+endif ()
+string (REPLACE ";" " ${DASH}D" URHO3D_COMPILE_DEFINITIONS "${DASH}D${URHO3D_COMPILE_DEFINITIONS}")
+get_directory_property (GLOBAL_INCLUDE_DIRS DIRECTORY ${CMAKE_SOURCE_DIR} INCLUDE_DIRECTORIES)
+if (GLOBAL_INCLUDE_DIRS)
+    string (REPLACE ";" "\" ${DASH}I\"" GLOBAL_INCLUDE_DIRS "${DASH}I\"${GLOBAL_INCLUDE_DIRS}\"")
+    string (REPLACE "${SYSROOT}" "" GLOBAL_INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS})
+endif ()
+set (ENGINE_INCLUDE_DIRS "${DASH}I\"\${includedir}\" ${DASH}I\"\${includedir}/Urho3D/ThirdParty\"")
+if (URHO3D_PHYSICS)
+    # Bullet library depends on its own include dir to be added in the header search path
+    # This is more practical than patching its header files in many places to make them work with relative path
+    set (ENGINE_INCLUDE_DIRS "${ENGINE_INCLUDE_DIRS} ${DASH}I\"\${includedir}/Urho3D/ThirdParty/Bullet\"")
+endif ()
+if (URHO3D_LUA)
+    # ditto for Lua/LuaJIT
+    set (ENGINE_INCLUDE_DIRS "${ENGINE_INCLUDE_DIRS} ${DASH}I\"\${includedir}/Urho3D/ThirdParty/Lua${JIT}\"")
+endif ()
+# todo: Reevaluate the command below when the CMake minimum required version is set to 2.8.12 (and remove only when the deprecated add_compiler_export_flags() is not used anymore)
+# Remove compiler flags that are only used for building the library
+string (REGEX REPLACE " -fvisibility[^ ]+" "" CLEANED_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string (REGEX REPLACE " -include \"[^\"]+\"" "" CLEANED_CMAKE_CXX_FLAGS "${CLEANED_CMAKE_CXX_FLAGS}")
+string (REPLACE "${SYSROOT}" "\${pc_sysrootdir}" CLEANED_CMAKE_CXX_FLAGS "${CLEANED_CMAKE_CXX_FLAGS}")
+string (REPLACE "${SYSROOT}" "\${pc_sysrootdir}" CLEANED_CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Urho3D.pc.in ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.pc${PC_SUFFIX} @ONLY)
+if (MSVC)
+    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -DLIB_NAME=$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}> -P ${CMAKE_SOURCE_DIR}/CMake/Modules/AdjustPkgConfigForMSVC.cmake)
+endif ()
+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})
+
+# Define post build steps
+if (ANDROID_NDK_GDB)
+    # Copy the library while it still has debug symbols for ndk-gdb
+    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${TARGET_NAME}> ${NDK_GDB_SOLIB_PATH}
+        COMMENT "Copying Urho3D library with debug symbols to ${NDK_GDB_SOLIB_PATH} directory")
+endif ()
+if (URHO3D_LIB_TYPE STREQUAL SHARED AND (ANDROID OR ARM))
+    # Strip the output shared library for embedded devices
+    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${TARGET_NAME}>
+        COMMENT "Stripping Urho3D shared library")
+endif ()
+if (URHO3D_SCP_TO_TARGET)
+    # Ensure SCP is the last command
+    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${URHO3D_SCP_TO_TARGET} || exit 0
+        COMMENT "Scp-ing Urho3D library to target system")
+endif ()

+ 7 - 2
Source/Urho3D/Graphics/AnimationController.cpp

@@ -198,8 +198,13 @@ bool AnimationController::Play(const String& name, unsigned char layer, bool loo
 
 
 bool AnimationController::PlayExclusive(const String& name, unsigned char layer, bool looped, float fadeTime)
 bool AnimationController::PlayExclusive(const String& name, unsigned char layer, bool looped, float fadeTime)
 {
 {
-    FadeOthers(name, 0.0f, fadeTime);
-    return Play(name, layer, looped, fadeTime);
+    bool success = Play(name, layer, looped, fadeTime);
+    
+    // Fade other animations only if successfully started the new one
+    if (success)
+        FadeOthers(name, 0.0f, fadeTime);
+    
+    return success;
 }
 }
 
 
 bool AnimationController::Stop(const String& name, float fadeOutTime)
 bool AnimationController::Stop(const String& name, float fadeOutTime)

+ 2 - 1
Source/Urho3D/Graphics/IndexBuffer.cpp

@@ -43,7 +43,8 @@ IndexBuffer::IndexBuffer(Context* context, bool forceHeadless) :
     lockCount_(0),
     lockCount_(0),
     lockScratchData_(0),
     lockScratchData_(0),
     shadowed_(false),
     shadowed_(false),
-    dynamic_(false)
+    dynamic_(false),
+    discardLock_(false)
 {
 {
     // Force shadowing mode if graphics subsystem does not exist
     // Force shadowing mode if graphics subsystem does not exist
     if (!graphics_)
     if (!graphics_)

+ 2 - 0
Source/Urho3D/Graphics/IndexBuffer.h

@@ -113,6 +113,8 @@ private:
     bool dynamic_;
     bool dynamic_;
     /// Shadowed flag.
     /// Shadowed flag.
     bool shadowed_;
     bool shadowed_;
+    /// Discard lock flag. Used by OpenGL only.
+    bool discardLock_;
 };
 };
 
 
 }
 }

+ 3 - 2
Source/Urho3D/Graphics/OpenGL/OGLIndexBuffer.cpp

@@ -181,6 +181,7 @@ void* IndexBuffer::Lock(unsigned start, unsigned count, bool discard)
 
 
     lockStart_ = start;
     lockStart_ = start;
     lockCount_ = count;
     lockCount_ = count;
+    discardLock_ = discard;
 
 
     if (shadowData_)
     if (shadowData_)
     {
     {
@@ -202,12 +203,12 @@ void IndexBuffer::Unlock()
     switch (lockState_)
     switch (lockState_)
     {
     {
     case LOCK_SHADOW:
     case LOCK_SHADOW:
-        SetDataRange(shadowData_.Get() + lockStart_ * indexSize_, lockStart_, lockCount_);
+        SetDataRange(shadowData_.Get() + lockStart_ * indexSize_, lockStart_, lockCount_, discardLock_);
         lockState_ = LOCK_NONE;
         lockState_ = LOCK_NONE;
         break;
         break;
 
 
     case LOCK_SCRATCH:
     case LOCK_SCRATCH:
-        SetDataRange(lockScratchData_, lockStart_, lockCount_);
+        SetDataRange(lockScratchData_, lockStart_, lockCount_, discardLock_);
         if (graphics_)
         if (graphics_)
             graphics_->FreeScratchBuffer(lockScratchData_);
             graphics_->FreeScratchBuffer(lockScratchData_);
         lockScratchData_ = 0;
         lockScratchData_ = 0;

+ 4 - 1
Source/Urho3D/Graphics/OpenGL/OGLTexture.cpp

@@ -113,7 +113,10 @@ void Texture::UpdateParameters()
     switch (filterMode)
     switch (filterMode)
     {
     {
     case FILTER_NEAREST:
     case FILTER_NEAREST:
-        glTexParameteri(target_, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+        if (levels_ < 2)
+            glTexParameteri(target_, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+        else
+            glTexParameteri(target_, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
         glTexParameteri(target_, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
         glTexParameteri(target_, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
         break;
         break;
 
 

+ 3 - 2
Source/Urho3D/Graphics/OpenGL/OGLVertexBuffer.cpp

@@ -184,6 +184,7 @@ void* VertexBuffer::Lock(unsigned start, unsigned count, bool discard)
 
 
     lockStart_ = start;
     lockStart_ = start;
     lockCount_ = count;
     lockCount_ = count;
+    discardLock_ = discard;
 
 
     if (shadowData_)
     if (shadowData_)
     {
     {
@@ -205,12 +206,12 @@ void VertexBuffer::Unlock()
     switch (lockState_)
     switch (lockState_)
     {
     {
     case LOCK_SHADOW:
     case LOCK_SHADOW:
-        SetDataRange(shadowData_.Get() + lockStart_ * vertexSize_, lockStart_, lockCount_);
+        SetDataRange(shadowData_.Get() + lockStart_ * vertexSize_, lockStart_, lockCount_, discardLock_);
         lockState_ = LOCK_NONE;
         lockState_ = LOCK_NONE;
         break;
         break;
 
 
     case LOCK_SCRATCH:
     case LOCK_SCRATCH:
-        SetDataRange(lockScratchData_, lockStart_, lockCount_);
+        SetDataRange(lockScratchData_, lockStart_, lockCount_, discardLock_);
         if (graphics_)
         if (graphics_)
             graphics_->FreeScratchBuffer(lockScratchData_);
             graphics_->FreeScratchBuffer(lockScratchData_);
         lockScratchData_ = 0;
         lockScratchData_ = 0;

+ 2 - 1
Source/Urho3D/Graphics/VertexBuffer.cpp

@@ -43,7 +43,8 @@ VertexBuffer::VertexBuffer(Context* context, bool forceHeadless) :
     lockCount_(0),
     lockCount_(0),
     lockScratchData_(0),
     lockScratchData_(0),
     shadowed_(false),
     shadowed_(false),
-    dynamic_(false)
+    dynamic_(false),
+    discardLock_(false)
 {
 {
     UpdateOffsets();
     UpdateOffsets();
 
 

+ 2 - 0
Source/Urho3D/Graphics/VertexBuffer.h

@@ -165,6 +165,8 @@ private:
     bool dynamic_;
     bool dynamic_;
     /// Shadowed flag.
     /// Shadowed flag.
     bool shadowed_;
     bool shadowed_;
+    /// Discard lock flag. Used by OpenGL only.
+    bool discardLock_;
 };
 };
 
 
 }
 }