CMakeLists.txt 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. # Set project name
  23. project (Urho3D-Tools)
  24. # Find Urho3D library
  25. find_package (Urho3D REQUIRED)
  26. include_directories (${URHO3D_INCLUDE_DIRS})
  27. # Urho3DPlayer target is rather special, although it is here, it is not a tool because it builds into platform-specific binary
  28. if (NOT EMSCRIPTEN)
  29. add_subdirectory (Urho3DPlayer)
  30. endif ()
  31. # Build PackageTool using host compiler toolchain
  32. if ((CMAKE_CROSSCOMPILING OR IOS) AND URHO3D_PACKAGING)
  33. # When cross-compiling, build the host tool as external project
  34. include (ExternalProject)
  35. if (IOS)
  36. # For iOS target, its host is MacOSX; Also workaround a known CMake/Xcode generator bug which prevents it from installing binaries correctly
  37. set (OSX_HOST -DCMAKE_OSX_SYSROOT=macosx BUILD_COMMAND bash -c "sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' CMakeScripts/install_postBuildPhase.make*")
  38. endif ()
  39. ExternalProject_Add (PackageTool
  40. SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/Tools/PackageTool
  41. CMAKE_ARGS -DDEST_RUNTIME_DIR=${CMAKE_BINARY_DIR}/bin/tool -DBAKED_CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} -DBAKED_CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR} ${OSX_HOST})
  42. install (PROGRAMS ${CMAKE_BINARY_DIR}/bin/tool/PackageTool DESTINATION ${DEST_RUNTIME_DIR}/tool)
  43. endif ()
  44. # All tools must be natively built and output to bin/tool subdir to differentiate them from platform-specific binaries in the bin directory
  45. set_output_directories (${CMAKE_BINARY_DIR}/bin/tool RUNTIME PDB)
  46. if (URHO3D_TOOLS)
  47. # Urho3D tools
  48. add_subdirectory (AssetImporter)
  49. add_subdirectory (OgreImporter)
  50. add_subdirectory (PackageTool)
  51. add_subdirectory (RampGenerator)
  52. add_subdirectory (SpritePacker)
  53. if (URHO3D_ANGELSCRIPT)
  54. add_subdirectory (ScriptCompiler)
  55. endif ()
  56. elseif ((NOT CMAKE_CROSSCOMPILING AND NOT IOS) AND URHO3D_PACKAGING)
  57. # PackageTool target is required but we are not cross-compiling, so build it as per normal
  58. add_subdirectory (PackageTool)
  59. endif ()