Browse Source

Merge branch 'library-build'.

Yao Wei Tjong 姚伟忠 12 years ago
parent
commit
e34e26d068
100 changed files with 223 additions and 524 deletions
  1. 0 1
      Docs/Doxyfile.in
  2. 9 11
      Docs/GettingStarted.dox
  3. 6 6
      Docs/Reference.dox
  4. 8 12
      Readme.txt
  5. 21 7
      Source/CMake/Modules/FindUrho3D.cmake
  6. 50 59
      Source/CMake/Modules/Urho3D-CMake-magic.cmake
  7. 40 107
      Source/CMakeLists.txt
  8. 1 1
      Source/Engine/Audio/Audio.h
  9. 3 10
      Source/Engine/Audio/CMakeLists.txt
  10. 0 27
      Source/Engine/Audio/Precompiled.h
  11. 42 24
      Source/Engine/CMakeLists.txt
  12. 1 0
      Source/Engine/Container/Allocator.cpp
  13. 1 7
      Source/Engine/Container/CMakeLists.txt
  14. 1 0
      Source/Engine/Container/HashBase.cpp
  15. 1 0
      Source/Engine/Container/RefCounted.cpp
  16. 1 0
      Source/Engine/Container/Str.cpp
  17. 1 0
      Source/Engine/Container/Swap.cpp
  18. 1 0
      Source/Engine/Container/VectorBase.cpp
  19. 3 12
      Source/Engine/Core/CMakeLists.txt
  20. 0 23
      Source/Engine/Core/Precompiled.cpp
  21. 0 27
      Source/Engine/Core/Precompiled.h
  22. 2 10
      Source/Engine/Engine/CMakeLists.txt
  23. 0 23
      Source/Engine/Engine/Precompiled.cpp
  24. 3 15
      Source/Engine/Graphics/CMakeLists.txt
  25. 1 1
      Source/Engine/Graphics/Direct3D9/D3D9Graphics.h
  26. 1 1
      Source/Engine/Graphics/OpenGL/OGLGraphics.h
  27. 0 23
      Source/Engine/Graphics/Precompiled.cpp
  28. 0 28
      Source/Engine/Graphics/Precompiled.h
  29. 2 11
      Source/Engine/IO/CMakeLists.txt
  30. 0 23
      Source/Engine/IO/Precompiled.cpp
  31. 0 27
      Source/Engine/IO/Precompiled.h
  32. 4 12
      Source/Engine/Input/CMakeLists.txt
  33. 1 0
      Source/Engine/Input/Input.cpp
  34. 16 13
      Source/Engine/LuaScript/CMakeLists.txt
  35. 0 0
      Source/Engine/LuaScript/LuaFile.cpp
  36. 0 0
      Source/Engine/LuaScript/LuaFile.h
  37. 2 2
      Source/Engine/LuaScript/LuaFunction.cpp
  38. 0 0
      Source/Engine/LuaScript/LuaFunction.h
  39. 0 0
      Source/Engine/LuaScript/LuaScript.cpp
  40. 1 1
      Source/Engine/LuaScript/LuaScript.h
  41. 0 0
      Source/Engine/LuaScript/LuaScriptInstance.cpp
  42. 0 0
      Source/Engine/LuaScript/LuaScriptInstance.h
  43. 0 0
      Source/Engine/LuaScript/pkgs/Audio/Audio.pkg
  44. 0 0
      Source/Engine/LuaScript/pkgs/Audio/Sound.pkg
  45. 0 0
      Source/Engine/LuaScript/pkgs/Audio/SoundListener.pkg
  46. 0 0
      Source/Engine/LuaScript/pkgs/Audio/SoundSource.pkg
  47. 0 0
      Source/Engine/LuaScript/pkgs/Audio/SoundSource3D.pkg
  48. 0 0
      Source/Engine/LuaScript/pkgs/AudioLuaAPI.pkg
  49. 0 0
      Source/Engine/LuaScript/pkgs/Container/Vector.pkg
  50. 0 0
      Source/Engine/LuaScript/pkgs/ContainerLuaAPI.pkg
  51. 0 0
      Source/Engine/LuaScript/pkgs/Core/Context.pkg
  52. 0 0
      Source/Engine/LuaScript/pkgs/Core/Object.pkg
  53. 0 0
      Source/Engine/LuaScript/pkgs/Core/ProcessUtils.pkg
  54. 0 0
      Source/Engine/LuaScript/pkgs/Core/StringUtils.pkg
  55. 0 0
      Source/Engine/LuaScript/pkgs/Core/Timer.pkg
  56. 0 0
      Source/Engine/LuaScript/pkgs/Core/Variant.pkg
  57. 0 0
      Source/Engine/LuaScript/pkgs/CoreLuaAPI.pkg
  58. 0 0
      Source/Engine/LuaScript/pkgs/Engine/Console.pkg
  59. 0 0
      Source/Engine/LuaScript/pkgs/Engine/DebugHud.pkg
  60. 0 0
      Source/Engine/LuaScript/pkgs/Engine/Engine.pkg
  61. 0 0
      Source/Engine/LuaScript/pkgs/EngineLuaAPI.pkg
  62. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/AnimatedModel.pkg
  63. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Animation.pkg
  64. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/AnimationController.pkg
  65. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/AnimationState.pkg
  66. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/BillboardSet.pkg
  67. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Camera.pkg
  68. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/DebugRenderer.pkg
  69. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/DecalSet.pkg
  70. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Drawable.pkg
  71. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Graphics.pkg
  72. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/GraphicsDefs.pkg
  73. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Light.pkg
  74. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Material.pkg
  75. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Model.pkg
  76. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Octree.pkg
  77. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/OctreeQuery.pkg
  78. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/ParticleEmitter.pkg
  79. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/RenderPath.pkg
  80. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/RenderSurface.pkg
  81. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Renderer.pkg
  82. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Skeleton.pkg
  83. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Skybox.pkg
  84. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/StaticModel.pkg
  85. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/StaticModelGroup.pkg
  86. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Technique.pkg
  87. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Terrain.pkg
  88. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/TerrainPatch.pkg
  89. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Texture.pkg
  90. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Texture2D.pkg
  91. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/TextureCube.pkg
  92. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Viewport.pkg
  93. 0 0
      Source/Engine/LuaScript/pkgs/Graphics/Zone.pkg
  94. 0 0
      Source/Engine/LuaScript/pkgs/GraphicsLuaAPI.pkg
  95. 0 0
      Source/Engine/LuaScript/pkgs/IO/Deserializer.pkg
  96. 0 0
      Source/Engine/LuaScript/pkgs/IO/File.pkg
  97. 0 0
      Source/Engine/LuaScript/pkgs/IO/FileSystem.pkg
  98. 0 0
      Source/Engine/LuaScript/pkgs/IO/FileWatcher.pkg
  99. 0 0
      Source/Engine/LuaScript/pkgs/IO/Log.pkg
  100. 0 0
      Source/Engine/LuaScript/pkgs/IO/PackageFile.pkg

+ 0 - 1
Docs/Doxyfile.in

@@ -666,7 +666,6 @@ WARN_LOGFILE           =
 # with spaces.
 # with spaces.
 
 
 INPUT                  = Source/Engine \
 INPUT                  = Source/Engine \
-                         Source/Extras/LuaScript \
                          Docs
                          Docs
 
 
 # This tag can be used to specify the character encoding of the source files 
 # This tag can be used to specify the character encoding of the source files 

+ 9 - 11
Docs/GettingStarted.dox

@@ -103,10 +103,10 @@ You can also build, deploy, run/debug (as C/C++ Remote %Application) using Eclip
 
 
 \section Building_Library Library build
 \section Building_Library Library build
 
 
-CMake build configuration has been scripted to generate Urho3D executable as the default build target. This default target builds the Urho3D script host application (a tool to execute AngelScript and Lua script). To change it to generate an Urho3D static or shared (dynamic) library build target instead, specify the build option "-DURHO3D_BUILD_TYPE=STATIC" or "-DURHO3D_BUILD_TYPE=SHARED", respectively. When this option is set, the other build options to generate sample and tool targets are ignored. Due to the way the Urho3D project is being structured and the potential conflict of different visibility (export) attribute settings, when building the Urho3D library target then no other runtime targets can be built at the same time.
+As of v1.31 (to be released), the build process first builds the Urho3D library target (either static or shared). The library is then linked against by other targets like tools and samples that reference Urho3D as one of the external libraries. The Urho3D library type is defaulted to static, so the build process would generate standalone executables as previous releases. The Urho3D library type can be changed using "URHO3D_LIB_TYPE" build option.
 
 
 Refer to \ref UsingLibrary "Using Urho3D as external library" on how to setup your own project to use Urho3D as external library.
 Refer to \ref UsingLibrary "Using Urho3D as external library" on how to setup your own project to use Urho3D as external library.
-    
+
 
 
 \section Building_64bit Desktop 64bit build
 \section Building_64bit Desktop 64bit build
 
 
@@ -138,7 +138,7 @@ A number of build options can be defined explicitly when invoking the above cmak
 |-DUSE_STATIC_RUNTIME=1                       |to use static C/C++ runtime libraries and eliminate the need for runtime DLLs installation (VS 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=user\@target:remote-location |to automatically scp executables to target system (Raspberry Pi cross-compiling build only), SSH digital key must be setup first for this to work|
 |-DSCP_TO_TARGET=user\@target:remote-location |to automatically scp executables to target system (Raspberry Pi cross-compiling build only), SSH digital key must be setup first for this to work|
 |-DCMAKE_BUILD_TYPE=Release/Debug/RelWithDebInfo |to tell CMake which build configuration to be generated, default is Release (cmake_gcc.sh and cmake_eclipse.sh only)|
 |-DCMAKE_BUILD_TYPE=Release/Debug/RelWithDebInfo |to tell CMake which build configuration to be generated, default is Release (cmake_gcc.sh and cmake_eclipse.sh only)|
-|-DURHO3D_BUILD_TYPE=EXE/STATIC/SHARED        |to tell CMake which Urho3D target to be built, default is EXE (Urho3D script host application)|
+|-DURHO3D_LIB_TYPE=STATIC/SHARED              |to specify Urho3D library type, default is STATIC|
 |-DANDROID_ABI=armeabi                        |to build armeabi native code (Android build only), default is armeabi-v7a|
 |-DANDROID_ABI=armeabi                        |to build armeabi native code (Android build only), default is armeabi-v7a|
 
 
 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.
 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.
@@ -265,7 +265,7 @@ F2          Toggle debug HUD
 
 
 \page UsingLibrary Using Urho3D as external library
 \page UsingLibrary Using Urho3D as external library
 
 
-This page shows how to create a new C++ project using Urho3D library as external library. This page assumes that you have already successfully build a static or shared library in the Urho3D project (separately from your own project). In order to find the external library in the Urho3D project build tree, specify an environment variable called "URHO3D_HOME" which points to the root directory of the Urho3D project.  
+This page shows how to create a new C++ project using Urho3D library as external library. This page assumes that you have already successfully build a static or shared library in the Urho3D project (separately from your own project). In order to find the external library in the Urho3D project build tree, specify an environment variable called "URHO3D_HOME" which points to the root directory of the Urho3D project.
 
 
 In your own project root directory, create a new CMakeLists.txt file and add the following lines:
 In your own project root directory, create a new CMakeLists.txt file and add the following lines:
 
 
@@ -302,18 +302,16 @@ set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
 setup_main_executable ()
 setup_main_executable ()
 \endcode
 \endcode
 
 
-Copy the "cmake" sub-directory from Urho3D project to your own project so that CMake can find the Urho3D-specific CMake modules in your project. Instead of copying, for platform that supports symbolic link, you can also create "cmake" symbolic link in your project build tree to point to "cmake" sub-directory from Urho3D project. Alternatively, you can just modify the CMAKE_MODULE_PATH search path above to "$ENV{URHO3D_HOME}/Source/CMake/Modules/".
+Copy the "CMake" sub-directory from Urho3D project to your own project so that CMake can find the Urho3D-specific CMake modules in your project. Instead of copying, for platform that supports symbolic link, you can also create "CMake" symbolic link in your project build tree to point to "CMake" sub-directory from Urho3D project. Alternatively, you can just modify the CMAKE_MODULE_PATH search path above to "$ENV{URHO3D_HOME}/Source/CMake/Modules/".
 
 
-Since your CMake build script include the Urho3D-Cmake-magic module, your project also now has the cross-platform build capability.  
+Since your CMake build script include the Urho3D-Cmake-magic module, your project also now has the cross-platform build capability.
 
 
-When both Urho3D static and shared library are built and available in the Urho3D project build tree, the Urho3D shared library takes precedence over static library to be linked against your own project. You can modify the CMAKE_FIND_LIBRARY_SUFFIXES global variable to change this behaviour. When linking statically against Urho3D static library, you must remember to additionally define "-DURHO3D_STATIC_DEFINE" in your compiler flag, especially on MSVC.
+When both Urho3D static and shared library are built and available in the Urho3D project build tree, the Urho3D shared library takes precedence over static library to be linked against your own project. You can modify the CMAKE_FIND_LIBRARY_SUFFIXES global variable to change this behaviour.
 
 
 
 
 \page Structure Overall structure
 \page Structure Overall structure
 
 
-Urho3D consists of several static libraries that are independent where possible: for example the Graphics library could be used without the Engine library, if only rendering capabilities were desired.
-
-The libraries are the following:
+The Urho3D library consists of the following subdirectories that represent different subsystems:
 
 
 - Container. Provides STL replacement classes and shared pointers.
 - Container. Provides STL replacement classes and shared pointers.
 - Math. Provides vector, quaternion & matrix types and geometric shapes used in intersection tests.
 - Math. Provides vector, quaternion & matrix types and geometric shapes used in intersection tests.
@@ -329,7 +327,7 @@ The libraries are the following:
 - Physics. Provides physics simulation.
 - Physics. Provides physics simulation.
 - Navigation. Provides navigation mesh generation and pathfinding.
 - Navigation. Provides navigation mesh generation and pathfinding.
 - %Script. Provides scripting support using the AngelScript language.
 - %Script. Provides scripting support using the AngelScript language.
-- %Engine. Instantiates the subsystems from the libraries above (except Script, which needs to be instantiated by the application) and manages the main loop iteration.
+- %Engine. Instantiates the subsystems from the modules above (except Script, which needs to be instantiated by the application) and manages the main loop iteration.
 
 
 Third-party libraries are used for the following functionality:
 Third-party libraries are used for the following functionality:
 
 

+ 6 - 6
Docs/Reference.dox

@@ -190,7 +190,7 @@ Note that on iOS calling \ref Engine::Exit "Exit()" is a no-op as there is no of
 
 
 \section MainLoop_ApplicationFramework Application framework
 \section MainLoop_ApplicationFramework Application framework
 
 
-The Application class in the Engine library provides a minimal framework for an Urho3D C++ program with a main loop. It has virtual functions Setup(), Start() and Stop() which can be defined by the application subclass. The header file also provides a macro for defining a program entry point, which
+The Application class provides a minimal framework for an Urho3D C++ program with a main loop. It has virtual functions Setup(), Start() and Stop() which can be defined by the application subclass. The header file also provides a macro for defining a program entry point, which
 will instantiate the Context object and then the user-specified application class. A minimal example, which would just display a blank rendering window and exit by pressing ESC:
 will instantiate the Context object and then the user-specified application class. A minimal example, which would just display a blank rendering window and exit by pressing ESC:
 
 
 \code
 \code
@@ -408,7 +408,7 @@ There are shortcut methods on the script side for creating and accessing a node'
 ScriptObject@ object = node.CreateScriptObject("Scripts/MyClass.as", "MyClass");
 ScriptObject@ object = node.CreateScriptObject("Scripts/MyClass.as", "MyClass");
 \endcode
 \endcode
 
 
-Note that these are not actual Node member functions on the C++ side, as the %Scene library is not allowed to depend on scripting.
+Note that these are not actual Node member functions on the C++ side, as the %Scene classes are not allowed to depend on scripting.
 
 
 \section Scripting_ObjectSerialization Script object serialization
 \section Scripting_ObjectSerialization Script object serialization
 
 
@@ -636,7 +636,7 @@ text:delete()
 
 
 \page Rendering Rendering
 \page Rendering Rendering
 
 
-Much of the rendering functionality in Urho3D is built on two subsystems, Graphics and Renderer, contained within the %Graphics library.
+Much of the rendering functionality in Urho3D is built on two subsystems, Graphics and Renderer.
 
 
 \section Rendering_Graphics Graphics
 \section Rendering_Graphics Graphics
 
 
@@ -1328,7 +1328,7 @@ The Audio subsystem is always instantiated, but in headless mode it is not activ
 
 
 \page Physics Physics
 \page Physics Physics
 
 
-The %Physics library in Urho3D implements rigid body physics simulation using the Bullet library.
+Urho3D implements rigid body physics simulation using the Bullet library.
 
 
 To use, a PhysicsWorld component must first be created to the Scene.
 To use, a PhysicsWorld component must first be created to the Scene.
 
 
@@ -1530,7 +1530,7 @@ The default flags are AM_FILE and AM_NET. Note that it is legal to define neithe
 
 
 \page Network Networking
 \page Network Networking
 
 
-The Network library provides reliable and unreliable UDP messaging using kNet. A server can be created that listens for incoming connections, and client connections can be made to the server. After connecting, code running on the server can assign the client into a scene to enable scene replication, provided that when connecting, the client specified a blank scene for receiving the updates.
+The Network subsystem provides reliable and unreliable UDP messaging using kNet. A server can be created that listens for incoming connections, and client connections can be made to the server. After connecting, code running on the server can assign the client into a scene to enable scene replication, provided that when connecting, the client specified a blank scene for receiving the updates.
 
 
 %Scene replication is one-directional: the server always has authority and sends scene updates to the client at a fixed update rate, by default 30 FPS. The client responds by sending controls updates (buttons, yaw and pitch + possible extra data) also at a fixed rate.
 %Scene replication is one-directional: the server always has authority and sends scene updates to the client at a fixed update rate, by default 30 FPS. The client responds by sending controls updates (buttons, yaw and pitch + possible extra data) also at a fixed rate.
 
 
@@ -1604,7 +1604,7 @@ The controls update message also includes the client's observer position for int
 
 
 \section Network_Messages Raw network messages
 \section Network_Messages Raw network messages
 
 
-All network messages have an integer ID. The first ID you can use for custom messages is 22 (lower ID's are either reserved for kNet's or the %Network library's internal use.) Messages can be sent either unreliably or reliably, in-order or unordered. The data payload is simply raw binary data that can be crafted by using for example VectorBuffer.
+All network messages have an integer ID. The first ID you can use for custom messages is 22 (lower ID's are either reserved for kNet's or the %Network subsystem's internal use.) Messages can be sent either unreliably or reliably, in-order or unordered. The data payload is simply raw binary data that can be crafted by using for example VectorBuffer.
 
 
 To send a message to a Connection, use its \ref Connection::SendMessage "SendMessage()" function. On the server, messages can also be broadcast to all client connections by calling the \ref Network::BroadcastMessage "BroadcastMessage()" function.
 To send a message to a Connection, use its \ref Connection::SendMessage "SendMessage()" function. On the server, messages can also be broadcast to all client connections by calling the \ref Network::BroadcastMessage "BroadcastMessage()" function.
 
 

+ 8 - 12
Readme.txt

@@ -329,16 +329,12 @@ generator.
 Library build
 Library build
 -------------
 -------------
 
 
-CMake build configuration has been scripted to generate Urho3D executable as the
-default build target. This default target builds the Urho3D script host
-application (a tool to execute AngelScript and Lua script). To change it to
-generate an Urho3D static or shared (dynamic) library build target instead,
-specify the build option "-DURHO3D_BUILD_TYPE=STATIC" or
-"-DURHO3D_BUILD_TYPE=SHARED", respectively. When this option is set, the other
-build options to generate sample and tool targets are ignored. Due to the way
-the Urho3D project is being structured and the potential conflict of different
-visibility (export) attribute settings, when building the Urho3D library target
-then no other runtime targets can be built at the same time.
+As of v1.31 (to be released), the build process first builds the Urho3D library
+target (either static or shared). The library is then linked against by other
+targets like tools and samples that reference Urho3D as one of the external
+libraries. The Urho3D library type is defaulted to static, so the build process
+would generate standalone executables as previous releases. The Urho3D library
+type can be changed using "URHO3D_LIB_TYPE" build option.    
 
 
 Refer to "Using Urho3D as external library" on how to setup your own project to
 Refer to "Using Urho3D as external library" on how to setup your own project to
 use Urho3D as external library.
 use Urho3D as external library.
@@ -392,8 +388,8 @@ cmake_xxxx batch files or shell scripts.
 |-DCMAKE_BUILD_TYPE=   |to tell CMake which build configuration to be          |
 |-DCMAKE_BUILD_TYPE=   |to tell CMake which build configuration to be          |
 |  Release/Debug/      | generated, default is Release (cmake_gcc.sh and       |
 |  Release/Debug/      | generated, default is Release (cmake_gcc.sh and       |
 |  RelWithDebInfo      | cmake_eclipse.sh only)                                |
 |  RelWithDebInfo      | cmake_eclipse.sh only)                                |
-|-DURHO3D_BUILD_TYPE=  |to tell CMake which Urho3D target to be built, default |
-|  EXE/STATIC/SHARED   | is EXE (Urho3D script host)                           |          
+|-DURHO3D_LIB_TYPE=    |to specify Urho3D library type, default is STATIC      |
+|  STATIC/SHARED       |                                                       |          
 |-DANDROID_ABI=armeabi |to build armeabi native code (Android build only),     |
 |-DANDROID_ABI=armeabi |to build armeabi native code (Android build only),     |
 |                      | default is armeabi-v7a                                |
 |                      | default is armeabi-v7a                                |
 |----------------------|-------------------------------------------------------|
 |----------------------|-------------------------------------------------------|

+ 21 - 7
Source/CMake/Modules/FindUrho3D.cmake

@@ -20,7 +20,7 @@
 # THE SOFTWARE.
 # THE SOFTWARE.
 #
 #
 
 
-# Find Urho3D library and include directories in the project root tree or installed location
+# Find Urho3D library and include directories in the project root tree or installed location (although there is no install option at the moment)
 # For project root tree detection to work, Urho3D library must be already been built
 # For project root tree detection to work, Urho3D library must be already been built
 #
 #
 #  URHO3D_FOUND
 #  URHO3D_FOUND
@@ -35,7 +35,11 @@ if (WIN32)
     set (URHO3D_LIB_NAMES ${URHO3D_LIB_NAMES} Urho3D_d)
     set (URHO3D_LIB_NAMES ${URHO3D_LIB_NAMES} Urho3D_d)
 endif ()
 endif ()
 
 
-set (URHO3D_HOME $ENV{URHO3D_HOME})
+if (CMAKE_PROJECT_NAME MATCHES Urho3D.* AND PROJECT_ROOT_DIR)
+    set (URHO3D_HOME ${PROJECT_ROOT_DIR})
+else ()
+    set (URHO3D_HOME $ENV{URHO3D_HOME})
+endif ()
 if (URHO3D_HOME)
 if (URHO3D_HOME)
     file (TO_CMAKE_PATH ${URHO3D_HOME} URHO3D_HOME)
     file (TO_CMAKE_PATH ${URHO3D_HOME} URHO3D_HOME)
     
     
@@ -52,6 +56,7 @@ if (URHO3D_HOME)
             ${SOURCE_TREE_PATH}/Graphics
             ${SOURCE_TREE_PATH}/Graphics
             ${SOURCE_TREE_PATH}/Input
             ${SOURCE_TREE_PATH}/Input
             ${SOURCE_TREE_PATH}/IO
             ${SOURCE_TREE_PATH}/IO
+            ${SOURCE_TREE_PATH}/LuaScript
             ${SOURCE_TREE_PATH}/Math
             ${SOURCE_TREE_PATH}/Math
             ${SOURCE_TREE_PATH}/Navigation
             ${SOURCE_TREE_PATH}/Navigation
             ${SOURCE_TREE_PATH}/Network
             ${SOURCE_TREE_PATH}/Network
@@ -60,10 +65,11 @@ if (URHO3D_HOME)
             ${SOURCE_TREE_PATH}/Scene
             ${SOURCE_TREE_PATH}/Scene
             ${SOURCE_TREE_PATH}/Script
             ${SOURCE_TREE_PATH}/Script
             ${SOURCE_TREE_PATH}/UI
             ${SOURCE_TREE_PATH}/UI
-            ${URHO3D_HOME}/Source/Extras/LuaScript
-            ${URHO3D_HOME}/Source/ThirdParty/SDL/include
             ${URHO3D_HOME}/Source/ThirdParty/Bullet/src
             ${URHO3D_HOME}/Source/ThirdParty/Bullet/src
             ${URHO3D_HOME}/Source/ThirdParty/kNet/include
             ${URHO3D_HOME}/Source/ThirdParty/kNet/include
+            ${URHO3D_HOME}/Source/ThirdParty/LZ4
+            ${URHO3D_HOME}/Source/ThirdParty/SDL/include
+            ${URHO3D_HOME}/Source/ThirdParty/STB
         )
         )
 
 
         if (ANDROID)
         if (ANDROID)
@@ -76,11 +82,16 @@ if (URHO3D_HOME)
             set (URHO3D_INCLUDE_DIR ${URHO3D_INCLUDE_DIR} ${URHO3D_HOME}/Build/Engine)
             set (URHO3D_INCLUDE_DIR ${URHO3D_INCLUDE_DIR} ${URHO3D_HOME}/Build/Engine)
             set (URHO3D_LIB_SEARCH_PATH ${URHO3D_HOME}/Lib)
             set (URHO3D_LIB_SEARCH_PATH ${URHO3D_HOME}/Lib)
         endif ()
         endif ()
-        find_library (URHO3D_LIBRARIES NAMES ${URHO3D_LIB_NAMES} PATHS ${URHO3D_LIB_SEARCH_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+        if (TARGET Urho3D_lib)
+            set (URHO3D_LIBRARIES Urho3D_lib)
+            set (FOUND_MESSAGE "Found Urho3D: as CMake target")
+        else ()
+            find_library (URHO3D_LIBRARIES NAMES ${URHO3D_LIB_NAMES} PATHS ${URHO3D_LIB_SEARCH_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+        endif ()
     endif ()
     endif ()
 else ()
 else ()
     set (URHO3D_INC_SEARCH_PATH /opt/include)
     set (URHO3D_INC_SEARCH_PATH /opt/include)
-    find_path (URHO3D_INCLUDE_DIR Urho3D.h ${URHO3D_INC_SEARCH_PATH} PATH_SUFFIXES Urho3D)
+    find_path (URHO3D_INCLUDE_DIR Urho3D.h PATHS ${URHO3D_INC_SEARCH_PATH} PATH_SUFFIXES Urho3D)
     
     
     set (URHO3D_LIB_SEARCH_PATH /opt/lib)
     set (URHO3D_LIB_SEARCH_PATH /opt/lib)
     find_library (URHO3D_LIBRARIES NAMES ${URHO3D_LIB_NAMES} PATHS ${URHO3D_LIB_SEARCH_PATH} PATH_SUFFIXES Urho3D)
     find_library (URHO3D_LIBRARIES NAMES ${URHO3D_LIB_NAMES} PATHS ${URHO3D_LIB_SEARCH_PATH} PATH_SUFFIXES Urho3D)
@@ -88,11 +99,14 @@ endif ()
 
 
 if (URHO3D_INCLUDE_DIR AND URHO3D_LIBRARIES)
 if (URHO3D_INCLUDE_DIR AND URHO3D_LIBRARIES)
     set (URHO3D_FOUND 1)
     set (URHO3D_FOUND 1)
+    if (NOT FOUND_MESSAGE)
+        set (FOUND_MESSAGE "Found Urho3D: ${URHO3D_LIBRARIES}")
+    endif ()
 endif ()
 endif ()
 
 
 if (URHO3D_FOUND)
 if (URHO3D_FOUND)
     include (FindPackageMessage)
     include (FindPackageMessage)
-    FIND_PACKAGE_MESSAGE (Urho3D "Found Urho3D: ${URHO3D_LIBRARIES} ${URHO3D_INCLUDE_DIR}" "[${URHO3D_LIBRARIES}][${URHO3D_INCLUDE_DIR}]")
+    FIND_PACKAGE_MESSAGE (Urho3D ${FOUND_MESSAGE} "[${URHO3D_LIBRARIES}][${URHO3D_INCLUDE_DIR}]")
 else ()
 else ()
     if (Urho3D_FIND_REQUIRED)
     if (Urho3D_FIND_REQUIRED)
         message (FATAL_ERROR "Could not find Urho3D library installation or project root tree via ENV{URHO3D_HOME}")
         message (FATAL_ERROR "Could not find Urho3D library installation or project root tree via ENV{URHO3D_HOME}")

+ 50 - 59
Source/CMake/Modules/Urho3D-CMake-magic.cmake

@@ -83,6 +83,14 @@ if (NOT WIN32)
     add_definitions (-DUNIX)
     add_definitions (-DUNIX)
 endif ()
 endif ()
 
 
+# Default library type is STATIC
+if (URHO3D_LIB_TYPE)
+    string (TOUPPER ${URHO3D_LIB_TYPE} URHO3D_LIB_TYPE)
+endif ()
+if (NOT URHO3D_LIB_TYPE STREQUAL SHARED)
+    add_definitions (-DURHO3D_STATIC_DEFINE)
+endif ()
+
 # If using Windows and not OpenGL, find DirectX SDK include & library directories
 # If using Windows and not OpenGL, find DirectX SDK include & library directories
 # Note: if a recent Windows SDK is installed instead, it will be possible to compile without;
 # Note: if a recent Windows SDK is installed instead, it will be possible to compile without;
 # therefore do not log a fatal error in that case
 # therefore do not log a fatal error in that case
@@ -185,10 +193,6 @@ else ()
     endif ()
     endif ()
 endif ()
 endif ()
 
 
-if (URHO3D_BUILD_TYPE)
-    string (TOUPPER ${URHO3D_BUILD_TYPE} URHO3D_BUILD_TYPE)
-endif ()
-
 # Include CMake builtin module for building shared library support
 # Include CMake builtin module for building shared library support
 include (GenerateExportHeader)
 include (GenerateExportHeader)
 
 
@@ -307,51 +311,35 @@ endmacro ()
 
 
 # Macro for setting up a library target
 # Macro for setting up a library target
 macro (setup_library)
 macro (setup_library)
-    add_library (${TARGET_NAME} ${LIB_TYPE} ${SOURCE_FILES})
+    add_library (${TARGET_NAME} ${ARGN} ${SOURCE_FILES})
     setup_target ()
     setup_target ()
 
 
-    if (CMAKE_PROJECT_NAME STREQUAL Urho3D AND NOT LIB_TYPE STREQUAL SHARED AND URHO3D_BUILD_TYPE MATCHES STATIC|SHARED)
-        set (STATIC_LIBRARY_TARGETS ${STATIC_LIBRARY_TARGETS} ${TARGET_NAME} PARENT_SCOPE)
-        if (URHO3D_BUILD_TYPE STREQUAL SHARED)
-            set_target_properties (${TARGET_NAME} PROPERTIES COMPILE_DEFINITIONS URHO3D_EXPORTS)
-        elseif (URHO3D_BUILD_TYPE STREQUAL STATIC)
-            set_target_properties (${TARGET_NAME} PROPERTIES COMPILE_DEFINITIONS URHO3D_STATIC_DEFINE)
-        endif ()
-
-        if (MSVC)
-            # Specific to VS generator
-            # On VS2008 we need to add a backslash to the IntDir, on later VS it already exists
-            if (CMAKE_GENERATOR MATCHES "2008")
-                set (INTDIR_SLASH "\\")
-            else ()
-                set (INTDIR_SLASH "")
+    if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
+        get_target_property (LIB_TYPE ${TARGET_NAME} TYPE)
+        # Only interested in static library type, i.e. exclude shared and module library types
+        if (LIB_TYPE MATCHES STATIC)
+            set (STATIC_LIBRARY_TARGETS ${STATIC_LIBRARY_TARGETS} ${TARGET_NAME} PARENT_SCOPE)
+            if (URHO3D_LIB_TYPE STREQUAL SHARED)
+                set_target_properties (${TARGET_NAME} PROPERTIES COMPILE_DEFINITIONS URHO3D_EXPORTS)
             endif ()
             endif ()
-            if (USE_MKLINK)
+    
+            if (XCODE)
+                # Specific to Xcode generator
                 set (SYMLINK ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_NAME}.lnk)
                 set (SYMLINK ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_NAME}.lnk)
                 add_custom_command (TARGET ${TARGET_NAME} PRE_LINK
                 add_custom_command (TARGET ${TARGET_NAME} PRE_LINK
-                    COMMAND rd \"${SYMLINK}\"
-                    COMMAND mklink /D \"${SYMLINK}\" \"$(ProjectDir)$(IntDir)\"
+                    COMMAND rm -f ${SYMLINK} && ln -s "$(OBJECT_FILE_DIR)-$(CURRENT_VARIANT)/$(CURRENT_ARCH)" ${SYMLINK}
                     COMMENT "Creating a symbolic link pointing to object file directory")
                     COMMENT "Creating a symbolic link pointing to object file directory")
-            else ()
-                file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_NAME}.dir)
-                add_custom_command (TARGET ${TARGET_NAME} PRE_LINK
-                    COMMAND copy /B \"$(ProjectDir)$(IntDir)${INTDIR_SLASH}*.obj\" \"$(ProjectDir)CMakeFiles\\${TARGET_NAME}.dir\"
-                    COMMENT "Copying object files to a common location also used by Makefile generator")
             endif ()
             endif ()
-        elseif (XCODE)
-            # Specific to Xcode generator
-            set (SYMLINK ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_NAME}.lnk)
-            add_custom_command (TARGET ${TARGET_NAME} PRE_LINK
-                COMMAND rm -f ${SYMLINK} && ln -s "$(OBJECT_FILE_DIR)-$(CURRENT_VARIANT)/$(CURRENT_ARCH)" ${SYMLINK}
-                COMMENT "Creating a symbolic link pointing to object file directory")
         endif ()
         endif ()
     endif ()
     endif ()
 endmacro ()
 endmacro ()
 
 
 # Macro for setting up an executable target
 # Macro for setting up an executable target
 macro (setup_executable)
 macro (setup_executable)
-    add_executable (${TARGET_NAME} ${EXE_TYPE} ${SOURCE_FILES})
+    add_executable (${TARGET_NAME} ${EXE_TYPE} ${SOURCE_FILES})   
+    define_dependency_libs (Urho3D_lib)
     setup_target ()
     setup_target ()
+    
     if (MSVC)
     if (MSVC)
         add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
         add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
             COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different \"$(TARGETPATH)\" \"${PROJECT_ROOT_DIR}/Bin\"
             COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different \"$(TARGETPATH)\" \"${PROJECT_ROOT_DIR}/Bin\"
@@ -360,15 +348,14 @@ macro (setup_executable)
     elseif (IOS)
     elseif (IOS)
         set_target_properties (${TARGET_NAME} PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
         set_target_properties (${TARGET_NAME} PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
     else ()
     else ()
-        get_target_property (EXECUTABLE_NAME ${TARGET_NAME} LOCATION)
         if (CMAKE_CROSSCOMPILING)
         if (CMAKE_CROSSCOMPILING)
             file (MAKE_DIRECTORY ${PROJECT_ROOT_DIR}/Bin-CC)
             file (MAKE_DIRECTORY ${PROJECT_ROOT_DIR}/Bin-CC)
-            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${EXECUTABLE_NAME} ${PROJECT_ROOT_DIR}/Bin-CC)
+            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different $<TARGET_FILE:${TARGET_NAME}> ${PROJECT_ROOT_DIR}/Bin-CC)
             if (SCP_TO_TARGET)
             if (SCP_TO_TARGET)
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp ${EXECUTABLE_NAME} ${SCP_TO_TARGET} || exit 0)
+                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${SCP_TO_TARGET} || exit 0)
             endif ()
             endif ()
         else ()
         else ()
-            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${EXECUTABLE_NAME} ${PROJECT_ROOT_DIR}/Bin)
+            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different $<TARGET_FILE:${TARGET_NAME}> ${PROJECT_ROOT_DIR}/Bin)
         endif ()
         endif ()
     endif ()
     endif ()
 endmacro ()
 endmacro ()
@@ -379,7 +366,7 @@ macro (setup_macosx_linker_flags LINKER_FLAGS)
     set (FLAGS "-framework AudioUnit -framework Carbon -framework Cocoa -framework CoreAudio -framework ForceFeedback -framework IOKit -framework OpenGL -framework CoreServices")
     set (FLAGS "-framework AudioUnit -framework Carbon -framework Cocoa -framework CoreAudio -framework ForceFeedback -framework IOKit -framework OpenGL -framework CoreServices")
     # LuaJIT specific - extra linker flags for linking against LuaJIT in 64-bit Mac OS X desktop build
     # LuaJIT specific - extra linker flags for linking against LuaJIT in 64-bit Mac OS X desktop build
     if (ENABLE_LUAJIT AND ENABLE_64BIT)
     if (ENABLE_LUAJIT AND ENABLE_64BIT)
-        if (URHO3D_BUILD_TYPE STREQUAL SHARED)
+        if (URHO3D_LIB_TYPE STREQUAL SHARED)
             set (FLAGS "${FLAGS} -image_base 7fff04c4a000")
             set (FLAGS "${FLAGS} -image_base 7fff04c4a000")
         else ()
         else ()
             set (FLAGS "${FLAGS} -pagezero_size 10000 -image_base 100000000")
             set (FLAGS "${FLAGS} -pagezero_size 10000 -image_base 100000000")
@@ -403,22 +390,21 @@ macro (setup_main_executable)
         set (SOURCE_FILES ${SOURCE_FILES} ${RESOURCE_FILES})
         set (SOURCE_FILES ${SOURCE_FILES} ${RESOURCE_FILES})
     endif ()
     endif ()
 
 
-    # Define external dependency libraries, for the convenience of other main target (not in Urho3D project) referencing Urho3D as external library
-    if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D AND NOT TARGET_NAME STREQUAL Main)
-        define_dependency_libs (Main)
-    endif ()
-
     # Setup target
     # Setup target
     if (ANDROID)
     if (ANDROID)
         # Add SDL native init function
         # Add SDL native init function
-        if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
-            set (SOURCE_FILES ${SOURCE_FILES} ${PROJECT_SOURCE_DIR}/ThirdParty/SDL/src/main/android/SDL_android_main.c)
+        if (CMAKE_PROJECT_NAME MATCHES Urho3D.*)
+            set (SOURCE_FILES ${SOURCE_FILES} ${PROJECT_ROOT_DIR}/Source/ThirdParty/SDL/src/main/android/SDL_android_main.c)
+            if (TARGET_NAME STREQUAL Urho3D AND URHO3D_LIB_TYPE STREQUAL SHARED)
+                # Rename target name to avoid name clash
+                set (TARGET_NAME Urho3Dapp)
+            endif ()
         elseif (EXISTS $ENV{URHO3D_HOME}/Source/ThirdParty/SDL/src/main/android/SDL_android_main.c)
         elseif (EXISTS $ENV{URHO3D_HOME}/Source/ThirdParty/SDL/src/main/android/SDL_android_main.c)
             set (SOURCE_FILES ${SOURCE_FILES} $ENV{URHO3D_HOME}/Source/ThirdParty/SDL/src/main/android/SDL_android_main.c)
             set (SOURCE_FILES ${SOURCE_FILES} $ENV{URHO3D_HOME}/Source/ThirdParty/SDL/src/main/android/SDL_android_main.c)
         endif ()
         endif ()
         # Setup target as main shared library
         # Setup target as main shared library
-        set (LIB_TYPE SHARED)
-        setup_library ()
+        define_dependency_libs (Urho3D_lib)
+        setup_library (SHARED)
         # Copy other dependent shared libraries to Android library output path
         # Copy other dependent shared libraries to Android library output path
         foreach(FILE ${ABSOLUTE_PATH_LIBS})
         foreach(FILE ${ABSOLUTE_PATH_LIBS})
             get_filename_component (EXT ${FILE} EXT)
             get_filename_component (EXT ${FILE} EXT)
@@ -448,7 +434,7 @@ macro (setup_main_executable)
         endif ()
         endif ()
         setup_executable ()
         setup_executable ()
     endif ()
     endif ()
-
+    
     if (XCODE)
     if (XCODE)
         get_target_property (TARGET_LOC ${TARGET_NAME} LOCATION)
         get_target_property (TARGET_LOC ${TARGET_NAME} LOCATION)
         if (IOS)
         if (IOS)
@@ -480,7 +466,7 @@ endmacro ()
 # It works for both targets setup within Urho3D project and outside Urho3D project that uses Urho3D as external static/shared library
 # It works for both targets setup within Urho3D project and outside Urho3D project that uses Urho3D as external static/shared library
 macro (define_dependency_libs TARGET)
 macro (define_dependency_libs TARGET)
     # ThirdParty/SDL external dependency
     # ThirdParty/SDL external dependency
-    if (${TARGET} MATCHES SDL|Main)
+    if (${TARGET} MATCHES SDL|Urho3D_lib)
         if (WIN32)
         if (WIN32)
             set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} user32 gdi32 winmm imm32 ole32 oleaut32 version uuid)
             set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} user32 gdi32 winmm imm32 ole32 oleaut32 version uuid)
         elseif (APPLE)
         elseif (APPLE)
@@ -496,7 +482,7 @@ macro (define_dependency_libs TARGET)
     endif ()
     endif ()
 
 
     # ThirdParty/kNet & ThirdParty/Civetweb external dependency
     # ThirdParty/kNet & ThirdParty/Civetweb external dependency
-    if (${TARGET} MATCHES Civetweb|kNet|Main)
+    if (${TARGET} MATCHES Civetweb|kNet|Urho3D_lib)
         if (WIN32)
         if (WIN32)
             set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} ws2_32)
             set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} ws2_32)
         elseif (NOT ANDROID)
         elseif (NOT ANDROID)
@@ -505,7 +491,7 @@ macro (define_dependency_libs TARGET)
     endif ()
     endif ()
 
 
     # ThirdParty/LuaJIT external dependency
     # ThirdParty/LuaJIT external dependency
-    if (ENABLE_LUAJIT AND ${TARGET} MATCHES LuaJIT|Main)
+    if (ENABLE_LUAJIT AND ${TARGET} MATCHES LuaJIT|Urho3D_lib)
         if (NOT WIN32)
         if (NOT WIN32)
             set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} dl m)
             set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} dl m)
             if (NOT APPLE)
             if (NOT APPLE)
@@ -515,7 +501,7 @@ macro (define_dependency_libs TARGET)
     endif ()
     endif ()
 
 
     # Engine/Core external dependency
     # Engine/Core external dependency
-    if (${TARGET} MATCHES Core|Main)
+    if (${TARGET} MATCHES Core|Urho3D_lib)
         if (WIN32)
         if (WIN32)
             set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} winmm)
             set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} winmm)
             if (ENABLE_MINIDUMPS)
             if (ENABLE_MINIDUMPS)
@@ -527,7 +513,7 @@ macro (define_dependency_libs TARGET)
     endif ()
     endif ()
 
 
     # Engine/Graphics external dependency
     # Engine/Graphics external dependency
-    if (${TARGET} MATCHES Graphics|Main)
+    if (${TARGET} MATCHES Graphics|Urho3D_lib)
         if (USE_OPENGL)
         if (USE_OPENGL)
             if (WIN32)
             if (WIN32)
                 set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} opengl32)
                 set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} opengl32)
@@ -541,13 +527,18 @@ macro (define_dependency_libs TARGET)
         endif ()
         endif ()
     endif ()
     endif ()
 
 
-    # Main external dependency
-    if (${TARGET} STREQUAL Main AND URHO3D_LIBRARIES)
+    # Urho3D_lib external dependency
+    if (${TARGET} STREQUAL Urho3D_lib AND URHO3D_LIBRARIES)
         set (ABSOLUTE_PATH_LIBS ${ABSOLUTE_PATH_LIBS} ${URHO3D_LIBRARIES})
         set (ABSOLUTE_PATH_LIBS ${ABSOLUTE_PATH_LIBS} ${URHO3D_LIBRARIES})
     endif ()
     endif ()
 
 
     if (LINK_LIBS_ONLY)
     if (LINK_LIBS_ONLY)
-        list (SORT LINK_LIBS_ONLY)
-        list (REMOVE_DUPLICATES LINK_LIBS_ONLY)
+        remove_duplicate (LINK_LIBS_ONLY)
     endif ()
     endif ()
 endmacro ()
 endmacro ()
+
+# Macro for sorting and removing duplicate value
+macro (remove_duplicate LIST_NAME)
+    list (SORT ${LIST_NAME})
+    list (REMOVE_DUPLICATES ${LIST_NAME})
+endmacro ()

+ 40 - 107
Source/CMakeLists.txt

@@ -49,131 +49,64 @@ if (NOT IOS AND NOT ANDROID AND NOT RASPI AND USE_OPENGL)
     add_definitions (-DGLEW_NO_GLU)
     add_definitions (-DGLEW_NO_GLU)
 endif ()
 endif ()
 
 
+# Add definition for Lua and LuaJIT
+if (ENABLE_LUAJIT)
+    add_definitions (-DENABLE_LUAJIT)
+    set (JIT "JIT")
+    # Implied ENABLE_LUA
+    set (ENABLE_LUA 1)
+endif ()
+if (ENABLE_LUA)
+    add_definitions (-DENABLE_LUA)
+endif ()
+
 # Add global include directories for export header and SDL header
 # Add global include directories for export header and SDL header
 include_directories (${CMAKE_BINARY_DIR}/Engine ThirdParty/SDL/include)
 include_directories (${CMAKE_BINARY_DIR}/Engine ThirdParty/SDL/include)
 
 
 # Setup the compiler flags for building shared library
 # Setup the compiler flags for building shared library
-if (URHO3D_BUILD_TYPE STREQUAL SHARED)
+if (URHO3D_LIB_TYPE STREQUAL SHARED)
     # Hide the symbols that are not explicitly marked for export
     # Hide the symbols that are not explicitly marked for export
     add_compiler_export_flags ()
     add_compiler_export_flags ()
     # Use PIC on platforms that support it 
     # Use PIC on platforms that support it 
     set (CMAKE_POSITION_INDEPENDENT_CODE true)
     set (CMAKE_POSITION_INDEPENDENT_CODE true)
 endif ()
 endif ()
 
 
-# Add definition for Lua JIT
-if (ENABLE_LUAJIT)
-    add_definitions (-DENABLE_LUAJIT)
-    set (JIT "JIT")
-    # Implied ENABLE_LUA
-    set (ENABLE_LUA 1)
-endif ()
-
 # Add targets
 # Add targets
-add_subdirectory (Engine/Audio)
-add_subdirectory (Engine/Container)
-add_subdirectory (Engine/Core)
-add_subdirectory (Engine/Engine)
-add_subdirectory (Engine/Graphics)
-add_subdirectory (Engine/Input)
-add_subdirectory (Engine/IO)
-add_subdirectory (Engine/Math)
-add_subdirectory (Engine/Navigation)
-add_subdirectory (Engine/Network)
-add_subdirectory (Engine/Physics)
-add_subdirectory (Engine/Resource)
-add_subdirectory (Engine/Scene)
-add_subdirectory (Engine/Script)
-add_subdirectory (Engine/UI)
-add_subdirectory (ThirdParty/AngelScript)
-add_subdirectory (ThirdParty/Bullet)
-add_subdirectory (ThirdParty/Civetweb)
-add_subdirectory (ThirdParty/Detour)
-add_subdirectory (ThirdParty/FreeType)
-add_subdirectory (ThirdParty/JO)
-add_subdirectory (ThirdParty/kNet)
-add_subdirectory (ThirdParty/LZ4)
-add_subdirectory (ThirdParty/PugiXml)
-add_subdirectory (ThirdParty/Recast)
-add_subdirectory (ThirdParty/SDL)
-add_subdirectory (ThirdParty/StanHull)
-add_subdirectory (ThirdParty/STB)
-
-# Alternative Lua bindings target
+foreach (SOURCE Audio Container Core Engine Graphics Input IO Math Navigation Network Physics Resource Scene Script UI)
+    add_subdirectory (Engine/${SOURCE})
+endforeach ()
+foreach (TARGET AngelScript Bullet Civetweb Detour FreeType JO kNet LZ4 PugiXml Recast SDL StanHull STB)
+    add_subdirectory (ThirdParty/${TARGET})
+endforeach ()
 if (ENABLE_LUA)
 if (ENABLE_LUA)
-    add_definitions (-DENABLE_LUA)
+    add_subdirectory (Engine/LuaScript)
     add_subdirectory (ThirdParty/Lua${JIT})
     add_subdirectory (ThirdParty/Lua${JIT})
     add_subdirectory (ThirdParty/tolua++/src/lib)
     add_subdirectory (ThirdParty/tolua++/src/lib)
-    add_subdirectory (Extras/LuaScript)
 endif ()
 endif ()
-
-if (NOT IOS AND NOT ANDROID)
-    if (ENABLE_LUA)
-        add_subdirectory (ThirdParty/tolua++/src/bin)
-    endif ()
-    if (NOT RASPI)
-        if (USE_OPENGL)
-            add_subdirectory (ThirdParty/GLEW)
-        endif ()
-        add_subdirectory (ThirdParty/LibCpuId)
-    endif ()
-endif ()    
-
-# Urho3D build type is mutually exclusive due to potential different visibility (export) attribute
-if (URHO3D_BUILD_TYPE MATCHES STATIC|SHARED)
-    # Urho3D library
-    add_subdirectory (Engine)
-else ()
-    # Urho3D script host application
-    add_subdirectory (Tools/Urho3D)
-
-    # Do not build tools for embedded system unless it is explicitly enabled
-    if (NOT DEFINED ENABLE_TOOLS)
-        if (RASPI)
-            set (ENABLE_TOOLS 0)
-        else ()
-            set (ENABLE_TOOLS 1)
-        endif ()
-    endif ()
-    
-    if (NOT IOS AND NOT ANDROID)
-        # Urho3D tools
-        if (ENABLE_TOOLS)
-            add_subdirectory (ThirdParty/Assimp)
-            add_subdirectory (Tools/AssetImporter)
-            add_subdirectory (Tools/OgreImporter)
-            add_subdirectory (Tools/PackageTool)
-            add_subdirectory (Tools/RampGenerator)
-            add_subdirectory (Tools/ScriptCompiler)
-            add_subdirectory (Tools/DocConverter)
-        endif ()
-    
-        # Urho3D samples
-        if (ENABLE_SAMPLES)
-            add_subdirectory (Samples)
-        endif ()
-        
-        # Urho3D extras
-        if (ENABLE_EXTRAS)
-            add_subdirectory (Extras/OgreBatchConverter)
-        endif ()
-    endif ()
-    
-    # Urho3D non-GL tools
-    if (NOT USE_OPENGL AND ENABLE_TOOLS)
-        add_subdirectory (ThirdParty/MojoShader)
-        add_subdirectory (Tools/ShaderCompiler)
+if (NOT IOS AND NOT ANDROID AND NOT RASPI)
+    if (USE_OPENGL)
+        add_subdirectory (ThirdParty/GLEW)
     endif ()
     endif ()
+    add_subdirectory (ThirdParty/LibCpuId)
+endif ()
+
+# Urho3D game engine library targets
+add_subdirectory (Engine)
+
+# Urho3D tool targets
+add_subdirectory (Tools)
+
+# Urho3D samples
+# Samples are built on iOS platform too when enabled
+# Although samples should also work for Android platform, currently there is no available mechanism to package each sample apps into individual *.apk
+if (NOT ANDROID AND ENABLE_SAMPLES)
+    add_subdirectory (Samples)
 endif ()
 endif ()
 
 
-# Generate platform specific export header file automatically
-if (NOT URHO3D_BUILD_TYPE STREQUAL URHO3D_EXPORTS_BUILD_TYPE OR ${CMAKE_SOURCE_DIR}/Engine/Urho3D.h.in IS_NEWER_THAN ${CMAKE_BINARY_DIR}/Engine/Urho3D.h)
-    set_target_properties (Urho3D PROPERTIES DEFINE_SYMBOL URHO3D_EXPORTS)
-    generate_export_header (Urho3D EXPORT_MACRO_NAME URHO3D_API EXPORT_FILE_NAME Engine/Urho3D.h)
-    set (URHO3D_EXPORTS_BUILD_TYPE ${URHO3D_BUILD_TYPE} CACHE INTERNAL "Build type when Urho3D export header was last generated")
-    
-    # Append Urho3D license notice to the export header file
-    file (READ ${CMAKE_BINARY_DIR}/Engine/Urho3D.h EXPORT_DEFINE)
-    configure_file (${CMAKE_SOURCE_DIR}/Engine/Urho3D.h.in ${CMAKE_BINARY_DIR}/Engine/Urho3D.h) 
+# Do not build extras for iOS and Android regardless of its build option 
+if (NOT IOS AND NOT ANDROID AND ENABLE_EXTRAS)   
+    # Urho3D extras
+    add_subdirectory (Extras)
 endif ()
 endif ()
 
 
 # Generate platform specific Doxyfile automatically
 # Generate platform specific Doxyfile automatically

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

@@ -125,6 +125,6 @@ private:
 };
 };
 
 
 /// Register Audio library objects.
 /// Register Audio library objects.
-void RegisterAudioLibrary(Context* context);
+void URHO3D_API RegisterAudioLibrary(Context* context);
 
 
 }
 }

+ 3 - 10
Source/Engine/Audio/CMakeLists.txt

@@ -20,18 +20,11 @@
 # THE SOFTWARE.
 # THE SOFTWARE.
 #
 #
 
 
-# Define target name
-set (TARGET_NAME Audio)
-
 # Define source files
 # Define source files
 file (GLOB CPP_FILES *.cpp)
 file (GLOB CPP_FILES *.cpp)
 file (GLOB H_FILES *.h)
 file (GLOB H_FILES *.h)
-set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
+set (ENGINE_SOURCE_FILES ${ENGINE_SOURCE_FILES} ${CPP_FILES} ${H_FILES} PARENT_SCOPE)
 
 
 # Define dependency libs
 # Define dependency libs
-set (LIBS ../Container ../Core ../Graphics ../IO ../Math ../Resource ../Scene ../../ThirdParty/STB)
-set (LINK_LIBS_ONLY SDL)
-
-# Setup target
-enable_pch ()
-setup_library ()
+set (ENGINE_LIBS ${ENGINE_LIBS} ../ThirdParty/STB PARENT_SCOPE)
+set (ENGINE_LINK_LIBS_ONLY ${ENGINE_LINK_LIBS_ONLY} SDL PARENT_SCOPE)

+ 0 - 27
Source/Engine/Audio/Precompiled.h

@@ -1,27 +0,0 @@
-//
-// Copyright (c) 2008-2013 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "HashMap.h"
-#include "HashSet.h"
-#include "Str.h"

+ 42 - 24
Source/Engine/CMakeLists.txt

@@ -21,15 +21,12 @@
 #
 #
 
 
 # Define target name
 # Define target name
-set (TARGET_NAME Urho3D)
-if (URHO3D_BUILD_TYPE STREQUAL SHARED)
-    set (LIB_TYPE SHARED)
-endif ()
+set (TARGET_NAME Urho3D_lib)
 
 
 # Define generated source files
 # Define generated source files
 execute_process (COMMAND git describe --always WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} RESULT_VARIABLE GIT_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
 execute_process (COMMAND git describe --always WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} RESULT_VARIABLE GIT_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
 if (GIT_EXIT_CODE EQUAL 0)
 if (GIT_EXIT_CODE EQUAL 0)
-    if (WIN32)
+    if (CMAKE_HOST_WIN32)
         add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gitversion.h
         add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gitversion.h
             COMMAND for /F %%v in ('git describe --always --dirty') do echo const char* revision="%%v"\; >${CMAKE_CURRENT_BINARY_DIR}/gitversion.h DEPENDS ${STATIC_LIBRARY_TARGETS}
             COMMAND for /F %%v in ('git describe --always --dirty') do echo const char* revision="%%v"\; >${CMAKE_CURRENT_BINARY_DIR}/gitversion.h DEPENDS ${STATIC_LIBRARY_TARGETS}
             WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
             WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
@@ -53,31 +50,28 @@ if (WIN32)
 else ()
 else ()
     set (OBJ_EXT .o)
     set (OBJ_EXT .o)
 endif ()
 endif ()
-
 foreach (TARGET ${STATIC_LIBRARY_TARGETS})
 foreach (TARGET ${STATIC_LIBRARY_TARGETS})
     get_target_property (SOURCES ${TARGET} SOURCES)
     get_target_property (SOURCES ${TARGET} SOURCES)
     get_target_property (INT_DIR ${TARGET} LOCATION)
     get_target_property (INT_DIR ${TARGET} LOCATION)
     get_filename_component (INT_DIR ${INT_DIR} PATH)
     get_filename_component (INT_DIR ${INT_DIR} PATH)
-    set (INT_DIR ${INT_DIR}/CMakeFiles/${TARGET}.dir)
     if (MSVC)
     if (MSVC)
         if (CMAKE_GENERATOR MATCHES "2008")
         if (CMAKE_GENERATOR MATCHES "2008")
-            string (REPLACE /$(OutDir) "" INT_DIR ${INT_DIR})
+            string (REPLACE /$(OutDir) /${TARGET}.dir/$(ConfigurationName) INT_DIR ${INT_DIR})
         else ()
         else ()
-            string (REPLACE /$(Configuration) "" INT_DIR ${INT_DIR})
+            string (REPLACE /$(Configuration) /${TARGET}.dir/$(ConfigurationName) INT_DIR ${INT_DIR})
         endif ()
         endif ()
-        if (USE_MKLINK)
-            string (REGEX REPLACE \\.dir$ .lnk INT_DIR ${INT_DIR})
-        endif ()
-    elseif (XCODE)
+    else ()
+        set (INT_DIR ${INT_DIR}/CMakeFiles/${TARGET}.dir)
+    endif ()
+    if (XCODE)
         string (REPLACE /$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) "" INT_DIR ${INT_DIR})
         string (REPLACE /$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) "" INT_DIR ${INT_DIR})
         string (REGEX REPLACE \\.dir$ .lnk INT_DIR ${INT_DIR})
         string (REGEX REPLACE \\.dir$ .lnk INT_DIR ${INT_DIR})
     endif ()
     endif ()
-    
     foreach (SOURCE ${SOURCES})
     foreach (SOURCE ${SOURCES})
         get_filename_component (NAME ${SOURCE} NAME)
         get_filename_component (NAME ${SOURCE} NAME)
         if (NAME MATCHES \\.c.*$|\\.mm?$|\\.S$|\\.s$)
         if (NAME MATCHES \\.c.*$|\\.mm?$|\\.S$|\\.s$)
             if (MSVC OR XCODE)
             if (MSVC OR XCODE)
-                string (REGEX REPLACE \\.c.*$|\\.mm?$|\\.S$|\\.s$ "" NAME ${NAME}) 
+                string (REGEX REPLACE \\.c.*$|\\.mm?$|\\.S$|\\.s$ "" NAME ${NAME})
             endif ()
             endif ()
             set (SYS_DIR "")
             set (SYS_DIR "")
             if (NOT MSVC AND NOT XCODE)
             if (NOT MSVC AND NOT XCODE)
@@ -106,23 +100,33 @@ endforeach ()
 # Define source files
 # Define source files
 file (GLOB CPP_FILES *.cpp)
 file (GLOB CPP_FILES *.cpp)
 file (GLOB H_FILES *.h)
 file (GLOB H_FILES *.h)
-set (SOURCE_FILES ${CPP_FILES} ${H_FILES} ${OBJ_FILES} gitversion.h)
+set (SOURCE_FILES ${ENGINE_SOURCE_FILES} ${CPP_FILES} ${H_FILES} ${OBJ_FILES} gitversion.h)
 set_source_files_properties (${OBJ_FILES} PROPERTIES GENERATED TRUE)
 set_source_files_properties (${OBJ_FILES} PROPERTIES GENERATED TRUE)
+enable_pch ()
 
 
 # Define dependency libs
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY ${CMAKE_CURRENT_BINARY_DIR})
-if (LIB_TYPE STREQUAL SHARED)
-    define_dependency_libs (Main)
-endif ()
+macro (set_list LIST_NAME)
+    remove_duplicate (ENGINE_${LIST_NAME})
+    set (${LIST_NAME} ${ENGINE_${LIST_NAME}})
+endmacro ()
+foreach (LIST_NAME LIBS INCLUDE_DIRS_ONLY LINK_LIBS_ONLY)
+    set_list (${LIST_NAME})
+endforeach ()
+file (GLOB ENGINE_DIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} */CMakeLists.txt)
+foreach (ENGINE_DIR ${ENGINE_DIRS})
+    get_filename_component (ENGINE_DIR ${ENGINE_DIR} PATH)
+    list (APPEND INCLUDE_DIRS_ONLY ${ENGINE_DIR})
+endforeach ()
 
 
 # Setup target
 # Setup target
-setup_library ()
+setup_library (${URHO3D_LIB_TYPE})
+adjust_library_name ()
 if (NOT GIT_EXIT_CODE EQUAL 0)
 if (NOT GIT_EXIT_CODE EQUAL 0)
     add_dependencies (${TARGET_NAME} ${STATIC_LIBRARY_TARGETS})
     add_dependencies (${TARGET_NAME} ${STATIC_LIBRARY_TARGETS})
 endif ()
 endif ()
 
 
 # Setup the frameworks for Mac OS X platform
 # Setup the frameworks for Mac OS X platform
-if (APPLE AND LIB_TYPE STREQUAL SHARED)
+if (APPLE AND URHO3D_LIB_TYPE STREQUAL SHARED)
     if (IOS)
     if (IOS)
         setup_ios_linker_flags (LINKER_FLAGS)
         setup_ios_linker_flags (LINKER_FLAGS)
     else ()
     else ()
@@ -131,6 +135,17 @@ if (APPLE AND LIB_TYPE STREQUAL SHARED)
     set_target_properties (${TARGET_NAME} PROPERTIES LINK_FLAGS ${LINKER_FLAGS})
     set_target_properties (${TARGET_NAME} PROPERTIES LINK_FLAGS ${LINKER_FLAGS})
 endif ()
 endif ()
 
 
+# Generate platform specific export header file automatically
+if (NOT URHO3D_LIB_TYPE STREQUAL URHO3D_EXPORTS_BUILD_TYPE OR ${CMAKE_CURRENT_SOURCE_DIR}/Urho3D.h.in IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h)
+    set_target_properties (${TARGET_NAME} PROPERTIES DEFINE_SYMBOL URHO3D_EXPORTS)
+    generate_export_header (${TARGET_NAME} BASE_NAME ${LIB_NAME} EXPORT_MACRO_NAME URHO3D_API EXPORT_FILE_NAME Urho3D.h)
+    set (URHO3D_EXPORTS_BUILD_TYPE ${URHO3D_LIB_TYPE} CACHE INTERNAL "Lib type when Urho3D export header was last generated")
+    
+    # Append Urho3D license notice to the export header file
+    file (READ ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h EXPORT_DEFINE)
+    configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Urho3D.h.in ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h) 
+endif ()
+
 # Define post build steps
 # Define post build steps
 file (MAKE_DIRECTORY ${PROJECT_ROOT_DIR}/Lib)
 file (MAKE_DIRECTORY ${PROJECT_ROOT_DIR}/Lib)
 if (MSVC)
 if (MSVC)
@@ -138,14 +153,17 @@ if (MSVC)
         COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different \"$(TARGETPATH)\" \"${PROJECT_ROOT_DIR}/Lib\"
         COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different \"$(TARGETPATH)\" \"${PROJECT_ROOT_DIR}/Lib\"
         COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different \"$(TARGETDIR)$(TARGETNAME).pdb\" \"${PROJECT_ROOT_DIR}/Lib\"
         COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different \"$(TARGETDIR)$(TARGETNAME).pdb\" \"${PROJECT_ROOT_DIR}/Lib\"
         COMMENT "Copying library and debug files to Lib directory")
         COMMENT "Copying library and debug files to Lib directory")
-    if (LIB_TYPE STREQUAL SHARED)
+    if (URHO3D_LIB_TYPE STREQUAL SHARED)
         add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
         add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
             COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different \"$(TARGETDIR)$(TARGETNAME).lib\" \"${PROJECT_ROOT_DIR}/Lib\"
             COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different \"$(TARGETDIR)$(TARGETNAME).lib\" \"${PROJECT_ROOT_DIR}/Lib\"
             COMMENT "Copying import library to Lib directory")
             COMMENT "Copying import library to Lib directory")
+        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+            COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different \"$(TARGETPATH)\" \"${PROJECT_ROOT_DIR}/Bin\"
+            COMMENT "Copying shared library to Bin directory")
     endif ()
     endif ()
 else ()
 else ()
     # Strip the output shared library for embedded devices
     # Strip the output shared library for embedded devices
-    if (LIB_TYPE STREQUAL SHARED AND (CMAKE_CROSSCOMPILING OR IOS))
+    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}>)
         add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${TARGET_NAME}>)
     endif ()
     endif ()
     set (OUTPUT_PATH ${PROJECT_ROOT_DIR}/Lib)
     set (OUTPUT_PATH ${PROJECT_ROOT_DIR}/Lib)

+ 1 - 0
Source/Engine/Container/Allocator.cpp

@@ -20,6 +20,7 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
+#include "Precompiled.h"
 #include "Allocator.h"
 #include "Allocator.h"
 
 
 #include "stdio.h"
 #include "stdio.h"

+ 1 - 7
Source/Engine/Container/CMakeLists.txt

@@ -20,13 +20,7 @@
 # THE SOFTWARE.
 # THE SOFTWARE.
 #
 #
 
 
-# Define target name
-set (TARGET_NAME Container)
-
 # Define source files
 # Define source files
 file (GLOB CPP_FILES *.cpp)
 file (GLOB CPP_FILES *.cpp)
 file (GLOB H_FILES *.h)
 file (GLOB H_FILES *.h)
-set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
-
-# Setup target
-setup_library ()
+set (ENGINE_SOURCE_FILES ${ENGINE_SOURCE_FILES} ${CPP_FILES} ${H_FILES} PARENT_SCOPE)

+ 1 - 0
Source/Engine/Container/HashBase.cpp

@@ -20,6 +20,7 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
+#include "Precompiled.h"
 #include "HashBase.h"
 #include "HashBase.h"
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"

+ 1 - 0
Source/Engine/Container/RefCounted.cpp

@@ -20,6 +20,7 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
+#include "Precompiled.h"
 #include "RefCounted.h"
 #include "RefCounted.h"
 
 
 #include <cassert>
 #include <cassert>

+ 1 - 0
Source/Engine/Container/Str.cpp

@@ -20,6 +20,7 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
+#include "Precompiled.h"
 #include "Str.h"
 #include "Str.h"
 #include "Swap.h"
 #include "Swap.h"
 
 

+ 1 - 0
Source/Engine/Container/Swap.cpp

@@ -20,6 +20,7 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
+#include "Precompiled.h"
 #include "HashBase.h"
 #include "HashBase.h"
 #include "ListBase.h"
 #include "ListBase.h"
 #include "Str.h"
 #include "Str.h"

+ 1 - 0
Source/Engine/Container/VectorBase.cpp

@@ -20,6 +20,7 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
+#include "Precompiled.h"
 #include "VectorBase.h"
 #include "VectorBase.h"
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"

+ 3 - 12
Source/Engine/Core/CMakeLists.txt

@@ -20,22 +20,13 @@
 # THE SOFTWARE.
 # THE SOFTWARE.
 #
 #
 
 
-# Define target name
-set (TARGET_NAME Core)
-
 # Define source files
 # Define source files
 file (GLOB CPP_FILES *.cpp)
 file (GLOB CPP_FILES *.cpp)
 file (GLOB H_FILES *.h)
 file (GLOB H_FILES *.h)
-set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
+set (ENGINE_SOURCE_FILES ${ENGINE_SOURCE_FILES} ${CPP_FILES} ${H_FILES} PARENT_SCOPE)
 
 
 # Define dependency libs
 # Define dependency libs
-set (LIBS ../Container ../Math)
-
 if (NOT IOS AND NOT ANDROID AND NOT RASPI)
 if (NOT IOS AND NOT ANDROID AND NOT RASPI)
-    set (INCLUDE_DIRS_ONLY ../../ThirdParty/LibCpuId/src)
-    set (LINK_LIBS_ONLY LibCpuId)
+    set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/LibCpuId/src PARENT_SCOPE)
+    set (ENGINE_LINK_LIBS_ONLY ${ENGINE_LINK_LIBS_ONLY} LibCpuId PARENT_SCOPE)
 endif ()
 endif ()
-
-# Setup target
-enable_pch ()
-setup_library ()

+ 0 - 23
Source/Engine/Core/Precompiled.cpp

@@ -1,23 +0,0 @@
-//
-// Copyright (c) 2008-2013 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include "Precompiled.h"

+ 0 - 27
Source/Engine/Core/Precompiled.h

@@ -1,27 +0,0 @@
-//
-// Copyright (c) 2008-2013 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "HashMap.h"
-#include "HashSet.h"
-#include "Str.h"

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

@@ -20,18 +20,10 @@
 # THE SOFTWARE.
 # THE SOFTWARE.
 #
 #
 
 
-# Define target name
-set (TARGET_NAME Engine)
-
 # Define source files
 # Define source files
 file (GLOB CPP_FILES *.cpp)
 file (GLOB CPP_FILES *.cpp)
 file (GLOB H_FILES *.h)
 file (GLOB H_FILES *.h)
-set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
+set (ENGINE_SOURCE_FILES ${ENGINE_SOURCE_FILES} ${CPP_FILES} ${H_FILES} PARENT_SCOPE)
 
 
 # Define dependency libs
 # Define dependency libs
-set (LIBS ../Audio ../Container ../Core ../Graphics ../Input ../IO ../Math ../Navigation ../Network ../Physics ../Resource ../Scene ../UI)
-set (INCLUDE_DIRS_ONLY ../../ThirdParty/Bullet/src ../../ThirdParty/kNet/include)
-
-# Setup target
-enable_pch ()
-setup_library ()
+set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/Bullet/src ../ThirdParty/kNet/include PARENT_SCOPE)

+ 0 - 23
Source/Engine/Engine/Precompiled.cpp

@@ -1,23 +0,0 @@
-//
-// Copyright (c) 2008-2013 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include "Precompiled.h"

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

@@ -20,13 +20,9 @@
 # THE SOFTWARE.
 # THE SOFTWARE.
 #
 #
 
 
-# Define target name
-set (TARGET_NAME Graphics)
-
 # Define source files
 # Define source files
 file (GLOB CPP_FILES *.cpp)
 file (GLOB CPP_FILES *.cpp)
 file (GLOB H_FILES *.h)
 file (GLOB H_FILES *.h)
-
 if (USE_OPENGL)
 if (USE_OPENGL)
     file (GLOB SYS_CPP_FILES OpenGL/*.cpp)
     file (GLOB SYS_CPP_FILES OpenGL/*.cpp)
     file (GLOB SYS_H_FILES OpenGL/*.h)
     file (GLOB SYS_H_FILES OpenGL/*.h)
@@ -34,18 +30,10 @@ else ()
     file (GLOB SYS_CPP_FILES Direct3D9/*.cpp)
     file (GLOB SYS_CPP_FILES Direct3D9/*.cpp)
     file (GLOB SYS_H_FILES Direct3D9/*.h)
     file (GLOB SYS_H_FILES Direct3D9/*.h)
 endif ()
 endif ()
-
-set (SOURCE_FILES ${CPP_FILES} ${H_FILES} ${SYS_CPP_FILES} ${SYS_H_FILES})
+set (ENGINE_SOURCE_FILES ${ENGINE_SOURCE_FILES} ${CPP_FILES} ${H_FILES} ${SYS_CPP_FILES} ${SYS_H_FILES} PARENT_SCOPE)
 
 
 # Define dependency libs
 # Define dependency libs
-set (LIBS ../Container ../Core ../IO ../Math ../Resource ../Scene)
-set (INCLUDE_DIRS_ONLY .)
-set (LINK_LIBS_ONLY SDL)
-
+set (ENGINE_LINK_LIBS_ONLY ${ENGINE_LINK_LIBS_ONLY} SDL PARENT_SCOPE)
 if (USE_OPENGL AND NOT IOS AND NOT ANDROID AND NOT RASPI)
 if (USE_OPENGL AND NOT IOS AND NOT ANDROID AND NOT RASPI)
-    set (LIBS ${LIBS} ../../ThirdParty/GLEW)
+    set (ENGINE_LIBS ${ENGINE_LIBS} ../ThirdParty/GLEW PARENT_SCOPE)
 endif ()
 endif ()
-
-# Setup target
-enable_pch ()
-setup_library ()

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

@@ -546,6 +546,6 @@ private:
 };
 };
 
 
 /// Register Graphics library objects.
 /// Register Graphics library objects.
-void RegisterGraphicsLibrary(Context* context);
+void URHO3D_API RegisterGraphicsLibrary(Context* context);
 
 
 }
 }

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

@@ -561,6 +561,6 @@ private:
 };
 };
 
 
 /// Register Graphics library objects.
 /// Register Graphics library objects.
-void RegisterGraphicsLibrary(Context* context_);
+void URHO3D_API RegisterGraphicsLibrary(Context* context_);
 
 
 }
 }

+ 0 - 23
Source/Engine/Graphics/Precompiled.cpp

@@ -1,23 +0,0 @@
-//
-// Copyright (c) 2008-2013 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include "Precompiled.h"

+ 0 - 28
Source/Engine/Graphics/Precompiled.h

@@ -1,28 +0,0 @@
-//
-// Copyright (c) 2008-2013 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "HashMap.h"
-#include "HashSet.h"
-#include "Sort.h"
-#include "Str.h"

+ 2 - 11
Source/Engine/IO/CMakeLists.txt

@@ -20,22 +20,13 @@
 # THE SOFTWARE.
 # THE SOFTWARE.
 #
 #
 
 
-# Define target name
-set (TARGET_NAME IO)
-
 # Define source files
 # Define source files
 file (GLOB CPP_FILES *.cpp)
 file (GLOB CPP_FILES *.cpp)
 file (GLOB H_FILES *.h)
 file (GLOB H_FILES *.h)
-
 if (APPLE AND NOT IOS)
 if (APPLE AND NOT IOS)
     file (GLOB C_FILES *.m)
     file (GLOB C_FILES *.m)
 endif()
 endif()
-
-set (SOURCE_FILES ${CPP_FILES} ${C_FILES} ${H_FILES})
+set (ENGINE_SOURCE_FILES ${ENGINE_SOURCE_FILES} ${CPP_FILES} ${C_FILES} ${H_FILES} PARENT_SCOPE)
 
 
 # Define dependency libs
 # Define dependency libs
-set (LIBS ../Container ../Core ../Math ../../ThirdParty/LZ4)
-
-# Setup target
-enable_pch ()
-setup_library ()
+set (ENGINE_LIBS ${ENGINE_LIBS} ../ThirdParty/LZ4 PARENT_SCOPE)

+ 0 - 23
Source/Engine/IO/Precompiled.cpp

@@ -1,23 +0,0 @@
-//
-// Copyright (c) 2008-2013 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include "Precompiled.h"

+ 0 - 27
Source/Engine/IO/Precompiled.h

@@ -1,27 +0,0 @@
-//
-// Copyright (c) 2008-2013 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "HashMap.h"
-#include "HashSet.h"
-#include "Str.h"

+ 4 - 12
Source/Engine/Input/CMakeLists.txt

@@ -20,21 +20,13 @@
 # THE SOFTWARE.
 # THE SOFTWARE.
 #
 #
 
 
-# Define target name
-set (TARGET_NAME Input)
-
 # Define source files
 # Define source files
 file (GLOB CPP_FILES *.cpp)
 file (GLOB CPP_FILES *.cpp)
 file (GLOB H_FILES *.h)
 file (GLOB H_FILES *.h)
-set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
+set (ENGINE_SOURCE_FILES ${ENGINE_SOURCE_FILES} ${CPP_FILES} ${H_FILES} PARENT_SCOPE)
 
 
 # Define dependency libs
 # Define dependency libs
-set (LIBS ../Container ../Core ../Graphics ../IO ../Math ../Resource ../Scene)
-set (LINK_LIBS_ONLY SDL)
-
-if (NOT IOS AND NOT ANDROID AND NOT RASPI AND USE_OPENGL)
-    set (INCLUDE_DIRS_ONLY ${INCLUDE_DIRS_ONLY} ../../ThirdParty/GLEW)
+set (ENGINE_LINK_LIBS_ONLY ${ENGINE_LINK_LIBS_ONLY} SDL PARENT_SCOPE)
+if (USE_OPENGL AND NOT IOS AND NOT ANDROID AND NOT RASPI)
+    set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/GLEW PARENT_SCOPE)
 endif ()
 endif ()
-
-# Setup target
-setup_library ()

+ 1 - 0
Source/Engine/Input/Input.cpp

@@ -20,6 +20,7 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
+#include "Precompiled.h"
 #include "Context.h"
 #include "Context.h"
 #include "CoreEvents.h"
 #include "CoreEvents.h"
 #include "FileSystem.h"
 #include "FileSystem.h"

+ 16 - 13
Source/Extras/LuaScript/CMakeLists.txt → Source/Engine/LuaScript/CMakeLists.txt

@@ -28,6 +28,17 @@ if (NOT ENABLE_SAFE_LUA)
     add_definitions (-DTOLUA_RELEASE)
     add_definitions (-DTOLUA_RELEASE)
 endif ()
 endif ()
 
 
+# The host tool must be built natively and would be used when cross-compiling
+if (CMAKE_CROSSCOMPILING OR IOS)
+    execute_process (COMMAND ${PROJECT_ROOT_DIR}/Bin/tolua++ -v RESULT_VARIABLE TOLUA_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
+    if (NOT TOLUA_EXIT_CODE EQUAL 0)
+        message (WARNING "For cross-compiling build to be successful, the 'tolua++' tool must be built natively first and present in the 'Bin' folder." )
+    endif ()
+else ()
+    add_subdirectory (../../ThirdParty/tolua++/src/bin ../../ThirdParty/tolua++/src/bin)
+    set (TOLUADEP tolua++)
+endif ()
+
 # Define generated source files
 # Define generated source files
 file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)
 file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)
 file (GLOB API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/*.pkg)
 file (GLOB API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/*.pkg)
@@ -38,7 +49,8 @@ foreach (API_PKG_FILE ${API_PKG_FILES})
     set (GEN_CPP_FILES ${GEN_CPP_FILES} ${GEN_CPP_FILE})
     set (GEN_CPP_FILES ${GEN_CPP_FILES} ${GEN_CPP_FILE})
     file (GLOB PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/${API}/*.pkg)
     file (GLOB PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/${API}/*.pkg)
     add_custom_command (OUTPUT ${GEN_CPP_FILE} 
     add_custom_command (OUTPUT ${GEN_CPP_FILE} 
-        COMMAND ${PROJECT_ROOT_DIR}/Bin/tolua++ -L basic.lua -o ${CMAKE_CURRENT_BINARY_DIR}/${GEN_CPP_FILE} ${NAME} DEPENDS ${API_PKG_FILE} ${PKG_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/basic.lua
+        COMMAND ${PROJECT_ROOT_DIR}/Bin/tolua++ -L basic.lua -o ${CMAKE_CURRENT_BINARY_DIR}/${GEN_CPP_FILE} ${NAME}
+        DEPENDS ${TOLUADEP} ${API_PKG_FILE} ${PKG_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/basic.lua
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pkgs
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pkgs
         COMMENT "Generating tolua++ API binding on the fly for ${API}")
         COMMENT "Generating tolua++ API binding on the fly for ${API}")
 endforeach ()
 endforeach ()
@@ -49,19 +61,10 @@ file (GLOB H_FILES *.h)
 set (SOURCE_FILES ${CPP_FILES} ${H_FILES} ${GEN_CPP_FILES})
 set (SOURCE_FILES ${CPP_FILES} ${H_FILES} ${GEN_CPP_FILES})
 
 
 # Define dependency libs
 # Define dependency libs
-set (LIBS ../../Engine/Audio ../../Engine/Container ../../Engine/Core ../../Engine/Engine ../../Engine/Graphics ../../Engine/Input ../../Engine/IO ../../ThirdParty/Lua${JIT}/src 
-    ../../Engine/Math ../../Engine/Navigation ../../Engine/Network ../../Engine/Physics ../../Engine/Resource ../../Engine/Scene ../../Engine/UI)
+set (LIBS ../../ThirdParty/Lua${JIT}/src)
 set (LINK_LIBS_ONLY tolua++_static)
 set (LINK_LIBS_ONLY tolua++_static)
-set (INCLUDE_DIRS_ONLY . ../../ThirdParty/Bullet/src ../../ThirdParty/kNet/include ../../ThirdParty/tolua++/include)
+set (INCLUDE_DIRS_ONLY . .. ../Audio ../Container ../Core ../Engine ../Graphics ../Input ../IO ../Math ../Navigation ../Network ../Physics ../Resource ../Scene ../UI
+    ../../ThirdParty/Bullet/src ../../ThirdParty/kNet/include ../../ThirdParty/tolua++/include)
 
 
 # Setup target
 # Setup target
-enable_pch ()
 setup_library ()
 setup_library ()
-
-# For IOS, Android, and Raspberry-Pi cross-compiling build to be successful, the "tolua++" tool must be already present in the "Bin" folder
-# One way to achieve this is to first do a native desktop build where all the tools would be generated, then switch to IOS/Android/Raspberry-Pi cross-compiling build
-# Intentionally do not include NOT RASPI in the condition below because the dependency is still required for Raspberry Pi native build
-if (NOT IOS AND NOT ANDROID)
-    # Add dependency to the "tolua++" bin tool
-    add_dependencies (${TARGET_NAME} tolua++)
-endif ()

+ 0 - 0
Source/Extras/LuaScript/LuaFile.cpp → Source/Engine/LuaScript/LuaFile.cpp


+ 0 - 0
Source/Extras/LuaScript/LuaFile.h → Source/Engine/LuaScript/LuaFile.h


+ 2 - 2
Source/Extras/LuaScript/LuaFunction.cpp → Source/Engine/LuaScript/LuaFunction.cpp

@@ -26,7 +26,6 @@
 #include "LuaScript.h"
 #include "LuaScript.h"
 #include "LuaScriptInstance.h"
 #include "LuaScriptInstance.h"
 #include "VectorBuffer.h"
 #include "VectorBuffer.h"
-#include "tolua++urho3d.h"
 
 
 extern "C"
 extern "C"
 {
 {
@@ -35,6 +34,7 @@ extern "C"
 #include <lauxlib.h>
 #include <lauxlib.h>
 }
 }
 #include "tolua++.h"
 #include "tolua++.h"
+#include "tolua++urho3d.h"
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
@@ -208,4 +208,4 @@ bool LuaFunction::PushLuaTable(const String& tableName)
     return true;
     return true;
 }
 }
 
 
-}
+}

+ 0 - 0
Source/Extras/LuaScript/LuaFunction.h → Source/Engine/LuaScript/LuaFunction.h


+ 0 - 0
Source/Extras/LuaScript/LuaScript.cpp → Source/Engine/LuaScript/LuaScript.cpp


+ 1 - 1
Source/Extras/LuaScript/LuaScript.h → Source/Engine/LuaScript/LuaScript.h

@@ -104,7 +104,7 @@ private:
 };
 };
 
 
 /// Register Lua script library objects.
 /// Register Lua script library objects.
-void RegisterLuaScriptLibrary(Context* context);
+void URHO3D_API RegisterLuaScriptLibrary(Context* context);
 
 
 /// Return context.
 /// Return context.
 Context* GetContext();
 Context* GetContext();

+ 0 - 0
Source/Extras/LuaScript/LuaScriptInstance.cpp → Source/Engine/LuaScript/LuaScriptInstance.cpp


+ 0 - 0
Source/Extras/LuaScript/LuaScriptInstance.h → Source/Engine/LuaScript/LuaScriptInstance.h


+ 0 - 0
Source/Extras/LuaScript/pkgs/Audio/Audio.pkg → Source/Engine/LuaScript/pkgs/Audio/Audio.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Audio/Sound.pkg → Source/Engine/LuaScript/pkgs/Audio/Sound.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Audio/SoundListener.pkg → Source/Engine/LuaScript/pkgs/Audio/SoundListener.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Audio/SoundSource.pkg → Source/Engine/LuaScript/pkgs/Audio/SoundSource.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Audio/SoundSource3D.pkg → Source/Engine/LuaScript/pkgs/Audio/SoundSource3D.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/AudioLuaAPI.pkg → Source/Engine/LuaScript/pkgs/AudioLuaAPI.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Container/Vector.pkg → Source/Engine/LuaScript/pkgs/Container/Vector.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/ContainerLuaAPI.pkg → Source/Engine/LuaScript/pkgs/ContainerLuaAPI.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Core/Context.pkg → Source/Engine/LuaScript/pkgs/Core/Context.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Core/Object.pkg → Source/Engine/LuaScript/pkgs/Core/Object.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Core/ProcessUtils.pkg → Source/Engine/LuaScript/pkgs/Core/ProcessUtils.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Core/StringUtils.pkg → Source/Engine/LuaScript/pkgs/Core/StringUtils.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Core/Timer.pkg → Source/Engine/LuaScript/pkgs/Core/Timer.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Core/Variant.pkg → Source/Engine/LuaScript/pkgs/Core/Variant.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/CoreLuaAPI.pkg → Source/Engine/LuaScript/pkgs/CoreLuaAPI.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Engine/Console.pkg → Source/Engine/LuaScript/pkgs/Engine/Console.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Engine/DebugHud.pkg → Source/Engine/LuaScript/pkgs/Engine/DebugHud.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Engine/Engine.pkg → Source/Engine/LuaScript/pkgs/Engine/Engine.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/EngineLuaAPI.pkg → Source/Engine/LuaScript/pkgs/EngineLuaAPI.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/AnimatedModel.pkg → Source/Engine/LuaScript/pkgs/Graphics/AnimatedModel.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Animation.pkg → Source/Engine/LuaScript/pkgs/Graphics/Animation.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/AnimationController.pkg → Source/Engine/LuaScript/pkgs/Graphics/AnimationController.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/AnimationState.pkg → Source/Engine/LuaScript/pkgs/Graphics/AnimationState.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/BillboardSet.pkg → Source/Engine/LuaScript/pkgs/Graphics/BillboardSet.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Camera.pkg → Source/Engine/LuaScript/pkgs/Graphics/Camera.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/DebugRenderer.pkg → Source/Engine/LuaScript/pkgs/Graphics/DebugRenderer.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/DecalSet.pkg → Source/Engine/LuaScript/pkgs/Graphics/DecalSet.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Drawable.pkg → Source/Engine/LuaScript/pkgs/Graphics/Drawable.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Graphics.pkg → Source/Engine/LuaScript/pkgs/Graphics/Graphics.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/GraphicsDefs.pkg → Source/Engine/LuaScript/pkgs/Graphics/GraphicsDefs.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Light.pkg → Source/Engine/LuaScript/pkgs/Graphics/Light.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Material.pkg → Source/Engine/LuaScript/pkgs/Graphics/Material.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Model.pkg → Source/Engine/LuaScript/pkgs/Graphics/Model.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Octree.pkg → Source/Engine/LuaScript/pkgs/Graphics/Octree.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/OctreeQuery.pkg → Source/Engine/LuaScript/pkgs/Graphics/OctreeQuery.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/ParticleEmitter.pkg → Source/Engine/LuaScript/pkgs/Graphics/ParticleEmitter.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/RenderPath.pkg → Source/Engine/LuaScript/pkgs/Graphics/RenderPath.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/RenderSurface.pkg → Source/Engine/LuaScript/pkgs/Graphics/RenderSurface.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Renderer.pkg → Source/Engine/LuaScript/pkgs/Graphics/Renderer.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Skeleton.pkg → Source/Engine/LuaScript/pkgs/Graphics/Skeleton.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Skybox.pkg → Source/Engine/LuaScript/pkgs/Graphics/Skybox.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/StaticModel.pkg → Source/Engine/LuaScript/pkgs/Graphics/StaticModel.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/StaticModelGroup.pkg → Source/Engine/LuaScript/pkgs/Graphics/StaticModelGroup.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Technique.pkg → Source/Engine/LuaScript/pkgs/Graphics/Technique.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Terrain.pkg → Source/Engine/LuaScript/pkgs/Graphics/Terrain.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/TerrainPatch.pkg → Source/Engine/LuaScript/pkgs/Graphics/TerrainPatch.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Texture.pkg → Source/Engine/LuaScript/pkgs/Graphics/Texture.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Texture2D.pkg → Source/Engine/LuaScript/pkgs/Graphics/Texture2D.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/TextureCube.pkg → Source/Engine/LuaScript/pkgs/Graphics/TextureCube.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Viewport.pkg → Source/Engine/LuaScript/pkgs/Graphics/Viewport.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/Graphics/Zone.pkg → Source/Engine/LuaScript/pkgs/Graphics/Zone.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/GraphicsLuaAPI.pkg → Source/Engine/LuaScript/pkgs/GraphicsLuaAPI.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/IO/Deserializer.pkg → Source/Engine/LuaScript/pkgs/IO/Deserializer.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/IO/File.pkg → Source/Engine/LuaScript/pkgs/IO/File.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/IO/FileSystem.pkg → Source/Engine/LuaScript/pkgs/IO/FileSystem.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/IO/FileWatcher.pkg → Source/Engine/LuaScript/pkgs/IO/FileWatcher.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/IO/Log.pkg → Source/Engine/LuaScript/pkgs/IO/Log.pkg


+ 0 - 0
Source/Extras/LuaScript/pkgs/IO/PackageFile.pkg → Source/Engine/LuaScript/pkgs/IO/PackageFile.pkg


Some files were not shown because too many files changed in this diff