CMakeLists.txt 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
  23. # Set project name
  24. project (ExternalProject-PackageTool)
  25. # Set minimum version
  26. cmake_minimum_required (VERSION 2.8.6)
  27. if (COMMAND cmake_policy)
  28. cmake_policy (SET CMP0003 NEW)
  29. if (CMAKE_VERSION VERSION_GREATER 2.8.12 OR CMAKE_VERSION VERSION_EQUAL 2.8.12)
  30. # INTERFACE_LINK_LIBRARIES defines the link interface
  31. cmake_policy (SET CMP0022 NEW)
  32. endif ()
  33. if (CMAKE_VERSION VERSION_GREATER 3.0.0 OR CMAKE_VERSION VERSION_EQUAL 3.0.0)
  34. # Disallow use of the LOCATION target property - therefore we set to OLD as we still need it
  35. cmake_policy (SET CMP0026 OLD)
  36. # MACOSX_RPATH is enabled by default
  37. cmake_policy (SET CMP0042 NEW)
  38. endif ()
  39. endif ()
  40. # Set CMake modules search path
  41. set (CMAKE_MODULE_PATH ${BAKED_CMAKE_SOURCE_DIR}/CMake/Modules)
  42. # Include Urho3D Cmake common module
  43. include (Urho3D-CMake-common)
  44. # Define additional source files
  45. set (MINI_URHO_CPP_FILES
  46. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/Allocator.cpp
  47. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/HashBase.cpp
  48. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/RefCounted.cpp
  49. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/Str.cpp
  50. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/VectorBase.cpp
  51. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Context.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. # Check existence of stdint.h for LibCpuId
  80. include (CheckIncludeFiles)
  81. CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H)
  82. if (HAVE_STDINT_H)
  83. add_definitions (-DHAVE_STDINT_H)
  84. endif ()
  85. # Setup SDK-like include dir in the build tree for building the mini-urho
  86. set (DEST_INCLUDE_DIR include/Urho3D)
  87. file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
  88. # Add dependency targets
  89. add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LibCpuId host/LibCpuId)
  90. add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LZ4 host/LZ4)
  91. add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/SDL host/SDL)
  92. set (INCLUDE_DIRS ${BAKED_CMAKE_BINARY_DIR}/include ${BAKED_CMAKE_BINARY_DIR}/include/Urho3D ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
  93. set (LIBS LibCpuId SDL)
  94. endif ()
  95. # Define target name
  96. if (TARGET PackageTool) # The target name is already taken by host-tool external project, so use a postfix for the target-tool
  97. set (POSTFIX _target)
  98. endif ()
  99. set (TARGET_NAME PackageTool${POSTFIX})
  100. # Define source files
  101. define_source_files (EXTRA_CPP_FILES ${MINI_URHO_CPP_FILES})
  102. # Define dependency libs
  103. list (APPEND LIBS LZ4)
  104. # Setup target
  105. if (APPLE)
  106. setup_macosx_linker_flags (CMAKE_EXE_LINKER_FLAGS)
  107. endif ()
  108. setup_executable ()
  109. adjust_target_name () # Remove postfix from the executable/binary name