CMakeLists.txt 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #
  2. # Copyright (c) 2008-2016 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. if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
  23. # Set CMake minimum version and CMake policy required by Urho3D-CMake-common module
  24. if (WIN32)
  25. cmake_minimum_required (VERSION 3.2.3) # Going forward all platforms will use this as minimum version
  26. else ()
  27. cmake_minimum_required (VERSION 2.8.6)
  28. endif ()
  29. if (COMMAND cmake_policy)
  30. cmake_policy (SET CMP0003 NEW)
  31. if (CMAKE_VERSION VERSION_GREATER 2.8.12 OR CMAKE_VERSION VERSION_EQUAL 2.8.12)
  32. # INTERFACE_LINK_LIBRARIES defines the link interface
  33. cmake_policy (SET CMP0022 NEW)
  34. endif ()
  35. if (CMAKE_VERSION VERSION_GREATER 3.0.0 OR CMAKE_VERSION VERSION_EQUAL 3.0.0)
  36. # Disallow use of the LOCATION target property - so we set to OLD as we still need it
  37. cmake_policy (SET CMP0026 OLD)
  38. # MACOSX_RPATH is enabled by default
  39. cmake_policy (SET CMP0042 NEW)
  40. endif ()
  41. endif ()
  42. # Set project name
  43. project (Urho3D-ExternalProject-PackageTool)
  44. # Set CMake modules search path
  45. set (CMAKE_MODULE_PATH ${BAKED_CMAKE_SOURCE_DIR}/CMake/Modules)
  46. # Include Urho3D Cmake common module
  47. include (Urho3D-CMake-common)
  48. # Define additional source files
  49. set (MINI_URHO_CPP_FILES
  50. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/Allocator.cpp
  51. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/HashBase.cpp
  52. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/RefCounted.cpp
  53. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/Str.cpp
  54. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/VectorBase.cpp
  55. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Context.cpp
  56. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/EventProfiler.cpp
  57. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Mutex.cpp
  58. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Object.cpp
  59. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/ProcessUtils.cpp
  60. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Profiler.cpp
  61. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/StringUtils.cpp
  62. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Thread.cpp
  63. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Timer.cpp
  64. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Variant.cpp
  65. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Deserializer.cpp
  66. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/File.cpp
  67. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/FileSystem.cpp
  68. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Log.cpp
  69. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/MemoryBuffer.cpp
  70. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/PackageFile.cpp
  71. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Serializer.cpp
  72. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/VectorBuffer.cpp
  73. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Color.cpp
  74. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix3.cpp
  75. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix3x4.cpp
  76. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix4.cpp
  77. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Quaternion.cpp
  78. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Rect.cpp
  79. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/StringHash.cpp
  80. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector2.cpp
  81. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector3.cpp
  82. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector4.cpp
  83. )
  84. # Check existence of stdint.h for LibCpuId
  85. include (CheckIncludeFiles)
  86. check_include_files (stdint.h HAVE_STDINT_H)
  87. if (HAVE_STDINT_H)
  88. add_definitions (-DHAVE_STDINT_H)
  89. endif ()
  90. # Define that we are building mini Urho
  91. add_definitions (-DMINI_URHO)
  92. # Setup SDK-like include dir in the build tree for building the mini-urho
  93. set (DEST_INCLUDE_DIR include/Urho3D)
  94. file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
  95. # Add dependency targets
  96. add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LibCpuId host/LibCpuId)
  97. add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LZ4 host/LZ4)
  98. set (INCLUDE_DIRS ${BAKED_CMAKE_BINARY_DIR}/include ${BAKED_CMAKE_BINARY_DIR}/include/Urho3D ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
  99. set (LIBS LibCpuId)
  100. endif ()
  101. # Define target name
  102. if (TARGET PackageTool) # The target name is already taken by host-tool external project, so use a postfix for the target-tool
  103. set (POSTFIX _target)
  104. endif ()
  105. set (TARGET_NAME PackageTool${POSTFIX})
  106. # Define source files
  107. define_source_files (EXTRA_CPP_FILES ${MINI_URHO_CPP_FILES})
  108. # Define dependency libs
  109. list (APPEND LIBS LZ4)
  110. # Setup target
  111. setup_executable (TOOL)
  112. adjust_target_name () # Remove postfix from the executable/binary name