diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index 0071571..97d14d3 100755 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -1,21 +1,24 @@ set(CMAKE_FOLDER "External") +include(FetchContent) FetchContent_Declare( - bullet - GIT_REPOSITORY https://github.com/bulletphysics/bullet3.git - GIT_TAG 2.89 + bullet + GIT_REPOSITORY https://github.com/bulletphysics/bullet3.git + GIT_TAG 2.89 + CMAKE_ARGS "-Wno-dev" + PATCH_COMMAND git apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/fix_bullet_cmake_version.patch ) FetchContent_Declare( - spirv-cross - GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Cross.git - GIT_TAG MoltenVK-1.1.5 + spirv-cross + GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Cross.git + GIT_TAG MoltenVK-1.1.5 ) FetchContent_Declare( - glslang - GIT_REPOSITORY https://github.com/KhronosGroup/glslang.git - GIT_TAG df609a01b386001e367709086c58529c48028d1e # taken from https://github.com/KhronosGroup/SPIRV-Cross/blob/2021-01-15/checkout_glslang_spirv_tools.sh#L3 + glslang + GIT_REPOSITORY https://github.com/KhronosGroup/glslang.git + GIT_TAG df609a01b386001e367709086c58529c48028d1e # taken from https://github.com/KhronosGroup/SPIRV-Cross/blob/2021-01-15/checkout_glslang_spirv_tools.sh#L3 ) # bullet @@ -47,6 +50,7 @@ set(USE_MSVC_RUNTIME_LIBRARY_DLL ON CACHE BOOL "" FORCE) set(ENABLE_GLSLANG_INSTALL OFF CACHE BOOL "" FORCE) set(ENABLE_CTEST OFF CACHE BOOL "" FORCE) +set(CMAKE_PROJECT_BULLET_PHYSICS_INCLUDE_BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/fix_bad_cmake_dev.cmake) FetchContent_MakeAvailable(bullet) FetchContent_MakeAvailable(spirv-cross) FetchContent_MakeAvailable(glslang) @@ -60,57 +64,55 @@ add_subdirectory(magic_enum) add_subdirectory(smaa) add_subdirectory(doctest) -include(FetchContent) - FetchContent_Declare(json - GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent.git - GIT_TAG v3.9.1) + GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent.git + GIT_TAG v3.9.1) FetchContent_GetProperties(json) -if(NOT json_POPULATED) - FetchContent_Populate(json) - add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL) -endif() +if (NOT json_POPULATED) + FetchContent_Populate(json) + add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL) +endif () -if(NOT ENABLE_IOS AND NOT ENABLE_TVOS) -add_subdirectory(ogg) -add_subdirectory(opus) +if (NOT ENABLE_IOS AND NOT ENABLE_TVOS) + add_subdirectory(ogg) + add_subdirectory(opus) -add_library(opusfile - opusfile/src/opusfile.c - opusfile/src/info.c - opusfile/src/internal.c - opusfile/src/stream.c) -target_include_directories(opusfile - PUBLIC - opusfile/include) -target_link_libraries(opusfile - PUBLIC - ogg - opus) -endif() + add_library(opusfile + opusfile/src/opusfile.c + opusfile/src/info.c + opusfile/src/internal.c + opusfile/src/stream.c) + target_include_directories(opusfile + PUBLIC + opusfile/include) + target_link_libraries(opusfile + PUBLIC + ogg + opus) +endif () -if(BUILD_TOOLS) - set(ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC OFF CACHE BOOL "" FORCE) - set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) - set(ASSIMP_NO_EXPORT ON CACHE BOOL "" FORCE) - set(ASSIMP_BUILD_SAMPLES OFF CACHE BOOL "" FORCE) - set(ASSIMP_INSTALL OFF CACHE BOOL "" FORCE) - set(ASSIMP_BUILD_ZLIB OFF CACHE BOOL "" FORCE) - set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "" FORCE) - set(ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE BOOL "" FORCE) +if (BUILD_TOOLS) + set(ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC OFF CACHE BOOL "" FORCE) + set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) + set(ASSIMP_NO_EXPORT ON CACHE BOOL "" FORCE) + set(ASSIMP_BUILD_SAMPLES OFF CACHE BOOL "" FORCE) + set(ASSIMP_INSTALL OFF CACHE BOOL "" FORCE) + set(ASSIMP_BUILD_ZLIB OFF CACHE BOOL "" FORCE) + set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "" FORCE) + set(ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE BOOL "" FORCE) - add_subdirectory(assimp) -endif() + add_subdirectory(assimp) +endif () FetchContent_Declare( - fmt - GIT_REPOSITORY https://github.com/fmtlib/fmt - GIT_TAG 8.0.1 + fmt + GIT_REPOSITORY https://github.com/fmtlib/fmt + GIT_TAG 8.0.1 ) FetchContent_MakeAvailable(fmt) -if(ENABLE_METAL) - add_subdirectory(metal-cpp) -endif() \ No newline at end of file +if (ENABLE_METAL) + add_subdirectory(metal-cpp) +endif () \ No newline at end of file diff --git a/extern/fix_bad_cmake_dev.cmake b/extern/fix_bad_cmake_dev.cmake new file mode 100644 index 0000000..c535686 --- /dev/null +++ b/extern/fix_bad_cmake_dev.cmake @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +cmake_policy(SET CMP0115 OLD) +cmake_policy(SET CMP0072 NEW) \ No newline at end of file diff --git a/extern/fix_bullet_cmake_version.patch b/extern/fix_bullet_cmake_version.patch new file mode 100644 index 0000000..450de89 --- /dev/null +++ b/extern/fix_bullet_cmake_version.patch @@ -0,0 +1,10 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 68e0a93bc..5b83fb1cd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 2.4.3) ++cmake_minimum_required(VERSION 2.8.12) + set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) + cmake_policy(SET CMP0017 NEW) + #this line has to appear before 'PROJECT' in order to be able to disable incremental linking