CMakeLists.txt 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #
  2. # Copyright (c) 2008-2020 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
  24. cmake_minimum_required (VERSION 3.10.2)
  25. # Set project name
  26. project (Urho3D-ExternalProject-PackageTool)
  27. # Set CMake modules search path
  28. set (CMAKE_MODULE_PATH ${BAKED_CMAKE_SOURCE_DIR}/cmake/Modules)
  29. # Include UrhoCommon.cmake module after setting project name
  30. include (UrhoCommon)
  31. # Define additional source files
  32. set (MINI_URHO_CPP_FILES
  33. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/Allocator.cpp
  34. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/HashBase.cpp
  35. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/RefCounted.cpp
  36. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/Str.cpp
  37. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Container/VectorBase.cpp
  38. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Context.cpp
  39. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/EventProfiler.cpp
  40. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Mutex.cpp
  41. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Object.cpp
  42. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/ProcessUtils.cpp
  43. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Profiler.cpp
  44. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/StringHashRegister.cpp
  45. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/StringUtils.cpp
  46. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Thread.cpp
  47. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Timer.cpp
  48. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Core/Variant.cpp
  49. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Deserializer.cpp
  50. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/File.cpp
  51. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/FileSystem.cpp
  52. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Log.cpp
  53. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/MemoryBuffer.cpp
  54. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/PackageFile.cpp
  55. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/Serializer.cpp
  56. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/IO/VectorBuffer.cpp
  57. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Color.cpp
  58. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix3.cpp
  59. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix3x4.cpp
  60. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Matrix4.cpp
  61. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Quaternion.cpp
  62. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Rect.cpp
  63. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/StringHash.cpp
  64. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector2.cpp
  65. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector3.cpp
  66. ${BAKED_CMAKE_SOURCE_DIR}/Source/Urho3D/Math/Vector4.cpp
  67. )
  68. # Define preprocessor macros
  69. add_definitions (-DMINI_URHO)
  70. # Setup SDK-like include dir in the build tree for building the mini-urho
  71. set (DEST_INCLUDE_DIR include/Urho3D)
  72. file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
  73. # Add dependency targets
  74. if (NOT CMAKE_SYSTEM_NAME STREQUAL Linux)
  75. include (CheckIncludeFile)
  76. check_include_file (stdint.h HAVE_STDINT_H)
  77. add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LibCpuId host/LibCpuId)
  78. set (LIBS LibCpuId)
  79. endif ()
  80. add_subdirectory (${BAKED_CMAKE_SOURCE_DIR}/Source/ThirdParty/LZ4 host/LZ4)
  81. set (INCLUDE_DIRS ${BAKED_CMAKE_BINARY_DIR}/include ${BAKED_CMAKE_BINARY_DIR}/include/Urho3D ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
  82. endif ()
  83. # Define target name
  84. if (TARGET PackageTool) # The target name is already taken by host-tool external project, so use a postfix for the target-tool
  85. set (POSTFIX _target)
  86. endif ()
  87. set (TARGET_NAME PackageTool${POSTFIX})
  88. # Define source files
  89. define_source_files (EXTRA_CPP_FILES ${MINI_URHO_CPP_FILES})
  90. # Define dependency libs
  91. list (APPEND LIBS LZ4)
  92. # Setup target
  93. setup_executable (TOOL)
  94. adjust_target_name () # Remove postfix from the executable/binary name