Browse Source

Finalize SDK-like include dirs clean up. Fix build using MSVC.

Yao Wei Tjong 姚伟忠 11 years ago
parent
commit
1cbbb6b805
63 changed files with 241 additions and 258 deletions
  1. 10 2
      CMake/Modules/FindUrho3D.cmake
  2. 3 1
      CMake/Modules/GetUrho3DRevision.cmake
  3. 8 6
      CMake/Modules/Urho3D-CMake-common.cmake
  4. 2 2
      CMakeLists.txt
  5. 2 2
      Docs/GettingStarted.dox
  6. 2 2
      Rakefile
  7. 1 1
      Source/ThirdParty/AngelScript/CMakeLists.txt
  8. 1 1
      Source/ThirdParty/Box2D/CMakeLists.txt
  9. 2 2
      Source/ThirdParty/Bullet/CMakeLists.txt
  10. 6 4
      Source/ThirdParty/SDL/CMakeLists.txt
  11. 16 14
      Source/ThirdParty/kNet/CMakeLists.txt
  12. 1 4
      Source/ThirdParty/kNet/include/kNet/Types.h
  13. 1 1
      Source/Tools/AssetImporter/AssetImporter.cpp
  14. 20 19
      Source/Urho3D/CMakeLists.txt
  15. 1 1
      Source/Urho3D/Core/MiniDump.cpp
  16. 3 3
      Source/Urho3D/Core/Object.h
  17. 0 9
      Source/Urho3D/Engine/CMakeLists.txt
  18. 1 1
      Source/Urho3D/Graphics/Direct3D9/D3D9GPUObject.h
  19. 9 9
      Source/Urho3D/Graphics/Direct3D9/D3D9Graphics.h
  20. 1 1
      Source/Urho3D/Graphics/Direct3D9/D3D9GraphicsImpl.h
  21. 4 4
      Source/Urho3D/Graphics/Direct3D9/D3D9IndexBuffer.h
  22. 2 2
      Source/Urho3D/Graphics/Direct3D9/D3D9RenderSurface.h
  23. 5 5
      Source/Urho3D/Graphics/Direct3D9/D3D9ShaderVariation.h
  24. 4 4
      Source/Urho3D/Graphics/Direct3D9/D3D9Texture.h
  25. 3 3
      Source/Urho3D/Graphics/Direct3D9/D3D9Texture2D.h
  26. 3 3
      Source/Urho3D/Graphics/Direct3D9/D3D9Texture3D.h
  27. 3 3
      Source/Urho3D/Graphics/Direct3D9/D3D9TextureCube.h
  28. 3 3
      Source/Urho3D/Graphics/Direct3D9/D3D9VertexBuffer.h
  29. 3 3
      Source/Urho3D/Graphics/Direct3D9/D3D9VertexDeclaration.h
  30. 1 1
      Source/Urho3D/Graphics/OpenGL/OGLGPUObject.h
  31. 8 8
      Source/Urho3D/Graphics/OpenGL/OGLGraphics.h
  32. 3 3
      Source/Urho3D/Graphics/OpenGL/OGLGraphicsImpl.h
  33. 4 4
      Source/Urho3D/Graphics/OpenGL/OGLIndexBuffer.h
  34. 2 2
      Source/Urho3D/Graphics/OpenGL/OGLRenderSurface.h
  35. 4 4
      Source/Urho3D/Graphics/OpenGL/OGLShaderProgram.h
  36. 4 4
      Source/Urho3D/Graphics/OpenGL/OGLShaderVariation.h
  37. 4 4
      Source/Urho3D/Graphics/OpenGL/OGLTexture.h
  38. 3 3
      Source/Urho3D/Graphics/OpenGL/OGLTexture2D.h
  39. 4 4
      Source/Urho3D/Graphics/OpenGL/OGLTexture3D.h
  40. 3 3
      Source/Urho3D/Graphics/OpenGL/OGLTextureCube.h
  41. 3 3
      Source/Urho3D/Graphics/OpenGL/OGLVertexBuffer.h
  42. 32 39
      Source/Urho3D/LuaScript/CMakeLists.txt
  43. 1 1
      Source/Urho3D/Network/CMakeLists.txt
  44. 1 1
      Source/Urho3D/Network/Connection.cpp
  45. 1 1
      Source/Urho3D/Network/Connection.h
  46. 1 1
      Source/Urho3D/Network/Network.cpp
  47. 2 2
      Source/Urho3D/Network/Network.h
  48. 1 1
      Source/Urho3D/Physics/CMakeLists.txt
  49. 13 13
      Source/Urho3D/Physics/CollisionShape.cpp
  50. 5 5
      Source/Urho3D/Physics/Constraint.cpp
  51. 2 2
      Source/Urho3D/Physics/PhysicsUtils.h
  52. 8 8
      Source/Urho3D/Physics/PhysicsWorld.cpp
  53. 3 3
      Source/Urho3D/Physics/RigidBody.cpp
  54. 1 1
      Source/Urho3D/Script/APITemplates.h
  55. 1 1
      Source/Urho3D/Script/Addons.h
  56. 0 10
      Source/Urho3D/Script/CMakeLists.txt
  57. 1 1
      Source/Urho3D/Script/MathAPI.cpp
  58. 1 1
      Source/Urho3D/Script/Script.cpp
  59. 1 1
      Source/Urho3D/Script/ScriptAPIDump.cpp
  60. 1 1
      Source/Urho3D/Script/ScriptFile.cpp
  61. 1 1
      Source/Urho3D/Script/ScriptInstance.cpp
  62. 0 3
      Source/Urho3D/Urho2D/CMakeLists.txt
  63. 1 3
      cmake_generic.bat

+ 10 - 2
CMake/Modules/FindUrho3D.cmake

@@ -57,7 +57,12 @@ set (PATH_SUFFIX Urho3D)
 if (CMAKE_PROJECT_NAME STREQUAL Urho3D AND TARGET Urho3D)
     # Library location is already known to be in the build tree
     set (URHO3D_HOME ${CMAKE_BINARY_DIR})
-    set (URHO3D_INCLUDE_DIRS ${URHO3D_HOME}/include/${PATH_SUFFIX} ${URHO3D_HOME}/include)
+    set (URHO3D_INCLUDE_DIRS ${URHO3D_HOME}/include ${URHO3D_HOME}/include/${PATH_SUFFIX}/ThirdParty)
+    if (URHO3D_PHYSICS)
+        # Bullet library depends on its own include dir to be added in the header search path
+        # This is more practical than patching its header files in many places to make them work with relative path
+        list (APPEND URHO3D_INCLUDE_DIRS ${URHO3D_HOME}/include/${PATH_SUFFIX}/ThirdParty/Bullet)
+    endif ()
     set (URHO3D_LIBRARIES Urho3D)
     set (FOUND_MESSAGE "Found Urho3D: as CMake target")
 else ()
@@ -103,7 +108,10 @@ else ()
     endif ()
     if (URHO3D_INCLUDE_DIRS)
         get_filename_component (PATH ${URHO3D_INCLUDE_DIRS} PATH)
-        list (APPEND URHO3D_INCLUDE_DIRS ${PATH})   # Note: variable change to list context after this
+        set (URHO3D_INCLUDE_DIRS ${PATH} ${URHO3D_INCLUDE_DIRS}/ThirdParty)
+        if (URHO3D_PHYSICS)
+            list (APPEND URHO3D_INCLUDE_DIRS ${URHO3D_INCLUDE_DIRS}/ThirdParty/Bullet)
+        endif ()
         if (NOT URHO3D_HOME)
             # URHO3D_HOME is not set when using SDK installed on system-wide default location, so set it now
             get_filename_component (PATH ${PATH} PATH)

+ 3 - 1
CMake/Modules/GetUrho3DRevision.cmake

@@ -35,7 +35,9 @@ if (NOT GIT_EXIT_CODE EQUAL 0)
 endif ()
 if (FILENAME)
     # Output complete revision number to a file
-    file (WRITE ${FILENAME} "const char* revision=\"${LIB_REVISION}\";\n")
+    file (WRITE ${FILENAME}.new "const char* revision=\"${LIB_REVISION}\";\n")
+    execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILENAME}.new ${FILENAME})
+    file (REMOVE ${FILENAME}.new)
 else ()
     # Output just major.minor.patch number to stdout
     string (REGEX MATCH "[^.]+\\.[^-]+" VERSION ${LIB_REVISION})            # Assume release tag always has major.minor format

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

@@ -125,10 +125,10 @@ elseif (WIN32)
 endif ()
 if (CMAKE_HOST_WIN32 AND NOT DEFINED URHO3D_MKLINK)
     # Test whether the host system is capable of setting up symbolic link
-    execute_process (COMMAND mklink test-link CMakeCache.txt RESULT_VARIABLE MKLINK_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
+    execute_process (COMMAND cmd /C mklink test-link CMakeCache.txt RESULT_VARIABLE MKLINK_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
     if (MKLINK_EXIT_CODE EQUAL 0)
         set (URHO3D_MKLINK TRUE)
-        file (REMOVE test-link)
+        file (REMOVE ${CMAKE_BINARY_DIR}/test-link)
     else ()
         set (URHO3D_MKLINK FALSE)
     endif ()
@@ -411,7 +411,9 @@ macro (create_symlink SOURCE DESTINATION)
         endif ()
         if (URHO3D_MKLINK)
             if (NOT EXISTS ${DESTINATION})
-                execute_process (COMMAND mklink ${SLASH_D} ${DESTINATION} ${SOURCE})
+                file (TO_NATIVE_PATH ${DESTINATION} NATIVE_DESTINATION)
+                file (TO_NATIVE_PATH ${SOURCE} NATIVE_SOURCE)
+                execute_process (COMMAND cmd /C mklink ${SLASH_D} ${NATIVE_DESTINATION} ${NATIVE_SOURCE} OUTPUT_QUIET ERROR_QUIET)
             endif ()
         elseif (${ARGN} STREQUAL FALLBACK_TO_COPY)
             if (NOT IS_ABSOLUTE ${SOURCE})
@@ -682,7 +684,7 @@ macro (setup_main_executable)
 
     if (ANDROID)
         # Add SDL native init function, SDL_Main() entry point must be defined by one of the source files in ${SOURCE_FILES}
-        find_file (ANDROID_MAIN_C_PATH SDL_android_main.c HINTS ${URHO3D_HOME}/include/${PATH_SUFFIX}/SDL/android PATH_SUFFIXES ${PATH_SUFFIX} DOC "Path to SDL_android_main.c" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+        find_file (ANDROID_MAIN_C_PATH SDL_android_main.c HINTS ${URHO3D_HOME}/include/${PATH_SUFFIX}/ThirdParty/SDL/android PATH_SUFFIXES ${PATH_SUFFIX} DOC "Path to SDL_android_main.c" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
         mark_as_advanced (ANDROID_MAIN_C_PATH)  # Hide it from cmake-gui in non-advanced mode
         if (ANDROID_MAIN_C_PATH)
             list (APPEND SOURCE_FILES ${ANDROID_MAIN_C_PATH})
@@ -944,13 +946,13 @@ macro (install_header_files)
         endif ()
         if (INSTALL_SOURCE MATCHES /$)
             if (ARG_USE_FILE_SYMLINK)
+                set (GLOBBING_EXPRESSION RELATIVE ${INSTALL_SOURCE})
                 if (ARG_FILES_MATCHING)
-                    set (GLOBBING_EXPRESSION RELATIVE ${INSTALL_SOURCE})
                     foreach (PATTERN ${ARG_PATTERN})
                         list (APPEND GLOBBING_EXPRESSION ${INSTALL_SOURCE}${PATTERN})
                     endforeach ()
                 else ()
-                    set (GLOBBING_EXPRESSION ${INSTALL_SOURCE}*)
+                    list (APPEND GLOBBING_EXPRESSION ${INSTALL_SOURCE}*)
                 endif ()
                 file (GLOB_RECURSE NAMES ${GLOBBING_EXPRESSION})
                 foreach (NAME ${NAMES})

+ 2 - 2
CMakeLists.txt

@@ -145,8 +145,8 @@ endif ()
 include (CPack)
 
 # Setup SDK-like include dir in the build tree
-foreach (DIR Direct3D9 OpenGL SDL)
-    file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/${DIR})
+foreach (DIR Direct3D9 OpenGL ThirdParty/SDL ThirdParty/kNet/win32)
+    file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/${DIR})    # CMake creates parent directories as needed automatically
 endforeach ()
 
 # Urho3D source

+ 2 - 2
Docs/GettingStarted.dox

@@ -71,7 +71,7 @@ A number of build options can be defined explicitly when invoking the above cmak
 |URHO3D_USE_LIB_DEB   |0|Enable 64-bit DEB CPack generator using /usr/lib and disable all other generators (Redhat-based host only)|
 |URHO3D_HOME          |-|Path to Urho3D build tree or SDK installation location (external project only)|
 |CMAKE_BUILD_TYPE     |*|Specify CMake build configuration (single-configuration generator only), possible values are Release (\*default), RelWithDebInfo, and Debug|
-|CMAKE_INSTALL_PREFIX |*|Install path prefix, prepended onto install directories; default to 'c:/Program Files' on Windows host and '/usr/local' on all other non-Windows hosts|
+|CMAKE_INSTALL_PREFIX |*|Install path prefix, prepended onto install directories; default to 'c:/Program Files/Urho3D' on Windows host and '/usr/local' on all other non-Windows hosts|
 |CMAKE_OSX_DEPLOYMENT_TARGET|-|Specify Mac OS X deployment target (OSX build only); default to current running OS X if not specified|
 |IPHONEOS_DEPLOYMENT_TARGET|-|Specify iPhone OS deployment target (iOS build only); default to latest installed iOS SDK if not specified|
 |ANDROID_ABI          |*|Specify target ABI (Android build only), possible values are arm64-v8a, armeabi, armeabi-v6 with VFP, armeabi-v7a (\*default), armeabi-v7a with NEON, armeabi-v7a with VFPV3, mips, mips64, x86, and x86_64|
@@ -177,7 +177,7 @@ As of V1.31, the build process first builds the Urho3D library target (either st
 
 To install the Urho3D library as an SDK, use the usual 'make install' command. There is an equivalent built-in target called "install" in Visual Studio solution and Xcode project to perform the SDK installation. This could be useful when you want your application to always link against a 'stable' installed version of the Urho3D library, while keeping your Urho3D project root tree in sync with origin/master; or when you want other users in the same host system to use the installed Urho3D SDK instead of them building from source again.
 
-The default install prefix is 'c:/Program Files' on Windows host and '/usr/local' on all other non-Windows hosts. You can use the CMAKE_INSTALL_PREFIX build option to alter this prefix path. However, when cross-compiling you may actually want to alter the final installation destination by supplying DESDIR environment variable instead of altering the CMAKE_INSTALL_PREFIX variable directly, especially when using Urho3D library as shared library type because the installed executables have their RPATH adjusted relative to CMAKE_INSTALL_PREFIX. The DESTDIR environment variable is not applicable for installation on Window host, i.e. it can only use CMAKE_INSTALL_PREFIX variable to alter the final installation destination. There is no RPATH adjustment for Windows platform but as the result the Urho3D.dll will be installed in a same directory as the installed executables.
+The default install prefix is 'c:/Program Files/Urho3D' on Windows host and '/usr/local' on all other non-Windows hosts. You can use the CMAKE_INSTALL_PREFIX build option to alter this prefix path. However, when cross-compiling you may actually want to alter the final installation destination by supplying DESDIR environment variable instead of altering the CMAKE_INSTALL_PREFIX variable directly, especially when using Urho3D library as shared library type because the installed executables have their RPATH adjusted relative to CMAKE_INSTALL_PREFIX. The DESTDIR environment variable is not applicable for installation on Window host, i.e. it can only use CMAKE_INSTALL_PREFIX variable to alter the final installation destination. There is no RPATH adjustment for Windows platform but as the result the Urho3D.dll will be installed in a same directory as the installed executables.
 
 If the Urho3D SDK is installed to a system-wide default location then the Urho3D library can be found by FindUrho3D CMake module automatically without the help of URHO3D_HOME environment variable or build option. When cross-compiling, the system-wide default location is usually in the system root of the cross-compiling target. To get a corresponding system root path for a cross-compiling build tree, you can use SYSROOT internal variable stored in the CMake cache. You can then use the system root path to set the DESTDIR environment variable in order to stage the Urho3D SDK installation in the corresponding system root. For example:
 

+ 2 - 2
Rakefile

@@ -45,8 +45,8 @@ task :scaffolding do
   puts "You may need to first set 'URHO3D_HOME' environment variable or use 'URHO3D_HOME' build option to point to your Urho3D build tree or your custom Urho3D SDK installation location."
   puts "Please see http://urho3d.github.io/documentation/HEAD/_using_library.html for more detail. For example:\n\n"
   if ENV['OS']
-    puts "set \"URHO3D_HOME=/path/to/Urho3D/build-tree/or/SDK\"\ncd #{abs_path}\nrake cmake URHO3D_64BIT=1 URHO3D_LUAJIT=1\nrake make\n\n"
-    puts "Alternatively you can call one of the batch files directly, such as, cmake_generic.bat ../native-Build -DURHO3D_64BIT=1 -DURHO3D_LUAJIT=1 and build using VS IDE"
+    puts "set \"URHO3D_HOME=/path/to/Urho3D/build-tree/or/SDK\"\ncd #{abs_path}\nrake cmake URHO3D_LUAJIT=1\nrake make\n\n"
+    puts "Alternatively you can call one of the batch files directly, such as, cmake_generic.bat ../native-Build -DURHO3D_LUAJIT=1 and build using VS IDE"
   else
     puts "export URHO3D_HOME=/path/to/Urho3D/build-tree/or/SDK\ncd #{abs_path}\nrake cmake URHO3D_LUAJIT=1\nrake make\n\n"
     puts "Alternatively you can call one of the shell scripts directly, such as, ./cmake_generic.sh ../native-Build -DURHO3D_LUAJIT=1 && cd ../native-Build && make"

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

@@ -36,4 +36,4 @@ set (INCLUDE_DIRS_ONLY include)
 setup_library ()
 
 # Install dependency for Urho3D/Script/APITemplates.h
-install_header_files (DIRECTORY include/ DESTINATION ${DEST_INCLUDE_DIR}/AngelScript FILES_MATCHING PATTERN *.h)     # Note: the trailing slash is significant
+install_header_files (DIRECTORY include/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/AngelScript FILES_MATCHING PATTERN *.h)     # Note: the trailing slash is significant

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

@@ -164,4 +164,4 @@ set (INCLUDE_DIRS_ONLY .)
 setup_library ()
 
 # Install dependency for Urho3D/Urho2D/PhysicsWorld2D.h and Urho3D/Urho2D/RigidBody2D.h
-install_header_files (DIRECTORY Box2D DESTINATION ${DEST_INCLUDE_DIR} FILES_MATCHING PATTERN *.h)
+install_header_files (DIRECTORY Box2D DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty FILES_MATCHING PATTERN *.h)

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

@@ -24,5 +24,5 @@ set (INCLUDE_DIRS_ONLY src)
 # Setup target
 setup_library ()
 
-# Install dependency for Urho3D/Physics/PhysicsWorld.h and Urho3D/Physics/RigidBody.h
-install_header_files (DIRECTORY src/ DESTINATION ${DEST_INCLUDE_DIR}/Bullet FILES_MATCHING PATTERN *.h)  # Note: the trailing slash is significant
+# Install dependency for Urho3D/Physics/PhysicsWorld.h, Urho3D/Physics/RigidBody.h, and Urho3D/Physics/PhysicsUtils.h
+install_header_files (DIRECTORY src/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/Bullet FILES_MATCHING PATTERN *.h)  # Note: the trailing slash is significant

+ 6 - 4
Source/ThirdParty/SDL/CMakeLists.txt

@@ -120,8 +120,10 @@ set (INCLUDE_DIRS_ONLY include)
 setup_library ()
 
 # Install dependency for D3D9GraphicsImpl.h, OGLGraphicsImpl.h, InputEvents.h, File.h, and Cursor.h
-install_header_files (DIRECTORY include/ DESTINATION ${DEST_INCLUDE_DIR}/SDL FILES_MATCHING PATTERN *.h USE_FILE_SYMLINK)    # Note: the trailing slash is significant
+install_header_files (DIRECTORY include/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/SDL FILES_MATCHING PATTERN *.h USE_FILE_SYMLINK)    # Note: the trailing slash is significant
 # Install dependency for SDL_android_main.c
-install_header_files (DIRECTORY src/main/android DESTINATION ${DEST_INCLUDE_DIR}/SDL)
-install_header_files (FILES src/SDL_internal.h DESTINATION ${DEST_INCLUDE_DIR}/SDL)
-install_header_files (DIRECTORY src/dynapi DESTINATION ${DEST_INCLUDE_DIR}/SDL FILES_MATCHING PATTERN *.h)
+if (ANDROID)
+    install_header_files (DIRECTORY src/main/android DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/SDL)
+    install_header_files (FILES src/SDL_internal.h DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/SDL)
+    install_header_files (DIRECTORY src/dynapi DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/SDL FILES_MATCHING PATTERN *.h)
+endif ()

+ 16 - 14
Source/ThirdParty/kNet/CMakeLists.txt

@@ -16,34 +16,34 @@
 
 set (TARGET_NAME kNet)
 
-file (GLOB kNetSourceFiles ./src/*.cpp)
-file (GLOB kNetHeaderFiles ./include/*.h ./include/kNet/*.h ./include/kNet/*.inl)
+file (GLOB kNetSourceFiles src/*.cpp)
+file (GLOB kNetHeaderFiles include/*.h include/kNet/*.h include/kNet/*.inl)
 
 if (WIN32)
-   file (GLOB kNetWin32SourceFiles ./src/win32/*.cpp)
-   file (GLOB kNetWin32HeaderFiles ./include/kNet/win32/*.h)
+   file (GLOB kNetWin32SourceFiles src/win32/*.cpp)
+   file (GLOB kNetWin32HeaderFiles include/kNet/win32/*.h)
 
    if (USE_BOOST)
-      list (REMOVE_ITEM kNetWin32SourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/./src/win32/W32Thread.cpp)
+      list (REMOVE_ITEM kNetWin32SourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/win32/W32Thread.cpp)
    endif ()
 
-   set (kNetSourceFiles ${kNetSourceFiles} ${kNetWin32SourceFiles})
-   set (kNetHeaderFiles ${kNetHeaderFiles} ${kNetWin32HeaderFiles})
+   list (APPEND kNetSourceFiles ${kNetWin32SourceFiles})
+   list (APPEND kNetHeaderFiles ${kNetWin32HeaderFiles})
 
    add_definitions (-D_WINSOCKAPI_)
    add_definitions (-D_CRT_SECURE_NO_WARNINGS)
    add_definitions (-DKNET_MEMORY_LEAK_CHECK)
 elseif (UNIX)
-   list (REMOVE_ITEM kNetSourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/./src/Clock.cpp)
-   file (GLOB kNetUnixSourceFiles ./src/unix/*.cpp)
-   file (GLOB kNetUnixHeaderFiles ./include/*.h ./include/kNet/*.h ./include/kNet/unix/*.h)
+   list (REMOVE_ITEM kNetSourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/Clock.cpp)
+   file (GLOB kNetUnixSourceFiles src/unix/*.cpp)
+   file (GLOB kNetUnixHeaderFiles include/*.h include/kNet/*.h include/kNet/unix/*.h)
 
    if (USE_BOOST)
-      list (REMOVE_ITEM kNetUnixSourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/./src/unix/UnixThread.cpp)
+      list (REMOVE_ITEM kNetUnixSourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/unix/UnixThread.cpp)
    endif ()
 
-   set (kNetSourceFiles ${kNetSourceFiles} ${kNetUnixSourceFiles})
-   set (kNetHeaderFiles ${kNetHeaderFiles} ${kNetUnixHeaderFiles})
+   list (APPEND kNetSourceFiles ${kNetUnixSourceFiles})
+   list (APPEND kNetHeaderFiles ${kNetUnixHeaderFiles})
 
    add_definitions (-DUNIX)
 endif ()
@@ -66,4 +66,6 @@ set (INCLUDE_DIRS_ONLY include)
 setup_library ()
 
 # Install dependency for Urho3D/Network/Connection.h and Urho3D/Network/Network.h
-install_header_files (DIRECTORY include/ DESTINATION ${DEST_INCLUDE_DIR}/kNet FILES_MATCHING PATTERN *.h *.inl)     # Note: the trailing slash is significant
+install_header_files (DIRECTORY include/kNet/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/kNet FILES_MATCHING PATTERN *.h *.inl USE_FILE_SYMLINK)     # Note: the trailing slash is significant
+file (GLOB kNetHeaderFiles include/*.h)
+install_header_files (FILES ${kNetHeaderFiles} DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/kNet)

+ 1 - 4
Source/ThirdParty/kNet/include/kNet/Types.h

@@ -16,8 +16,6 @@
 /** @file Types.h
 	@brief Provides platform-independent fixed size types. */
 
-// Modified by Yao Wei Tjong for Urho3D
-
 // Preprocessor macro for suppressing unused formal parameter warnings while still showing the variable name in Doxygen documentation.
 #if defined(DOXYGEN) // DOXYGEN is a special define used when Doxygen is run.
 #define UNUSED(x) x
@@ -27,8 +25,7 @@
 
 #ifndef KNET_NO_FIXEDWIDTH_TYPES
 
-// Urho3D: use relative path
-#include "../kNetBuildConfig.h"
+#include "kNetBuildConfig.h"
 
 #ifdef __MINGW32__
 #include <stdint.h>

+ 1 - 1
Source/Tools/AssetImporter/AssetImporter.cpp

@@ -142,7 +142,7 @@ void BuildAndSaveAnimations(OutModel* model = 0);
 
 void ExportScene(const String& outName, bool asPrefab);
 void CollectSceneModels(OutScene& scene, aiNode* node);
-Node* CreateSceneNode(Scene* scene, aiNode* srcNode, HashMap<aiNode*, WeakPtr<Node> >& nodeMapping);
+Node* CreateSceneNode(Scene* scene, aiNode* srcNode, HashMap<aiNode*, Node*>& nodeMapping);
 void BuildAndSaveScene(OutScene& scene, bool asPrefab);
 
 void ExportMaterials(HashSet<String>& usedTextures);

+ 20 - 19
Source/Urho3D/CMakeLists.txt

@@ -66,23 +66,12 @@ set (SOURCES Audio Container Core Engine Graphics Input IO Math Resource Scene U
 if (URHO3D_ANGELSCRIPT)
     list (APPEND SOURCES Script)
 endif ()
-
-if (URHO3D_NETWORK)
-    list (APPEND SOURCES Network)
-endif ()
-
-if (URHO3D_NAVIGATION)
-    list (APPEND SOURCES Navigation)
-endif ()
-
-if (URHO3D_PHYSICS)
-    list (APPEND SOURCES Physics)
-endif ()
-
-if (URHO3D_URHO2D)
-    list (APPEND SOURCES Urho2D)
-endif ()
-
+foreach (DIR Navigation Network Physics Urho2D)
+    string (TOUPPER URHO3D_${DIR} OPT)
+    if (${OPT})
+        list (APPEND SOURCES ${DIR})
+    endif ()
+endforeach ()
 foreach (SOURCE ${SOURCES})
     add_subdirectory (${SOURCE})
     source_group ("Source Files\\${SOURCE}" FILES ${${SOURCE}_CPP_FILES})
@@ -90,6 +79,13 @@ foreach (SOURCE ${SOURCES})
     list (APPEND ENGINE_SOURCE_FILES ${${SOURCE}_CPP_FILES} ${${SOURCE}_H_FILES})
     list (APPEND ENGINE_INCLUDE_DIRS_ONLY ${SOURCE})
 endforeach ()
+if (MSVC)
+    # MSVC compiler does not handle quoted include pathspec with relative path (used in Graphics/Direct3D9/*.h) the same way as GCC and Clang
+    # Following header search paths must be added in order to make MSVC resolves "../" back to one of the directory which contains the header file being searched
+    foreach (DIR container core graphics math resource)
+        list (APPEND ENGINE_INCLUDE_DIRS_ONLY ${DIR}/workaround)
+    endforeach ()
+endif ()
 define_source_files (EXTRA_CPP_FILES ${ENGINE_SOURCE_FILES} EXTRA_H_FILES ${CMAKE_CURRENT_BINARY_DIR}/librevision.h PCH)
 list (APPEND SOURCE_FILES ${ALL_OBJ_FILES})
 set_source_files_properties (${ALL_OBJ_FILES} PROPERTIES GENERATED TRUE)
@@ -99,7 +95,12 @@ foreach (LIST_NAME LIBS INCLUDE_DIRS_ONLY LINK_LIBS_ONLY)
     set_list (${LIST_NAME} ENGINE_${LIST_NAME} REMOVE_DUPLICATE)
 endforeach ()
 # Add include directories to find the export header and headers from exported SDKs
-list (APPEND INCLUDE_DIRS_ONLY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR})
+list (APPEND INCLUDE_DIRS_ONLY ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
+if (URHO3D_PHYSICS)
+    # Bullet library depends on its own include dir to be added in the header search path
+    # This is more practical than patching its header files in many places to make them work with relative path
+    list (APPEND INCLUDE_DIRS_ONLY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Bullet)
+endif ()
 
 # Setup library output path
 if (ANDROID)
@@ -252,7 +253,7 @@ if (GLOBAL_INCLUDE_DIRS)
     string (REPLACE ";" "\" ${DASH}I\"" GLOBAL_INCLUDE_DIRS "${DASH}I\"${GLOBAL_INCLUDE_DIRS}\"")
     string (REPLACE "${SYSROOT}" "" GLOBAL_INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS})
 endif ()
-set (ENGINE_INCLUDE_DIRS "${DASH}I\"\${includedir}/${PATH_SUFFIX}\" ${DASH}I\"\${includedir}\"")
+set (ENGINE_INCLUDE_DIRS "${DASH}I\"\${includedir}\" ${DASH}I\"\${includedir}/${PATH_SUFFIX}/ThirdParty\"")
 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Urho3D.pc.in ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.pc @ONLY)
 if (ANDROID)
     set (RENAME RENAME Urho3D-${ANDROID_NDK_ABI_NAME}.pc)

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

@@ -32,7 +32,7 @@
 #include <time.h>
 #include <windows.h>
 #include <dbghelp.h>
-#include <SDL.h>
+#include <SDL/SDL.h>
 
 namespace Urho3D
 {

+ 3 - 3
Source/Urho3D/Core/Object.h

@@ -58,11 +58,11 @@ public:
     virtual ~Object();
     
     /// Return type hash.
-    virtual StringHash GetType() const = 0;
+    virtual Urho3D::StringHash GetType() const = 0;
     /// Return base class type hash.
-    virtual StringHash GetBaseType() const = 0;
+    virtual Urho3D::StringHash GetBaseType() const = 0;
     /// Return type name.
-    virtual const String& GetTypeName() const = 0;
+    virtual const Urho3D::String& GetTypeName() const = 0;
     /// Handle event.
     virtual void OnEvent(Object* sender, StringHash eventType, VariantMap& eventData);
     

+ 0 - 9
Source/Urho3D/Engine/CMakeLists.txt

@@ -22,12 +22,3 @@
 
 # Define source files
 define_source_files (PARENT_SCOPE)
-
-# Define dependency libs
-if (URHO3D_NETWORK)
-    set (INCLUDE_DIRS ${INCLUDE_DIRS} ../ThirdParty/kNet/include)
-endif ()
-if (URHO3D_PHYSICS)
-    set (INCLUDE_DIRS ${INCLUDE_DIRS} ../ThirdParty/Bullet/src)
-endif ()
-set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ${INCLUDE_DIRS} PARENT_SCOPE)

+ 1 - 1
Source/Urho3D/Graphics/Direct3D9/D3D9GPUObject.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#include "Ptr.h"
+#include "../Ptr.h"
 
 namespace Urho3D
 {

+ 9 - 9
Source/Urho3D/Graphics/Direct3D9/D3D9Graphics.h

@@ -22,15 +22,15 @@
 
 #pragma once
 
-#include "ArrayPtr.h"
-#include "Color.h"
-#include "HashSet.h"
-#include "Image.h"
-#include "Mutex.h"
-#include "Object.h"
-#include "Plane.h"
-#include "Rect.h"
-#include "GraphicsDefs.h"
+#include "../ArrayPtr.h"
+#include "../Color.h"
+#include "../HashSet.h"
+#include "../Image.h"
+#include "../Mutex.h"
+#include "../Object.h"
+#include "../Plane.h"
+#include "../Rect.h"
+#include "../GraphicsDefs.h"
 
 namespace Urho3D
 {

+ 1 - 1
Source/Urho3D/Graphics/Direct3D9/D3D9GraphicsImpl.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#include "Color.h"
+#include "../Color.h"
 
 #include <d3d9.h>
 #include <SDL/SDL.h>

+ 4 - 4
Source/Urho3D/Graphics/Direct3D9/D3D9IndexBuffer.h

@@ -22,10 +22,10 @@
 
 #pragma once
 
-#include "GPUObject.h"
-#include "Object.h"
-#include "GraphicsDefs.h"
-#include "ArrayPtr.h"
+#include "../GPUObject.h"
+#include "../Object.h"
+#include "../GraphicsDefs.h"
+#include "../ArrayPtr.h"
 
 namespace Urho3D
 {

+ 2 - 2
Source/Urho3D/Graphics/Direct3D9/D3D9RenderSurface.h

@@ -22,8 +22,8 @@
 
 #pragma once
 
-#include "GraphicsDefs.h"
-#include "Viewport.h"
+#include "../GraphicsDefs.h"
+#include "../Viewport.h"
 
 namespace Urho3D
 {

+ 5 - 5
Source/Urho3D/Graphics/Direct3D9/D3D9ShaderVariation.h

@@ -22,11 +22,11 @@
 
 #pragma once
 
-#include "GPUObject.h"
-#include "GraphicsDefs.h"
-#include "HashSet.h"
-#include "RefCounted.h"
-#include "ArrayPtr.h"
+#include "../GPUObject.h"
+#include "../GraphicsDefs.h"
+#include "../HashSet.h"
+#include "../RefCounted.h"
+#include "../ArrayPtr.h"
 
 namespace Urho3D
 {

+ 4 - 4
Source/Urho3D/Graphics/Direct3D9/D3D9Texture.h

@@ -22,10 +22,10 @@
 
 #pragma once
 
-#include "Color.h"
-#include "GPUObject.h"
-#include "GraphicsDefs.h"
-#include "Resource.h"
+#include "../Color.h"
+#include "../GPUObject.h"
+#include "../GraphicsDefs.h"
+#include "../Resource.h"
 
 namespace Urho3D
 {

+ 3 - 3
Source/Urho3D/Graphics/Direct3D9/D3D9Texture2D.h

@@ -22,9 +22,9 @@
 
 #pragma once
 
-#include "RenderSurface.h"
-#include "Ptr.h"
-#include "Texture.h"
+#include "../RenderSurface.h"
+#include "../Ptr.h"
+#include "../Texture.h"
 
 namespace Urho3D
 {

+ 3 - 3
Source/Urho3D/Graphics/Direct3D9/D3D9Texture3D.h

@@ -22,9 +22,9 @@
 
 #pragma once
 
-#include "RenderSurface.h"
-#include "Ptr.h"
-#include "Texture.h"
+#include "../RenderSurface.h"
+#include "../Ptr.h"
+#include "../Texture.h"
 
 namespace Urho3D
 {

+ 3 - 3
Source/Urho3D/Graphics/Direct3D9/D3D9TextureCube.h

@@ -22,9 +22,9 @@
 
 #pragma once
 
-#include "RenderSurface.h"
-#include "Ptr.h"
-#include "Texture.h"
+#include "../RenderSurface.h"
+#include "../Ptr.h"
+#include "../Texture.h"
 
 namespace Urho3D
 {

+ 3 - 3
Source/Urho3D/Graphics/Direct3D9/D3D9VertexBuffer.h

@@ -22,9 +22,9 @@
 
 #pragma once
 
-#include "GPUObject.h"
-#include "GraphicsDefs.h"
-#include "ArrayPtr.h"
+#include "../GPUObject.h"
+#include "../GraphicsDefs.h"
+#include "../ArrayPtr.h"
 
 namespace Urho3D
 {

+ 3 - 3
Source/Urho3D/Graphics/Direct3D9/D3D9VertexDeclaration.h

@@ -22,9 +22,9 @@
 
 #pragma once
 
-#include "GraphicsDefs.h"
-#include "RefCounted.h"
-#include "Vector.h"
+#include "../GraphicsDefs.h"
+#include "../RefCounted.h"
+#include "../Vector.h"
 
 #include <d3d9.h>
 

+ 1 - 1
Source/Urho3D/Graphics/OpenGL/OGLGPUObject.h

@@ -22,7 +22,7 @@
 
 #pragma once
 
-#include "Ptr.h"
+#include "../Ptr.h"
 
 namespace Urho3D
 {

+ 8 - 8
Source/Urho3D/Graphics/OpenGL/OGLGraphics.h

@@ -22,14 +22,14 @@
 
 #pragma once
 
-#include "ArrayPtr.h"
-#include "Color.h"
-#include "GraphicsDefs.h"
-#include "Image.h"
-#include "Mutex.h"
-#include "Object.h"
-#include "Plane.h"
-#include "Rect.h"
+#include "../ArrayPtr.h"
+#include "../Color.h"
+#include "../GraphicsDefs.h"
+#include "../Image.h"
+#include "../Mutex.h"
+#include "../Object.h"
+#include "../Plane.h"
+#include "../Rect.h"
 
 namespace Urho3D
 {

+ 3 - 3
Source/Urho3D/Graphics/OpenGL/OGLGraphicsImpl.h

@@ -22,9 +22,9 @@
 
 #pragma once
 
-#include "Color.h"
-#include "HashMap.h"
-#include "Timer.h"
+#include "../Color.h"
+#include "../HashMap.h"
+#include "../Timer.h"
 
 #if defined(ANDROID) || defined (RPI)
 #include <GLES2/gl2.h>

+ 4 - 4
Source/Urho3D/Graphics/OpenGL/OGLIndexBuffer.h

@@ -22,10 +22,10 @@
 
 #pragma once
 
-#include "ArrayPtr.h"
-#include "GPUObject.h"
-#include "Object.h"
-#include "GraphicsDefs.h"
+#include "../ArrayPtr.h"
+#include "../GPUObject.h"
+#include "../Object.h"
+#include "../GraphicsDefs.h"
 
 namespace Urho3D
 {

+ 2 - 2
Source/Urho3D/Graphics/OpenGL/OGLRenderSurface.h

@@ -22,8 +22,8 @@
 
 #pragma once
 
-#include "GraphicsDefs.h"
-#include "Viewport.h"
+#include "../GraphicsDefs.h"
+#include "../Viewport.h"
 
 namespace Urho3D
 {

+ 4 - 4
Source/Urho3D/Graphics/OpenGL/OGLShaderProgram.h

@@ -22,10 +22,10 @@
 
 #pragma once
 
-#include "GPUObject.h"
-#include "GraphicsDefs.h"
-#include "HashMap.h"
-#include "RefCounted.h"
+#include "../GPUObject.h"
+#include "../GraphicsDefs.h"
+#include "../HashMap.h"
+#include "../RefCounted.h"
 
 namespace Urho3D
 {

+ 4 - 4
Source/Urho3D/Graphics/OpenGL/OGLShaderVariation.h

@@ -22,10 +22,10 @@
 
 #pragma once
 
-#include "ArrayPtr.h"
-#include "GPUObject.h"
-#include "GraphicsDefs.h"
-#include "RefCounted.h"
+#include "../ArrayPtr.h"
+#include "../GPUObject.h"
+#include "../GraphicsDefs.h"
+#include "../RefCounted.h"
 
 namespace Urho3D
 {

+ 4 - 4
Source/Urho3D/Graphics/OpenGL/OGLTexture.h

@@ -22,10 +22,10 @@
 
 #pragma once
 
-#include "Color.h"
-#include "GPUObject.h"
-#include "GraphicsDefs.h"
-#include "Resource.h"
+#include "../Color.h"
+#include "../GPUObject.h"
+#include "../GraphicsDefs.h"
+#include "../Resource.h"
 
 namespace Urho3D
 {

+ 3 - 3
Source/Urho3D/Graphics/OpenGL/OGLTexture2D.h

@@ -22,9 +22,9 @@
 
 #pragma once
 
-#include "RenderSurface.h"
-#include "Ptr.h"
-#include "Texture.h"
+#include "../RenderSurface.h"
+#include "../Ptr.h"
+#include "../Texture.h"
 
 namespace Urho3D
 {

+ 4 - 4
Source/Urho3D/Graphics/OpenGL/OGLTexture3D.h

@@ -22,10 +22,10 @@
 
 #pragma once
 
-#include "Image.h"
-#include "RenderSurface.h"
-#include "Ptr.h"
-#include "Texture.h"
+#include "../Image.h"
+#include "../RenderSurface.h"
+#include "../Ptr.h"
+#include "../Texture.h"
 
 namespace Urho3D
 {

+ 3 - 3
Source/Urho3D/Graphics/OpenGL/OGLTextureCube.h

@@ -22,9 +22,9 @@
 
 #pragma once
 
-#include "RenderSurface.h"
-#include "Ptr.h"
-#include "Texture.h"
+#include "../RenderSurface.h"
+#include "../Ptr.h"
+#include "../Texture.h"
 
 namespace Urho3D
 {

+ 3 - 3
Source/Urho3D/Graphics/OpenGL/OGLVertexBuffer.h

@@ -22,9 +22,9 @@
 
 #pragma once
 
-#include "ArrayPtr.h"
-#include "GPUObject.h"
-#include "GraphicsDefs.h"
+#include "../ArrayPtr.h"
+#include "../GPUObject.h"
+#include "../GraphicsDefs.h"
 
 namespace Urho3D
 {

+ 32 - 39
Source/Urho3D/LuaScript/CMakeLists.txt

@@ -33,7 +33,7 @@ if (CMAKE_CROSSCOMPILING OR IOS)
     # When cross-compiling, build the host tool as external project
     include (ExternalProject)
     if (IOS)
-        # For iOS target, its host is MacOSX; Workaround a known CMake/Xcode generator bug which prevents it from installing binaries correctly
+        # For iOS target, its host is MacOSX; Also workaround a known CMake/Xcode generator bug which prevents it from installing binaries correctly
         set (OSX_HOST -DCMAKE_OSX_SYSROOT=macosx BUILD_COMMAND bash -c "sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' CMakeScripts/install_postBuildPhase.make*")
     endif ()
     ExternalProject_Add(tolua++
@@ -48,27 +48,14 @@ endif ()
 # Define generated source files
 file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)
 file (GLOB API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/*.pkg)
-
-# Remove NavigationLuaAPI.pkg
-if (NOT URHO3D_NAVIGATION)
-    list (REMOVE_ITEM API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/NavigationLuaAPI.pkg)
-endif ()
-
-# Remove NetworkLuaAPI.pkg
-if (NOT URHO3D_NETWORK)
-    list (REMOVE_ITEM API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/NetworkLuaAPI.pkg)
-endif ()
-
-# Remove PhysicsLuaAPI.pkg
-if (NOT URHO3D_PHYSICS)
-    list (REMOVE_ITEM API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/PhysicsLuaAPI.pkg)
-endif ()
-
-# Remove Urho2DLuaAPI.pkg
-if (NOT URHO3D_URHO2D)
-    list (REMOVE_ITEM API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/Urho2DLuaAPI.pkg)
-endif ()
-
+foreach (DIR Navigation Network Physics Urho2D)
+    string (TOUPPER URHO3D_${DIR} OPT)
+    if (${OPT})
+        list (APPEND INCLUDE_DIRS_ONLY ../${DIR})
+    else ()
+        list (REMOVE_ITEM API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/${DIR}LuaAPI.pkg)
+    endif ()
+endforeach ()
 foreach (API_PKG_FILE ${API_PKG_FILES})
     get_filename_component (NAME ${API_PKG_FILE} NAME)
     string (REGEX REPLACE LuaAPI\\.pkg$ "" API ${NAME})
@@ -88,27 +75,33 @@ define_source_files (EXTRA_CPP_FILES ${GEN_CPP_FILES})
 # Define dependency libs
 set (LIBS ../../ThirdParty/Lua${JIT}/src)
 set (LINK_LIBS_ONLY toluapp)
-set (INCLUDE_DIRS_ONLY . .. ../Audio ../Container ../Core ../Engine ../Graphics ../Input ../IO ../Math ../Navigation ../Resource ../Scene ../UI
-    ../../ThirdParty/toluapp/include ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR})
-
-if (URHO3D_NAVIGATION)
-    set (INCLUDE_DIRS_ONLY ${INCLUDE_DIRS_ONLY} ../Navigation)
-endif ()
-
-if (URHO3D_NETWORK)
-    set (INCLUDE_DIRS_ONLY ${INCLUDE_DIRS_ONLY} ../Network ../../ThirdParty/kNet/include)
-endif ()
-
-if (URHO3D_PHYSICS)
-    set (INCLUDE_DIRS_ONLY ${INCLUDE_DIRS_ONLY} ../Physics ../../ThirdParty/Bullet/src)
-endif ()
-
-if (URHO3D_URHO2D)
-    set (INCLUDE_DIRS_ONLY ${INCLUDE_DIRS_ONLY} ../Urho2D ../../ThirdParty/Box2D)
+list (APPEND INCLUDE_DIRS_ONLY . .. ../Audio ../Container ../Core ../Engine ../Graphics ../Input ../IO ../Math ../Resource ../Scene ../UI
+    ../../ThirdParty/toluapp/include ${CMAKE_BINARY_DIR}/Source/Urho3D ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
+if (MSVC)
+    # MSVC compiler does not handle quoted include pathspec with relative path (used in Graphics/Direct3D9/*.h) the same way as GCC and Clang
+    # Following header search paths must be added in order to make MSVC resolves "../" back to one of the directory which contains the header file being searched
+    foreach (DIR container core graphics math resource)
+        list (APPEND INCLUDE_DIRS_ONLY ${DIR}/workaround)
+    endforeach ()
 endif ()
 
 # Setup target
 setup_library ()
+if (CMAKE_HOST_WIN32 AND NOT URHO3D_MKLINK)
+    # When falling back to file copy on Windows host system then LuaScript depends on some thirdparty libs to be built first
+    # as the thirdparty lib's headers are only copied to the build tree in their corresponding post-build steps
+    set (DEPS SDL)
+    if (URHO3D_NETWORK)
+        list (APPEND DEPS kNet)
+    endif ()
+    if (URHO3D_PHYSICS)
+        list (APPEND DEPS Bullet)
+    endif ()
+    if (URHO3D_URHO2D)
+        list (APPEND DEPS Box2D)
+    endif ()
+    add_dependencies (${TARGET_NAME} ${DEPS})
+endif ()
 
 # Install dependency for Engine
 install_header_files (FILES ${H_FILES} DESTINATION ${DEST_INCLUDE_DIR})

+ 1 - 1
Source/Urho3D/Network/CMakeLists.txt

@@ -24,4 +24,4 @@
 define_source_files (PARENT_SCOPE)
 
 # Define dependency libs
-set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/kNet/include ../ThirdParty/Civetweb/include PARENT_SCOPE)
+set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/Civetweb/include PARENT_SCOPE)

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

@@ -38,7 +38,7 @@
 #include "SceneEvents.h"
 #include "SmoothedTransform.h"
 
-#include <kNet.h>
+#include <kNet/kNet.h>
 
 #include "DebugNew.h"
 

+ 1 - 1
Source/Urho3D/Network/Connection.h

@@ -30,7 +30,7 @@
 #include "VectorBuffer.h"
 
 #include <kNet/kNetFwd.h>
-#include <kNet/kNet/SharedPtr.h>
+#include <kNet/SharedPtr.h>
 
 #ifdef SendMessage
 #undef SendMessage

+ 1 - 1
Source/Urho3D/Network/Network.cpp

@@ -37,7 +37,7 @@
 #include "Protocol.h"
 #include "Scene.h"
 
-#include <kNet.h>
+#include <kNet/kNet.h>
 
 #include "DebugNew.h"
 

+ 2 - 2
Source/Urho3D/Network/Network.h

@@ -27,8 +27,8 @@
 #include "Object.h"
 #include "VectorBuffer.h"
 
-#include <kNet/kNet/IMessageHandler.h>
-#include <kNet/kNet/INetworkServerListener.h>
+#include <kNet/IMessageHandler.h>
+#include <kNet/INetworkServerListener.h>
 
 namespace Urho3D
 {

+ 1 - 1
Source/Urho3D/Physics/CMakeLists.txt

@@ -24,4 +24,4 @@
 define_source_files (PARENT_SCOPE)
 
 # Define dependency libs
-set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/Bullet/src ../ThirdParty/StanHull PARENT_SCOPE)
+set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/StanHull PARENT_SCOPE)

+ 13 - 13
Source/Urho3D/Physics/CollisionShape.cpp

@@ -40,19 +40,19 @@
 #include "Terrain.h"
 #include "VertexBuffer.h"
 
-#include <BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>
-#include <BulletCollision/CollisionShapes/btBoxShape.h>
-#include <BulletCollision/CollisionShapes/btCapsuleShape.h>
-#include <BulletCollision/CollisionShapes/btCompoundShape.h>
-#include <BulletCollision/CollisionShapes/btConeShape.h>
-#include <BulletCollision/CollisionShapes/btConvexHullShape.h>
-#include <BulletCollision/CollisionShapes/btCylinderShape.h>
-#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
-#include <BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h>
-#include <BulletCollision/CollisionShapes/btSphereShape.h>
-#include <BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h>
-#include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
-#include <BulletCollision/CollisionShapes/btStaticPlaneShape.h>
+#include <Bullet/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>
+#include <Bullet/BulletCollision/CollisionShapes/btBoxShape.h>
+#include <Bullet/BulletCollision/CollisionShapes/btCapsuleShape.h>
+#include <Bullet/BulletCollision/CollisionShapes/btCompoundShape.h>
+#include <Bullet/BulletCollision/CollisionShapes/btConeShape.h>
+#include <Bullet/BulletCollision/CollisionShapes/btConvexHullShape.h>
+#include <Bullet/BulletCollision/CollisionShapes/btCylinderShape.h>
+#include <Bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
+#include <Bullet/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h>
+#include <Bullet/BulletCollision/CollisionShapes/btSphereShape.h>
+#include <Bullet/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h>
+#include <Bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
+#include <Bullet/BulletCollision/CollisionShapes/btStaticPlaneShape.h>
 #include <hull.h>
 
 namespace Urho3D

+ 5 - 5
Source/Urho3D/Physics/Constraint.cpp

@@ -31,11 +31,11 @@
 #include "RigidBody.h"
 #include "Scene.h"
 
-#include <BulletDynamics/ConstraintSolver/btConeTwistConstraint.h>
-#include <BulletDynamics/ConstraintSolver/btHingeConstraint.h>
-#include <BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h>
-#include <BulletDynamics/ConstraintSolver/btSliderConstraint.h>
-#include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
+#include <Bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h>
+#include <Bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.h>
+#include <Bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h>
+#include <Bullet/BulletDynamics/ConstraintSolver/btSliderConstraint.h>
+#include <Bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
 
 namespace Urho3D
 {

+ 2 - 2
Source/Urho3D/Physics/PhysicsUtils.h

@@ -25,8 +25,8 @@
 #include "Quaternion.h"
 #include "Vector3.h"
 
-#include <LinearMath/btVector3.h>
-#include <LinearMath/btQuaternion.h>
+#include <Bullet/LinearMath/btVector3.h>
+#include <Bullet/LinearMath/btQuaternion.h>
 
 namespace Urho3D
 {

+ 8 - 8
Source/Urho3D/Physics/PhysicsWorld.cpp

@@ -38,14 +38,14 @@
 #include "SceneEvents.h"
 #include "Sort.h"
 
-#include <BulletCollision/BroadphaseCollision/btDbvtBroadphase.h>
-#include <BulletCollision/BroadphaseCollision/btBroadphaseProxy.h>
-#include <BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h>
-#include <BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>
-#include <BulletCollision/CollisionShapes/btBoxShape.h>
-#include <BulletCollision/CollisionShapes/btSphereShape.h>
-#include <BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h>
-#include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
+#include <Bullet/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h>
+#include <Bullet/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h>
+#include <Bullet/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h>
+#include <Bullet/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>
+#include <Bullet/BulletCollision/CollisionShapes/btBoxShape.h>
+#include <Bullet/BulletCollision/CollisionShapes/btSphereShape.h>
+#include <Bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h>
+#include <Bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
 
 extern ContactAddedCallback gContactAddedCallback;
 

+ 3 - 3
Source/Urho3D/Physics/RigidBody.cpp

@@ -36,9 +36,9 @@
 #include "SceneEvents.h"
 #include "SmoothedTransform.h"
 
-#include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
-#include <BulletDynamics/Dynamics/btRigidBody.h>
-#include <BulletCollision/CollisionShapes/btCompoundShape.h>
+#include <Bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
+#include <Bullet/BulletDynamics/Dynamics/btRigidBody.h>
+#include <Bullet/BulletCollision/CollisionShapes/btCompoundShape.h>
 
 namespace Urho3D
 {

+ 1 - 1
Source/Urho3D/Script/APITemplates.h

@@ -39,7 +39,7 @@
 #include "StaticModel.h"
 #include "Texture.h"
 
-#include <angelscript.h>
+#include <AngelScript/angelscript.h>
 #include <cstring>
 
 #ifdef _MSC_VER

+ 1 - 1
Source/Urho3D/Script/Addons.h

@@ -26,7 +26,7 @@
 #include "HashMap.h"
 #include "Str.h"
 
-#include <angelscript.h>
+#include <AngelScript/angelscript.h>
 
 // Adapted from Angelscript's scriptarray, scriptdictionary & scriptstdstring add-ons, but with garbage collection disabled
 

+ 0 - 10
Source/Urho3D/Script/CMakeLists.txt

@@ -22,13 +22,3 @@
 
 # Define source files
 define_source_files (PARENT_SCOPE)
-
-# Define dependency libs
-set (INCLUDE_DIRS ../ThirdParty/AngelScript/include)
-if (URHO3D_NETWORK)
-    set (INCLUDE_DIRS ${INCLUDE_DIRS} ../ThirdParty/kNet/include)
-endif ()
-if (URHO3D_PHYSICS)
-    set (INCLUDE_DIRS ${INCLUDE_DIRS} ../ThirdParty/Bullet/src)
-endif ()
-set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ${INCLUDE_DIRS} PARENT_SCOPE)

+ 1 - 1
Source/Urho3D/Script/MathAPI.cpp

@@ -27,7 +27,7 @@
 #include "Polyhedron.h"
 #include "Ray.h"
 
-#include <angelscript.h>
+#include <AngelScript/angelscript.h>
 
 namespace Urho3D
 {

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

@@ -31,7 +31,7 @@
 #include "ScriptFile.h"
 #include "ScriptInstance.h"
 
-#include <angelscript.h>
+#include <AngelScript/angelscript.h>
 
 #include "DebugNew.h"
 

+ 1 - 1
Source/Urho3D/Script/ScriptAPIDump.cpp

@@ -27,7 +27,7 @@
 #include "Log.h"
 #include "Script.h"
 
-#include <angelscript.h>
+#include <AngelScript/angelscript.h>
 
 #include "DebugNew.h"
 

+ 1 - 1
Source/Urho3D/Script/ScriptFile.cpp

@@ -32,7 +32,7 @@
 #include "ScriptFile.h"
 #include "ScriptInstance.h"
 
-#include <angelscript.h>
+#include <AngelScript/angelscript.h>
 #include <cstring>
 
 #include "DebugNew.h"

+ 1 - 1
Source/Urho3D/Script/ScriptInstance.cpp

@@ -37,7 +37,7 @@
 #include "ScriptFile.h"
 #include "ScriptInstance.h"
 
-#include <angelscript.h>
+#include <AngelScript/angelscript.h>
 
 #include "DebugNew.h"
 

+ 0 - 3
Source/Urho3D/Urho2D/CMakeLists.txt

@@ -22,6 +22,3 @@
 
 # Define source files
 define_source_files (PARENT_SCOPE)
-
-# Define dependency libs
-set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/Box2D/ PARENT_SCOPE)

+ 1 - 3
cmake_generic.bat

@@ -23,6 +23,7 @@
 @echo off
 
 :: Determine source tree and build tree
+set "SOURCE=%~dp0"
 set "BUILD="
 if "%~1" == "" goto :continue
 set "ARG1=%~1"
@@ -31,7 +32,6 @@ set "BUILD=%~1"
 shift
 :continue
 if "%BUILD%" == "" if exist "%cd%\CMakeCache.txt" (set "BUILD=%cd%") else (goto :error)
-set "SOURCE=%~dp0"
 
 :: Detect CMake toolchains directory if it is not provided explicitly
 if "%TOOLCHAINS%" == "" set "TOOLCHAINS=%SOURCE%/CMake/Toolchains"
@@ -54,9 +54,7 @@ if not "%~1" == "" (
 )
 
 :: Create project with the chosen CMake generator and toolchain
-echo on
 cmake -E make_directory %BUILD% && cmake -E chdir %BUILD% cmake %OPTS% %* %SOURCE%
-@echo off
 
 goto :eof
 :error