CMakeLists.txt 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #
  2. # Copyright (c) 2008-2017 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 UrhoCommon module
  24. cmake_minimum_required (VERSION 3.2.3)
  25. if (COMMAND cmake_policy)
  26. # Libraries linked via full path no longer produce linker search paths
  27. cmake_policy (SET CMP0003 NEW)
  28. # INTERFACE_LINK_LIBRARIES defines the link interface
  29. cmake_policy (SET CMP0022 NEW)
  30. # Disallow use of the LOCATION target property - so we set to OLD as we still need it
  31. cmake_policy (SET CMP0026 OLD)
  32. # MACOSX_RPATH is enabled by default
  33. cmake_policy (SET CMP0042 NEW)
  34. # Honor the visibility properties for SHARED target types only
  35. cmake_policy (SET CMP0063 OLD)
  36. endif ()
  37. # Set project name
  38. project (Urho3D-ExternalProject-PackageTool)
  39. # Set CMake modules search path
  40. set (CMAKE_MODULE_PATH ${BAKED_CMAKE_SOURCE_DIR}/CMake/Modules)
  41. # Include UrhoCommon.cmake module after setting project name
  42. include (UrhoCommon)
  43. # Define additional source files
  44. set (MINI_URHO_CPP_FILES
  45. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/Allocator.cpp
  46. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/HashBase.cpp
  47. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/RefCounted.cpp
  48. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/Str.cpp
  49. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/VectorBase.cpp
  50. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Context.cpp
  51. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/EventProfiler.cpp
  52. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Mutex.cpp
  53. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Object.cpp
  54. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/ProcessUtils.cpp
  55. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Profiler.cpp
  56. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/StringUtils.cpp
  57. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Thread.cpp
  58. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Timer.cpp
  59. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Variant.cpp
  60. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Deserializer.cpp
  61. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/File.cpp
  62. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/FileSystem.cpp
  63. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Log.cpp
  64. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/MemoryBuffer.cpp
  65. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/PackageFile.cpp
  66. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Serializer.cpp
  67. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/VectorBuffer.cpp
  68. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Color.cpp
  69. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix3.cpp
  70. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix3x4.cpp
  71. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix4.cpp
  72. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Quaternion.cpp
  73. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Rect.cpp
  74. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/StringHash.cpp
  75. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector2.cpp
  76. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector3.cpp
  77. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector4.cpp
  78. )
  79. # Define preprocessor macros
  80. add_definitions (-DMINI_URHO)
  81. # Setup SDK-like include dir in the build tree for building the mini-urho
  82. set (DEST_INCLUDE_DIR include/Urho3D)
  83. file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
  84. # Add dependency targets
  85. if (NOT CMAKE_SYSTEM_NAME STREQUAL Linux)
  86. include (CheckIncludeFile)
  87. check_include_file (stdint.h HAVE_STDINT_H)
  88. add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LibCpuId host/LibCpuId)
  89. set (LIBS LibCpuId)
  90. endif ()
  91. add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LZ4 host/LZ4)
  92. set (INCLUDE_DIRS ${BAKED_CMAKE_BINARY_DIR}/include ${BAKED_CMAKE_BINARY_DIR}/include/Urho3D ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
  93. endif ()
  94. # Define target name
  95. if (TARGET PackageTool) # The target name is already taken by host-tool external project, so use a postfix for the target-tool
  96. set (POSTFIX _target)
  97. endif ()
  98. set (TARGET_NAME PackageTool${POSTFIX})
  99. # Define source files
  100. define_source_files (EXTRA_CPP_FILES ${MINI_URHO_CPP_FILES})
  101. # Define dependency libs
  102. list (APPEND LIBS LZ4)
  103. # Setup target
  104. setup_executable (TOOL)
  105. adjust_target_name () # Remove postfix from the executable/binary name