CMakeLists.txt 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #
  2. # Copyright (c) 2008-2015 the Urho3D project.
  3. #
  4. # Permission is hereby granted, free of charge, to any person obtaining a copy
  5. # of this software and associated documentation files (the "Software"), to deal
  6. # in the Software without restriction, including without limitation the rights
  7. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. # copies of the Software, and to permit persons to whom the Software is
  9. # furnished to do so, subject to the following conditions:
  10. #
  11. # The above copyright notice and this permission notice shall be included in
  12. # all copies or substantial portions of the Software.
  13. #
  14. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. # THE SOFTWARE.
  21. #
  22. # Check existence of stdint.h for LibCpuId
  23. include (CheckIncludeFiles)
  24. CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H)
  25. if (HAVE_STDINT_H)
  26. add_definitions (-DHAVE_STDINT_H)
  27. endif ()
  28. # Setup RPATH settings
  29. if (URHO3D_LIB_TYPE STREQUAL SHARED AND NOT WIN32 AND NOT ANDROID AND NOT IOS AND NOT EMSCRIPTEN)
  30. # Add RPATH entries when building
  31. set (CMAKE_SKIP_BUILD_RPATH FALSE)
  32. # But don't set them yet in the build tree
  33. set (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  34. if (APPLE)
  35. if (CMAKE_VERSION VERSION_GREATER 2.8.12 OR CMAKE_VERSION VERSION_EQUAL 2.8.12)
  36. set (CMAKE_MACOSX_RPATH TRUE)
  37. endif ()
  38. set (ORIGIN @loader_path)
  39. else ()
  40. set (ORIGIN $ORIGIN)
  41. endif ()
  42. # When installing/packaging set the first RPATH entry to the library location relative to the executable
  43. set (CMAKE_INSTALL_RPATH ${ORIGIN}/../lib${LIB_SUFFIX}/${PATH_SUFFIX}) # The library location is based on SDK install destination
  44. # The second entry to the install destination of the library, if the destination location is not in the system default search path
  45. list (FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} isSystemDir)
  46. if (isSystemDir STREQUAL -1)
  47. list (APPEND CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${DEST_LIBRARY_DIR})
  48. endif ()
  49. endif ()
  50. # Add targets
  51. foreach (TARGET FreeType JO LZ4 PugiXml rapidjson SDL StanHull STB)
  52. add_subdirectory (ThirdParty/${TARGET})
  53. endforeach ()
  54. if (URHO3D_ANGELSCRIPT)
  55. add_subdirectory (ThirdParty/AngelScript)
  56. endif ()
  57. if (URHO3D_LUA)
  58. add_subdirectory (ThirdParty/Lua${JIT})
  59. add_subdirectory (ThirdParty/toluapp/src/lib)
  60. endif ()
  61. if (URHO3D_NETWORK)
  62. add_subdirectory (ThirdParty/Civetweb)
  63. add_subdirectory (ThirdParty/kNet)
  64. endif ()
  65. if (URHO3D_NAVIGATION)
  66. add_subdirectory (ThirdParty/Detour)
  67. add_subdirectory (ThirdParty/DetourCrowd)
  68. add_subdirectory (ThirdParty/DetourTileCache)
  69. add_subdirectory (ThirdParty/Recast)
  70. endif ()
  71. if (URHO3D_URHO2D)
  72. add_subdirectory (ThirdParty/Box2D)
  73. endif ()
  74. if (URHO3D_PHYSICS)
  75. add_subdirectory (ThirdParty/Bullet)
  76. endif ()
  77. if (NOT IOS AND NOT ANDROID AND NOT RPI AND NOT EMSCRIPTEN)
  78. if (URHO3D_OPENGL)
  79. add_subdirectory (ThirdParty/GLEW)
  80. elseif (NOT URHO3D_D3D11)
  81. add_subdirectory (ThirdParty/MojoShader)
  82. endif ()
  83. add_subdirectory (ThirdParty/LibCpuId)
  84. endif ()
  85. # Urho3D game engine library
  86. add_subdirectory (Urho3D)
  87. # Urho3D tools
  88. add_subdirectory (Tools)
  89. # Urho3D samples
  90. # Samples are built on iOS platform too when enabled. Currently there is no available mechanism to package each sample apps into individual *.apk
  91. # for Android platform, so we deploy all samples into one apk and use a simple list view activity launcher to select the sample to run
  92. if (URHO3D_SAMPLES)
  93. add_subdirectory (Samples)
  94. endif ()
  95. # Urho3D extras
  96. if (URHO3D_EXTRAS)
  97. add_subdirectory (Extras)
  98. endif ()