Browse Source

Refactor build scripts to group Urho3D specific build option.
Initial support of project configuration and generation via cmake-gui.

Yao Wei Tjong 姚伟忠 11 years ago
parent
commit
46285baf97
93 changed files with 430 additions and 344 deletions
  1. 5 5
      .travis.yml
  2. 9 9
      Docs/CMakeLists.txt
  3. 55 29
      Docs/GettingStarted.dox
  4. 1 1
      Docs/Reference.dox
  5. 12 12
      Rakefile
  6. 98 48
      Readme.txt
  7. 9 9
      Source/CMake/Modules/FindUrho3D.cmake
  8. 41 64
      Source/CMake/Modules/Urho3D-CMake-common.cmake
  9. 50 8
      Source/CMakeLists.txt
  10. 3 3
      Source/Engine/CMakeLists.txt
  11. 1 1
      Source/Engine/Core/Main.h
  12. 1 1
      Source/Engine/Core/MiniDump.cpp
  13. 1 1
      Source/Engine/Core/MiniDump.h
  14. 2 2
      Source/Engine/Core/ProcessUtils.cpp
  15. 1 1
      Source/Engine/Core/Profiler.h
  16. 1 1
      Source/Engine/Engine/DebugHud.cpp
  17. 8 8
      Source/Engine/Engine/Engine.cpp
  18. 1 1
      Source/Engine/Engine/Engine.h
  19. 6 6
      Source/Engine/Graphics/Batch.cpp
  20. 3 3
      Source/Engine/Graphics/CMakeLists.txt
  21. 1 1
      Source/Engine/Graphics/Camera.cpp
  22. 2 2
      Source/Engine/Graphics/Direct3D9/D3D9Graphics.cpp
  23. 1 1
      Source/Engine/Graphics/GPUObject.h
  24. 1 1
      Source/Engine/Graphics/Graphics.h
  25. 1 1
      Source/Engine/Graphics/GraphicsImpl.h
  26. 1 1
      Source/Engine/Graphics/IndexBuffer.h
  27. 1 1
      Source/Engine/Graphics/OpenGL/OGLGraphics.cpp
  28. 1 1
      Source/Engine/Graphics/RenderSurface.h
  29. 5 5
      Source/Engine/Graphics/Renderer.cpp
  30. 1 1
      Source/Engine/Graphics/Shader.cpp
  31. 1 1
      Source/Engine/Graphics/ShaderProgram.h
  32. 1 1
      Source/Engine/Graphics/ShaderVariation.h
  33. 1 1
      Source/Engine/Graphics/Texture.h
  34. 1 1
      Source/Engine/Graphics/Texture2D.h
  35. 1 1
      Source/Engine/Graphics/Texture3D.h
  36. 1 1
      Source/Engine/Graphics/TextureCube.h
  37. 1 1
      Source/Engine/Graphics/VertexBuffer.h
  38. 1 1
      Source/Engine/Graphics/VertexDeclaration.h
  39. 13 13
      Source/Engine/Graphics/View.cpp
  40. 4 4
      Source/Engine/IO/FileWatcher.cpp
  41. 1 1
      Source/Engine/IO/Log.h
  42. 1 1
      Source/Engine/Input/CMakeLists.txt
  43. 1 1
      Source/Engine/LuaScript/CMakeLists.txt
  44. 1 1
      Source/Engine/Network/Connection.cpp
  45. 2 2
      Source/Engine/Physics/PhysicsWorld.cpp
  46. 1 1
      Source/Engine/Script/IOAPI.cpp
  47. 1 1
      Source/Engine/Script/Script.cpp
  48. 2 2
      Source/Engine/Script/Script.h
  49. 1 1
      Source/Engine/UI/UIBatch.cpp
  50. 1 1
      Source/Extras/Readme.txt
  51. 1 1
      Source/Samples/01_HelloWorld/CMakeLists.txt
  52. 1 1
      Source/Samples/02_HelloGUI/CMakeLists.txt
  53. 1 1
      Source/Samples/03_Sprites/CMakeLists.txt
  54. 1 1
      Source/Samples/04_StaticScene/CMakeLists.txt
  55. 1 1
      Source/Samples/05_AnimatingScene/CMakeLists.txt
  56. 1 1
      Source/Samples/06_SkeletalAnimation/CMakeLists.txt
  57. 1 1
      Source/Samples/07_Billboards/CMakeLists.txt
  58. 1 1
      Source/Samples/08_Decals/CMakeLists.txt
  59. 1 1
      Source/Samples/09_MultipleViewports/CMakeLists.txt
  60. 1 1
      Source/Samples/10_RenderToTexture/CMakeLists.txt
  61. 1 1
      Source/Samples/11_Physics/CMakeLists.txt
  62. 1 1
      Source/Samples/12_PhysicsStressTest/CMakeLists.txt
  63. 1 1
      Source/Samples/13_Ragdolls/CMakeLists.txt
  64. 1 1
      Source/Samples/14_SoundEffects/CMakeLists.txt
  65. 1 1
      Source/Samples/15_Navigation/CMakeLists.txt
  66. 1 1
      Source/Samples/16_Chat/CMakeLists.txt
  67. 1 1
      Source/Samples/17_SceneReplication/CMakeLists.txt
  68. 1 1
      Source/Samples/18_CharacterDemo/CMakeLists.txt
  69. 1 1
      Source/Samples/19_VehicleDemo/CMakeLists.txt
  70. 1 1
      Source/Samples/20_HugeObjectCount/CMakeLists.txt
  71. 1 1
      Source/Samples/21_AngelScriptIntegration/CMakeLists.txt
  72. 1 1
      Source/Samples/22_LuaIntegration/CMakeLists.txt
  73. 1 1
      Source/Samples/23_Water/CMakeLists.txt
  74. 1 1
      Source/Samples/24_Urho2DSprite/CMakeLists.txt
  75. 1 1
      Source/Samples/25_Urho2DParticle/CMakeLists.txt
  76. 1 1
      Source/Samples/26_ConsoleInput/CMakeLists.txt
  77. 1 1
      Source/Samples/27_Urho2DPhysics/CMakeLists.txt
  78. 1 1
      Source/Samples/28_Urho2DPhysicsRope/CMakeLists.txt
  79. 1 1
      Source/Samples/29_SoundSynthesis/CMakeLists.txt
  80. 2 2
      Source/Samples/CMakeLists.txt
  81. 1 1
      Source/ThirdParty/AngelScript/CMakeLists.txt
  82. 2 2
      Source/ThirdParty/Bullet/src/LinearMath/btScalar.h
  83. 1 1
      Source/ThirdParty/LibCpuId/CMakeLists.txt
  84. 1 1
      Source/ThirdParty/Lua/CMakeLists.txt
  85. 5 5
      Source/ThirdParty/LuaJIT/CMakeLists.txt
  86. 2 2
      Source/ThirdParty/LuaJIT/DetectTargetArchitecture.cmake
  87. 1 1
      Source/ThirdParty/toluapp/src/bin/CMakeLists.txt
  88. 3 12
      Source/Tools/CMakeLists.txt
  89. 6 6
      Source/Tools/Urho3DPlayer/CMakeLists.txt
  90. 10 10
      Source/Tools/Urho3DPlayer/Urho3DPlayer.cpp
  91. 1 1
      Source/Tools/Urho3DPlayer/Urho3DPlayer.h
  92. 3 3
      cmake_android.bat
  93. 3 3
      cmake_vs2008.bat

+ 5 - 5
.travis.yml

@@ -26,10 +26,10 @@ env:
     - secure: AfoHc5tpnYoI2TVGUeE9Xdru+15pd5N4YzO7EWvwmMnrHtNO3retrmKOGpnIyfbP2BeWRTW/z+BI4G0RrfvubjHu2us4wRh6Jq8+UZohBBkM+ldTnyqYHX97q+6ScWBWZGg7dpthd1x/7fmds8dSRzustHUhI7RzPbWEMQH1DGI=
     - DISPLAY=:99.0
   matrix:
-    - LINUX=1               ENABLE_64BIT=1 URHO3D_LIB_TYPE=STATIC SITE_UPDATE=1
-    - LINUX=1               ENABLE_64BIT=1 URHO3D_LIB_TYPE=SHARED
-    - WINDOWS=1 ARCH=x86_64 ENABLE_64BIT=1 URHO3D_LIB_TYPE=STATIC
-    - WINDOWS=1 ARCH=x86_64 ENABLE_64BIT=1 URHO3D_LIB_TYPE=SHARED
+    - LINUX=1               URHO3D_64BIT=1 URHO3D_LIB_TYPE=STATIC SITE_UPDATE=1
+    - LINUX=1               URHO3D_64BIT=1 URHO3D_LIB_TYPE=SHARED
+    - WINDOWS=1 ARCH=x86_64 URHO3D_64BIT=1 URHO3D_LIB_TYPE=STATIC
+    - WINDOWS=1 ARCH=x86_64 URHO3D_64BIT=1 URHO3D_LIB_TYPE=SHARED
     - LINUX=1                              URHO3D_LIB_TYPE=STATIC
     - LINUX=1                              URHO3D_LIB_TYPE=SHARED
     - WINDOWS=1 ARCH=i686                  URHO3D_LIB_TYPE=STATIC
@@ -55,7 +55,7 @@ before_install:
     - sudo apt-get update -q -y
 install:
     - sudo apt-get install -q -y --no-install-recommends libasound2-dev
-    - bash -c "[ x$ENABLE_64BIT == 'x' ]" && sudo apt-get remove -q -y gvfs-daemons && sudo apt-get install -q -y libxrandr-dev:i386 libgl1-mesa-dev:i386 libxext-dev:i386 libxrender-dev:i386 g++-multilib && export CMAKE_PREFIX_PATH=/usr/lib/i386-linux-gnu || true
+    - bash -c "[ x$URHO3D_64BIT == 'x' ]" && sudo apt-get remove -q -y gvfs-daemons && sudo apt-get install -q -y libxrandr-dev:i386 libgl1-mesa-dev:i386 libxext-dev:i386 libxrender-dev:i386 g++-multilib && export CMAKE_PREFIX_PATH=/usr/lib/i386-linux-gnu || true
     - bash -c "( [ $SITE_UPDATE_ON_MASTER_COMMIT ] || [ $PACKAGE_UPLOAD ] )" && sudo apt-get install -q -y --no-install-recommends doxygen graphviz || true
     - bash -c "[ $WINDOWS ]" && sudo apt-get install -q -y gcc-mingw-w64 gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 g++-mingw-w64 g++-mingw-w64-i686 g++-mingw-w64-x86-64 binutils-mingw-w64 binutils-mingw-w64-i686 binutils-mingw-w64-x86-64 && export MINGW_PREFIX=/usr/bin/${ARCH}-w64-mingw32 || true
     - bash -c "( [ $LINUX ] || [ $RPI ] ) && [ $PACKAGE_UPLOAD ]" && sudo apt-get install -q -y rpm || true

+ 9 - 9
Docs/CMakeLists.txt

@@ -40,9 +40,9 @@ find_package (Doxygen QUIET)
 
 if (DOXYGEN_FOUND)
     # Generate platform specific Doxyfile automatically
-    if (NOT USE_OPENGL EQUAL DOXYFILE_USE_OPENGL OR ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in IS_NEWER_THAN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
-        set (DOXYFILE_USE_OPENGL ${USE_OPENGL} CACHE INTERNAL "USE_OPENGL flag when Doxyfile was last generated")
-        if (USE_OPENGL)
+    if (NOT URHO3D_OPENGL EQUAL DOXYFILE_URHO3D_OPENGL OR ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in IS_NEWER_THAN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
+        set (DOXYFILE_URHO3D_OPENGL ${URHO3D_OPENGL} CACHE INTERNAL "URHO3D_OPENGL flag when Doxyfile was last generated")
+        if (URHO3D_OPENGL)
             set (EXCLUDE_GRAPHICS_API Direct3D9)
         else ()
             set (EXCLUDE_GRAPHICS_API OpenGL)
@@ -83,16 +83,16 @@ if (DOXYGEN_FOUND)
         add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox COMMAND echo dummy >${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox)
     endif ()
 
-    # If ENABLE_DOCS build option is set then add the custom 'doc' target into the default 'all' target, i.e. a normal build would not only build the software but also the documentation
-    if (ENABLE_DOCS_QUIET)
-        set (ENABLE_DOCS 1)
+    # If URHO3D_DOCS build option is set then add the custom 'doc' target into the default 'all' target, i.e. a normal build would not only build the software but also the documentation
+    if (URHO3D_DOCS_QUIET)
+        set (URHO3D_DOCS 1)
         if (CMAKE_HOST_WIN32)
             set (REDIRECT_STDOUT 1>nul)     # In quiet mode, redirect standard output stream of Doxygen to a null device
         else ()
             set (REDIRECT_STDOUT 1>/dev/null)
         endif ()
     endif ()
-    if (ENABLE_DOCS)
+    if (URHO3D_DOCS)
         set (ALL ALL)
     endif ()
 
@@ -105,8 +105,8 @@ if (DOXYGEN_FOUND)
 endif ()
 
 # Make sure html output directory exists and not empty
-file (WRITE ${CMAKE_CURRENT_SOURCE_DIR}/html/Readme.txt "If ENABLE_DOCS build option is not set then use 'make doc' command or an equivalent command in IDE to re-generate Urho3D documentation before calling 'make install' or its equivalent.")
+file (WRITE ${CMAKE_CURRENT_SOURCE_DIR}/html/Readme.txt "If URHO3D_DOCS build option is not set then use 'make doc' command or an equivalent command in IDE to re-generate Urho3D documentation before calling 'make install' or its equivalent.")
     
 # Currently it is not possible to make built-in 'install' target to depend on 'doc' in CMake, therefore 'make doc' command need to be invoked manually before 'make install' in order to install the SDK with complete documentation
-# Unless, ENABLE_DOCS build option is set in which case the custom 'doc' target is part of the default 'all' target which in turn the 'install' target depends on, so a single 'make install' alone is suffice to install everything 
+# Unless, URHO3D_DOCS build option is set in which case the custom 'doc' target is part of the default 'all' target which in turn the 'install' target depends on, so a single 'make install' alone is suffice to install everything 
 install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/html/ DESTINATION ${DEST_SHARE_DIR}/Docs USE_SOURCE_PERMISSIONS)

+ 55 - 29
Docs/GettingStarted.dox

@@ -45,7 +45,7 @@ For Eclipse, import the Eclipse's project generated by CMake into the workspace
 For GCC, execute make in the Build directory (by default, cmake_gcc.sh specifies to make a Release build).\n
 For Xcode, open Urho3D.xcodeproj and build.
 
-If using MinGW to compile, DirectX headers may need to be acquired separately. They can be copied to the MinGW installation eg. from the following package: http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz These will be missing some of the headers related to shader compilation, so a MinGW build will use OpenGL by default. To build in Direct3D9 mode, the MinGW-w64 port is necessary: http://mingw-w64.sourceforge.net/ Using it, Direct3D9 can be enabled with the CMake option -DUSE_OPENGL=0.
+If using MinGW to compile, DirectX headers may need to be acquired separately. They can be copied to the MinGW installation eg. from the following package: http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz These will be missing some of the headers related to shader compilation, so a MinGW build will use OpenGL by default. To build in Direct3D9 mode, the MinGW-w64 port is necessary: http://mingw-w64.sourceforge.net/ Using it, Direct3D9 can be enabled with the CMake option -DURHO3D_OPENGL=0.
 
 After the build is complete, the programs can be run from the Bin directory. These include the Urho3D player application, which can run application scripts, the tools, and C++ sample applications if they have been enabled.
 
@@ -63,7 +63,7 @@ First, if you are building under Windows platform without MKLINK support then co
 
 Set the ANDROID_NDK environment variable to point to your Android NDK. On Windows, ensure that make.exe from the Android NDK is included in the path and is executable from the command line.
 
-On Windows, execute cmake_android.bat. If MKLINK support is available, provide build option "-DUSE_MKLINK=1" to generate out-of-source build. Then go to the build directory Source/Android (or android-Build if out-of-source build) and execute the following commands. On OS X or Linux, execute cmake_gcc.sh (the ANDROID_NDK environment variable distinguishes from a normal desktop build) then go to the android-Build directory (always an out-of-source build) and execute the following commands.
+On Windows, execute cmake_android.bat. If MKLINK support is available, provide build option "-DURHO3D_MKLINK=1" to generate out-of-source build. Then go to the build directory Source/Android (or android-Build if out-of-source build) and execute the following commands. On OS X or Linux, execute cmake_gcc.sh (the ANDROID_NDK environment variable distinguishes from a normal desktop build) then go to the android-Build directory (always an out-of-source build) and execute the following commands.
 
 - android update project -p . -t 1 (only needed on the first time,
                                     replace '-t 1' with desired target-id)
@@ -95,11 +95,12 @@ To run from Xcode on iPhone/iPad Simulator, edit the Product Scheme to set "Run"
 
 For native build on Raspberry Pi itself, use the similar process for Linux Desktop build described above.
 
-For cross-compiling build on another build/host machine, firstly set the RASPI_TOOL environment variable to point to your Raspberry Pi Cross-Compiling tool where all the arm-linux-gnueabihf-* executables are located. You can setup the tool using <a href="http://crosstool-ng.org/">crosstool-NG</a> or just download one from https://github.com/raspberrypi/tools. Secondly, set the RASPI_ROOT environment variable to point to your Raspbian or Pidora system root. You must install the Urho3D prerequisites software development packages for Raspberry Pi (see \ref Building_Prerequisites) in the system root before attempting to do the Urho3D cross-compiling build.
+For cross-compiling build on another build/host machine, firstly set the RASPI_TOOL environment variable to point to your Raspberry Pi Cross-Compiling tool where all the arm-linux-gnueabihf-* executables are located. You can setup the tool using <a href="http://crosstool-ng.org/">crosstool-NG</a> or just download one from https://github.com/raspberrypi/tools. Secondly, set the RASPI_ROOT environment variable to point to your Raspbian or Pidora system root. You must install the Urho3D prerequisites software development packages for Raspberry Pi (see \ref Building_Prerequisites) in the system root before attempting to do the Urho3D cross-compiling build. You can download a Raspbian system root from
+https://github.com/urho3d/rpi-sysroot.
 
 When running cmake_gcc.sh with RASPI_TOOL environment variable set, it tells build script to generate additional raspi-Build directory for cross-compiling. Go to this raspi-Build directory and proceed to execute make. After the build is complete, the ARM executables can be found in Bin-CC output directory.
 
-You can also build, deploy, run/debug (as C/C++ Remote %Application) using Eclipse IDE, if you run cmake_eclipse.sh to generate the project file. Import the CMake generated Eclipse project in the raspi-Build directory into Eclipse's workspace. Build the project as usual. Use the SCP_TO_TARGET build option to automatically deploy the ARM executables to target Raspberry Pi as part of every project build or configure Eclipse to perform a "download to target path" in the Run/Debug configuration for C/C++ Remote %Application. Either way, you have to configure the Run/Debug configuration how to reach your target Raspberry Pi.
+You can also build, deploy, run/debug (as C/C++ Remote %Application) using Eclipse IDE, if you run cmake_eclipse.sh to generate the project file. Import the CMake generated Eclipse project in the raspi-Build directory into Eclipse's workspace. Build the project as usual. Use the URHO3D_SCP_TO_TARGET build option to automatically deploy the ARM executables to target Raspberry Pi as part of every project build or configure Eclipse to perform a "download to target path" in the Run/Debug configuration for C/C++ Remote %Application. Either way, you have to configure the Run/Debug configuration how to reach your target Raspberry Pi.
 
 \section Building_MinGW MinGW cross-compile build process
 
@@ -113,7 +114,7 @@ Running cmake_gcc.sh with the MINGW_PREFIX environment variable set, produces an
 
 \section Building_64bit Desktop 64bit build
 
-Currently CMake build configuration has been set to compile Urho3D as 32bit by default. To enable 64bit build, run the provided cmake_xxxx.bat or cmake_xxxx.sh by passing the option "-DENABLE_64BIT=1" explicitly. For Visual Studio on Windows platform, this option also overrides CMake to use a 64bit solution generator.
+Currently CMake build configuration has been set to compile Urho3D as 32bit by default. To enable 64bit build, run the provided cmake_xxxx.bat or cmake_xxxx.sh by passing the option "-DURHO3D_64BIT=1" explicitly. For Visual Studio on Windows platform, this option also overrides CMake to use a 64bit solution generator.
 
 \section Building_Library Library build
 
@@ -125,7 +126,7 @@ Refer to \ref UsingLibrary "Using Urho3D as external library" on how to setup yo
 
 \section Building_Docs Documentation build
 
-If ENABLE_DOCS build option is set then a normal (ALL) build would not only build Urho3D software but also Urho3D documentation automatically. If it is not then the documentation can be generated by manually invoking 'make doc' command or its equivalent command in IDE.
+If URHO3D_DOCS build option is set then a normal (ALL) build would not only build Urho3D software but also Urho3D documentation automatically. If it is not then the documentation can be generated by manually invoking 'make doc' command or its equivalent command in IDE.
 
 The prerequisites are Doxygen and Graphviz. Tools to dump the \ref ScriptAPI "AngelScript API" for the default \ref Script "scripting" subsystem and the \ref LuaScriptAPI "LuaScript API" (when the LuaScript subsystem is also enabled) will be built internally when all the tools are being built.
 
@@ -138,31 +139,56 @@ Note that you can also force an OpenGL mode build on Windows by using the CMake
 \section Build_Options Build options
 
 A number of build options can be defined explicitly when invoking the above cmake_xxxx batch files or shell scripts.\n
-|Defines               |Build Options|
-|----------------------|---------------------|
-|-DENABLE_64BIT=1      |to enable 64bit build|
-|-DENABLE_LUA=1        |to enable additional Lua scripting support|
-|-DENABLE_LUAJIT=1     |to enable Lua Just-in-time compilation, implied ENABLE_LUA (check its CMakeLists.txt for more options)|
-|-DENABLE_SAFE_LUA=1   |to enable Lua C++ wrapper safety checks|
-|-DENABLE_SAMPLES=1    |to build the C++ sample applications|
-|-DENABLE_TOOLS=1      |to build the tools (only useful for Raspberry Pi build because this option is already enabled by default for other Desktop platforms)|
-|-DENABLE_DOCS=1       |to build the docs when building all the targets|
-|-DENABLE_ANGELSCRIPT=0|to disable AngelScript scripting support|
-|-DENABLE_SSE=0        |to disable SSE instruction set|
-|-DENABLE_MINIDUMPS=0  |to disable minidumps on crash (VS only)|
-|-DENABLE_FILEWATCHER=0|to disable filewatcher support|
-|-DENABLE_PROFILING=0  |to disable profiling support|
-|-DENABLE_LOGGING=0    |to disable logging support|
-|-DUSE_OPENGL=1        |to use OpenGL instead of Direct3D (only useful for VS on Windows platform because this option is enabled by default for other platforms)|
-|-DUSE_MKLINK=1        |to use mklink command to create symbolic links (Windows Vista and above only)|
-|-DUSE_STATIC_RUNTIME=1|to use static C/C++ runtime libraries and eliminate the need for runtime DLLs installation (VS only)|
-|-DSCP_TO_TARGET=<v>   |to automatically scp 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|
-|-DCMAKE_BUILD_TYPE=<v>|to tell CMake which build configuration to be generated (Makefile generator only), possible values are Release (default), Debug, and RelWithDebInfo|
-|-DURHO3D_LIB_TYPE=<v> |to specify Urho3D library type, possible values are STATIC (default) and SHARED|
-|-DANDROID_ABI=<v>     |to specify ABI for native code (Android build only), possible values are armeabi-v7a (default) and armeabi|
+|Defines              |V|Build Options|
+|---------------------|-|---------------------|
+|URHO3D_64BIT         |0|Enable 64bit build|
+|URHO3D_ANGELSCRIPT   |1|Enable AngelScript scripting support|
+|URHO3D_LUA           |0|Enable Lua scripting support|
+|URHO3D_LUAJIT        |0|Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)|
+|URHO3D_LUAJIT_AMALG  |0|Enable LuaJIT amalgamated build (LuaJIT only)|
+|URHO3D_SAFE_LUA      |0|Enable Lua C++ wrapper safety checks (when Lua scripting support is enabled only)|
+|URHO3D_SAMPLES       |0|Build sample applications|
+|URHO3D_TOOLS         |1|Build standalone tools (Desktop and RPI only; on Android only build Lua standalone tools)|
+|URHO3D_EXTRAS        |0|Build extras (Desktop and RPI only)|
+|URHO3D_DOCS[_QUIET]  |0|Generate documentation as part of normal build (the 'doc' builtin target can be used to generate documentation regardless of this option's value)|
+|URHO3D_SSE           |1|Enable SSE instruction set|
+|URHO3D_MINIDUMPS     |1|Enable minidumps on crash (VS only)|
+|URHO3D_FILEWATCHER   |1|Enable filewatcher support|
+|URHO3D_PROFILING     |1|Enable profiling support|
+|URHO3D_LOGGING       |1|Enable logging support|
+|URHO3D_TESTING       |0|Enable testing support|
+|URHO3D_TEST_TIME_OUT |5|Number of seconds to test run the executables (when testing support is enabled only)|
+|URHO3D_OPENGL        |0|Use OpenGL instead of Direct3D (Windows platform only)|
+|URHO3D_MKLINK        |0|Use mklink command to create symbolic links (Windows Vista and above only)|
+|URHO3D_STATIC_RUNTIME|0|Use static C/C++ runtime libraries and eliminate the need for runtime DLLs installation (VS only)|
+|URHO3D_LIB_TYPE      |*|Specify Urho3D library type, possible values are STATIC (\*default) and SHARED|
+|URHO3D_SCP_TO_TARGET |-|Use scp to transfer executables to target system (non-Android cross-compiling build only), SSH digital key must be setup first for this to work, typical value has a pattern of usr@tgt:remote-loc|
+|CMAKE_BUILD_TYPE     |*|Specify CMake build configuration to be generated (Makefile generator only), possible values are Release (\*default), Debug, and RelWithDebInfo|
+|ANDROID_ABI          |*|Specify target ABI (Android build only), possible values are armeabi-v7a (\*default) and armeabi|
 
 Note that build option values specified via command line are cached by CMake. The cached values will be used by CMake in the subsequent invocation. That is, the same build options are not required to be specified again and again. Once a non-default build option value is being cached, it can only be reverted back to its default value by explicitly setting it via command line. That is, simply by NOT passing the corresponding build option would not work. One way to revert all the build options to their default values is by clearing the CMake cache by calling cmake_clean.bat or cmake_clean.sh.
 
+\section Using_CMake_GUI Using cmake-gui to configure and generate Urho3D project file
+
+Instead of using one of the provided batch files or shell scripts, you can use cmake-gui to configure and generate Urho3D project file. However, you have to adhere to the current limitations:
+- The build directory must be located inside the Urho3D project root directory and sibling of the "Source" directory.\n
+- The build directory must be named accordingly based on the target platform.\n
+    - On desktop/native platform: Build\n
+    - On Windows platform using MinGW: mingw-Build\n
+    - On iOS platform: ios-Build\n
+    - On Android platform: android-Build\n
+    - On Raspberry Pi platform: raspi-Build\n
+- The runtime and archive output directories are automatically set based on the target platform regardless of the build directory name (should you choose not to adhere with the above). For example on Android platform, they will be android-Bin and android-Lib, respectively.\n
+If you choose not to adhere with this build directory naming convention then you will have to install the Urho3D library into your local filesystem in order to use the Urho3D library in your external project (See http://urho3d.github.io/documentation/a00004.html#UsingLibraryFromSDK).
+- All the post-CMake workaround and/or bug fixes that are scripted in the batch files or shell scripts are not applied to the generated project file.
+
+Steps to configure:
+-# In the Urho3D project root directory, invoke "cmake-gui Source".
+-# Set the build directory name.
+-# Configure and update the build options as many times as necessary until there are no more new options in red. For the first configuration, choose the generator you like to use. Click the Group check box to group the build options.
+    - In the Ungrouped Entries: only check one of these options (ANDROID, IOS, RASPI) when you target the platform, leave them unchecked for dekstop/native build.
+    - In the URHO3D group: check any of the options you desire. Some of the options when checked may cause new options to be made available in the subsequent configuration loop.
+-# Generate when all the configurations are done.
 
 \page Running Running Urho3D player application
 
@@ -273,7 +299,7 @@ The sample applications start from the very simple (a "Hello World" program) and
 
 The AngelScript and Lua versions reside in the Bin/Data/Scripts and Bin/Data/LuaScripts directories. %Batch files to run each of them are not provided due to their large amount: instead run the player application with the script file name as the parameter, for example Urho3DPlayer Scripts/01_HelloWorld.as
 
-The C++ versions need to be explicitly enabled in the build with the CMake option -DENABLE_SAMPLES=1. When enabled, the executables will be produced into the Bin directory and can be run from there. Their source code is in the Source/Samples directory.
+The C++ versions need to be explicitly enabled in the build with the CMake option -DURHO3D_SAMPLES=1. When enabled, the executables will be produced into the Bin directory and can be run from there. Their source code is in the Source/Samples directory.
 
 The samples provide the following common key controls:
 

+ 1 - 1
Docs/Reference.dox

@@ -557,7 +557,7 @@ In unmodified AngelScript, this would have to be written as:
 \page LuaScripting Lua scripting
 
 Lua scripting in Urho3D has its dedicated LuaScript subsystem that must be instantiated before the scripting capabilities can be used. Lua support is not compiled in by default but must be enabled by the CMake
-build option -DENABLE_LUA=1. For more details see \ref Build_Options "Build options". Instantiating the subsystem is done like this:
+build option -DURHO3D_LUA=1. For more details see \ref Build_Options "Build options". Instantiating the subsystem is done like this:
 
 \code
 context_->RegisterSubsystem(new LuaScript(context_));

+ 12 - 12
Rakefile

@@ -41,7 +41,7 @@ task :scaffolding do
   puts "\nNew project created in #{abs_path}\n\n"
   puts "To build the new project, you may need to first define and export either 'URHO3D_HOME' or 'URHO3D_INSTALL_PREFIX' environment variable"
   puts "Please see http://urho3d.github.io/documentation/a00004.html for more detail. For example:\n\n"
-  puts "$ URHO3D_HOME=#{Dir.pwd}; export URHO3D_HOME\n$ cd #{abs_path}\n$ ./cmake_gcc.sh -DENABLE_64BIT=1 -DENABLE_LUAJIT=1\n$ cd Build\n$ make\n\n"
+  puts "$ URHO3D_HOME=#{Dir.pwd}; export URHO3D_HOME\n$ cd #{abs_path}\n$ ./cmake_gcc.sh -DURHO3D_64BIT=1 -DURHO3D_LUAJIT=1\n$ cd Build\n$ make\n\n"
 end
 
 # Usage: NOT intended to be used manually (if you insist then try: rake travis_ci)
@@ -205,8 +205,8 @@ define_source_files ()
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ExternalLibAS COMMAND \\${TARGET_NAME} Data/Scripts/12_PhysicsStressTest.as -w -timeout \\${TEST_TIME_OUT})
-add_test (NAME ExternalLibLua COMMAND \\${TARGET_NAME} Data/LuaScripts/12_PhysicsStressTest.lua -w -timeout \\${TEST_TIME_OUT})
+add_test (NAME ExternalLibAS COMMAND \\${TARGET_NAME} Data/Scripts/12_PhysicsStressTest.as -w -timeout \\${URHO3D_TEST_TIME_OUT})
+add_test (NAME ExternalLibLua COMMAND \\${TARGET_NAME} Data/LuaScripts/12_PhysicsStressTest.lua -w -timeout \\${URHO3D_TEST_TIME_OUT})
 EOF" or abort 'Failed to create new project using Urho3D as external library'
 end
 
@@ -216,14 +216,14 @@ def makefile_travis_ci
     jit = ''
     amalg = ''
     # Lua on MinGW build requires tolua++ tool to be built natively first
-    system 'MINGW_PREFIX= ./cmake_gcc.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA=1 -DENABLE_TOOLS=0' or abort 'Failed to configure native build for tolua++ target'
+    system 'MINGW_PREFIX= ./cmake_gcc.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE -DURHO3D_64BIT=$URHO3D_64BIT -DURHO3D_LUA=1 -DURHO3D_TOOLS=0' or abort 'Failed to configure native build for tolua++ target'
     system 'cd Build/ThirdParty/toluapp/src/bin && make' or abort 'Failed to build tolua++ tool'
     ENV['SKIP_NATIVE'] = '1'
   else
     jit = 'JIT'
-    amalg = '-DENABLE_LUAJIT_AMALG=1'
+    amalg = '-DURHO3D_LUAJIT_AMALG=1'
   end
-  system "./cmake_gcc.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA#{jit}=1 #{amalg} -DENABLE_SAMPLES=1 -DENABLE_TOOLS=1 -DENABLE_EXTRAS=1 -DENABLE_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration}" or abort 'Failed to configure Urho3D library build'
+  system "./cmake_gcc.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE -DURHO3D_64BIT=$URHO3D_64BIT -DURHO3D_LUA#{jit}=1 #{amalg} -DURHO3D_SAMPLES=1 -DURHO3D_TOOLS=1 -DURHO3D_EXTRAS=1 -DURHO3D_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration}" or abort 'Failed to configure Urho3D library build'
   if ENV['ANDROID']
     # LuaJIT on Android build requires tolua++ and buildvm-android tools to be built natively first
     system 'cd Build/ThirdParty/toluapp/src/bin && make' or abort 'Failed to build tolua++ tool'
@@ -246,7 +246,7 @@ def makefile_travis_ci
     platform_prefix = ''
   end
   # Only 64-bit Linux environment with virtual framebuffer X server support and not MinGW build; or OSX build environment are capable to run tests
-  if $testing == 1 and (ENV['ENABLE_64BIT'] and ENV['WINDOWS'].to_i != 1 or ENV['OSX'])
+  if $testing == 1 and (ENV['URHO3D_64BIT'] and ENV['WINDOWS'].to_i != 1 or ENV['OSX'])
     test = '&& make test'
   else
     test = ''
@@ -254,7 +254,7 @@ def makefile_travis_ci
   system "cd #{platform_prefix}Build && make #{test}" or abort 'Failed to build or test Urho3D library'
   # Create a new project on the fly that uses newly built Urho3D library
   scaffolding "#{platform_prefix}Build/generated/externallib"
-  system "URHO3D_HOME=`pwd`; export URHO3D_HOME && cd #{platform_prefix}Build/generated/externallib && echo '\nUsing Urho3D as external library in external project' && ./cmake_gcc.sh -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA#{jit}=1 -DENABLE_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration} && cd #{platform_prefix}Build && make #{test}" or abort 'Failed to configure/build/test temporary project using Urho3D as external library' 
+  system "URHO3D_HOME=`pwd`; export URHO3D_HOME && cd #{platform_prefix}Build/generated/externallib && echo '\nUsing Urho3D as external library in external project' && ./cmake_gcc.sh -DURHO3D_64BIT=$URHO3D_64BIT -DURHO3D_LUA#{jit}=1 -DURHO3D_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration} && cd #{platform_prefix}Build && make #{test}" or abort 'Failed to configure/build/test temporary project using Urho3D as external library' 
 end
 
 def xcode_travis_ci
@@ -264,18 +264,18 @@ def xcode_travis_ci
     amalg = ''
     platform_prefix = 'ios-'
     # Lua on IOS build requires tolua++ tool to be built natively first
-    system "./cmake_macosx.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA=1 -DENABLE_TOOLS=0" or abort 'Failed to configure native build for tolua++ target'
+    system "./cmake_macosx.sh -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE -DURHO3D_64BIT=$URHO3D_64BIT -DURHO3D_LUA=1 -DURHO3D_TOOLS=0" or abort 'Failed to configure native build for tolua++ target'
     xcode_build(0, 'Build/Urho3D.xcodeproj', 'tolua++') or abort 'Failed to build tolua++ tool'
   else
     jit = 'JIT'
-    amalg = '-DENABLE_LUAJIT_AMALG=1'
+    amalg = '-DURHO3D_LUAJIT_AMALG=1'
     platform_prefix = ''
   end
-  system "./cmake_macosx.sh -DIOS=$IOS -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA#{jit}=1 #{amalg} -DENABLE_SAMPLES=1 -DENABLE_TOOLS=1 -DENABLE_EXTRAS=1 -DENABLE_TESTING=#{$testing}" or abort 'Failed to configure Urho3D library build'
+  system "./cmake_macosx.sh -DIOS=$IOS -DURHO3D_LIB_TYPE=$URHO3D_LIB_TYPE -DURHO3D_64BIT=$URHO3D_64BIT -DURHO3D_LUA#{jit}=1 #{amalg} -DURHO3D_SAMPLES=1 -DURHO3D_TOOLS=1 -DURHO3D_EXTRAS=1 -DURHO3D_TESTING=#{$testing}" or abort 'Failed to configure Urho3D library build'
   xcode_build(ENV['IOS'], "#{platform_prefix}Build/Urho3D.xcodeproj") or abort 'Failed to build or test Urho3D library'
   # Create a new project on the fly that uses newly built Urho3D library
   scaffolding "#{platform_prefix}Build/generated/externallib"
-  system "URHO3D_HOME=`pwd`; export URHO3D_HOME && cd #{platform_prefix}Build/generated/externallib && echo '\nUsing Urho3D as external library in external project' && ./cmake_macosx.sh -DIOS=$IOS -DENABLE_64BIT=$ENABLE_64BIT -DENABLE_LUA#{jit}=1 -DENABLE_TESTING=#{$testing}" or abort 'Failed to configure temporary project using Urho3D as external library'
+  system "URHO3D_HOME=`pwd`; export URHO3D_HOME && cd #{platform_prefix}Build/generated/externallib && echo '\nUsing Urho3D as external library in external project' && ./cmake_macosx.sh -DIOS=$IOS -DURHO3D_64BIT=$URHO3D_64BIT -DURHO3D_LUA#{jit}=1 -DURHO3D_TESTING=#{$testing}" or abort 'Failed to configure temporary project using Urho3D as external library'
   xcode_build(ENV['IOS'], "#{platform_prefix}Build/generated/externallib/#{platform_prefix}Build/Scaffolding.xcodeproj") or abort 'Failed to configure/build/test temporary project using Urho3D as external library'
 end
 

+ 98 - 48
Readme.txt

@@ -201,7 +201,7 @@ http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz. These will
 be missing some of the headers related to shader compilation, so a MinGW build 
 will use OpenGL by default. To build in Direct3D9 mode, the MinGW-w64 port is 
 necessary: http://mingw-w64.sourceforge.net/. Using it, Direct3D9 can be 
-enabled with the CMake option -DUSE_OPENGL=0.
+enabled with the CMake option -DURHO3D_OPENGL=0.
 
 After the build is complete, the programs can be run from the Bin directory.
 These include the Urho3D player application, which can run application scripts,
@@ -248,7 +248,7 @@ Windows, ensure that make.exe from the Android NDK is included in the path and
 is executable from the command line.
 
 On Windows, execute cmake_android.bat. If MKLINK support is available, provide
-build option "-DUSE_MKLINK=1" to generate out-of-source build. Then go to the
+build option "-DURHO3D_MKLINK=1" to generate out-of-source build. Then go to the
 build directory Source/Android (or android-Build if out-of-source build) and
 execute the following commands. On OS X or Linux, execute cmake_gcc.sh (the
 ANDROID_NDK environment variable distinguishes from a normal desktop build) then
@@ -320,7 +320,8 @@ from https://github.com/raspberrypi/tools. Secondly, set the RASPI_ROOT
 environment variable to point to your Raspbian or Pidora system root. You must
 install the Urho3D prerequisites software development packages for Raspberry Pi
 (see "Building_Prerequisites") in the system root before attempting to do the
-Urho3D cross-compiling build.
+Urho3D cross-compiling build. You can download a Raspbian system root from
+https://github.com/urho3d/rpi-sysroot.
 
 When running cmake_gcc.sh with RASPI_TOOL environment variable set, it tells
 build script to generate additional raspi-Build directory for cross-compiling.
@@ -330,11 +331,12 @@ is complete, the ARM executables can be found in Bin-CC output directory.
 You can also build, deploy, run/debug (as C/C++ Remote Application) using
 Eclipse IDE, if you run cmake_eclipse.sh to generate the project file. Import
 the CMake generated Eclipse project in the raspi-Build directory into Eclipse's
-workspace. Build the project as usual. Use the SCP_TO_TARGET build option to
-automatically deploy the ARM executables to target Raspberry Pi as part of every
-project build or configure Eclipse to perform a "download to target path" in the
-Run/Debug configuration for C/C++ Remote Application. Either way, you have to
-configure the Run/Debug configuration how to reach your target Raspberry Pi.
+workspace. Build the project as usual. Use the URHO3D_SCP_TO_TARGET build option
+to automatically deploy the ARM executables to target Raspberry Pi as part of
+every project build or configure Eclipse to perform a "download to target path"
+in the Run/Debug configuration for C/C++ Remote Application. Either way, you
+have to configure the Run/Debug configuration how to reach your target Raspberry
+Pi.
 
 
 MinGW cross-compile build process
@@ -367,7 +369,7 @@ Desktop 64bit build
 
 Currently CMake build configuration has been set to compile Urho3D as 32bit by
 default. To enable 64bit build, run the provided cmake_xxxx.bat or cmake_xxxx.sh
-by passing the option "-DENABLE_64BIT=1" explicitly. For Visual Studio on
+by passing the option "-DURHO3D_64BIT=1" explicitly. For Visual Studio on
 Windows platform, this option also overrides CMake to use a 64bit solution
 generator.
 
@@ -398,7 +400,7 @@ use Urho3D as external library.
 Documentation build
 -------------------
 
-If ENABLE_DOCS build option is set then a normal (ALL) build would not only
+If URHO3D_DOCS build option is set then a normal (ALL) build would not only
 build Urho3D software but also Urho3D documentation automatically. If it is not
 then the documentation can be generated by manually invoking 'make doc' command
 or its equivalent command in IDE.
@@ -427,44 +429,49 @@ Build options
 A number of build options can be defined explicitly when invoking the above
 cmake_xxxx batch files or shell scripts.
 
-|----------------------|-------------------------------------------------------|
-|Defines               |Build Options                                          |
-|----------------------|-------------------------------------------------------|
-|-DENABLE_64BIT=1      |to enable 64bit build                                  |
-|-DENABLE_LUA=1        |to enable additional Lua scripting support             |
-|-DENABLE_LUAJIT=1     |to enable Lua Just-in-time compilation, implied        |
-|                      | ENABLE_LUA (check its CMakeLists.txt for more options)|
-|-DENABLE_SAFE_LUA=1   |to enable Lua C++ wrapper safety checks                |
-|-DENABLE_SAMPLES=1    |to build the C++ sample applications                   |
-|-DENABLE_TOOLS=1      |to build the tools (only useful for Raspberry Pi build |
-|                      | because this option is already enabled by default for |
-|                      | other Desktop platforms)                              |
-|-DENABLE_DOCS=1       |to build the docs when building all the targets        |
-|-DENABLE_ANGELSCRIPT=0|to disable AngelScript scripting support               |
-|-DENABLE_SSE=0        |to disable SSE instruction set                         |
-|-DENABLE_MINIDUMPS=0  |to disable minidumps on crash (VS only)                |
-|-DENABLE_FILEWATCHER=0|to disable filewatcher support                         |
-|-DENABLE_PROFILING=0  |to disable profiling support                           |
-|-DENABLE_LOGGING=0    |to disable logging support                             |
-|-DUSE_OPENGL=1        |to use OpenGL instead of Direct3D (only useful for VS  |
-|                      | on Windows platform because this option is enabled by |
-|                      | default for other platforms)                          | 
-|-DUSE_MKLINK=1        |to use mklink command to create symbolic links (Windows|
-|                      |  Vista and above only)                                |
-|-DUSE_STATIC_RUNTIME=1|to use static C/C++ runtime libraries and eliminate the|
-|                      |  need for runtime DLLs installation (VS only)         |
-|-DSCP_TO_TARGET=<v>   |to automatically scp 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             |
-|-DCMAKE_BUILD_TYPE=<v>|to tell CMake which build configuration to be          |
-|                      | generated (Makefile generator only), possible values  |
-|                      | are Release (default), Debug, and RelWithDebInfo      |
-|-DURHO3D_LIB_TYPE=<v> |to specify Urho3D library type, possible values are    |
-|                      | STATIC (default) and SHARED                           |
-|-DANDROID_ABI=<v>     |to specify ABI for native code (Android build only),   |
-|                      | possible values are armeabi-v7a (default) and armeabi |
-|----------------------|-------------------------------------------------------|
+|---------------------|-|------------------------------------------------------|
+|Defines              |V|Build Options                                         |
+|---------------------|-|------------------------------------------------------|
+|URHO3D_64BIT         |0|Enable 64bit build                                    |
+|URHO3D_ANGELSCRIPT   |1|Enable AngelScript scripting support                  |
+|URHO3D_LUA           |0|Enable Lua scripting support                          |
+|URHO3D_LUAJIT        |0|Enable Lua scripting support using LuaJIT (check      |
+|                     | | LuaJIT's CMakeLists.txt for more options)            |
+|URHO3D_LUAJIT_AMALG  |0|Enable LuaJIT amalgamated build (LuaJIT only)         |
+|URHO3D_SAFE_LUA      |0|Enable Lua C++ wrapper safety checks (when Lua        |
+|                     | | scripting support is enabled only)                   |
+|URHO3D_SAMPLES       |0|Build sample applications                             |
+|URHO3D_TOOLS         |1|Build standalone tools (Desktop and RPI only;         |
+|                     | | on Android only build Lua standalone tools)          |
+|URHO3D_EXTRAS        |0|Build extras (Desktop and RPI only)                   |
+|URHO3D_DOCS[_QUIET]  |0|Generate documentation as part of normal build (the   |
+|                     | | 'doc' builtin target can be used to generate         |
+|                     | | documentation regardless of this option's value)     |
+|URHO3D_SSE           |1|Enable SSE instruction set                            |
+|URHO3D_MINIDUMPS     |1|Enable minidumps on crash (VS only)                   |
+|URHO3D_FILEWATCHER   |1|Enable filewatcher support                            |
+|URHO3D_PROFILING     |1|Enable profiling support                              |
+|URHO3D_LOGGING       |1|Enable logging support                                |
+|URHO3D_TESTING       |0|Enable testing support                                |
+|URHO3D_TEST_TIME_OUT |5|Number of seconds to test run the executables (when   |
+|                     | | testing support is enabled only)                     |
+|URHO3D_OPENGL        |0|Use OpenGL instead of Direct3D (Windows platform only)|
+|URHO3D_MKLINK        |0|Use mklink command to create symbolic links (Windows  |
+|                     | | Vista and above only)                                |
+|URHO3D_STATIC_RUNTIME|0|Use static C/C++ runtime libraries and eliminate the  |
+|                     | | need for runtime DLLs installation (VS only)         |
+|URHO3D_LIB_TYPE      |*|Specify Urho3D library type, possible values are      |
+|                     | | STATIC (*default) and SHARED                         |
+|URHO3D_SCP_TO_TARGET |-|Use scp to transfer executables to target system (non-|
+|                     | | Android cross-compiling build only), SSH digital key |
+|                     | | must be setup first for this to work, typical value  |
+|                     | | has a pattern of usr@tgt:remote-loc                  |
+|CMAKE_BUILD_TYPE     |*|Specify CMake build configuration to be generated     |
+|                     | | (Makefile generator only), possible values are       |
+|                     | | Release (*default), Debug, and RelWithDebInfo        |
+|ANDROID_ABI          |*|Specify target ABI (Android build only), possible     |
+|                     | | values are armeabi-v7a (*default) and armeabi        |
+|---------------------|-|------------------------------------------------------|
 
 Note that build option values specified via command line are cached by CMake.
 The cached values will be used by CMake in the subsequent invocation. That is,
@@ -476,6 +483,49 @@ the build options to their default values is by clearing the CMake cache by
 calling cmake_clean.bat or cmake_clean.sh.
 
 
+Using cmake-gui to configure and generate Urho3D project file
+-------------------------------------------------------------
+
+Instead of using one of the provided batch files or shell scripts, you can use
+cmake-gui to configure and generate Urho3D project file. However, you have to
+adhere to the current limitations:
+
+- The build directory must be located inside the Urho3D project root directory
+  and sibling of the "Source" directory.
+- The build directory must be named accordingly based on the target platform.
+    - On desktop/native platform: Build
+    - On Windows platform using MinGW: mingw-Build
+    - On iOS platform: ios-Build
+    - On Android platform: android-Build
+    - On Raspberry Pi platform: raspi-Build
+- The runtime and archive output directories are automatically set based on the
+  target platform regardless of the build directory name (should you choose not
+  to adhere with the above). For example on Android platform, they will be
+  android-Bin and android-Lib, respectively.
+  If you choose not to adhere with this build directory naming convention then
+  you will have to install the Urho3D library into your local filesystem in
+  order to use the Urho3D library in your external project
+  (See http://urho3d.github.io/documentation/a00004.html#UsingLibraryFromSDK).
+- All the post-CMake workaround and/or bug fixes that are scripted in the batch
+  files or shell scripts are not applied to the generated project file.
+
+Steps to configure:
+
+1. In the Urho3D project root directory, invoke "cmake-gui Source".
+2. Set the build directory name.
+3. Configure and update the build options as many times as necessary until there
+   are no more new options in red. For the first configuration, choose the
+   generator you like to use. Click the Group check box to group the build
+   options.
+    - In the Ungrouped Entries: only check one of these options (ANDROID, IOS,
+      RASPI) when you target the platform, leave them unchecked for
+      dekstop/native build.
+    - In the URHO3D group: check any of the options you desire. Some of the
+      options when checked may cause new options to be made available in the
+      subsequent configuration loop.
+4. Generate when all the configurations are done.
+
+
 History
 -------
 

+ 9 - 9
Source/CMake/Modules/FindUrho3D.cmake

@@ -59,15 +59,15 @@ elseif (NOT URHO3D_HOME AND DEFINED ENV{URHO3D_HOME})
 endif ()
 if (URHO3D_HOME)
     # Construct source tree paths from URHO3D_HOME environment variable
-    find_file (SOURCE_TREE_PATH Urho3D.h.in ${URHO3D_HOME}/Source/Engine NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-    if (SOURCE_TREE_PATH)
-        get_filename_component (SOURCE_TREE_PATH ${SOURCE_TREE_PATH} PATH)
-        set (URHO3D_INCLUDE_DIRS ${SOURCE_TREE_PATH})
+    find_file (URHO3D_SOURCE_TREE Urho3D.h.in ${URHO3D_HOME}/Source/Engine DOC "Path to Urho3D project source tree" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+    if (URHO3D_SOURCE_TREE)
+        get_filename_component (URHO3D_SOURCE_TREE ${URHO3D_SOURCE_TREE} PATH)
+        set (URHO3D_INCLUDE_DIRS ${URHO3D_SOURCE_TREE})
         foreach (DIR Audio Container Core Engine Graphics Input IO LuaScript Math Navigation Network Physics Resource Scene Script UI Urho2D)
-            list (APPEND URHO3D_INCLUDE_DIRS ${SOURCE_TREE_PATH}/${DIR})     # Note: variable change to list context after this
+            list (APPEND URHO3D_INCLUDE_DIRS ${URHO3D_SOURCE_TREE}/${DIR})     # Note: variable change to list context after this
         endforeach ()
         set (DIRS Box2D Bullet/src kNet/include SDL/include)
-        if (ENABLE_ANGELSCRIPT)
+        if (URHO3D_ANGELSCRIPT)
             list (APPEND DIRS AngelScript/include)
         endif ()
         foreach (DIR ${DIRS})
@@ -77,7 +77,7 @@ if (URHO3D_HOME)
         # For non Urho3D project using Urho3D as external library, Urho3D project itself must be built using predefined build directory as per specified in the provided build scripts.
         if (IS_INTERNAL)
             set (BINARY_DIR ${CMAKE_BINARY_DIR})
-        elseif (ANDROID AND CMAKE_HOST_WIN32 AND NOT USE_MKLINK)
+        elseif (ANDROID AND CMAKE_HOST_WIN32 AND NOT URHO3D_MKLINK)
             set (BINARY_DIR ${URHO3D_HOME}/Source/Android)
         else ()
             set (BINARY_DIR ${URHO3D_HOME}/${PLATFORM_PREFIX}Build)
@@ -131,7 +131,7 @@ else ()
     if (URHO3D_INCLUDE_DIRS)
         set (BASE_DIR ${URHO3D_INCLUDE_DIRS})
         set (DIRS Bullet kNet SDL)
-        if (ENABLE_ANGELSCRIPT)
+        if (URHO3D_ANGELSCRIPT)
             list (APPEND DIRS AngelScript)
         endif ()
         foreach (DIR ${DIRS})
@@ -170,4 +170,4 @@ else ()
     endif ()
 endif ()
 
-mark_as_advanced (URHO3D_INCLUDE_DIRS URHO3D_LIBRARIES)
+mark_as_advanced (URHO3D_INCLUDE_DIRS URHO3D_LIBRARIES URHO3D_SOURCE_TREE)

+ 41 - 64
Source/CMake/Modules/Urho3D-CMake-common.cmake

@@ -35,34 +35,25 @@ if (CMAKE_HOST_WIN32)
 endif ()
 
 # Enable testing
-if (ENABLE_TESTING)
+if (URHO3D_TESTING)
     enable_testing ()
-    add_definitions (-DENABLE_TESTING)
-    set (TEST_TIME_OUT 5)    # in seconds
+    add_definitions (-DURHO3D_TESTING)
 endif ()
 
 # Enable SSE instruction set. Requires Pentium III or Athlon XP processor at minimum.
-if (NOT DEFINED ENABLE_SSE)
-    set (ENABLE_SSE 1)
-endif ()
-if (ENABLE_SSE)
-    add_definitions (-DENABLE_SSE)
+if (URHO3D_SSE)
+    add_definitions (-DURHO3D_SSE)
 endif ()
 
 # Enable structured exception handling and minidumps on MSVC only.
-if (MSVC)
-    if (NOT DEFINED ENABLE_MINIDUMPS)
-        set (ENABLE_MINIDUMPS 1)
-    endif ()
-    if (ENABLE_MINIDUMPS)
-        add_definitions (-DENABLE_MINIDUMPS)
-    endif ()
+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)
-    if (USE_STATIC_RUNTIME)
+    if (URHO3D_STATIC_RUNTIME)
         set (RELEASE_RUNTIME /MT)
         set (DEBUG_RUNTIME /MTd)
     else ()
@@ -72,32 +63,32 @@ if (MSVC)
 endif ()
 
 # Enable file watcher support for automatic resource reloads by default.
-if (ENABLE_FILEWATCHER OR NOT DEFINED ENABLE_FILEWATCHER)
-    add_definitions (-DENABLE_FILEWATCHER)
+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 (ENABLE_PROFILING OR NOT DEFINED ENABLE_PROFILING)
-    add_definitions (-DENABLE_PROFILING)
+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 (ENABLE_LOGGING OR NOT DEFINED ENABLE_LOGGING)
-    add_definitions (-DENABLE_LOGGING)
+if (URHO3D_LOGGING)
+    add_definitions (-DURHO3D_LOGGING)
 endif ()
 
 # If not on MSVC, enable use of OpenGL instead of Direct3D9 (either not compiling on Windows or
 # with a compiler that may not have an up-to-date DirectX SDK). This can also be unconditionally
 # enabled, but Windows graphics card drivers are usually better optimized for Direct3D. Direct3D can
-# be manually enabled for MinGW with -DUSE_OPENGL=0, but is likely to fail due to missing headers
+# be manually enabled for MinGW with -DURHO3D_OPENGL=0, but is likely to fail due to missing headers
 # and libraries, unless the MinGW-w64 distribution is used.
 if (NOT MSVC)
-    if (NOT WIN32 OR NOT DEFINED USE_OPENGL)
-        set (USE_OPENGL 1)
+    if (NOT WIN32 OR NOT DEFINED URHO3D_OPENGL)
+        set (URHO3D_OPENGL 1)
     endif ()
 endif ()
-if (USE_OPENGL)
-    add_definitions (-DUSE_OPENGL)
+if (URHO3D_OPENGL)
+    add_definitions (-DURHO3D_OPENGL)
 endif ()
 
 # If not on Windows, enable Unix mode for kNet library.
@@ -106,29 +97,24 @@ if (NOT WIN32)
 endif ()
 
 # Add definitions for GLEW
-if (NOT IOS AND NOT ANDROID AND NOT RASPI AND USE_OPENGL)
+if (NOT IOS AND NOT ANDROID AND NOT RASPI AND URHO3D_OPENGL)
     add_definitions (-DGLEW_STATIC -DGLEW_NO_GLU)
 endif ()
 
-# Enable AngelScript by default
-if (NOT DEFINED ENABLE_ANGELSCRIPT)
-    set (ENABLE_ANGELSCRIPT 1)
-endif ()
-
 # Add definition for AngelScript
-if (ENABLE_ANGELSCRIPT)
-    add_definitions (-DENABLE_ANGELSCRIPT)
+if (URHO3D_ANGELSCRIPT)
+    add_definitions (-DURHO3D_ANGELSCRIPT)
 endif ()
 
 # Add definition for Lua and LuaJIT
-if (ENABLE_LUAJIT)
-    add_definitions (-DENABLE_LUAJIT)
+if (URHO3D_LUAJIT)
+    add_definitions (-DURHO3D_LUAJIT)
     set (JIT JIT)
-    # Implied ENABLE_LUA
-    set (ENABLE_LUA 1)
+    # Implied URHO3D_LUA
+    set (URHO3D_LUA 1)
 endif ()
-if (ENABLE_LUA)
-    add_definitions (-DENABLE_LUA)
+if (URHO3D_LUA)
+    add_definitions (-DURHO3D_LUA)
 endif ()
 
 # Default library type is STATIC
@@ -160,7 +146,7 @@ endif ()
 if (IOS)
     # IOS-specific setup
     add_definitions (-DIOS)
-    if (ENABLE_64BIT)
+    if (URHO3D_64BIT)
         set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_INCLUDING_64_BIT))
     else ()
         set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
@@ -172,7 +158,7 @@ if (IOS)
     set (CMAKE_OSX_SYSROOT iphoneos)    # Set Base SDK to "Latest iOS"
 elseif (XCODE)
     # MacOSX-Xcode-specific setup
-    if (NOT ENABLE_64BIT)
+    if (NOT URHO3D_64BIT)
         set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
     endif ()
     set (CMAKE_OSX_SYSROOT macosx)	# Set Base SDK to "Latest OS X"
@@ -193,7 +179,7 @@ if (MSVC)
     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})
     # SSE flag is redundant if already compiling as 64bit
-    if (ENABLE_SSE AND NOT ENABLE_64BIT)
+    if (URHO3D_SSE AND NOT URHO3D_64BIT)
         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE")
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE")
     endif ()
@@ -206,7 +192,7 @@ else ()
         # Most of the flags are already setup in android.toolchain.cmake module
         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
-        if (ENABLE_64BIT)
+        if (URHO3D_64BIT)
             # TODO: Revisit this again when ARM also support 64bit
             # For now just reference it to suppress "unused variable" warning
         endif ()
@@ -224,19 +210,19 @@ else ()
         else ()
             set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
             set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
-            if (ENABLE_64BIT)
+            if (URHO3D_64BIT)
                 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
                 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
             else ()
                 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
                 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
-                if (ENABLE_SSE)
+                if (URHO3D_SSE)
                     if (NOT WIN32)
                         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse")
                         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse")
                     else ()
                         message (STATUS "Using SSE2 instead of SSE because SSE fails on some Windows ports of GCC")
-                        message (STATUS "Disable SSE with the CMake option -DENABLE_SSE=0 if this is not desired")
+                        message (STATUS "Disable SSE with the CMake option -DURHO3D_SSE=0 if this is not desired")
                         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
                         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
                     endif ()
@@ -295,15 +281,6 @@ elseif (CMAKE_CROSSCOMPILING)
 endif ()
 set_output_directories (${PROJECT_ROOT_DIR}/${PLATFORM_PREFIX}Bin RUNTIME PDB)
 
-# Reference supported build options that are potentially not being referenced due to platform or build type branching to suppress "unused variable" warning
-if (ENABLE_SAMPLES AND ENABLE_EXTRAS AND ENABLE_TOOLS AND
-    ENABLE_MINIDUMPS AND USE_MKLINK AND USE_STATIC_RUNTIME AND
-    ENABLE_64BIT AND
-    SCP_TO_TARGET AND
-    ANDROID_ABI AND
-    ENABLE_SAFE_LUA)
-endif ()
-
 # Override builtin macro and function to suit our need, always generate header file regardless of target type...
 macro (_DO_SET_MACRO_VALUES TARGET_LIBRARY)
     set (DEFINE_DEPRECATED)
@@ -461,8 +438,8 @@ macro (setup_executable)
     
     if (IOS)
         set_target_properties (${TARGET_NAME} PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
-    elseif (CMAKE_CROSSCOMPILING AND NOT ANDROID AND SCP_TO_TARGET)
-        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${SCP_TO_TARGET} || exit 0)
+    elseif (CMAKE_CROSSCOMPILING AND NOT ANDROID AND URHO3D_SCP_TO_TARGET)
+        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${URHO3D_SCP_TO_TARGET} || exit 0)
     endif ()
     if (DEST_RUNTIME_DIR)
         # Need to check if the variable is defined first because this macro could be called by CMake project outside of Urho3D that does not wish to install anything
@@ -603,7 +580,7 @@ macro (define_dependency_libs TARGET)
     endif ()
 
     # Engine/LuaJIT external dependency
-    if (ENABLE_LUAJIT AND ${TARGET} MATCHES LuaJIT|Urho3D)
+    if (URHO3D_LUAJIT AND ${TARGET} MATCHES LuaJIT|Urho3D)
         if (NOT WIN32)
             list (APPEND LINK_LIBS_ONLY dl m)
         endif ()
@@ -614,7 +591,7 @@ macro (define_dependency_libs TARGET)
         # Core
         if (WIN32)
             list (APPEND LINK_LIBS_ONLY winmm)
-            if (ENABLE_MINIDUMPS)
+            if (URHO3D_MINIDUMPS)
                 list (APPEND LINK_LIBS_ONLY dbghelp)
             endif ()
         elseif (NOT ANDROID)
@@ -622,7 +599,7 @@ macro (define_dependency_libs TARGET)
         endif ()
 
         # Graphics
-        if (USE_OPENGL)
+        if (URHO3D_OPENGL)
             if (WIN32)
                 list (APPEND LINK_LIBS_ONLY opengl32)
             elseif (ANDROID)
@@ -652,9 +629,9 @@ macro (define_dependency_libs TARGET)
     endif ()
 
     # LuaJIT specific - extra linker flags for linking against LuaJIT (adapted from LuaJIT's original Makefile)
-    if (ENABLE_LUAJIT AND ${TARGET} MATCHES Urho3D)
+    if (URHO3D_LUAJIT AND ${TARGET} MATCHES Urho3D)
         # 64-bit Mac OS X
-        if (ENABLE_64BIT AND APPLE AND NOT IOS)
+        if (URHO3D_64BIT AND APPLE AND NOT IOS)
             set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000")
         endif ()
         # GCC-specific

+ 50 - 8
Source/CMakeLists.txt

@@ -36,6 +36,48 @@ endif ()
 # Set CMake modules search path
 set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
 
+# Define all supported build options
+include (CMakeDependentOption)
+option (ANDROID "Setup build for Android platform")
+option (RASPI "Setup build for Raspberry Pi platform")
+option (IOS "Setup build for iOS platform")
+option (URHO3D_64BIT "Enable 64-bit build")
+option (URHO3D_ANGELSCRIPT "Enable AngelScript scripting support" TRUE)
+option (URHO3D_LUA "Enable additional Lua scripting support")
+option (URHO3D_LUAJIT "Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)")
+cmake_dependent_option (URHO3D_LUAJIT_AMALG "Enable LuaJIT amalgamated build (LuaJIT only)" FALSE "URHO3D_LUAJIT" FALSE)
+cmake_dependent_option (URHO3D_SAFE_LUA "Enable Lua C++ wrapper safety checks (Lua scripting only)" FALSE "URHO3D_LUA OR URHO3D_LUAJIT" FALSE)
+option (URHO3D_SAMPLES "Build sample applications")
+cmake_dependent_option (URHO3D_TOOLS "Build standalone tools (Desktop and RPI only; on Android only build Lua standalone tools)" TRUE "NOT IOS;NOT ANDROID OR URHO3D_LUA OR URHO3D_LUAJIT" FALSE)
+cmake_dependent_option (URHO3D_EXTRAS "Build extras (Desktop and RPI only)" FALSE "NOT IOS AND NOT ANDROID" FALSE)
+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_SSE "Enable SSE instruction set" TRUE)
+cmake_dependent_option (URHO3D_MINIDUMPS "Enable minidumps on crash (VS only)" TRUE "MSVC" FALSE)
+option (URHO3D_FILEWATCHER "Enable filewatcher support" TRUE)
+option (URHO3D_PROFILING "Enable profiling support" TRUE)
+option (URHO3D_LOGGING "Enable logging support" TRUE)
+option (URHO3D_TESTING "Enable testing support" FALSE)
+if (URHO3D_TESTING)
+    set (URHO3D_TEST_TIME_OUT 5 CACHE STRING "Number of seconds to test run the executables")
+else ()
+    unset (URHO3D_TEST_TIME_OUT CACHE)
+endif ()
+cmake_dependent_option (URHO3D_OPENGL "Use OpenGL instead of Direct3D (Windows platform only)" FALSE "WIN32" FALSE)
+cmake_dependent_option (URHO3D_MKLINK "Use mklink command to create symbolic links (Windows Vista and above only)" FALSE "WIN32" FALSE)
+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)
+set (URHO3D_LIB_TYPE STATIC CACHE STRING "Specify Urho3D library type, possible values are STATIC (default) and SHARED")
+if (CMAKE_CROSSCOMPILING AND NOT ANDROID)
+    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_ABI armeabi-v7a CACHE STRING "Specify ABI for native code (Android build only), possible values are armeabi-v7a (default) and armeabi")
+else ()
+    unset (ANDROID_ABI CACHE)
+endif ()
+
 # Include Urho3D cmake common module
 include (Urho3D-CMake-common)
 
@@ -52,7 +94,7 @@ if (WIN32)
     set (SCRIPT_PATTERN *.bat)
 else ()
     set (PATH_SUFFIX /Urho3D)
-    if (ENABLE_64BIT)   # TODO: Revisit this again when ARM also supports 64bit, for now ARM architecture ignores ENABLE_64BIT build option
+    if (URHO3D_64BIT)   # TODO: Revisit this again when ARM also supports 64bit, for now ARM architecture ignores URHO3D_64BIT build option
         if (NOT CMAKE_CROSSCOMPILING AND EXISTS /usr/lib64)
             # Probably target system is a RedHat-based distro
             set (LIB_SUFFIX 64)
@@ -111,7 +153,7 @@ elseif (WIN32)
 elseif (CPACK_SYSTEM_NAME STREQUAL Linux)
     list (APPEND CPACK_GENERATOR RPM DEB)
 endif ()
-if (ENABLE_64BIT)
+if (URHO3D_64BIT)
     set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-64bit)
 endif ()
 set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-${URHO3D_LIB_TYPE})
@@ -124,16 +166,16 @@ include (CPack)
 foreach (TARGET Box2D Bullet Civetweb Detour FreeType JO kNet LZ4 PugiXml Recast SDL StanHull STB)
     add_subdirectory (ThirdParty/${TARGET})
 endforeach ()
-if (ENABLE_ANGELSCRIPT)
+if (URHO3D_ANGELSCRIPT)
     add_subdirectory (ThirdParty/AngelScript)
 endif ()
-if (ENABLE_LUA)
+if (URHO3D_LUA)
     add_subdirectory (Engine/LuaScript)
     add_subdirectory (ThirdParty/Lua${JIT})
     add_subdirectory (ThirdParty/toluapp/src/lib)
 endif ()
 if (NOT IOS AND NOT ANDROID AND NOT RASPI)
-    if (USE_OPENGL)
+    if (URHO3D_OPENGL)
         add_subdirectory (ThirdParty/GLEW)
     else ()
         add_subdirectory (ThirdParty/MojoShader)
@@ -150,13 +192,13 @@ 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 (ENABLE_SAMPLES)
+if (URHO3D_SAMPLES)
     add_subdirectory (Samples)
 endif ()
 
 # Urho3D extras
-# Do not build extras for iOS and Android regardless of its build option 
-if (NOT IOS AND NOT ANDROID AND ENABLE_EXTRAS)   
+# Do not build extras for iOS and Android
+if (NOT IOS AND NOT ANDROID AND URHO3D_EXTRAS)
     add_subdirectory (Extras)
 endif ()
 

+ 3 - 3
Source/Engine/CMakeLists.txt

@@ -63,7 +63,7 @@ endif ()
 
 # Define source files
 set (SOURCES Audio Container Core Engine Graphics Input IO Math Navigation Network Physics Resource Scene UI Urho2D)
-if (ENABLE_ANGELSCRIPT)
+if (URHO3D_ANGELSCRIPT)
     list (APPEND SOURCES Script)
 endif ()
 foreach (SOURCE ${SOURCES})
@@ -226,8 +226,8 @@ if (URHO3D_LIB_TYPE STREQUAL SHARED AND (CMAKE_CROSSCOMPILING OR IOS))
     add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${TARGET_NAME}>
         COMMENT "Stripping shared library")
 endif ()
-if (CMAKE_CROSSCOMPILING AND NOT ANDROID AND SCP_TO_TARGET)
+if (CMAKE_CROSSCOMPILING AND NOT ANDROID AND URHO3D_SCP_TO_TARGET)
     # Ensure SCP is the last command
-    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${SCP_TO_TARGET} || exit 0
+    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${URHO3D_SCP_TO_TARGET} || exit 0
         COMMENT "Scp-ing library to target system")
 endif ()

+ 1 - 1
Source/Engine/Core/Main.h

@@ -44,7 +44,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, in
     return function; \
 }
 // MSVC release mode: write minidump on crash
-#elif defined(_MSC_VER) && defined(ENABLE_MINIDUMPS)
+#elif defined(_MSC_VER) && defined(URHO3D_MINIDUMPS)
 #define DEFINE_MAIN(function) \
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd) \
 { \

+ 1 - 1
Source/Engine/Core/MiniDump.cpp

@@ -22,7 +22,7 @@
 
 #include "Precompiled.h"
 
-#if defined(_MSC_VER) && defined(ENABLE_MINIDUMPS)
+#if defined(_MSC_VER) && defined(URHO3D_MINIDUMPS)
 
 #include "ProcessUtils.h"
 

+ 1 - 1
Source/Engine/Core/MiniDump.h

@@ -25,7 +25,7 @@
 namespace Urho3D
 {
 
-#if defined(_MSC_VER) && defined(ENABLE_MINIDUMPS)
+#if defined(_MSC_VER) && defined(URHO3D_MINIDUMPS)
 /// Write a minidump. Needs to be called from within a structured exception handler.
 URHO3D_API int WriteMiniDump(const char* applicationName, void* exceptionPointers);
 #endif

+ 2 - 2
Source/Engine/Core/ProcessUtils.cpp

@@ -104,7 +104,7 @@ void GetCPUData(struct cpu_id_t* data)
 
 void InitFPU()
 {
-    #if !defined(ENABLE_LUAJIT) && !defined(ANDROID) && !defined(IOS) && !defined(RASPI) && !defined(__x86_64__) && !defined(_M_AMD64)
+    #if !defined(URHO3D_LUAJIT) && !defined(ANDROID) && !defined(IOS) && !defined(RASPI) && !defined(__x86_64__) && !defined(_M_AMD64)
     // Make sure FPU is in round-to-nearest, single precision mode
     // This ensures Direct3D and OpenGL behave similarly, and all threads behave similarly
     #ifdef _MSC_VER
@@ -267,7 +267,7 @@ const Vector<String>& GetArguments()
 String GetConsoleInput()
 {
     String ret;
-    #ifdef ENABLE_TESTING
+    #ifdef URHO3D_TESTING
     // When we are running automated tests, reading the console may block. Just return empty in that case
     return ret;
     #endif

+ 1 - 1
Source/Engine/Core/Profiler.h

@@ -246,7 +246,7 @@ private:
     Profiler* profiler_;
 };
 
-#ifdef ENABLE_PROFILING
+#ifdef URHO3D_PROFILING
 #define PROFILE(name) AutoProfileBlock profile_ ## name (GetSubsystem<Profiler>(), #name)
 #else
 #define PROFILE(name)

+ 1 - 1
Source/Engine/Engine/DebugHud.cpp

@@ -142,7 +142,7 @@ void DebugHud::Update()
             shadowQualityTexts[renderer->GetShadowQuality()],
             renderer->GetMaxOccluderTriangles() > 0 ? "On" : "Off",
             renderer->GetDynamicInstancing() ? "On" : "Off",
-            #ifdef USE_OPENGL
+            #ifdef URHO3D_OPENGL
             "OGL");
             #else
             graphics->GetSM3Support() ? "SM3" : "SM2");

+ 8 - 8
Source/Engine/Engine/Engine.cpp

@@ -85,7 +85,7 @@ Engine::Engine(Context* context) :
     maxInactiveFps_(60),
     pauseMinimized_(false),
     #endif
-#ifdef ENABLE_TESTING
+#ifdef URHO3D_TESTING
     timeOut_(0),
 #endif
     autoExit_(true),
@@ -100,11 +100,11 @@ Engine::Engine(Context* context) :
     // Create subsystems which do not depend on engine initialization or startup parameters
     context_->RegisterSubsystem(new Time(context_));
     context_->RegisterSubsystem(new WorkQueue(context_));
-    #ifdef ENABLE_PROFILING
+    #ifdef URHO3D_PROFILING
     context_->RegisterSubsystem(new Profiler(context_));
     #endif
     context_->RegisterSubsystem(new FileSystem(context_));
-    #ifdef ENABLE_LOGGING
+    #ifdef URHO3D_LOGGING
     context_->RegisterSubsystem(new Log(context_));
     #endif
     context_->RegisterSubsystem(new ResourceCache(context_));
@@ -300,7 +300,7 @@ bool Engine::Initialize(const VariantMap& parameters)
     // Init FPU state of main thread
     InitFPU();
 
-    #ifdef ENABLE_TESTING
+    #ifdef URHO3D_TESTING
     if (HasParameter(parameters, "TimeOut"))
         timeOut_ = GetParameter(parameters, "TimeOut", 0).GetInt() * 1000000LL;
     #endif
@@ -448,7 +448,7 @@ void Engine::DumpProfiler()
 
 void Engine::DumpResources()
 {
-    #ifdef ENABLE_LOGGING
+    #ifdef URHO3D_LOGGING
     ResourceCache* cache = GetSubsystem<ResourceCache>();
     const HashMap<ShortStringHash, ResourceGroup>& resourceGroups = cache->GetAllResources();
     LOGRAW("\n");
@@ -472,7 +472,7 @@ void Engine::DumpResources()
 
 void Engine::DumpMemory()
 {
-    #ifdef ENABLE_LOGGING
+    #ifdef URHO3D_LOGGING
     #if defined(_MSC_VER) && defined(_DEBUG)
     _CrtMemState state;
     _CrtMemCheckpoint(&state);
@@ -583,7 +583,7 @@ void Engine::ApplyFrameLimit()
     }
 
     elapsed = frameTimer_.GetUSec(true);
-    #ifdef ENABLE_TESTING
+    #ifdef URHO3D_TESTING
     if (timeOut_ > 0)
     {
         timeOut_ -= elapsed;
@@ -731,7 +731,7 @@ VariantMap Engine::ParseParameters(const Vector<String>& arguments)
                 ret["TextureAnisotropy"] = ToInt(value);
                 ++i;
             }
-            #ifdef ENABLE_TESTING
+            #ifdef URHO3D_TESTING
             else if (argument == "timeout" && !value.Empty())
             {
                 ret["TimeOut"] = ToInt(value);

+ 1 - 1
Source/Engine/Engine/Engine.h

@@ -126,7 +126,7 @@ private:
     unsigned maxInactiveFps_;
     /// Pause when minimized flag.
     bool pauseMinimized_;
-#ifdef ENABLE_TESTING
+#ifdef URHO3D_TESTING
     /// Time out counter for testing.
     long long timeOut_;
 #endif

+ 6 - 6
Source/Engine/Graphics/Batch.cpp

@@ -99,7 +99,7 @@ void CalculateShadowMatrix(Matrix4& dest, LightBatchQueue* queue, unsigned split
         0.5f * (float)viewport.Height() / height
     );
     
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     offset.x_ += scale.x_;
     offset.y_ += scale.y_;
     offset.y_ = 1.0f - offset.y_;
@@ -143,7 +143,7 @@ void CalculateSpotMatrix(Matrix4& dest, Light* light, const Vector3& translation
     spotProj.m22_ = 1.0f / Max(light->GetRange(), M_EPSILON);
     spotProj.m32_ = 1.0f;
     
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     texAdjust.SetTranslation(Vector3(0.5f, 0.5f, 0.5f));
     texAdjust.SetScale(Vector3(0.5f, -0.5f, 0.5f));
     #else
@@ -231,7 +231,7 @@ void Batch::Prepare(View* view, bool setModelTransform) const
         float widthRange = 0.5f * viewport.Width() / rtWidth;
         float heightRange = 0.5f * viewport.Height() / rtHeight;
         
-        #ifdef USE_OPENGL
+        #ifdef URHO3D_OPENGL
         Vector4 bufferUVOffset(((float)viewport.left_) / rtWidth + widthRange,
             1.0f - (((float)viewport.top_) / rtHeight + heightRange), widthRange, heightRange);
         #else
@@ -412,7 +412,7 @@ void Batch::Prepare(View* view, bool setModelTransform) const
                     Matrix4 lightVecRot(lightNode->GetWorldRotation().RotationMatrix());
                     // HLSL compiler will pack the parameters as if the matrix is only 3x4, so must be careful to not overwrite
                     // the next parameter
-                    #ifdef USE_OPENGL
+                    #ifdef URHO3D_OPENGL
                     graphics->SetShaderParameter(VSP_LIGHTMATRICES, lightVecRot.Data(), 16);
                     #else
                     graphics->SetShaderParameter(VSP_LIGHTMATRICES, lightVecRot.Data(), 12);
@@ -475,7 +475,7 @@ void Batch::Prepare(View* view, bool setModelTransform) const
                     Matrix4 lightVecRot(lightNode->GetWorldRotation().RotationMatrix());
                     // HLSL compiler will pack the parameters as if the matrix is only 3x4, so must be careful to not overwrite
                     // the next parameter
-                    #ifdef USE_OPENGL
+                    #ifdef URHO3D_OPENGL
                     graphics->SetShaderParameter(PSP_LIGHTMATRICES, lightVecRot.Data(), 16);
                     #else
                     graphics->SetShaderParameter(PSP_LIGHTMATRICES, lightVecRot.Data(), 12);
@@ -494,7 +494,7 @@ void Batch::Prepare(View* view, bool setModelTransform) const
                 unsigned faceHeight = shadowMap->GetHeight() / 3;
                 float width = (float)shadowMap->GetWidth();
                 float height = (float)shadowMap->GetHeight();
-                #ifdef USE_OPENGL
+                #ifdef URHO3D_OPENGL
                     float mulX = (float)(faceWidth - 3) / width;
                     float mulY = (float)(faceHeight - 3) / height;
                     float addX = 1.5f / width;

+ 3 - 3
Source/Engine/Graphics/CMakeLists.txt

@@ -21,7 +21,7 @@
 #
 
 # Define source files
-if (USE_OPENGL)
+if (URHO3D_OPENGL)
     set (GRAPHICS_SYS_DIR OpenGL)
 else ()
     set (GRAPHICS_SYS_DIR Direct3D9)
@@ -29,9 +29,9 @@ endif ()
 define_source_files (GLOB_CPP_PATTERNS *.cpp ${GRAPHICS_SYS_DIR}/*.cpp GLOB_H_PATTERNS *.h ${GRAPHICS_SYS_DIR}/*.h PARENT_SCOPE)
 
 # Define dependency libs
-if (USE_OPENGL AND NOT IOS AND NOT ANDROID AND NOT RASPI)
+if (URHO3D_OPENGL AND NOT IOS AND NOT ANDROID AND NOT RASPI)
     set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/GLEW PARENT_SCOPE)
 endif ()
-if (NOT USE_OPENGL)
+if (NOT URHO3D_OPENGL)
     set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/MojoShader PARENT_SCOPE)
 endif ()

+ 1 - 1
Source/Engine/Graphics/Camera.cpp

@@ -393,7 +393,7 @@ Matrix4 Camera::GetProjection(bool apiSpecific) const
     Matrix4 ret(Matrix4::ZERO);
 
     // Whether to construct matrix using OpenGL or Direct3D clip space convention
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     bool openGLFormat = apiSpecific;
     #else
     bool openGLFormat = false;

+ 2 - 2
Source/Engine/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -489,7 +489,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
     impl_->device_->EndScene();
     impl_->device_->Present(0, 0, 0, 0);
     
-    #ifdef ENABLE_LOGGING
+    #ifdef URHO3D_LOGGING
     String msg;
     msg.AppendWithFormat("Set screen mode %dx%d %s", width_, height_, (fullscreen_ ? "fullscreen" : "windowed"));
     if (borderless_)
@@ -2481,7 +2481,7 @@ bool Graphics::CreateInterface()
 
 bool Graphics::CreateDevice(unsigned adapter, unsigned deviceType)
 {
-#ifdef ENABLE_LUAJIT
+#ifdef URHO3D_LUAJIT
     DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE;
 #else
     DWORD behaviorFlags = 0;

+ 1 - 1
Source/Engine/Graphics/GPUObject.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 #include "OpenGL/OGLGPUObject.h"
 #else
 #include "Direct3D9/D3D9GPUObject.h"

+ 1 - 1
Source/Engine/Graphics/Graphics.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 #include "OpenGL/OGLGraphics.h"
 #else
 #include "Direct3D9/D3D9Graphics.h"

+ 1 - 1
Source/Engine/Graphics/GraphicsImpl.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 #include "OpenGL/OGLGraphicsImpl.h"
 #else
 #include "Direct3D9/D3D9GraphicsImpl.h"

+ 1 - 1
Source/Engine/Graphics/IndexBuffer.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 #include "OpenGL/OGLIndexBuffer.h"
 #else
 #include "Direct3D9/D3D9IndexBuffer.h"

+ 1 - 1
Source/Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -502,7 +502,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
     
     CheckFeatureSupport(extensions);
     
-    #ifdef ENABLE_LOGGING
+    #ifdef URHO3D_LOGGING
     String msg;
     msg.AppendWithFormat("Set screen mode %dx%d %s", width_, height_, (fullscreen_ ? "fullscreen" : "windowed"));
     if (borderless_)

+ 1 - 1
Source/Engine/Graphics/RenderSurface.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 #include "OpenGL/OGLRenderSurface.h"
 #else
 #include "Direct3D9/D3D9RenderSurface.h"

+ 5 - 5
Source/Engine/Graphics/Renderer.cpp

@@ -172,7 +172,7 @@ static const unsigned short spotLightIndexData[] =
 
 static const char* shadowVariations[] =
 {
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     // No specific hardware shadow compare variation on OpenGL, it is always supported
     "LQSHADOW ",
     "LQSHADOW ",
@@ -872,7 +872,7 @@ Texture2D* Renderer::GetShadowMap(Light* light, Camera* camera, unsigned viewWid
     int retries = 3;
     
     // OpenGL: create shadow map only. Color rendertarget is not needed
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     while (retries)
     {
         if (!newShadowMap->SetSize(width, height, shadowMapFormat, TEXTURE_DEPTHSTENCIL))
@@ -966,7 +966,7 @@ Texture2D* Renderer::GetScreenBuffer(int width, int height, unsigned format, boo
         newBuffer->SetFilterMode(filtered ? FILTER_BILINEAR : FILTER_NEAREST);
         newBuffer->ResetUseTimer();
         screenBuffers_[searchKey].Push(newBuffer);
-        #ifdef USE_OPENGL
+        #ifdef URHO3D_OPENGL
         // OpenGL hack: clear persistent floating point screen buffers to ensure the initial contents aren't illegal (NaN)?
         // Otherwise eg. the AutoExposure post process will not work correctly
         if (persistentKey && Texture::GetDataType(format) == GL_FLOAT)
@@ -1622,7 +1622,7 @@ void Renderer::CreateGeometries()
     pointLightGeometry_->SetIndexBuffer(plib);
     pointLightGeometry_->SetDrawRange(TRIANGLE_LIST, 0, plib->GetIndexCount());
     
-    #if !defined(USE_OPENGL) || !defined(GL_ES_VERSION_2_0)
+    #if !defined(URHO3D_OPENGL) || !defined(GL_ES_VERSION_2_0)
     if (graphics_->GetShadowMapFormat())
     {
         faceSelectCubeMap_ = new TextureCube(context_);
@@ -1666,7 +1666,7 @@ void Renderer::SetIndirectionTextureData()
         {
             for (unsigned x = 0; x < 256; ++x)
             {
-                #ifdef USE_OPENGL
+                #ifdef URHO3D_OPENGL
                 dest[0] = x;
                 dest[1] = 255 - y;
                 dest[2] = faceX;

+ 1 - 1
Source/Engine/Graphics/Shader.cpp

@@ -102,7 +102,7 @@ bool Shader::Load(Deserializer& source)
     CommentOutFunction(psSourceCode_, "void VS(");
     
     // OpenGL: rename either VS() or PS() to main(), comment out vertex attributes in pixel shaders
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     vsSourceCode_.Replace("void VS(", "void main(");
     psSourceCode_.Replace("void PS(", "void main(");
     psSourceCode_.Replace("attribute ", "// attribute ");

+ 1 - 1
Source/Engine/Graphics/ShaderProgram.h

@@ -22,6 +22,6 @@
 
 #pragma once
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 #include "OpenGL/OGLShaderProgram.h"
 #endif

+ 1 - 1
Source/Engine/Graphics/ShaderVariation.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 #include "OpenGL/OGLShaderVariation.h"
 #else
 #include "Direct3D9/D3D9ShaderVariation.h"

+ 1 - 1
Source/Engine/Graphics/Texture.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 #include "OpenGL/OGLTexture.h"
 #else
 #include "Direct3D9/D3D9Texture.h"

+ 1 - 1
Source/Engine/Graphics/Texture2D.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 #include "OpenGL/OGLTexture2D.h"
 #else
 #include "Direct3D9/D3D9Texture2D.h"

+ 1 - 1
Source/Engine/Graphics/Texture3D.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 #include "OpenGL/OGLTexture3D.h"
 #else
 #include "Direct3D9/D3D9Texture3D.h"

+ 1 - 1
Source/Engine/Graphics/TextureCube.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 #include "OpenGL/OGLTextureCube.h"
 #else
 #include "Direct3D9/D3D9TextureCube.h"

+ 1 - 1
Source/Engine/Graphics/VertexBuffer.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 #include "OpenGL/OGLVertexBuffer.h"
 #else
 #include "Direct3D9/D3D9VertexBuffer.h"

+ 1 - 1
Source/Engine/Graphics/VertexDeclaration.h

@@ -22,6 +22,6 @@
 
 #pragma once
 
-#ifndef USE_OPENGL
+#ifndef URHO3D_OPENGL
 #include "Direct3D9/D3D9VertexDeclaration.h"
 #endif

+ 13 - 13
Source/Engine/Graphics/View.cpp

@@ -402,7 +402,7 @@ bool View::Define(RenderSurface* renderTarget, Viewport* viewport)
     
     // On OpenGL, flip the projection if rendering to a texture so that the texture can be addressed in the same way
     // as a render texture produced on Direct3D9
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     if (renderTarget_)
         flipVertical_ = true;
     #endif
@@ -453,7 +453,7 @@ bool View::Define(RenderSurface* renderTarget, Viewport* viewport)
     rtSize_ = IntVector2(rtWidth, rtHeight);
     
     // On OpenGL flip the viewport if rendering to a texture for consistent UV addressing with Direct3D9
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     if (renderTarget_)
     {
         viewRect_.bottom_ = rtSize_.y_ - viewRect_.top_;
@@ -546,7 +546,7 @@ void View::Render()
     }
     #endif
     
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     if (camera_)
         camera_->SetFlipVertical(flipVertical_);
     #endif
@@ -554,7 +554,7 @@ void View::Render()
     // Render
     ExecuteRenderPathCommands();
     
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     if (camera_)
         camera_->SetFlipVertical(false);
     #endif
@@ -634,7 +634,7 @@ void View::SetCameraShaderParameters(Camera* camera, bool setProjection, bool ov
     if (camera->IsOrthographic())
     {
         depthMode.x_ = 1.0f;
-        #ifdef USE_OPENGL
+        #ifdef URHO3D_OPENGL
         depthMode.z_ = 0.5f;
         depthMode.w_ = 0.5f;
         #else
@@ -653,7 +653,7 @@ void View::SetCameraShaderParameters(Camera* camera, bool setProjection, bool ov
     if (setProjection)
     {
         Matrix4 projection = camera->GetProjection();
-        #ifdef USE_OPENGL
+        #ifdef URHO3D_OPENGL
         // Add constant depth bias manually to the projection matrix due to glPolygonOffset() inconsistency
         float constantBias = 2.0f * graphics_->GetDepthConstantBias();
         projection.m22_ += projection.m32_ * constantBias;
@@ -1677,7 +1677,7 @@ void View::RenderQuad(RenderPathCommand& command)
     float widthRange = 0.5f * viewSize_.x_ / rtWidth;
     float heightRange = 0.5f * viewSize_.y_ / rtHeight;
     
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     Vector4 bufferUVOffset(((float)viewRect_.left_) / rtWidth + widthRange,
         1.0f - (((float)viewRect_.top_) / rtHeight + heightRange), widthRange, heightRange);
     #else
@@ -1705,7 +1705,7 @@ void View::RenderQuad(RenderPathCommand& command)
         float height = (float)renderTargets_[nameHash]->GetHeight();
         
         graphics_->SetShaderParameter(invSizeName, Vector4(1.0f / width, 1.0f / height, 0.0f, 0.0f));
-        #ifdef USE_OPENGL
+        #ifdef URHO3D_OPENGL
         graphics_->SetShaderParameter(offsetsName, Vector4::ZERO);
         #else
         graphics_->SetShaderParameter(offsetsName, Vector4(0.5f / width, 0.5f / height, 0.0f, 0.0f));
@@ -1781,7 +1781,7 @@ void View::AllocateScreenBuffers()
     bool needSubstitute = false;
     unsigned numViewportTextures = 0;
 
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     // Due to FBO limitations, in OpenGL deferred modes need to render to texture first and then blit to the backbuffer
     // Also, if rendering to a texture with full deferred rendering, it must be RGBA to comply with the rest of the buffers.
     if ((deferred_ && !renderTarget_) || (deferredAmbient_ && renderTarget_ && renderTarget_->GetParentTexture()->GetFormat() !=
@@ -1804,7 +1804,7 @@ void View::AllocateScreenBuffers()
         needSubstitute = true;
     }
 
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     if (deferred_ && !hdrRendering)
         format = Graphics::GetRGBAFormat();
     #endif
@@ -1913,7 +1913,7 @@ void View::BlitFramebuffer(Texture2D* source, RenderSurface* destination, bool d
     float widthRange = 0.5f * viewSize_.x_ / rtWidth;
     float heightRange = 0.5f * viewSize_.y_ / rtHeight;
     
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     Vector4 bufferUVOffset(((float)viewRect_.left_) / rtWidth + widthRange,
         1.0f - (((float)viewRect_.top_) / rtHeight + heightRange), widthRange, heightRange);
     #else
@@ -1934,7 +1934,7 @@ void View::DrawFullscreenQuad(bool nearQuad)
     Matrix3x4 model = Matrix3x4::IDENTITY;
     Matrix4 projection = Matrix4::IDENTITY;
     
-    #ifdef USE_OPENGL
+    #ifdef URHO3D_OPENGL
     if (flipVertical_)
         projection.m11_ = -1.0f;
     model.m23_ = nearQuad ? -1.0f : 1.0f;
@@ -2472,7 +2472,7 @@ void View::FinalizeShadowCamera(Camera* shadowCamera, Light* light, const IntRec
             shadowCamera->SetZoom(shadowCamera->GetZoom() * ((shadowMapWidth - 2.0f) / shadowMapWidth));
         else
         {
-            #ifdef USE_OPENGL
+            #ifdef URHO3D_OPENGL
                 shadowCamera->SetZoom(shadowCamera->GetZoom() * ((shadowMapWidth - 3.0f) / shadowMapWidth));
             #else
                 shadowCamera->SetZoom(shadowCamera->GetZoom() * ((shadowMapWidth - 4.0f) / shadowMapWidth));

+ 4 - 4
Source/Engine/IO/FileWatcher.cpp

@@ -51,7 +51,7 @@ FileWatcher::FileWatcher(Context* context) :
     fileSystem_(GetSubsystem<FileSystem>()),
     watchSubDirs_(false)
 {
-#if defined(ENABLE_FILEWATCHER)
+#if defined(URHO3D_FILEWATCHER)
 #if defined(__linux__)
     watchHandle_ = inotify_init();
 #elif defined(__APPLE__) && !defined(IOS)
@@ -63,7 +63,7 @@ FileWatcher::FileWatcher(Context* context) :
 FileWatcher::~FileWatcher()
 {
     StopWatching();
-#if defined(ENABLE_FILEWATCHER)
+#if defined(URHO3D_FILEWATCHER)
 #if defined(__linux__)
     close(watchHandle_);
 #endif
@@ -81,7 +81,7 @@ bool FileWatcher::StartWatching(const String& pathName, bool watchSubDirs)
     // Stop any previous watching
     StopWatching();
     
-#if defined(ENABLE_FILEWATCHER)
+#if defined(URHO3D_FILEWATCHER)
 #if defined(WIN32)
     String nativePath = GetNativePath(RemoveTrailingSlash(pathName));
     
@@ -216,7 +216,7 @@ void FileWatcher::StopWatching()
 
 void FileWatcher::ThreadFunction()
 {
-#if defined(ENABLE_FILEWATCHER)
+#if defined(URHO3D_FILEWATCHER)
 #if defined(WIN32)
     unsigned char buffer[BUFFERSIZE];
     DWORD bytesFilled = 0;

+ 1 - 1
Source/Engine/IO/Log.h

@@ -92,7 +92,7 @@ private:
     bool quiet_;
 };
 
-#ifdef ENABLE_LOGGING
+#ifdef URHO3D_LOGGING
 #define LOGDEBUG(message) Log::Write(LOG_DEBUG, message)
 #define LOGINFO(message) Log::Write(LOG_INFO, message)
 #define LOGWARNING(message) Log::Write(LOG_WARNING, message)

+ 1 - 1
Source/Engine/Input/CMakeLists.txt

@@ -24,6 +24,6 @@
 define_source_files (PARENT_SCOPE)
 
 # Define dependency libs
-if (USE_OPENGL AND NOT IOS AND NOT ANDROID AND NOT RASPI)
+if (URHO3D_OPENGL AND NOT IOS AND NOT ANDROID AND NOT RASPI)
     set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/GLEW PARENT_SCOPE)
 endif ()

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

@@ -24,7 +24,7 @@
 set (TARGET_NAME LuaScript)
 
 # Optionally enable Lua / C++ wrapper safety checks
-if (NOT ENABLE_SAFE_LUA)
+if (NOT URHO3D_SAFE_LUA)
     add_definitions (-DTOLUA_RELEASE)
 endif ()
 

+ 1 - 1
Source/Engine/Network/Connection.cpp

@@ -254,7 +254,7 @@ void Connection::SendClientUpdate()
 
 void Connection::SendRemoteEvents()
 {
-    #ifdef ENABLE_LOGGING
+    #ifdef URHO3D_LOGGING
     if (logStatistics_ && statsTimer_.GetMSec(false) > STATS_INTERVAL_MSEC)
     {
         statsTimer_.Reset();

+ 2 - 2
Source/Engine/Physics/PhysicsWorld.cpp

@@ -578,7 +578,7 @@ void PhysicsWorld::PreStep(float timeStep)
     SendEvent(E_PHYSICSPRESTEP, eventData);
 
     // Start profiling block for the actual simulation step
-#ifdef ENABLE_PROFILING
+#ifdef URHO3D_PROFILING
     Profiler* profiler = GetSubsystem<Profiler>();
     if (profiler)
         profiler->BeginBlock("StepSimulation");
@@ -587,7 +587,7 @@ void PhysicsWorld::PreStep(float timeStep)
 
 void PhysicsWorld::PostStep(float timeStep)
 {
-#ifdef ENABLE_PROFILING
+#ifdef URHO3D_PROFILING
     Profiler* profiler = GetSubsystem<Profiler>();
     if (profiler)
         profiler->EndBlock();

+ 1 - 1
Source/Engine/Script/IOAPI.cpp

@@ -44,7 +44,7 @@ static Log* GetLog()
     return GetScriptContext()->GetSubsystem<Log>();
 }
 
-#ifdef ENABLE_LOGGING
+#ifdef URHO3D_LOGGING
 
 static void Print(const String& value, bool error)
 {

+ 1 - 1
Source/Engine/Script/Script.cpp

@@ -272,7 +272,7 @@ void Script::SetExecuteConsoleCommands(bool enable)
 
 void Script::DumpAPI(DumpMode mode)
 {
-    // Does not use LOGRAW macro here to ensure the messages are always dumped regardless of ENABLE_LOGGING compiler directive and of Log subsystem availability
+    // Does not use LOGRAW macro here to ensure the messages are always dumped regardless of URHO3D_LOGGING compiler directive and of Log subsystem availability
     if (mode == DOXYGEN)
         Log::WriteRaw("namespace Urho3D\n{\n\n/**\n\\page ScriptAPI Scripting API\n\n");
     else if (mode == C_HEADER)

+ 2 - 2
Source/Engine/Script/Script.h

@@ -69,7 +69,7 @@ public:
     void SetDefaultScene(Scene* scene);
     /// Set whether to execute engine console commands as script code. Default true.
     void SetExecuteConsoleCommands(bool enable);
-    /// Print the whole script API (all registered classes, methods and properties) to the log. No-ops when ENABLE_LOGGING not defined.
+    /// Print the whole script API (all registered classes, methods and properties) to the log. No-ops when URHO3D_LOGGING not defined.
     void DumpAPI(DumpMode mode= DOXYGEN);
     /// Log a message from the script engine.
     void MessageCallback(const asSMessageInfo* msg);
@@ -102,7 +102,7 @@ private:
     unsigned GetScriptNestingLevel() { return scriptNestingLevel_; }
     /// Return a script function/method execution context for the current execution nesting level.
     asIScriptContext* GetScriptFileContext();
-    /// Output a sanitated row of script API. No-ops when ENABLE_LOGGING not defined.
+    /// Output a sanitated row of script API. No-ops when URHO3D_LOGGING not defined.
     void OutputAPIRow(DumpMode mode, const String& row, bool removeReference = false, String separator = ";");
     /// Handle a console command event.
     void HandleConsoleCommand(StringHash eventType, VariantMap& eventData);

+ 1 - 1
Source/Engine/UI/UIBatch.cpp

@@ -32,7 +32,7 @@
 namespace Urho3D
 {
 
-#ifdef USE_OPENGL
+#ifdef URHO3D_OPENGL
 static const float posAdjust = 0.0f;
 #else
 static const float posAdjust = 0.5f;

+ 1 - 1
Source/Extras/Readme.txt

@@ -6,7 +6,7 @@ OgreBatchConverter
 
 - Contributed by Carlo Carollo. Converts multiple Ogre .mesh.xml files (also from
   subdirectories) by invoking the OgreImporter tool. Use the CMake option
-  ENABLE_EXTRAS to include in the build.
+  URHO3D_EXTRAS to include in the build.
 
 OgreMaxscriptExport
 

+ 1 - 1
Source/Samples/01_HelloWorld/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/02_HelloGUI/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/03_Sprites/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/04_StaticScene/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/05_AnimatingScene/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/06_SkeletalAnimation/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/07_Billboards/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/08_Decals/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/09_MultipleViewports/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/10_RenderToTexture/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/11_Physics/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/12_PhysicsStressTest/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/13_Ragdolls/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/14_SoundEffects/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/15_Navigation/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/16_Chat/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/17_SceneReplication/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/18_CharacterDemo/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/19_VehicleDemo/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/20_HugeObjectCount/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/21_AngelScriptIntegration/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/22_LuaIntegration/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/23_Water/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/24_Urho2DSprite/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/25_Urho2DParticle/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/26_ConsoleInput/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/27_Urho2DPhysics/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/28_Urho2DPhysicsRope/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 1 - 1
Source/Samples/29_SoundSynthesis/CMakeLists.txt

@@ -30,4 +30,4 @@ define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
 setup_main_executable ()
 
 # Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${TEST_TIME_OUT})
+add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${URHO3D_TEST_TIME_OUT})

+ 2 - 2
Source/Samples/CMakeLists.txt

@@ -54,10 +54,10 @@ add_subdirectory (17_SceneReplication)
 add_subdirectory (18_CharacterDemo)
 add_subdirectory (19_VehicleDemo)
 add_subdirectory (20_HugeObjectCount)
-if (ENABLE_ANGELSCRIPT)
+if (URHO3D_ANGELSCRIPT)
     add_subdirectory (21_AngelScriptIntegration)
 endif ()
-if (ENABLE_LUA)
+if (URHO3D_LUA)
     add_subdirectory (22_LuaIntegration)
 endif ()
 add_subdirectory (23_Water)

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

@@ -18,7 +18,7 @@ if (IOS OR ANDROID OR RASPI)
     endif ()
 endif ()
 
-if (MSVC AND ENABLE_64BIT)
+if (MSVC AND URHO3D_64BIT)
     enable_language (ASM_MASM)
     # Commented out due to cmake bug
     #set (ASM_FILES source/as_callfunc_x64_msvc_asm.asm)

+ 2 - 2
Source/ThirdParty/Bullet/src/LinearMath/btScalar.h

@@ -69,7 +69,7 @@ inline int	btGetVersion()
 		#else
 
 // Urho3D: allow to disable SSE
-#if (defined (ENABLE_SSE) && defined (_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined (BT_USE_DOUBLE_PRECISION))
+#if (defined (URHO3D_SSE) && defined (_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined (BT_USE_DOUBLE_PRECISION))
 			#if _MSC_VER>1400
 				#define BT_USE_SIMD_VECTOR3
 			#endif
@@ -164,7 +164,7 @@ inline int	btGetVersion()
 	//non-windows systems
 
 // Urho3D: allow to disable SSE
-#if (defined (ENABLE_SSE) && defined (__APPLE__) && (!defined (BT_USE_DOUBLE_PRECISION)))
+#if (defined (URHO3D_SSE) && defined (__APPLE__) && (!defined (BT_USE_DOUBLE_PRECISION)))
     #if defined (__i386__) || defined (__x86_64__)
 		#define BT_USE_SIMD_VECTOR3
 		#define BT_USE_SSE

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

@@ -10,7 +10,7 @@ file (GLOB H_FILES
     src/*.h
 )
 
-if (MSVC AND ENABLE_64BIT)
+if (MSVC AND URHO3D_64BIT)
     enable_language (ASM_MASM)
     # Commented out due to cmake bug
     #set (ASM_FILES src/masm-x64.asm)

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

@@ -34,7 +34,7 @@ setup_library ()
 
 # On Android platform, use 'adb push' to copy the tool(s) from android-Bin to Android (virtual) device; use 'adb shell' to login into a remote shell to execute the tool in the (virtual) device
 # The tools are not built on iOS platform as there is no (easy) way to execute them on the iOS device
-if (NOT IOS AND (NOT DEFINED ENABLE_TOOLS OR ENABLE_TOOLS))
+if (NOT IOS AND URHO3D_TOOLS)
     # 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
 

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

@@ -34,7 +34,7 @@ endif ()
 
 # Makefile: Build mode
 # When LuaJIT is enabled for Urho3D, always build as static library to be linked against in main Urho3D executable or library CMake target
-# Use -DENABLE_LUAJIT_AMALG=1 to compile LuaJIT core as one huge C file and allows GCC to generate faster and shorter code
+# Use -DURHO3D_LUAJIT_AMALG=1 to compile LuaJIT core as one huge C file and allows GCC to generate faster and shorter code
 # Use -Dxxxxx=0/1/2 as CMake build option to turn off/on the features and debugging support below
 
 # Makefile: Features
@@ -120,7 +120,7 @@ if (MSVC)
     endif ()
     set (TARGET_TESTARCH "${TARGET_TESTARCH} LJ_HASJIT ${MSVC_HASJIT}\n")
     
-    if (ENABLE_64BIT)
+    if (URHO3D_64BIT)
         set (MSVC_ARCH_BITS 64)
         set (MSVC_TARGET_ARCH X64)
     else ()
@@ -228,7 +228,7 @@ else ()
     set (LJVM_BOUT lj_vm.s)
     enable_language (ASM)
     if (TARGET_LJARCH STREQUAL x64)
-        if (ENABLE_64BIT)
+        if (URHO3D_64BIT)
             set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -m64")
         else ()
             set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -m32")
@@ -250,7 +250,7 @@ generate_source (vmdef.lua vmdef ${LJLIB_C})
 generate_source (lj_folddef.h folddef src/lj_opt_fold.c)
 
 # Define source files
-if (ENABLE_LUAJIT_AMALG)
+if (URHO3D_LUAJIT_AMALG)
     set (LJCORE_C src/ljamalg.c)
 else ()
     set (LJCORE_C src/lj_gc.c src/lj_err.c src/lj_char.c src/lj_bc.c src/lj_obj.c
@@ -276,7 +276,7 @@ setup_library ()
 
 # On Android platform, use 'adb push' to copy the tool(s) from android-Bin to Android (virtual) device; use 'adb shell' to login into a remote shell to execute the tool in the (virtual) device
 # The tools are not built on iOS platform as there is no (easy) way to execute them on the iOS device
-if (NOT IOS AND (NOT DEFINED ENABLE_TOOLS OR ENABLE_TOOLS))
+if (NOT IOS AND URHO3D_TOOLS)
     # Define target name for LuaJIT interpreter cum compiler
     set (TARGET_NAME luajit_interpreter)   # Note: intended target name is 'luajit' which clashes with 'LuaJIT' library target above for case-insensitive platform
 

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

@@ -46,7 +46,7 @@ find_string ("LJ_TARGET_(X64|X86|ARM|PPC|PPCSPE|MIPS) 1" "${TARGET_TESTARCH}" TA
 if (TARGET_LJARCH)
     string (TOLOWER ${TARGET_LJARCH} TARGET_LJARCH)
     set (TARGET_LJARCH${VARIANT} ${TARGET_LJARCH} CACHE INTERNAL "LUAJIT INTERNAL - TARGET_LJARCH${VARIANT}")
-    if (TARGET_LJARCH STREQUAL x64 AND NOT ENABLE_64BIT)
+    if (TARGET_LJARCH STREQUAL x64 AND NOT URHO3D_64BIT)
         set (TARGET_LJARCH x86)
     endif ()
 else ()
@@ -110,7 +110,7 @@ set (DASM_ARCH ${TARGET_LJARCH})
 # Below regex is a workaround for "LJ_ARCH_BITS (.*?)\\n" as CMake does not understand non-greedy quantifier
 find_string ("LJ_ARCH_BITS ([^\\n]*)" "${TARGET_TESTARCH}" ARCH_BITS ${VARIANT})
 if (ARCH_BITS EQUAL 64)
-    if (ENABLE_64BIT)
+    if (URHO3D_64BIT)
         set (DASM_AFLAGS ${DASM_AFLAGS} -D P64)
     else ()
         set (ARCH_BITS 32)

+ 1 - 1
Source/ThirdParty/toluapp/src/bin/CMakeLists.txt

@@ -15,7 +15,7 @@ endif ()
 set (INCLUDE_DIRS_ONLY ../../include)
 
 # Setup target
-if (ENABLE_LUAJIT AND ENABLE_64BIT AND APPLE AND NOT IOS)
+if (URHO3D_LUAJIT AND URHO3D_64BIT AND APPLE AND NOT IOS)
     setup_macosx_linker_flags (CMAKE_EXE_LINKER_FLAGS)
 endif ()
 setup_executable (NODEPS)

+ 3 - 12
Source/Tools/CMakeLists.txt

@@ -30,23 +30,14 @@ include_directories (${URHO3D_INCLUDE_DIRS})
 # Urho3DPlayer application
 add_subdirectory (Urho3DPlayer)
 
-# Do not build tools for Raspberry Pi unless it is explicitly enabled
-if (NOT DEFINED ENABLE_TOOLS)
-    if (RASPI)
-        set (ENABLE_TOOLS 0)
-    else ()
-        set (ENABLE_TOOLS 1)
-    endif ()
-endif ()
-
-# Do not build tools for iOS and Android regardless of the ENABLE_TOOLS build option
-if (NOT IOS AND NOT ANDROID AND ENABLE_TOOLS)
+# Do not build tools for iOS and Android regardless of the URHO3D_TOOLS build option
+if (NOT IOS AND NOT ANDROID AND URHO3D_TOOLS)
     # Urho3D tools
     add_subdirectory (AssetImporter)
     add_subdirectory (OgreImporter)
     add_subdirectory (PackageTool)
     add_subdirectory (RampGenerator)
-    if (ENABLE_ANGELSCRIPT)
+    if (URHO3D_ANGELSCRIPT)
         add_subdirectory (ScriptCompiler)
     endif ()
 endif ()

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

@@ -30,11 +30,11 @@ define_source_files ()
 setup_main_executable ()
 
 # Setup test cases
-if (ENABLE_ANGELSCRIPT)
-    add_test (NAME Editor COMMAND ${TARGET_NAME} Data/Scripts/Editor.as -w -timeout ${TEST_TIME_OUT})
-    add_test (NAME NinjaSnowWar COMMAND ${TARGET_NAME} Data/Scripts/NinjaSnowWar.as -w -timeout ${TEST_TIME_OUT})
-    add_test (NAME SpritesAS COMMAND ${TARGET_NAME} Data/Scripts/03_Sprites.as -w -timeout ${TEST_TIME_OUT})
+if (URHO3D_ANGELSCRIPT)
+    add_test (NAME Editor COMMAND ${TARGET_NAME} Data/Scripts/Editor.as -w -timeout ${URHO3D_TEST_TIME_OUT})
+    add_test (NAME NinjaSnowWar COMMAND ${TARGET_NAME} Data/Scripts/NinjaSnowWar.as -w -timeout ${URHO3D_TEST_TIME_OUT})
+    add_test (NAME SpritesAS COMMAND ${TARGET_NAME} Data/Scripts/03_Sprites.as -w -timeout ${URHO3D_TEST_TIME_OUT})
 endif ()
-if (ENABLE_LUA)
-    add_test (NAME SpritesLua COMMAND ${TARGET_NAME} Data/LuaScripts/03_Sprites.lua -w -timeout ${TEST_TIME_OUT})
+if (URHO3D_LUA)
+    add_test (NAME SpritesLua COMMAND ${TARGET_NAME} Data/LuaScripts/03_Sprites.lua -w -timeout ${URHO3D_TEST_TIME_OUT})
 endif ()

+ 10 - 10
Source/Tools/Urho3DPlayer/Urho3DPlayer.cpp

@@ -28,12 +28,12 @@
 #include "ResourceCache.h"
 #include "ResourceEvents.h"
 
-#ifdef ENABLE_ANGELSCRIPT
+#ifdef URHO3D_ANGELSCRIPT
 #include "ScriptFile.h"
 #include "Script.h"
 #endif
 
-#ifdef ENABLE_LUA
+#ifdef URHO3D_LUA
 #include "LuaScript.h"
 #endif
 
@@ -122,7 +122,7 @@ void Urho3DPlayer::Start()
     String extension = GetExtension(scriptFileName_);
     if (extension != ".lua" && extension != ".luc")
     {
-#ifdef ENABLE_ANGELSCRIPT
+#ifdef URHO3D_ANGELSCRIPT
         // Instantiate and register the AngelScript subsystem
         context_->RegisterSubsystem(new Script(context_));
 
@@ -130,7 +130,7 @@ void Urho3DPlayer::Start()
         scriptFile_ = GetSubsystem<ResourceCache>()->GetResource<ScriptFile>(scriptFileName_);
 
         /// \hack If we are running the editor, also instantiate Lua subsystem to enable editing Lua ScriptInstances
-#ifdef ENABLE_LUA
+#ifdef URHO3D_LUA
         if (scriptFileName_.Contains("Editor.as", false))
         {
             LuaScript* luaScript = new LuaScript(context_);
@@ -153,7 +153,7 @@ void Urho3DPlayer::Start()
     }
     else
     {
-#ifdef ENABLE_LUA
+#ifdef URHO3D_LUA
         // Instantiate and register the Lua script subsystem
         LuaScript* luaScript = new LuaScript(context_);
         context_->RegisterSubsystem(luaScript);
@@ -176,7 +176,7 @@ void Urho3DPlayer::Start()
 
 void Urho3DPlayer::Stop()
 {
-#ifdef ENABLE_ANGELSCRIPT
+#ifdef URHO3D_ANGELSCRIPT
     if (scriptFile_)
     {
         // Execute the optional stop function
@@ -189,7 +189,7 @@ void Urho3DPlayer::Stop()
     }
 #endif
     
-#ifdef ENABLE_LUA
+#ifdef URHO3D_LUA
     else
     {
         LuaScript* luaScript = GetSubsystem<LuaScript>();
@@ -201,7 +201,7 @@ void Urho3DPlayer::Stop()
 
 void Urho3DPlayer::HandleScriptReloadStarted(StringHash eventType, VariantMap& eventData)
 {
-#ifdef ENABLE_ANGELSCRIPT
+#ifdef URHO3D_ANGELSCRIPT
     if (scriptFile_->GetFunction("void Stop()"))
         scriptFile_->Execute("void Stop()");
 #endif
@@ -209,7 +209,7 @@ void Urho3DPlayer::HandleScriptReloadStarted(StringHash eventType, VariantMap& e
 
 void Urho3DPlayer::HandleScriptReloadFinished(StringHash eventType, VariantMap& eventData)
 {
-#ifdef ENABLE_ANGELSCRIPT
+#ifdef URHO3D_ANGELSCRIPT
     // Restart the script application after reload
     if (!scriptFile_->Execute("void Start()"))
     {
@@ -221,7 +221,7 @@ void Urho3DPlayer::HandleScriptReloadFinished(StringHash eventType, VariantMap&
 
 void Urho3DPlayer::HandleScriptReloadFailed(StringHash eventType, VariantMap& eventData)
 {
-#ifdef ENABLE_ANGELSCRIPT
+#ifdef URHO3D_ANGELSCRIPT
     scriptFile_.Reset();
     ErrorExit();
 #endif

+ 1 - 1
Source/Tools/Urho3DPlayer/Urho3DPlayer.h

@@ -53,7 +53,7 @@ private:
     /// Script file name.
     String scriptFileName_;
     
-#ifdef ENABLE_ANGELSCRIPT
+#ifdef URHO3D_ANGELSCRIPT
     /// Script file.
     SharedPtr<ScriptFile> scriptFile_;
 #endif

+ 3 - 3
cmake_android.bat

@@ -22,14 +22,14 @@
 
 @echo off
 pushd %~dp0
-:: Define USE_MKLINK to 1 to enable out-of-source build and symbolic linking of resources from Bin directory
+:: Define URHO3D_MKLINK to 1 to enable out-of-source build and symbolic linking of resources from Bin directory
 set "build=Source\Android"
 set "source=.."
 set "use_mklink="
-if exist android-Build\CMakeCache.txt. for /F "eol=/ delims=:= tokens=1-3" %%i in (android-Build\CMakeCache.txt) do if "%%i" == "USE_MKLINK" set "use_mklink=%%k"
+if exist android-Build\CMakeCache.txt. for /F "eol=/ delims=:= tokens=1-3" %%i in (android-Build\CMakeCache.txt) do if "%%i" == "URHO3D_MKLINK" set "use_mklink=%%k"
 :loop
 if not "%1" == "" (
-    if "%1" == "-DUSE_MKLINK" set "use_mklink=%~2"
+    if "%1" == "-DURHO3D_MKLINK" set "use_mklink=%~2"
     shift
     shift
     goto loop

+ 3 - 3
cmake_vs2008.bat

@@ -25,11 +25,11 @@ pushd %~dp0
 cmake -E make_directory Build
 set "arch="
 set "version=9 2008"
-if exist Build\CMakeCache.txt. for /F "eol=/ delims=:= tokens=1-3" %%i in (Build\CMakeCache.txt) do if "%%i" == "ENABLE_64BIT" if "%%k" == "1" set "arch= Win64"
+if exist Build\CMakeCache.txt. for /F "eol=/ delims=:= tokens=1-3" %%i in (Build\CMakeCache.txt) do if "%%i" == "URHO3D_64BIT" if "%%k" == "1" set "arch= Win64"
 :loop
 if not "%1" == "" (
-    if "%1" == "-DENABLE_64BIT" if "%~2" == "1" set "arch= Win64"
-    if "%1" == "-DENABLE_64BIT" if "%~2" == "0" set "arch="
+    if "%1" == "-DURHO3D_64BIT" if "%~2" == "1" set "arch= Win64"
+    if "%1" == "-DURHO3D_64BIT" if "%~2" == "0" set "arch="
     if "%1" == "VERSION" set "version=%~2"
     shift
     shift