CMakeLists.txt 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. cmake_minimum_required (VERSION 3.9.0)
  2. project (Banshee3D)
  3. set (BSF_DIRECTORY ${PROJECT_SOURCE_DIR}/Source/bsf)
  4. set (BSF_SOURCE_DIR ${BSF_DIRECTORY}/Source)
  5. set (APP_ROOT_DIR ${PROJECT_SOURCE_DIR})
  6. set (BS_IS_BANSHEE3D 1)
  7. # Grab BSF
  8. find_path(SUBMODULE_SOURCES "Source/Foundation/bsfEngine/BsApplication.h" "Source/bsf/")
  9. if(NOT SUBMODULE_SOURCES)
  10. execute_process(COMMAND git submodule update
  11. --init
  12. -- Source/bsf
  13. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
  14. else()
  15. execute_process(COMMAND git submodule update
  16. -- Source/bsf
  17. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
  18. endif()
  19. mark_as_advanced(SUBMODULE_SOURCES)
  20. include(${BSF_SOURCE_DIR}/CMake/Properties.cmake)
  21. include(${BSF_SOURCE_DIR}/CMake/FindPackageOrBuild.cmake)
  22. include(${BSF_SOURCE_DIR}/CMake/HelperMethods.cmake)
  23. add_subdirectory(${BSF_SOURCE_DIR})
  24. set (BS_PREBUILT_DEPENDENCIES_VERSION 24)
  25. set (BS_SRC_DEPENDENCIES_VERSION 15)
  26. set (BS_BUILTIN_ASSETS_VERSION 8)
  27. # Options
  28. set(GENERATE_SCRIPT_BINDINGS OFF CACHE BOOL "If true, script binding files will be generated. Script bindings are required for the project to build properly, however they take a while to generate. If you are sure the script bindings are up to date, you can turn off their generation (temporarily) to speed up the build.")
  29. # Ensure dependencies are up to date
  30. ## Check prebuilt dependencies that are downloaded in a .zip
  31. check_and_update_binary_deps(Banshee ${PROJECT_SOURCE_DIR}/Dependencies/ ${BS_PREBUILT_DEPENDENCIES_VERSION})
  32. ## Check data dependencies
  33. check_and_update_builtin_assets(Banshee ${PROJECT_SOURCE_DIR}/Data ${BS_BUILTIN_ASSETS_VERSION} YES)
  34. # Generate script bindings
  35. include(${BSF_SOURCE_DIR}/CMake/GenerateScriptBindings.cmake)
  36. # Sub-directories
  37. add_subdirectory(Source/EditorCore)
  38. ## Script interop
  39. add_subdirectory(${BSF_SOURCE_DIR}/Plugins/bsfMono)
  40. add_subdirectory(Source/Scripting/SBansheeEngine)
  41. add_subdirectory(Source/Scripting/SBansheeEditor)
  42. ## Executables
  43. add_subdirectory(Source/Banshee3D)
  44. add_subdirectory(Source/Game)
  45. ## Managed projects
  46. set(CS_ENGINE_PROJ ${PROJECT_SOURCE_DIR}/Source/Scripting/MBansheeEngine/MBansheeEngine.csproj)
  47. set(CS_EDITOR_PROJ ${PROJECT_SOURCE_DIR}/Source/Scripting/MBansheeEditor/MBansheeEditor.csproj)
  48. if(MSVC)
  49. include_external_msproject(MBansheeEngine ${CS_ENGINE_PROJ})
  50. include_external_msproject(MBansheeEditor ${CS_EDITOR_PROJ})
  51. set_target_properties(MBansheeEngine PROPERTIES
  52. MAP_IMPORTED_CONFIG_RELEASE OptimizedDebug
  53. )
  54. set_target_properties(MBansheeEditor PROPERTIES
  55. MAP_IMPORTED_CONFIG_RELEASE OptimizedDebug
  56. )
  57. set_property(TARGET MBansheeEngine PROPERTY FOLDER Script)
  58. set_property(TARGET MBansheeEditor PROPERTY FOLDER Script)
  59. add_dependencies(Banshee3D MBansheeEngine MBansheeEditor)
  60. add_dependencies(Game MBansheeEngine)
  61. set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Banshee3D)
  62. else()
  63. find_package(mcs)
  64. if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
  65. set(CS_PROJ_CONFIG Debug)
  66. else()
  67. set(CS_PROJ_CONFIG Release)
  68. endif()
  69. add_custom_target(BuildManaged
  70. COMMAND xbuild /p:Configuration=${CS_PROJ_CONFIG} ${CS_EDITOR_PROJ}
  71. COMMENT "Building managed assemblies")
  72. add_dependencies(Banshee3D BuildManaged)
  73. add_dependencies(Game BuildManaged)
  74. endif()