diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..bebc3791b --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +ThirdParty/ConanRecipes/**/* text eol=lf \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78c145247..caddafe95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ on: env: BUILD_TYPE: Release MAKE_THREAD_NUM: 16 - CMAKE_VERSION: '3.28.1' + CMAKE_VERSION: '4.1.2' jobs: build: @@ -31,9 +31,13 @@ jobs: detached: true - name: Set XCode Version - run: sudo xcode-select -s /Library/Developer/CommandLineTools + run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer if: runner.os == 'macOS' + - name: Setup MSVC + uses: ilammy/msvc-dev-cmd@v1 + if: runner.os == 'Windows' + - name: Checkout Repo uses: actions/checkout@v4 @@ -42,19 +46,19 @@ jobs: with: node-version: 24 - - name: Setup cmake + - name: Setup CMake uses: jwlawson/actions-setup-cmake@v2 with: cmake-version: ${{env.CMAKE_VERSION}} - - name: Update Cache Files - uses: actions/cache@v4 - with: - path: ${{github.workspace}}/ThirdParty/Zip - key: ${{runner.os}}-3rd-zip + - name: Setup Conan + uses: conan-io/setup-conan@v1 + + - name: Config Conan Remote + run: conan remote add explosion https://kindem.online/artifactory/api/conan/conan - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCI=ON + run: cmake -B ${{github.workspace}}/build -G=Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCI=ON - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j ${{env.MAKE_THREAD_NUM}} diff --git a/.gitignore b/.gitignore index 806a67742..7ac52f192 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ build* # 3rd ThirdParty/Zip ThirdParty/Lib +ThirdParty/ConanRecipes/**/src +ThirdParty/ConanRecipes/**/build +ThirdParty/ConanRecipes/**/CMakeUserPresets.json diff --git a/CMake/Common.cmake b/CMake/Common.cmake index 70614f2fa..27f0ddf2c 100644 --- a/CMake/Common.cmake +++ b/CMake/Common.cmake @@ -25,7 +25,7 @@ add_definitions(-DCOMPILER_APPLE_CLANG=$,1,0>) add_definitions(-DCOMPILER_GCC=$,1,0>) if (${MSVC}) - add_compile_options(/bigobj) + add_compile_options(/bigobj /MD) add_definitions(-D_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS=1) add_definitions(-DWIN32_LEAN_AND_MEAN) add_definitions(-DNOMINMAX=1) diff --git a/CMake/Target.cmake b/CMake/Target.cmake index 97e9dc4dd..45859a86c 100644 --- a/CMake/Target.cmake +++ b/CMake/Target.cmake @@ -77,6 +77,11 @@ function(exp_process_runtime_dependencies) ) foreach (d ${arg_DEP_TARGET}) list(APPEND runtime_deps $) + exp_gather_target_runtime_dependencies_recurse( + NAME ${d} + OUT_RUNTIME_DEP dep_target_runtime_deps + ) + list(APPEND runtime_deps ${dep_target_runtime_deps}) endforeach () foreach(r ${runtime_deps}) add_custom_command( @@ -135,32 +140,32 @@ function(exp_add_resources_copy_command) add_dependencies(${arg_NAME} ${copy_res_target_name}) endfunction() -function(exp_gather_target_include_dirs) +function(exp_gather_target_libs) set(options "") set(singleValueArgs NAME OUTPUT) set(multiValueArgs "") cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT (TARGET ${arg_NAME})) - return() - endif() - - get_target_property(target_incs ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) - if (NOT ("${target_incs}" STREQUAL "target_incs-NOTFOUND")) - foreach(target_inc ${target_incs}) - list(APPEND result ${target_inc}) - endforeach() - endif() + string(REGEX MATCH "\\$\\" match ${arg_NAME}) + if (match) + set(${arg_OUTPUT} "" PARENT_SCOPE) + endif () get_target_property(target_libs ${arg_NAME} LINK_LIBRARIES) if (NOT ("${target_libs}" STREQUAL "target_libs-NOTFOUND")) foreach(target_lib ${target_libs}) - exp_gather_target_include_dirs( + string(REGEX MATCH "\\$\\" match ${target_lib}) + if (match) + continue() + endif () + + list(APPEND result ${target_lib}) + exp_gather_target_libs( NAME ${target_lib} - OUTPUT lib_incs + OUTPUT libs ) - foreach(lib_inc ${lib_incs}) - list(APPEND result ${lib_inc}) + foreach(lib ${libs}) + list(APPEND result ${lib}) endforeach() endforeach() endif() @@ -189,12 +194,13 @@ function(exp_add_mirror_info_source_generation_target) endif() if (DEFINED arg_LIB) foreach (l ${arg_LIB}) - exp_gather_target_include_dirs( + list(APPEND inc $) + exp_gather_target_libs( NAME ${l} - OUTPUT target_incs + OUTPUT target_libs ) - foreach (i ${target_incs}) - list(APPEND inc ${i}) + foreach (tl ${target_libs}) + list(APPEND inc $) endforeach () endforeach() endif() @@ -202,7 +208,7 @@ function(exp_add_mirror_info_source_generation_target) list(APPEND inc_args "-I") foreach (i ${inc}) - list(APPEND inc_args ${i}) + list(APPEND inc_args \"${i}\") endforeach() if (DEFINED arg_FRAMEWORK_DIR) @@ -336,6 +342,11 @@ function(exp_add_executable) EXPORT ${SUB_PROJECT_NAME}Targets RUNTIME DESTINATION ${SUB_PROJECT_NAME}/Binaries ) + export( + TARGETS ${arg_NAME} + NAMESPACE ${SUB_PROJECT_NAME}:: + APPEND FILE ${CMAKE_BINARY_DIR}/${SUB_PROJECT_NAME}Targets.cmake + ) if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") install(CODE "execute_process(COMMAND install_name_tool -add_rpath @executable_path ${CMAKE_INSTALL_PREFIX}/${SUB_PROJECT_NAME}/Binaries/$)") @@ -400,18 +411,18 @@ function(exp_add_library) endforeach () foreach (lib ${arg_PUBLIC_MERGE_LIB}) if (TARGET ${lib}) - get_target_property(target_incs ${lib} INTERFACE_INCLUDE_DIRECTORIES) - if (NOT ("${target_incs}" STREQUAL "target_incs-NOTFOUND")) - foreach(target_inc ${target_incs}) - list(APPEND public_inc ${target_inc}) - endforeach() - endif() + list(APPEND public_inc $) endif () endforeach () foreach (inc ${public_inc}) - get_filename_component(absolute_inc ${inc} ABSOLUTE) - list(APPEND public_build_inc $) + string(REGEX MATCH "\\$\\<.+\\>" match ${inc}) + if (match) + list(APPEND public_build_inc $) + else () + get_filename_component(absolute_inc ${inc} ABSOLUTE) + list(APPEND public_build_inc $) + endif () endforeach () target_include_directories( ${arg_NAME} @@ -468,13 +479,6 @@ function(exp_add_library) ) endif () - if (${MSVC}) - target_compile_options( - ${arg_NAME} - PRIVATE /MD$<$:d> - ) - endif() - if ("${arg_TYPE}" STREQUAL "SHARED") string(TOUPPER ${arg_NAME}_API api_name) string(REPLACE "-" "/" api_dir ${arg_NAME}) @@ -513,6 +517,11 @@ function(exp_add_library) LIBRARY DESTINATION ${SUB_PROJECT_NAME}/Target/${arg_NAME}/Lib RUNTIME DESTINATION ${SUB_PROJECT_NAME}/Binaries ) + export( + TARGETS ${arg_NAME} + NAMESPACE ${SUB_PROJECT_NAME}:: + APPEND FILE ${CMAKE_BINARY_DIR}/${SUB_PROJECT_NAME}Targets.cmake + ) if ("${arg_TYPE}" STREQUAL "SHARED") install( FILES $ diff --git a/CMake/ThirdParty.cmake b/CMake/ThirdParty.cmake deleted file mode 100644 index 1d3716b78..000000000 --- a/CMake/ThirdParty.cmake +++ /dev/null @@ -1,337 +0,0 @@ -function(exp_download_and_extract_3rd_package) - set(options "") - set(singleValueArgs URL SAVE_AS EXTRACT_TO) - set(multiValueArgs HASH) - cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) - - if (EXISTS ${arg_SAVE_AS}) - message("found downloaded file for ${arg_URL} -> ${arg_SAVE_AS}") - else() - message("starting download package ${arg_URL}") - file( - DOWNLOAD - ${arg_URL} ${arg_SAVE_AS} - SHOW_PROGRESS - ) - endif() - - if (DEFINED arg_HASH) - exp_get_3rd_platform_value( - OUTPUT platform_hash - INPUT ${arg_HASH} - ) - - file(SHA256 ${arg_SAVE_AS} hash_value) - if (NOT (${platform_hash} STREQUAL ${hash_value})) - message(FATAL_ERROR "check hash value failed for file ${arg_SAVE_AS}, given ${platform_hash} actual ${hash_value}") - endif () - endif() - - if (NOT EXISTS ${arg_EXTRACT_TO}) - file( - ARCHIVE_EXTRACT - INPUT ${arg_SAVE_AS} - DESTINATION ${arg_EXTRACT_TO} - ) - endif() -endfunction() - -function(exp_expand_3rd_path_expression) - set(options "") - set(singleValueArgs OUTPUT SOURCE_DIR BINARY_DIR INSTALL_DIR) - set(multiValueArgs INPUT) - cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) - - foreach(i ${arg_INPUT}) - set(temp "${i}") - if (DEFINED arg_SOURCE_DIR) - string(REPLACE "$" ${arg_SOURCE_DIR} temp ${temp}) - endif() - if (DEFINED arg_BINARY_DIR) - string(REPLACE "$" ${arg_BINARY_DIR} temp ${temp}) - endif() - if (DEFINED arg_INSTALL_DIR) - string(REPLACE "$" ${arg_INSTALL_DIR} temp ${temp}) - endif() - list(APPEND result ${temp}) - endforeach() - - set(${arg_OUTPUT} ${result} PARENT_SCOPE) -endfunction() - -function(exp_get_3rd_platform_value) - set(options "") - set(singleValueArgs OUTPUT) - set(multiValueArgs INPUT) - cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) - - set(platform_keywords "Windows;Darwin;Linux") - - set(has_keywords FALSE) - foreach (i ${arg_INPUT}) - foreach (k ${platform_keywords}) - if (${i} STREQUAL ${k}) - set(has_keywords TRUE) - break() - endif() - endforeach() - - if (${has_keywords}) - break() - endif() - endforeach() - - set(start_log FALSE) - foreach (i ${arg_INPUT}) - if ((NOT ${start_log}) AND (${i} STREQUAL ${CMAKE_SYSTEM_NAME})) - set(start_log TRUE) - continue() - endif() - - if (NOT ${start_log}) - continue() - endif() - - set(end_log FALSE) - foreach (k ${platform_keywords}) - if (${k} STREQUAL ${i}) - set(end_log TRUE) - break() - endif() - endforeach() - - if (${end_log}) - break() - endif() - - list(APPEND result ${i}) - endforeach () - - if (${has_keywords}) - set(${arg_OUTPUT} ${result} PARENT_SCOPE) - else() - set(${arg_OUTPUT} ${arg_INPUT} PARENT_SCOPE) - endif() -endfunction() - -function(exp_add_3rd_header_only_package) - set(options "") - set(singleValueArgs NAME SOURCE_DIR INSTALL_DIR) - set(multiValueArgs INSTALL_FILES INCLUDE) - cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) - - add_library(${arg_NAME} INTERFACE) - - if (DEFINED arg_INSTALL_DIR AND DEFINED arg_INSTALL_FILES) - foreach (install_file ${arg_INSTALL_FILES}) - if (IS_DIRECTORY ${arg_SOURCE_DIR}/${install_file}) - list(APPEND commands COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${arg_SOURCE_DIR}/${install_file} ${arg_INSTALL_DIR}/${install_file}) - else () - list(APPEND commands COMMAND ${CMAKE_COMMAND} -E copy_if_different ${arg_SOURCE_DIR}/${install_file} ${arg_INSTALL_DIR}/${install_file}) - endif () - endforeach () - - add_custom_target( - ${arg_NAME}.Install - COMMAND ${commands} - ) - add_dependencies(${arg_NAME} ${arg_NAME}.Install) - endif () - - if (DEFINED arg_INCLUDE) - exp_expand_3rd_path_expression( - INPUT ${arg_INCLUDE} - OUTPUT r_include - SOURCE_DIR ${arg_SOURCE_DIR} - INSTALL_DIR ${arg_INSTALL_DIR} - ) - exp_get_3rd_platform_value( - OUTPUT p_include - INPUT ${r_include} - ) - target_include_directories( - ${arg_NAME} - INTERFACE ${p_include} - ) - endif () -endfunction() - -function(exp_add_3rd_binary_package) - set(options "") - set(singleValueArgs NAME SOURCE_DIR) - set(multiValueArgs INCLUDE LINK LIB RUNTIME_DEP) - cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) - - add_library(${arg_NAME} INTERFACE) - - if (DEFINED arg_INCLUDE) - exp_expand_3rd_path_expression( - INPUT ${arg_INCLUDE} - OUTPUT r_include - SOURCE_DIR ${arg_SOURCE_DIR} - ) - exp_get_3rd_platform_value( - INPUT ${r_include} - OUTPUT p_include - ) - target_include_directories( - ${arg_NAME} - INTERFACE ${p_include} - ) - endif() - - if (DEFINED arg_LINK) - exp_expand_3rd_path_expression( - INPUT ${arg_LINK} - OUTPUT r_link - SOURCE_DIR ${arg_SOURCE_DIR} - ) - exp_get_3rd_platform_value( - INPUT ${r_link} - OUTPUT p_link - ) - target_link_directories( - ${arg_NAME} - INTERFACE ${p_link} - ) - endif() - - if (DEFINED arg_LIB) - exp_expand_3rd_path_expression( - INPUT ${arg_LIB} - OUTPUT r_lib - SOURCE_DIR ${arg_SOURCE_DIR} - ) - exp_get_3rd_platform_value( - OUTPUT p_lib - INPUT ${r_lib} - ) - target_link_libraries( - ${arg_NAME} - INTERFACE "${p_lib}" - ) - endif() - - if (DEFINED arg_RUNTIME_DEP) - exp_expand_3rd_path_expression( - INPUT ${arg_RUNTIME_DEP} - OUTPUT r_runtime_dep - SOURCE_DIR ${arg_SOURCE_DIR} - ) - exp_get_3rd_platform_value( - INPUT ${r_runtime_dep} - OUTPUT p_runtime_dep - ) - set_target_properties( - ${arg_NAME} PROPERTIES - RUNTIME_DEP "${p_runtime_dep}" - ) - endif() -endfunction() - -function(exp_add_3rd_cmake_package) - set(options "") - set(singleValueArgs NAME SOURCE_DIR BINARY_DIR INSTALL_DIR) - set(multiValueArgs CMAKE_ARG INCLUDE LINK LIB RUNTIME_DEP) - cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) - - if (NOT ${generator_is_multi_config}) - set(build_type_args -DCMAKE_BUILD_TYPE=$) - endif () - - ExternalProject_Add( - ${arg_NAME}.External - SOURCE_DIR ${arg_SOURCE_DIR} - BINARY_DIR ${arg_BINARY_DIR} - CMAKE_ARGS ${build_type_args} -DCMAKE_INSTALL_PREFIX=${arg_INSTALL_DIR} ${arg_CMAKE_ARG} - BUILD_COMMAND ${CMAKE_COMMAND} --build --config $ -j 16 - INSTALL_COMMAND ${CMAKE_COMMAND} --install --config $ - ) - add_library(${arg_NAME} INTERFACE) - add_dependencies(${arg_NAME} ${arg_NAME}.External) - - if (DEFINED arg_INCLUDE) - exp_expand_3rd_path_expression( - INPUT ${arg_INCLUDE} - OUTPUT r_include - SOURCE_DIR ${arg_SOURCE_DIR} - BINARY_DIR ${arg_BINARY_DIR} - INSTALL_DIR ${arg_INSTALL_DIR} - ) - exp_get_3rd_platform_value( - INPUT ${r_include} - OUTPUT p_include - ) - target_include_directories( - ${arg_NAME} - INTERFACE ${p_include} - ) - endif() - - if (DEFINED arg_LINK) - exp_expand_3rd_path_expression( - INPUT ${arg_LINK} - OUTPUT r_link - SOURCE_DIR ${arg_SOURCE_DIR} - BINARY_DIR ${arg_BINARY_DIR} - INSTALL_DIR ${arg_INSTALL_DIR} - ) - exp_get_3rd_platform_value( - INPUT ${r_link} - OUTPUT p_link - ) - target_link_directories( - ${arg_NAME} - INTERFACE ${p_link} - ) - endif() - - if (DEFINED arg_LIB) - exp_expand_3rd_path_expression( - INPUT ${arg_LIB} - OUTPUT r_lib - SOURCE_DIR ${arg_SOURCE_DIR} - BINARY_DIR ${arg_BINARY_DIR} - INSTALL_DIR ${arg_INSTALL_DIR} - ) - exp_get_3rd_platform_value( - INPUT ${r_lib} - OUTPUT p_lib - ) - target_link_libraries( - ${arg_NAME} - INTERFACE "${p_lib}" - ) - endif() - - if (DEFINED arg_RUNTIME_DEP) - exp_expand_3rd_path_expression( - INPUT ${arg_RUNTIME_DEP} - OUTPUT r_runtime_dep - SOURCE_DIR ${arg_SOURCE_DIR} - BINARY_DIR ${arg_BINARY_DIR} - INSTALL_DIR ${arg_INSTALL_DIR} - ) - exp_get_3rd_platform_value( - INPUT ${r_runtime_dep} - OUTPUT p_runtime_dep - ) - set_target_properties( - ${arg_NAME} PROPERTIES - RUNTIME_DEP "${p_runtime_dep}" - ) - endif() -endfunction() - -function(exp_add_3rd_alias_package) - set(options "") - set(singleValueArgs NAME) - set(multiValueArgs LIB) - cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) - - add_library(${arg_NAME} INTERFACE) - target_link_libraries( - ${arg_NAME} - INTERFACE "${arg_LIB}" - ) -endfunction() diff --git a/CMakeLists.txt b/CMakeLists.txt index 201559d9b..c4f716575 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,8 @@ cmake_minimum_required(VERSION 3.25) + +set(CONAN_INSTALL_BUILD_CONFIGURATIONS "Release" CACHE STRING "" FORCE) +set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES ${CMAKE_SOURCE_DIR}/conan_provider.cmake CACHE PATH "" FORCE) + project(Explosion) option(BUILD_EDITOR "Build Explosion editor" ON) @@ -7,11 +11,14 @@ option(CI "Build in CI" OFF) set(SUB_PROJECT_NAME "Engine" CACHE STRING "" FORCE) set(ENGINE_SUB_PROJECT_NAME "Engine" CACHE STRING "" FORCE) +set(CMAKE_MAP_IMPORTED_CONFIG_DEBUG "Release" CACHE STRING "" FORCE) +set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Release" CACHE STRING "" FORCE) +set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL "Release" CACHE STRING "" FORCE) + add_definitions(-DBUILD_EDITOR=$) include(CMake/Common.cmake) include(CMake/Target.cmake) -include(CMake/ThirdParty.cmake) add_subdirectory(ThirdParty) add_subdirectory(Engine) diff --git a/Editor/CMakeLists.txt b/Editor/CMakeLists.txt index 0b51913ce..a1e5ec330 100644 --- a/Editor/CMakeLists.txt +++ b/Editor/CMakeLists.txt @@ -1,25 +1,25 @@ -set(CMAKE_PREFIX_PATH ${QT_LIB_PREFIX}) find_package( - Qt6 ${QT_VERSION} - COMPONENTS Core Gui Widgets Quick WebEngineWidgets + Qt6 + COMPONENTS Core Gui Widgets WebEngineWidgets REQUIRED ) +set(QT_ROOT ${QT6_INSTALL_PREFIX}) -qt_standard_project_setup(REQUIRES ${QT_VERSION}) +qt_standard_project_setup() if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(PLATFORM_EXECUTABLE_HINT MACOSX_BUNDLE) - set(BUNDLE_INSTALL_DESTINATION BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}/${ENGINE_SUB_PROJECT_NAME}/Binaries) - set(PLATFORM_FRAMEWORK_DIR ${QT_LIB_PREFIX}/lib) + set(platform_executable_hint MACOSX_BUNDLE) + set(bundle_install_dest BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}/${ENGINE_SUB_PROJECT_NAME}/Binaries) + set(platform_fwk_dir ${QT_ROOT}/lib) endif () -set(EDITOR_INCLUDES Include) -set(EDITOR_QT_LIBS Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Quick Qt6::WebEngineWidgets) -set(EDITOR_LIBS Core RHI Runtime cpp-httplib ${EDITOR_QT_LIBS}) +set(editor_includes Include) +set(editor_qt_libs Qt6::Core Qt6::Gui Qt6::Widgets Qt6::WebEngineWidgets) +set(editor_libs Core RHI Runtime httplib::httplib ${editor_qt_libs}) -foreach (QT_LIB ${EDITOR_QT_LIBS}) +foreach (QT_LIB ${editor_qt_libs}) string(REPLACE "::" "" QT_RAW_LIB ${QT_LIB}) - list(APPEND EDITOR_INCLUDES ${${QT_RAW_LIB}_INCLUDE_DIRS}) + list(APPEND editor_includes ${${QT_RAW_LIB}_INCLUDE_DIRS}) endforeach () exp_add_mirror_info_source_generation_target( @@ -27,13 +27,13 @@ exp_add_mirror_info_source_generation_target( OUTPUT_SRC EDITOR_MIRROR_GENERATED_SRC OUTPUT_TARGET_NAME EDITOR_MIRROR_GENERATED_TARGET SEARCH_DIR Include - PRIVATE_INC ${EDITOR_INCLUDES} - LIB ${EDITOR_LIBS} - FRAMEWORK_DIR ${PLATFORM_FRAMEWORK_DIR} + PRIVATE_INC ${editor_includes} + LIB ${editor_libs} + FRAMEWORK_DIR ${platform_fwk_dir} ) file(GLOB_RECURSE SOURCES Src/*.cpp) -qt_add_executable(Editor ${PLATFORM_EXECUTABLE_HINT} ${SOURCES} ${EDITOR_MIRROR_GENERATED_SRC}) +qt_add_executable(Editor ${platform_executable_hint} ${SOURCES} ${EDITOR_MIRROR_GENERATED_SRC}) get_cmake_property(GENERATOR_IS_MULTI_CONFIG GENERATOR_IS_MULTI_CONFIG) if (${GENERATOR_IS_MULTI_CONFIG}) @@ -48,8 +48,8 @@ else () ) endif () -target_include_directories(Editor PRIVATE ${EDITOR_INCLUDES}) -target_link_libraries(Editor PRIVATE ${EDITOR_LIBS}) +target_include_directories(Editor PRIVATE ${editor_includes}) +target_link_libraries(Editor PRIVATE ${editor_libs}) if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set(RHI_DEP_TARGETS RHI-DirectX12 RHI-Vulkan) @@ -60,98 +60,93 @@ add_dependencies(Editor ${EDITOR_MIRROR_GENERATED_TARGET} ${RHI_DEP_TARGETS}) exp_process_runtime_dependencies( NAME Editor + DEP_TARGET ${RHI_DEP_TARGETS} ) install( TARGETS Editor RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${ENGINE_SUB_PROJECT_NAME}/Binaries - ${BUNDLE_INSTALL_DESTINATION} + ${bundle_install_dest} +) +export( + TARGETS Editor + NAMESPACE ${SUB_PROJECT_NAME}:: + APPEND FILE ${CMAKE_BINARY_DIR}/${SUB_PROJECT_NAME}Targets.cmake ) if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set(QT_WIN_DEPLOY_EXECUTABLE ${QT_LIB_PREFIX}/bin/windeployqt.exe) + set(qt_win_deploy_executable ${QT_ROOT}/bin/windeployqt.exe) add_custom_command( TARGET Editor POST_BUILD - # ++ QT 6.9.1 Temporal Fix Start - # #see https://bugreports.qt.io/browse/QTBUG-137542 - # NOTICE: seems cause some error on debug config, like render process crash after hover a remote link, please use DebugWithRelease before official fix at 6.9.2 - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_LIB_PREFIX}/resources/qtwebengine_devtools_resources.pak ${QT_LIB_PREFIX}/resources/qtwebengine_devtools_resources.debug.pak - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_LIB_PREFIX}/resources/qtwebengine_resources.pak ${QT_LIB_PREFIX}/resources/qtwebengine_resources.debug.pak - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_LIB_PREFIX}/resources/qtwebengine_resources_100p.pak ${QT_LIB_PREFIX}/resources/qtwebengine_resources_100p.debug.pak - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_LIB_PREFIX}/resources/qtwebengine_resources_200p.pak ${QT_LIB_PREFIX}/resources/qtwebengine_resources_200p.debug.pak - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_LIB_PREFIX}/resources/qtwebengine_devtools_resources.pak $/resources/qtwebengine_devtools_resources.pak - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_LIB_PREFIX}/resources/qtwebengine_resources.pak $/resources/qtwebengine_resources.pak - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_LIB_PREFIX}/resources/qtwebengine_resources_100p.pak $/resources/qtwebengine_resources_100p.pak - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_LIB_PREFIX}/resources/qtwebengine_resources_200p.pak $/resources/qtwebengine_resources_200p.pak - # -- QT 6.9.1 Temporal Fix End - COMMAND ${QT_WIN_DEPLOY_EXECUTABLE} $ + COMMAND ${qt_win_deploy_executable} $ ) install( - CODE "execute_process(COMMAND ${QT_WIN_DEPLOY_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${ENGINE_SUB_PROJECT_NAME}/Binaries/$)" + CODE "execute_process(COMMAND ${qt_win_deploy_executable} ${CMAKE_INSTALL_PREFIX}/${ENGINE_SUB_PROJECT_NAME}/Binaries/$)" ) elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(QT_MAC_DEPLOY_EXECUTABLE ${QT_LIB_PREFIX}/bin/macdeployqt) + set(qt_mac_deploy_executable ${QT_ROOT}/bin/macdeployqt) add_custom_command( TARGET Editor POST_BUILD - COMMAND ${QT_MAC_DEPLOY_EXECUTABLE} $/Editor.app -no-strip + COMMAND ${qt_mac_deploy_executable} $/Editor.app -no-strip ) install( - CODE "execute_process(COMMAND ${QT_MAC_DEPLOY_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${ENGINE_SUB_PROJECT_NAME}/Binaries/Editor.app -no-strip)" + CODE "execute_process(COMMAND ${qt_mac_deploy_executable} ${CMAKE_INSTALL_PREFIX}/${ENGINE_SUB_PROJECT_NAME}/Binaries/Editor.app -no-strip)" ) endif () if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - foreach (RHI_DEP_TARGET ${RHI_DEP_TARGETS}) - list(APPEND RHI_DEP_TARGET_COPY_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $/../Frameworks/$) + foreach (rhi_dep_target ${RHI_DEP_TARGETS}) + list(APPEND rhi_dep_target_copy_commands COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $/../Frameworks/$) + # TODO also copy runtime dep of runtime dep endforeach () add_custom_command( TARGET Editor POST_BUILD - ${RHI_DEP_TARGET_COPY_COMMANDS} + ${rhi_dep_target_copy_commands} ) endif () # ---- begin shaders --------------------------------------------------------------------------------- -get_engine_shader_resources(OUTPUT EDITOR_RESOURCES) +get_engine_shader_resources(OUTPUT editor_resources) -file(GLOB_RECURSE SHADERS Shader/*.es*) -foreach (SHADER ${SHADERS}) - get_filename_component(SHADER_ABSOLUTE ${SHADER} ABSOLUTE) - string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/Shader ../Shader/Editor COPY_DST ${SHADER_ABSOLUTE}) - list(APPEND EDITOR_RESOURCES ${SHADER}->${COPY_DST}) +file(GLOB_RECURSE shaders Shader/*.es*) +foreach (shader ${shaders}) + get_filename_component(shader_absolute ${shader} ABSOLUTE) + string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/Shader ../Shader/Editor copy_dst ${shader_absolute}) + list(APPEND editor_resources ${shader}->${copy_dst}) endforeach () -file(GLOB_RECURSE RESOURCES Resource/*) -foreach (RESOURCE ${RESOURCES}) - get_filename_component(RESOURCE_ABSOLUTE ${RESOURCE} ABSOLUTE) - string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/Resource ../Resource/Editor COPY_DST ${RESOURCE_ABSOLUTE}) - list(APPEND EDITOR_RESOURCES ${RESOURCE}->${COPY_DST}) +file(GLOB_RECURSE resources Resource/*) +foreach (resource ${resources}) + get_filename_component(resource_absolute ${resource} ABSOLUTE) + string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/Resource ../Resource/Editor copy_dst ${resource_absolute}) + list(APPEND editor_resources ${resource}->${copy_dst}) endforeach () exp_add_resources_copy_command( NAME Editor - RES ${EDITOR_RESOURCES} + RES ${editor_resources} ) # ---- end shaders ----------------------------------------------------------------------------------- # ---- begin web project ----------------------------------------------------------------------------- -find_program(NPM_EXECUTABLE NAMES npm.cmd npm REQUIRED NO_CACHE) +find_program(npm_executable NAMES npm.cmd npm REQUIRED NO_CACHE) message("Perform web project npm install......") execute_process( - COMMAND ${CMAKE_COMMAND} -E env ${NPM_EXECUTABLE} install --no-fund --registry=https://registry.npmmirror.com + COMMAND ${CMAKE_COMMAND} -E env ${npm_executable} install --no-fund --registry=https://registry.npmmirror.com WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Web - RESULT_VARIABLE NPM_INSTALL_RESULT - OUTPUT_VARIABLE NPM_INSTALL_OUTPUT - ERROR_VARIABLE NPM_INSTALL_ERROR + RESULT_VARIABLE npm_install_result + OUTPUT_VARIABLE npm_install_output + ERROR_VARIABLE npm_install_error ) -if (${NPM_INSTALL_RESULT} STREQUAL "0") - message(${NPM_INSTALL_OUTPUT}) +if (${npm_install_result} STREQUAL "0") + message(${npm_install_output}) else () - message(FATAL_ERROR ${NPM_INSTALL_ERROR}) + message(FATAL_ERROR ${npm_install_error}) endif () add_custom_target( Editor.Web - COMMAND ${CMAKE_COMMAND} -E env ${NPM_EXECUTABLE} run build + COMMAND ${CMAKE_COMMAND} -E env ${npm_executable} run build WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Web VERBATIM ) diff --git a/Engine/Source/Common/CMakeLists.txt b/Engine/Source/Common/CMakeLists.txt index 674e6a9e1..bc7fbe101 100644 --- a/Engine/Source/Common/CMakeLists.txt +++ b/Engine/Source/Common/CMakeLists.txt @@ -1,16 +1,16 @@ -file(GLOB_RECURSE SOURCES Src/*.cpp) +file(GLOB_RECURSE sources Src/*.cpp) exp_add_library( NAME Common TYPE STATIC - SRC ${SOURCES} + SRC ${sources} PUBLIC_INC Include - PUBLIC_MERGE_LIB rapidjson debugbreak cityhash taskflow + PUBLIC_MERGE_LIB rapidjson::rapidjson debugbreak::debugbreak cityhash::cityhash Taskflow::Taskflow ) -file(GLOB TEST_SOURCES Test/*.cpp) +file(GLOB test_sources Test/*.cpp) exp_add_test( NAME Common.Test INC Test - SRC ${TEST_SOURCES} + SRC ${test_sources} LIB Common ) diff --git a/Engine/Source/Common/Include/Common/Platform.h b/Engine/Source/Common/Include/Common/Platform.h index 541d3fddf..110b73e3d 100644 --- a/Engine/Source/Common/Include/Common/Platform.h +++ b/Engine/Source/Common/Include/Common/Platform.h @@ -4,6 +4,8 @@ #pragma once +#include + namespace Common { enum class DevelopmentPlatform { windows, @@ -29,4 +31,9 @@ namespace Common { x64, max }; + + class PlatformUtils { + public: + static void SetEnvVar(const std::string& inKey, const std::string& inValue); + }; } diff --git a/Engine/Source/Common/Src/Platform.cpp b/Engine/Source/Common/Src/Platform.cpp new file mode 100644 index 000000000..2add1eafb --- /dev/null +++ b/Engine/Source/Common/Src/Platform.cpp @@ -0,0 +1,23 @@ +// +// Created by johnk on 2025/12/21. +// + +#if PLATFORM_WINDOWS +#include +#else +#include +#endif + +#include +#include + +namespace Common { + void PlatformUtils::SetEnvVar(const std::string& inKey, const std::string& inValue) + { +#if PLATFORM_WINDOWS + Assert(SetEnvironmentVariableA(inKey.c_str(), inValue.c_str())); +#else + setenv(inKey.c_str(), inValue.c_str(), 1); +#endif + } +} diff --git a/Engine/Source/Common/Test/HashTest.cpp b/Engine/Source/Common/Test/HashTest.cpp index 1e0f3dc74..532085fc1 100644 --- a/Engine/Source/Common/Test/HashTest.cpp +++ b/Engine/Source/Common/Test/HashTest.cpp @@ -11,7 +11,7 @@ TEST(HashTest, CityHashTest) { constexpr std::string_view testString = "Hello, World"; - ASSERT_EQ(4508847345234768385, Common::HashUtils::CityHash(testString.data(), testString.size())); + ASSERT_EQ(7750308374451649530, Common::HashUtils::CityHash(testString.data(), testString.size())); } TEST(HashTest, StrCrc32Test) diff --git a/Engine/Source/Core/CMakeLists.txt b/Engine/Source/Core/CMakeLists.txt index cc02b9105..c15712585 100644 --- a/Engine/Source/Core/CMakeLists.txt +++ b/Engine/Source/Core/CMakeLists.txt @@ -1,16 +1,16 @@ -file(GLOB SOURCES Src/*.cpp) +file(GLOB sources Src/*.cpp) exp_add_library( NAME Core TYPE SHARED - SRC ${SOURCES} + SRC ${sources} PUBLIC_INC Include PUBLIC_LIB Common - PUBLIC_MERGE_LIB clipp + PUBLIC_MERGE_LIB clipp::clipp ) -file(GLOB TEST_SOURCES Test/*.cpp) +file(GLOB test_sources Test/*.cpp) exp_add_test( NAME Core.Test - SRC ${TEST_SOURCES} + SRC ${test_sources} LIB Core ) diff --git a/Engine/Source/Core/Src/Module.cpp b/Engine/Source/Core/Src/Module.cpp index c8105c315..24ff9ec14 100644 --- a/Engine/Source/Core/Src/Module.cpp +++ b/Engine/Source/Core/Src/Module.cpp @@ -148,7 +148,7 @@ namespace Core { for (const auto& searchPath : searchPaths) { std::optional result = std::nullopt; - (void) searchPath.TraverseRecurse([&](const Common::Path& path) -> bool { + (void) searchPath.Traverse([&](const Common::Path& path) -> bool { if (path.IsDirectory()) { return true; } diff --git a/Engine/Source/Launch/CMakeLists.txt b/Engine/Source/Launch/CMakeLists.txt index 857208f4e..b90dcb38d 100644 --- a/Engine/Source/Launch/CMakeLists.txt +++ b/Engine/Source/Launch/CMakeLists.txt @@ -1,9 +1,9 @@ -file(GLOB_RECURSE SOURCES Src/*.cpp) +file(GLOB_RECURSE sources Src/*.cpp) exp_add_library( NAME Launch TYPE STATIC - SRC ${SOURCES} + SRC ${sources} PUBLIC_INC Include PUBLIC_LIB Runtime - PUBLIC_MERGE_LIB glfw + PUBLIC_MERGE_LIB glfw::glfw ) \ No newline at end of file diff --git a/Engine/Source/Mirror/CMakeLists.txt b/Engine/Source/Mirror/CMakeLists.txt index 240bfb2fd..74ec4d024 100644 --- a/Engine/Source/Mirror/CMakeLists.txt +++ b/Engine/Source/Mirror/CMakeLists.txt @@ -1,16 +1,16 @@ -file(GLOB SOURCES Src/*.cpp) +file(GLOB sources Src/*.cpp) exp_add_library( NAME Mirror TYPE SHARED - SRC ${SOURCES} + SRC ${sources} PUBLIC_INC Include PUBLIC_LIB Common ) -file(GLOB TEST_SOURCES Test/*.cpp) +file(GLOB test_sources Test/*.cpp) exp_add_test( NAME Mirror.Test - SRC ${TEST_SOURCES} + SRC ${test_sources} LIB Mirror INC Test REFLECT Test diff --git a/Engine/Source/RHI-DirectX12/CMakeLists.txt b/Engine/Source/RHI-DirectX12/CMakeLists.txt index 9b5c29b2d..e42791ca4 100644 --- a/Engine/Source/RHI-DirectX12/CMakeLists.txt +++ b/Engine/Source/RHI-DirectX12/CMakeLists.txt @@ -1,9 +1,9 @@ -file(GLOB SOURCES Src/*.cpp) +file(GLOB sources Src/*.cpp) exp_add_library( NAME RHI-DirectX12 TYPE SHARED - SRC ${SOURCES} + SRC ${sources} PUBLIC_INC Include PUBLIC_LIB RHI d3d12 - PUBLIC_MERGE_LIB DirectXHeaders dxgi d3dcompiler + PUBLIC_MERGE_LIB Microsoft::DirectX-Headers dxgi d3dcompiler ) diff --git a/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Common.h b/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Common.h index 417a297f6..9feae4cc4 100644 --- a/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Common.h +++ b/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Common.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Instance.h b/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Instance.h index 224c232a5..304de00c8 100644 --- a/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Instance.h +++ b/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Instance.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Queue.h b/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Queue.h index 784924714..f2b165d92 100644 --- a/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Queue.h +++ b/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Queue.h @@ -5,7 +5,7 @@ #pragma once #include -#include +#include #include diff --git a/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/ShaderModule.h b/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/ShaderModule.h index 83c5a6128..45e082e25 100644 --- a/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/ShaderModule.h +++ b/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/ShaderModule.h @@ -4,7 +4,6 @@ #pragma once -#include #include #include diff --git a/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Synchronous.h b/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Synchronous.h index d80125467..0f131802d 100644 --- a/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Synchronous.h +++ b/Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Synchronous.h @@ -8,7 +8,7 @@ #include #include -#include +#include using namespace Microsoft::WRL; #include diff --git a/Engine/Source/RHI-Dummy/CMakeLists.txt b/Engine/Source/RHI-Dummy/CMakeLists.txt index 23b290d65..74b4e71be 100644 --- a/Engine/Source/RHI-Dummy/CMakeLists.txt +++ b/Engine/Source/RHI-Dummy/CMakeLists.txt @@ -1,8 +1,8 @@ -file(GLOB SOURCES Src/*.cpp) +file(GLOB sources Src/*.cpp) exp_add_library( NAME RHI-Dummy TYPE SHARED - SRC ${SOURCES} + SRC ${sources} PUBLIC_INC Include PUBLIC_LIB RHI ) diff --git a/Engine/Source/RHI-Vulkan/CMakeLists.txt b/Engine/Source/RHI-Vulkan/CMakeLists.txt index 3dedd5fc8..bad54060e 100644 --- a/Engine/Source/RHI-Vulkan/CMakeLists.txt +++ b/Engine/Source/RHI-Vulkan/CMakeLists.txt @@ -1,22 +1,19 @@ -file(GLOB SOURCES Src/*.cpp) +file(GLOB sources Src/*.cpp) if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set(PLATFORM_SOURCES Src/Platform/Win32Surface.cpp) + set(platform_sources Src/Platform/Win32Surface.cpp) elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(PLATFORM_SOURCES Src/Platform/MacosSurface.mm) - set(PLATFORM_EXT_LIBS - "-framework Cocoa" - "-framework IOKit" - "-framework CoreFoundation") + set(platform_sources Src/Platform/MacosSurface.mm) + set(platform_ext_libs molten-vk::molten-vk "-framework Cocoa" "-framework IOKit" "-framework CoreFoundation") endif() exp_add_library( NAME RHI-Vulkan TYPE SHARED - SRC ${SOURCES} ${PLATFORM_SOURCES} + SRC ${sources} ${platform_sources} PUBLIC_INC Include - PUBLIC_LIB RHI ${PLATFORM_EXT_LIBS} - PUBLIC_MERGE_LIB VulkanSDK spirv-cross VulkanMemoryAllocator + PUBLIC_LIB RHI ${platform_ext_libs} + PUBLIC_MERGE_LIB Vulkan::Headers Vulkan::Loader vulkan-validationlayers::vulkan-validationlayers spirv-cross::spirv-cross GPUOpen::VulkanMemoryAllocator ) # .mm files can not perform unity build with .cpp files diff --git a/Engine/Source/RHI-Vulkan/Src/Instance.cpp b/Engine/Source/RHI-Vulkan/Src/Instance.cpp index c19574d3d..803d12e33 100644 --- a/Engine/Source/RHI-Vulkan/Src/Instance.cpp +++ b/Engine/Source/RHI-Vulkan/Src/Instance.cpp @@ -6,8 +6,11 @@ #include #include -#include + +#include "Common/Platform.h" + #include +#include namespace RHI::Vulkan { static std::vector requiredLayerNames = { @@ -57,6 +60,10 @@ namespace RHI::Vulkan { VulkanInstance::VulkanInstance() { +#if PLATFORM_MACOS + Common::PlatformUtils::SetEnvVar("VK_DRIVER_FILES", "MoltenVK_icd.json"); +#endif + #if BUILD_CONFIG_DEBUG PrepareLayers(); #endif @@ -84,6 +91,8 @@ namespace RHI::Vulkan { #if BUILD_CONFIG_DEBUG void VulkanInstance::PrepareLayers() { + Common::PlatformUtils::SetEnvVar("VK_LAYER_PATH", "VkLayer_khronos_validation.json"); + uint32_t supportedLayerCount = 0; vkEnumerateInstanceLayerProperties(&supportedLayerCount, nullptr); std::vector supportedLayers(supportedLayerCount); diff --git a/Engine/Source/RHI/CMakeLists.txt b/Engine/Source/RHI/CMakeLists.txt index 55dc88ffc..5b7d83f94 100644 --- a/Engine/Source/RHI/CMakeLists.txt +++ b/Engine/Source/RHI/CMakeLists.txt @@ -1,8 +1,8 @@ -file(GLOB SOURCES Src/*.cpp) +file(GLOB sources Src/*.cpp) exp_add_library( NAME RHI TYPE STATIC - SRC ${SOURCES} + SRC ${sources} PUBLIC_INC Include PUBLIC_LIB Core ) diff --git a/Engine/Source/Render/CMakeLists.txt b/Engine/Source/Render/CMakeLists.txt index fbd8cd6e7..f391457aa 100644 --- a/Engine/Source/Render/CMakeLists.txt +++ b/Engine/Source/Render/CMakeLists.txt @@ -1,29 +1,25 @@ -if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(platform_libs VulkanSDK) -endif() - -file(GLOB SOURCES Src/*.cpp) +file(GLOB sources Src/*.cpp) exp_add_library( NAME Render.Static TYPE STATIC - SRC ${SOURCES} + SRC ${sources} PUBLIC_INC Include PUBLIC_LIB Core RHI - PUBLIC_MERGE_LIB dxc spirv-cross ${platform_libs} + PUBLIC_MERGE_LIB dxc::dxc spirv-cross::spirv-cross ) -file(GLOB SHARED_SOURCES SharedSrc/*.cpp) +file(GLOB shader_sources SharedSrc/*.cpp) exp_add_library( NAME Render TYPE SHARED - SRC ${SHARED_SOURCES} + SRC ${shader_sources} PUBLIC_LIB Render.Static ) -file(GLOB TEST_SOURCES Test/*.cpp) +file(GLOB test_sources Test/*.cpp) exp_add_test( NAME Render.Test - SRC ${TEST_SOURCES} + SRC ${test_sources} LIB RHI Render.Static DEP_TARGET RHI-Dummy ) diff --git a/Engine/Source/Runtime/CMakeLists.txt b/Engine/Source/Runtime/CMakeLists.txt index 8c102a2f1..6acf42476 100644 --- a/Engine/Source/Runtime/CMakeLists.txt +++ b/Engine/Source/Runtime/CMakeLists.txt @@ -1,18 +1,18 @@ -file(GLOB_RECURSE SOURCES Src/*.cpp) +file(GLOB_RECURSE sources Src/*.cpp) exp_add_library( NAME Runtime TYPE SHARED - SRC ${SOURCES} + SRC ${sources} PUBLIC_INC Include REFLECT Include PUBLIC_LIB Core Mirror Render - PUBLIC_MERGE_LIB assimp-lib + PUBLIC_MERGE_LIB assimp::assimp ) -file(GLOB TEST_SOURCES Test/*.cpp) +file(GLOB test_sources Test/*.cpp) exp_add_test( NAME Runtime.Test - SRC ${TEST_SOURCES} + SRC ${test_sources} LIB Runtime INC Test REFLECT Test diff --git a/Engine/Source/Test/CMakeLists.txt b/Engine/Source/Test/CMakeLists.txt index 1cf82677d..b1a388f56 100644 --- a/Engine/Source/Test/CMakeLists.txt +++ b/Engine/Source/Test/CMakeLists.txt @@ -4,5 +4,5 @@ exp_add_library( SRC Src/Main.cpp PUBLIC_INC Include PUBLIC_LIB Core - PUBLIC_MERGE_LIB googletest + PUBLIC_MERGE_LIB GTest::gtest ) \ No newline at end of file diff --git a/README.md b/README.md index ec3ab662b..1d0957050 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,48 @@ Explosion is a cross-platform C++ game engine, based on modern graphics api (aka You need install those tools to system by yourself and add them to path: * [Python3](https://www.python.org/downloads/) +* [Conan](https://github.com/conan-io/conan) * [CMake](https://cmake.org/download/) +* [Ninja](https://github.com/ninja-build/ninja) * [Node.js](https://nodejs.org/en/download) build steps of engine may use them. # Build +## Configure Conan + +Some third-party libraries managed by Conan may need to be downloaded and installed from our private repository. Please configure Conan's remote first: + +```shell +conan remote add explosion https://kindem.online/artifactory/api/conan/conan +``` + +## macOS Notice +If you have not installed xcode and xcode command line tool, you need install them, xcode can be downloaded from app store, and xcode command line tool can be installed with: + +```shell +xcode-select --install +``` + +And you need check the xcode-select path: + +```shell +xcode-select -p +``` + +If the output not equals `/Applications/Xcode.app/Contents/Developer`, you need to set it: + +```shell +sudo xcode-select -s /Applications/Xcode.app/Contents/Developer +``` + +## Windows Notice + +Some third-party libraries managed by conan may fail to install or compile on Windows due to excessively long build tree paths. So you need to configure the environment variable `CONAN_HOME` and set it to a relatively short path, such as `C:\t` + +## Build Project + The following table contains supported platform, toolchain and generator: @@ -87,29 +122,11 @@ The parameters' meaning: After build the project, you can get all dist binaries in `/dist`. -## macOS Notice -If you have not installed xcode command line tools, you need install it: - -```shell -xcode-select --install -``` - -If xcode app or xcode command line tools installed on you system, you need check xcode path set to command line tools path, continue with this command: - -```shell -xcode-select -p -``` - -if the command print is not `/Library/Developer/CommandLineTools`, use this command to reset it: - -```shell -sudo xcode-select -s /Library/Developer/CommandLineTools -``` - # Third Party Project Usage Thanks all those following projects: +* [Conan](https://github.com/conan-io/conan) * [DirectX-Headers](https://github.com/microsoft/DirectX-Headers) * [Vulkan](https://www.vulkan.org/) * [DirectXShaderCompiler](https://github.com/microsoft/DirectXShaderCompiler) diff --git a/Sample/CMakeLists.txt b/Sample/CMakeLists.txt index 71d6c2f74..931784eca 100644 --- a/Sample/CMakeLists.txt +++ b/Sample/CMakeLists.txt @@ -37,46 +37,47 @@ function(add_sample) RES ${paths} NOT_INSTALL ) + add_dependencies(${arg_NAME} ${platform_dep_target}) endfunction() if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(PLATFORM_EXT_LIBS + set(platform_ext_libs "-framework Cocoa" "-framework IOKit" "-framework CoreFoundation") endif() -file(GLOB SOURCES Base/*.cpp) +file(GLOB sources Base/*.cpp) exp_add_library( NAME Sample-Base - SRC ${SOURCES} + SRC ${sources} PUBLIC_INC Base - PUBLIC_LIB RHI ${PLATFORM_EXT_LIBS} Render.Static - PUBLIC_MERGE_LIB glfw clipp stb assimp-lib + PUBLIC_LIB RHI ${platform_ext_libs} Render.Static + PUBLIC_MERGE_LIB glfw::glfw clipp::clipp stb::stb assimp::assimp NOT_INSTALL ) -file(GLOB SOURCES RHI-Triangle/*.cpp) +file(GLOB sources RHI-Triangle/*.cpp) add_sample( NAME RHISample-Triangle - SRC ${SOURCES} + SRC ${sources} INC RHI-Triangle SHADER RHI-Triangle/Triangle.esl ) -file(GLOB SOURCES RHI-TexSampling/*.cpp) +file(GLOB sources RHI-TexSampling/*.cpp) add_sample( NAME RHISample-TexSampling - SRC ${SOURCES} + SRC ${sources} INC RHI-TexSampling SHADER RHI-TexSampling/TexSampling.esl IMAGE RHI-TexSampling/Awesomeface.png ) -file(GLOB SOURCES RHI-SSAO/*.cpp) +file(GLOB sources RHI-SSAO/*.cpp) add_sample( NAME RHISample-SSAO - SRC ${SOURCES} + SRC ${sources} INC RHI-SSAO SHADER RHI-SSAO/Shader/Gbuffer.esl @@ -87,28 +88,28 @@ add_sample( RHI-SSAO/Model/Voyager.gltf ) -file(GLOB SOURCES RHI-ParallelCompute/*.cpp) +file(GLOB sources RHI-ParallelCompute/*.cpp) add_sample( NAME RHISample-ParallelCompute - SRC ${SOURCES} + SRC ${sources} SHADER RHI-ParallelCompute/Compute.esl ) -file(GLOB SOURCES Rendering-Triangle/*.cpp) +file(GLOB sources Rendering-Triangle/*.cpp) add_sample( NAME RenderingSample-Triangle - SRC ${SOURCES} + SRC ${sources} INC Rendering-Triangle SHADER Rendering-Triangle/Triangle.esl ) -file(GLOB SOURCES Rendering-BaseTexture/*.cpp) +file(GLOB sources Rendering-BaseTexture/*.cpp) add_sample( - NAME Rendering-BaseTexture - SRC ${SOURCES} - INC Rendering-BaseTexture - SHADER Rendering-BaseTexture/BaseTexture.esl - IMAGE Rendering-BaseTexture/Awesomeface.png + NAME Rendering-BaseTexture + SRC ${sources} + INC Rendering-BaseTexture + SHADER Rendering-BaseTexture/BaseTexture.esl + IMAGE Rendering-BaseTexture/Awesomeface.png ) diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt index f06dc4cc8..8971cdfed 100644 --- a/ThirdParty/CMakeLists.txt +++ b/ThirdParty/CMakeLists.txt @@ -1,468 +1,34 @@ -set(3RD_REPO "http://1.13.181.171" CACHE STRING "" FORCE) -set(3RD_DIR ${CMAKE_SOURCE_DIR}/ThirdParty CACHE PATH "" FORCE) -set(3RD_ZIP_DIR ${3RD_DIR}/Zip CACHE PATH "" FORCE) -set(3RD_SOURCE_DIR ${3RD_DIR}/Lib CACHE PATH "" FORCE) -set(3RD_BINARY_DIR ${CMAKE_BINARY_DIR}/ThirdPartyBuild CACHE PATH "" FORCE) -set(3RD_INSTALL_DIR ${CMAKE_BINARY_DIR}/ThirdPartyInstall CACHE PATH "" FORCE) +if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + add_library(OpenGLDummy INTERFACE) + add_library(opengl::opengl ALIAS OpenGLDummy) +endif () + +find_package(httplib REQUIRED GLOBAL) +find_package(glfw REQUIRED GLOBAL) +find_package(stb REQUIRED GLOBAL) +find_package(cityhash REQUIRED GLOBAL) +find_package(GTest REQUIRED GLOBAL) +find_package(Taskflow REQUIRED GLOBAL) +find_package(libclang REQUIRED GLOBAL) +find_package(assimp REQUIRED GLOBAL) +find_package(VulkanMemoryAllocator REQUIRED GLOBAL) +find_package(debugbreak REQUIRED GLOBAL) +find_package(rapidjson REQUIRED GLOBAL) +find_package(clipp REQUIRED GLOBAL) +find_package(dxc REQUIRED GLOBAL) +find_package(VulkanHeaders REQUIRED GLOBAL) +find_package(VulkanLoader REQUIRED GLOBAL) +find_package(VulkanValidationLayers REQUIRED GLOBAL) +find_package(spirv-cross REQUIRED GLOBAL) -function(download_and_setup_3rd_package) - set(options "") - set(singleValueArgs NAME) - set(multiValueArgs PLATFORM VERSION HASH) - cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) - - exp_get_3rd_platform_value( - OUTPUT version_value - INPUT ${arg_VERSION} - ) - - set(cur_platform All ${CMAKE_SYSTEM_NAME}) - foreach (platform ${cur_platform}) - if (${platform} IN_LIST arg_PLATFORM) - set(full_name "${arg_NAME}-${platform}-${version_value}") - endif () - endforeach () - - if (NOT DEFINED full_name) - set(${arg_NAME}_READY FALSE PARENT_SCOPE) - return() - endif () - - set(source_dir ${3RD_SOURCE_DIR}/${full_name}) - exp_download_and_extract_3rd_package( - URL ${3RD_REPO}/${full_name}.7z - SAVE_AS ${3RD_ZIP_DIR}/${full_name}.7z - EXTRACT_TO ${source_dir} - HASH ${arg_HASH} - ) - set(${arg_NAME}_READY TRUE PARENT_SCOPE) - set(${arg_NAME}_SOURCE_DIR ${source_dir} PARENT_SCOPE) - set(${arg_NAME}_BINARY_DIR ${3RD_BINARY_DIR}/${arg_NAME} PARENT_SCOPE) - set(${arg_NAME}_INSTALL_DIR ${3RD_INSTALL_DIR}/${arg_NAME}/$ PARENT_SCOPE) -endfunction() - -function(should_setup_3rd_package) - set(options "") - set(singleValueArgs NAME) - set(multiValueArgs PLATFORM) - cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) - - set(cur_platform All ${CMAKE_SYSTEM_NAME}) - foreach (platform ${cur_platform}) - if (${platform} IN_LIST arg_PLATFORM) - set(${arg_NAME}_READY TRUE PARENT_SCOPE) - return() - endif () - endforeach () - - set(${arg_NAME}_READY FALSE PARENT_SCOPE) -endfunction() - -# DirectX 12 Headers -download_and_setup_3rd_package( - NAME DirectXHeaders - PLATFORM Windows - VERSION 1.4.9 - HASH 0313c5145214dda2a183af97212878482aafbb2433d4f0ec0a2efeec7cc9ef2a -) -if (${DirectXHeaders_READY}) - exp_add_3rd_header_only_package( - NAME DirectXHeaders - SOURCE_DIR ${DirectXHeaders_SOURCE_DIR} - INCLUDE $/include - ) -endif () - -# VulkanSDK -set(VULKAN_SDK_VERSION 1.3.296.0) -download_and_setup_3rd_package( - NAME VulkanSDK - PLATFORM Windows Darwin - VERSION ${VULKAN_SDK_VERSION} - HASH - Windows 27b8344a5b1333222d55c9c107914dba1cc9beb788b207e087c27dc7b8762816 - Darwin a792aaad3937a694a4cb853d2fbb3fa7025ba3754bedd52799e687a4c254129c -) -if (${VulkanSDK_READY}) - exp_add_3rd_binary_package( - NAME VulkanSDK - SOURCE_DIR ${VulkanSDK_SOURCE_DIR} - INCLUDE - Windows $/Include - Darwin $/macOS/include - LINK - Windows $/Lib - Darwin $/macOS/lib - LIB - Windows vulkan-1 - Darwin vulkan.1 - ) - if (NOT ${CI}) - #see https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderLayerInterface.md - if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - execute_process(COMMAND reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers" OUTPUT_VARIABLE LAYERS) - string(REGEX MATCH "VkLayer_khronos_validation\.json" MATCH_RESULT ${LAYERS}) - list(LENGTH MATCH_RESULT MATCH_RESULT_LENGTH) - - if (${MATCH_RESULT_LENGTH} GREATER 0) - message("Used registered validation layer in HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers") - else () - set(VALIDATION_LAYER_JSON ${3RD_SOURCE_DIR}/VulkanSDK-Windows-${VULKAN_SDK_VERSION}/Bin/VkLayer_khronos_validation.json) - message("Found no registered validation layer, will register ${VALIDATION_LAYER_JSON} to reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers") - string(REPLACE "/" "\\" VALIDATION_LAYER_JSON ${VALIDATION_LAYER_JSON}) - execute_process(COMMAND PowerShell -Command "Start-Process reg -ArgumentList 'add HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers /v ${VALIDATION_LAYER_JSON} /t REG_DWORD /d 0' -Verb RunAs") - endif () - else (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - # new version of vulkaninfo application use volk to perform dynamic loading, which need libvulkan.dylib in working directory or system, - # so if vulkaninfo print initialized failed, we need copy vulkan dynamic lib to working directory - set(PLATFORM_VULKAN_SDK_DIR ${CMAKE_SOURCE_DIR}/ThirdParty/Lib/VulkanSDK-Darwin-${VULKAN_SDK_VERSION}/macOS) - execute_process(COMMAND ${PLATFORM_VULKAN_SDK_DIR}/bin/vulkaninfo WORKING_DIRECTORY ${PLATFORM_VULKAN_SDK_DIR}/bin OUTPUT_VARIABLE VULKAN_INFO ERROR_VARIABLE VULKAN_INFO) - string(REGEX MATCH "Failed to initialize" MATCH_RESULT ${VULKAN_INFO}) - list(LENGTH MATCH_RESULT MATCH_RESULT_LENGTH) - if (${MATCH_RESULT_LENGTH} GREATER 0) - set(SRC_FILE ${PLATFORM_VULKAN_SDK_DIR}/lib/libvulkan.dylib) - set(DST_FILE ${PLATFORM_VULKAN_SDK_DIR}/bin/libvulkan.dylib) - message("vulkaninfo initialized failed, perform vulkan dynamic library copy: ${SRC_FILE} -> ${DST_FILE}") - file(COPY_FILE ${SRC_FILE} ${DST_FILE} ONLY_IF_DIFFERENT) - else () - message("vulkaninfo test success") - endif () - - # check drivers - execute_process(COMMAND ${PLATFORM_VULKAN_SDK_DIR}/bin/vulkaninfo WORKING_DIRECTORY ${PLATFORM_VULKAN_SDK_DIR}/bin OUTPUT_VARIABLE VULKAN_INFO ERROR_VARIABLE VULKAN_INFO) - string(REGEX MATCH "ERROR_INCOMPATIBLE_DRIVER" MATCH_RESULT ${VULKAN_INFO}) - list(LENGTH MATCH_RESULT MATCH_RESULT_LENGTH) - if (${MATCH_RESULT_LENGTH} GREATER 0) - message("there is no drivers found for vulkan, copy and rewrite driver files to ~/.config/vulkan/icd.d") - get_filename_component(DRIVERS_DIR_ABSOLUTE ~/.config/vulkan/icd.d ABSOLUTE) - if (NOT EXISTS ${DRIVERS_DIR_ABSOLUTE}) - file(MAKE_DIRECTORY ${DRIVERS_DIR_ABSOLUTE}) - endif () - - file(GLOB DRIVER_FILES ${PLATFORM_VULKAN_SDK_DIR}/share/vulkan/icd.d/*.json) - foreach (DRIVER_FILE ${DRIVER_FILES}) - file(READ ${DRIVER_FILE} FILE_CONTENT) - string(REPLACE "../../../lib" "${PLATFORM_VULKAN_SDK_DIR}/lib" FILE_CONTENT ${FILE_CONTENT}) - get_filename_component(FILE_NAME ${DRIVER_FILE} NAME) - file(WRITE ${DRIVERS_DIR_ABSOLUTE}/${FILE_NAME} ${FILE_CONTENT}) - endforeach () - else () - message("found vulkan drivers installed in system, will use it") - endif () - - # check layers - execute_process(COMMAND ${PLATFORM_VULKAN_SDK_DIR}/bin/vulkaninfo WORKING_DIRECTORY ${PLATFORM_VULKAN_SDK_DIR}/bin OUTPUT_VARIABLE VULKAN_INFO ERROR_VARIABLE VULKAN_INFO) - string(REGEX MATCH "Layers:\n=======" MATCH_RESULT ${VULKAN_INFO}) - list(LENGTH MATCH_RESULT MATCH_RESULT_LENGTH) - if (${MATCH_RESULT_LENGTH} GREATER 0) - message("there is no layers found for vulkan, copy and rewrite layer files to ~/.config/vulkan/explicit_layer.d") - get_filename_component(LAYERS_DIR_ABSOLUTE ~/.config/vulkan/explicit_layer.d ABSOLUTE) - if (NOT EXISTS ${LAYERS_DIR_ABSOLUTE}) - file(MAKE_DIRECTORY ${LAYERS_DIR_ABSOLUTE}) - endif () - - file(GLOB LAYER_FILES ${PLATFORM_VULKAN_SDK_DIR}/share/vulkan/explicit_layer.d/*.json) - foreach (LAYER_FILE ${LAYER_FILES}) - file(READ ${LAYER_FILE} FILE_CONTENT) - string(REPLACE "../../../lib" "${PLATFORM_VULKAN_SDK_DIR}/lib" FILE_CONTENT ${FILE_CONTENT}) - get_filename_component(FILE_NAME ${LAYER_FILE} NAME) - file(WRITE ${LAYERS_DIR_ABSOLUTE}/${FILE_NAME} ${FILE_CONTENT}) - endforeach () - else () - message("found vulkan layers installed in system, will use it") - endif () - endif () - endif () -endif () - -# DXC -# Windows uses standalone package, macOS uses lib in VulkanSDK -if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - download_and_setup_3rd_package( - NAME dxc - PLATFORM Windows - VERSION 1.6.2112 - HASH b8d8e5cd03234e477bc3fe5d4258652a7fb61916141660408ee4c54a4f1eb939 - ) - if (${dxc_READY}) - exp_add_3rd_binary_package( - NAME dxc - SOURCE_DIR ${dxc_SOURCE_DIR} - INCLUDE $/inc - LINK $/lib/x64 - LIB dxcompiler - RUNTIME_DEP - Windows $/bin/x64/dxcompiler.dll $/bin/x64/dxil.dll - ) - endif () -elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - should_setup_3rd_package( - NAME dxc - PLATFORM Darwin - ) - if (${dxc_READY}) - exp_add_3rd_alias_package( - NAME dxc - LIB dxcompiler - ) - endif () -endif () - -# GLFW -download_and_setup_3rd_package( - NAME glfw - PLATFORM All - VERSION 4.0 - HASH 2483836f085d616acaa48f6dc8efec5239f6a538c3a25d13fdc6a7afb2cce1d4 -) -if (${glfw_READY}) - exp_add_3rd_cmake_package( - NAME glfw - SOURCE_DIR ${glfw_SOURCE_DIR} - BINARY_DIR ${glfw_BINARY_DIR} - INSTALL_DIR ${glfw_INSTALL_DIR} - CMAKE_ARG -DUSE_MSVC_RUNTIME_LIBRARY_DLL=OFF -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF - INCLUDE $/include - LINK $/lib - LIB glfw3 - ) -endif () - -# clipp -download_and_setup_3rd_package( - NAME clipp - PLATFORM All - VERSION forked-f7cffbd61a7b64189d6573e8c3848d094c35168a - HASH 59db8b8586381652b5e0ae629a9d32e0e443428bc4d94af091b9525a62d167fb -) -if (${clipp_READY}) - exp_add_3rd_header_only_package( - NAME clipp - SOURCE_DIR ${clipp_SOURCE_DIR} - INCLUDE $/include - ) -endif () - -# DebugBreak -download_and_setup_3rd_package( - NAME debugbreak - PLATFORM All - VERSION 1.0 - HASH 16e35a330a9927181ed2e03a92efe6d39670b33c1bdf61ab88d29673ef3a89d4 -) -if (${debugbreak_READY}) - exp_add_3rd_header_only_package( - NAME debugbreak - SOURCE_DIR ${debugbreak_SOURCE_DIR} - INSTALL_DIR ${debugbreak_INSTALL_DIR} - INSTALL_FILES debugbreak.h - INCLUDE $ - ) -endif () - -# LLVM-Clang -download_and_setup_3rd_package( - NAME llvm-clang - PLATFORM Windows Darwin - VERSION 19.1.6 - HASH - Windows f68b922c87a99b22c0b53a5cbd55db86bd3870c16c4e9060efaecfb9ce49e726 - Darwin 08fdf1b6208823acadc23027fda1f12e5171101ec05fa526b545088be31fe19d -) -if (${llvm-clang_READY}) - exp_add_3rd_binary_package( - NAME llvm-clang - SOURCE_DIR ${llvm-clang_SOURCE_DIR} - INCLUDE $/include - LINK $/lib - LIB - Windows libclang - Darwin clang - RUNTIME_DEP - Windows $/bin/libclang.dll - Darwin $/lib/libclang.dylib - ) -endif () - -# Google Test -download_and_setup_3rd_package( - NAME googletest - PLATFORM All - VERSION 1.11.0 - HASH bb1146f051868868b96fa83069d4d05f0e05216b5c3f697859c591fd73b93a86 -) -if (${googletest_READY}) - exp_add_3rd_cmake_package( - NAME googletest - SOURCE_DIR ${googletest_SOURCE_DIR} - BINARY_DIR ${googletest_BINARY_DIR} - INSTALL_DIR ${googletest_INSTALL_DIR} - CMAKE_ARG -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -Dgtest_force_shared_crt=ON - INCLUDE $/include - LINK $/lib - LIB gtest$,d,> gmock$,d,> - ) -endif () - -# TaskFlow -download_and_setup_3rd_package( - NAME taskflow - PLATFORM All - VERSION 3.4.0 - HASH 774e23d5b6be17a5482d70ffd76ba4ccfd8821c86b7c3f0bcdcd5d96bc264041 -) -if (${taskflow_READY}) - exp_add_3rd_header_only_package( - NAME taskflow - SOURCE_DIR ${taskflow_SOURCE_DIR} - INSTALL_DIR ${taskflow_INSTALL_DIR} - INSTALL_FILES taskflow - INCLUDE $ - ) -endif () - -# CityHash -download_and_setup_3rd_package( - NAME cityhash - PLATFORM All - VERSION forked-2f248cfbf88d0895d069258e4971b5f2fc3a9f19 - HASH 5acf325794585578915dfa7fbac9eb2ca436ffe4831b05c40d1f286b68d7ac20 -) -if (${cityhash_READY}) - exp_add_3rd_cmake_package( - NAME cityhash - SOURCE_DIR ${cityhash_SOURCE_DIR} - BINARY_DIR ${cityhash_BINARY_DIR} - INSTALL_DIR ${cityhash_INSTALL_DIR} - INCLUDE $/include - LINK $/lib - LIB city - ) -endif () - -# stb-image -download_and_setup_3rd_package( - NAME stb - PLATFORM All - VERSION master-8b5f1f37b5b75829fc72d38e7b5d4bcbf8a26d55 - HASH 32e28f89a85b3bb6749e8caed9eb5226f7f5956769005d2b5a41d48d9481d90c -) -if (${stb_READY}) - exp_add_3rd_header_only_package( - NAME stb - SOURCE_DIR ${stb_SOURCE_DIR} - INCLUDE $ - ) -endif () - -# spirv-cross -download_and_setup_3rd_package( - NAME spirv-cross - PLATFORM All - VERSION 1.3.243.0 - HASH 2b09e3cf9357156e8a4f1bd7cde3771184f652ec3b632993495748112a7f4665 -) -if (${spirv-cross_READY}) - exp_add_3rd_cmake_package( - NAME spirv-cross - SOURCE_DIR ${spirv-cross_SOURCE_DIR} - BINARY_DIR ${spirv-cross_BINARY_DIR} - INSTALL_DIR ${spirv-cross_INSTALL_DIR} - CMAKE_ARG -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DSPIRV_CROSS_CLI=OFF -DSPIRV_CROSS_ENABLE_C_API=OFF -DSPIRV_CROSS_ENABLE_TESTS=OFF - INCLUDE $/include - LINK $/lib - LIB spirv-cross-core$,$>,d,> - spirv-cross-msl$,$>,d,> - spirv-cross-glsl$,$>,d,> - ) -endif () - -# assimp -download_and_setup_3rd_package( - NAME assimp-lib - PLATFORM All - VERSION 5.2.5 - HASH ae55d305a607ad8cc598c306663796dbf6e50a3cb0b952fe1ea3175f0f342ad9 -) -if (${assimp-lib_READY}) - exp_add_3rd_cmake_package( - NAME assimp-lib - SOURCE_DIR ${assimp-lib_SOURCE_DIR} - BINARY_DIR ${assimp-lib_BINARY_DIR} - INSTALL_DIR ${assimp-lib_INSTALL_DIR} - CMAKE_ARG -DASSIMP_BUILD_TESTS=OFF -DASSIMP_WARNINGS_AS_ERRORS=OFF -DASSIMP_INSTALL_PDB=OFF - INCLUDE $/include - LINK $/lib - LIB - Windows "assimp-vc${MSVC_TOOLSET_VERSION}-mt$,d,>" - Darwin "assimp$,d,>" - RUNTIME_DEP - Windows "$/bin/assimp-vc${MSVC_TOOLSET_VERSION}-mt$,d,>.dll" - ) -endif () - -# vma -download_and_setup_3rd_package( - NAME VulkanMemoryAllocator - PLATFORM All - VERSION 3.0.1 - HASH a63a5e32c21fa9e839580d0c8727c6dead9da01730a8f0d10717cd784bc632de -) -if (${VulkanMemoryAllocator_READY}) - exp_add_3rd_header_only_package( - NAME VulkanMemoryAllocator - SOURCE_DIR ${VulkanMemoryAllocator_SOURCE_DIR} - INCLUDE $/include - ) -endif () - -# Qt6 -set(QT_VERSION "6.9.1" CACHE STRING "" FORCE) -download_and_setup_3rd_package( - NAME Qt - PLATFORM Windows Darwin - VERSION ${QT_VERSION} - HASH - Windows 9cd849f79784fda5436b0da3b7625b4530a77b93c5e80ea9a2d8a95060c174b6 - Darwin 3938c6156228fcf63c33029067bd4b6dd333ed284e069198b85d92de3d9b3e13 -) if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set(QT_LIB_PREFIX ${Qt_SOURCE_DIR}/${QT_VERSION}/msvc2022_64 CACHE PATH "" FORCE) + find_package(DirectX-Headers REQUIRED GLOBAL) + set_target_properties(assimp::assimp PROPERTIES RUNTIME_DEP "${assimp_INCLUDE_DIR}/../bin/assimp-vc${MSVC_TOOLSET_VERSION}-mt.dll") + set_target_properties(libclang::libclang PROPERTIES RUNTIME_DEP "${libclang_INCLUDE_DIR}/../bin/libclang.dll") + set_target_properties(dxc::dxc PROPERTIES RUNTIME_DEP "${dxc_INCLUDE_DIR}/../bin/dxil.dll;${dxc_INCLUDE_DIR}/../bin/dxcompiler.dll") + set_target_properties(vulkan-validationlayers::vulkan-validationlayers PROPERTIES RUNTIME_DEP "${VulkanValidationLayers_INCLUDE_DIR}/../bin/VkLayer_khronos_validation.dll;${VulkanValidationLayers_INCLUDE_DIR}/../bin/VkLayer_khronos_validation.json") elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(QT_LIB_PREFIX ${Qt_SOURCE_DIR}/${QT_VERSION}/macos CACHE PATH "" FORCE) - - # NOTICE: Fix Qt 6.9.1 build on macOS 26, #see https://codereview.qt-project.org/c/qt/qtbase/+/652022/3/cmake/FindWrapOpenGL.cmake#b50 - if (QT_VERSION STREQUAL "6.9.1") - file(COPY_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Patch/Qt-Darwin-6.9.1-FindWrapOpenGL.cmake ${QT_LIB_PREFIX}/lib/cmake/Qt6/FindWrapOpenGL.cmake) - endif () -endif () - -# rapidjson -download_and_setup_3rd_package( - NAME rapidjson - PLATFORM All - VERSION d621dc9 - HASH 696f6ca1ecca9d13170c0a47eda66a3015bcf02a7b4bdd23f574ea302eb4bf3e -) -if (${rapidjson_READY}) - exp_add_3rd_header_only_package( - NAME rapidjson - SOURCE_DIR ${rapidjson_SOURCE_DIR} - INCLUDE $/include - ) -endif () - -# cpp-httplib -download_and_setup_3rd_package( - NAME cpp-httplib - PLATFORM All - VERSION 0.24.0 - HASH a0320b106f4a8f945ec2556e62fffab05b068f2ddfff99c6a367b2e16c14bde1 -) -if (${cpp-httplib_READY}) - exp_add_3rd_header_only_package( - NAME cpp-httplib - SOURCE_DIR ${cpp-httplib_SOURCE_DIR} - INCLUDE $ - ) + find_package(MoltenVK REQUIRED GLOBAL) + set_target_properties(vulkan-validationlayers::vulkan-validationlayers PROPERTIES RUNTIME_DEP "${VulkanValidationLayers_INCLUDE_DIR}/../lib/libVkLayer_khronos_validation.dylib;${VulkanValidationLayers_INCLUDE_DIR}/../share/vulkan/explicit_layer.d/VkLayer_khronos_validation.json") + set_target_properties(molten-vk::molten-vk PROPERTIES RUNTIME_DEP "${MoltenVK_INCLUDE_DIR}/../lib/libMoltenVK.dylib;${MoltenVK_INCLUDE_DIR}/../lib/MoltenVK_icd.json") endif () diff --git a/ThirdParty/ConanRecipes/README.md b/ThirdParty/ConanRecipes/README.md new file mode 100644 index 000000000..f32e1eb6f --- /dev/null +++ b/ThirdParty/ConanRecipes/README.md @@ -0,0 +1,44 @@ +# ConanRecipes + +This repository stores all private Conan recipes used by the explosion game engine. Typically, you don't need to build them separately, as all recipes and precompiled binaries have been uploaded to our private artifact repository at [https://kindem.online/artifactory/api/conan/conan](https://kindem.online/artifactory/api/conan/conan) +. The CMake scripts in the explosion game engine will automatically download and install all dependencies from this repository. + +If you have extremely poor network connectivity, you may use these Conan recipes to locally build the required third-party dependencies for the engine. + +Here is a simple example: + +```shell +cd ThirdParty/ConanRecipes +conan create qt/conanfile.py --version="6.10.1-exp" +``` + +For explosion engine developers, those commands may help to debug conan recipes: + +```shell +cd ThirdParty/ConanRecipes +# source stage +conan source qt/conanfile.py --version="6.10.1-exp" +# build stage +conan build qt/conanfile.py --version="6.10.1-exp" +# export stage +conan export-pkg qt/conanfile.py --version="6.10.1-exp" +# test stage +conan test qt/test_package qt/6.10.1-exp +``` + +# Windows User Notice +On the Windows platform, we consider some Visual Studio components as part of the system toolchain. These components are not automatically configured in the conan script, so you will need to install them manually: + +* ATL +* Windows SDK +* Windows Driver Kit + +And some lib may build failed with long build tree path in development mode (like qt-webengine), in this case, you can use the commands to map conan recipes working directory as a driver and execute all conan commands in the driver root: + +```shell +# map +subst z: path/to/engine/ThirdParty/ConanRecipes + +# unmap +subst z: /d +``` diff --git a/ThirdParty/ConanRecipes/assimp/conandata.yml b/ThirdParty/ConanRecipes/assimp/conandata.yml new file mode 100644 index 000000000..01dc5ceb5 --- /dev/null +++ b/ThirdParty/ConanRecipes/assimp/conandata.yml @@ -0,0 +1,3 @@ +sources: + "6.0.2-exp": + url: "https://github.com/assimp/assimp/archive/refs/tags/v6.0.2.tar.gz" diff --git a/ThirdParty/ConanRecipes/assimp/conanfile.py b/ThirdParty/ConanRecipes/assimp/conanfile.py new file mode 100644 index 000000000..a48a9206f --- /dev/null +++ b/ThirdParty/ConanRecipes/assimp/conanfile.py @@ -0,0 +1,67 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, get, collect_libs +import os + +required_conan_version = ">=2.0.9" + +class AssimpConan(ConanFile): + name = "assimp" + description = "assimp" + license = "https://github.com/assimp/assimp?tab=License-1-ov-file" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/assimp/assimp" + topics = ("model", "loader", "tool") + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_cppstd(self, 17) + + def requirements(self): + self.requires("zlib/1.3.1") + + def build_requirements(self): + self.tool_requires("ninja/[>=1.12]") + self.tool_requires("cmake/[>=3.16]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + def generate(self): + cmake_toolchain = CMakeToolchain(self, generator="Ninja") + cmake_toolchain.cache_variables["ASSIMP_BUILD_TESTS"] = "OFF" + cmake_toolchain.cache_variables["ASSIMP_WARNINGS_AS_ERRORS"] = "OFF" + cmake_toolchain.cache_variables["ASSIMP_INSTALL_PDB"] = "OFF" + cmake_toolchain.cache_variables["ASSIMP_BUILD_ZLIB"] = "OFF" + cmake_toolchain.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = collect_libs(self) + self.cpp_info.includedirs = ["include"] + self.cpp_info.libdirs = ["lib"] + if self.settings.os == "Windows": + self.cpp_info.bindirs = ["bin"] + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/assimp/test_package/CMakeLists.txt b/ThirdParty/ConanRecipes/assimp/test_package/CMakeLists.txt new file mode 100644 index 000000000..8a14c9209 --- /dev/null +++ b/ThirdParty/ConanRecipes/assimp/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(assimp REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE assimp::assimp) diff --git a/ThirdParty/ConanRecipes/assimp/test_package/conanfile.py b/ThirdParty/ConanRecipes/assimp/test_package/conanfile.py new file mode 100644 index 000000000..2e77b4246 --- /dev/null +++ b/ThirdParty/ConanRecipes/assimp/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/assimp/test_package/test_package.cpp b/ThirdParty/ConanRecipes/assimp/test_package/test_package.cpp new file mode 100644 index 000000000..fbeef62b1 --- /dev/null +++ b/ThirdParty/ConanRecipes/assimp/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include +#include +#include + +int main(int argc, char **argv) { + Assimp::Importer importer; + const aiScene* scene = importer.ReadFile("", aiProcess_CalcTangentSpace | aiProcess_Triangulate | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType); + return 0; +} \ No newline at end of file diff --git a/ThirdParty/ConanRecipes/clipp/conandata.yml b/ThirdParty/ConanRecipes/clipp/conandata.yml new file mode 100644 index 000000000..6dc1f8e48 --- /dev/null +++ b/ThirdParty/ConanRecipes/clipp/conandata.yml @@ -0,0 +1,8 @@ +sources: + "1.2.3-exp": + url: "https://github.com/muellan/clipp/archive/refs/tags/v1.2.3.tar.gz" +patches: + "1.2.3-exp": + - patch_file: patches/0000-fix-cpp23.patch + patch_description: fix build for c++23 + patch_type: portability diff --git a/ThirdParty/ConanRecipes/clipp/conanfile.py b/ThirdParty/ConanRecipes/clipp/conanfile.py new file mode 100644 index 000000000..4895c2def --- /dev/null +++ b/ThirdParty/ConanRecipes/clipp/conanfile.py @@ -0,0 +1,38 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.files import get, apply_conandata_patches, copy, export_conandata_patches +import os + +required_conan_version = ">=2.0.9" + +class ClippConan(ConanFile): + name = "clipp" + description = "clipp" + license = "https://github.com/muellan/clipp?tab=MIT-1-ov-file" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/muellan/clipp" + topics = ("utils", "cli") + package_type = "header-library" + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + self.folders.source = "src" + self.folders.build = "build" + self.folders.generators = "build/generators" + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + def package(self): + copy(self, "*.h", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.includedirs = ["include"] + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/clipp/patches/0000-fix-cpp23.patch b/ThirdParty/ConanRecipes/clipp/patches/0000-fix-cpp23.patch new file mode 100644 index 000000000..9d0f3dc68 --- /dev/null +++ b/ThirdParty/ConanRecipes/clipp/patches/0000-fix-cpp23.patch @@ -0,0 +1,60 @@ +From 390fd25c5404fdb9f8515774a1ab4283d06873e0 Mon Sep 17 00:00:00 2001 +From: K +Date: Thu, 7 Apr 2022 21:05:09 +0800 +Subject: [PATCH] fix: fix compile issue in C++23 + +#see https://github.com/muellan/clipp/pull/54 +--- + include/clipp.h | 22 +++++++++++++++++++--- + 1 file changed, 19 insertions(+), 3 deletions(-) + +diff --git a/include/clipp.h b/include/clipp.h +index d7b101e..a1bec2d 100644 +--- a/include/clipp.h ++++ b/include/clipp.h +@@ -155,16 +155,27 @@ namespace traits { + * @brief function (class) signature type trait + * + *****************************************************************************/ ++#if defined(__cpp_lib_is_invocable) + template + constexpr auto + check_is_callable(int) -> decltype( + std::declval()(std::declval()...), + std::integral_constant::type>::value>{} ); ++ std::is_same::type>::value>{} ); + +-template ++template + constexpr auto +-check_is_callable(long) -> std::false_type; ++check_is_callable_without_arg(int) -> decltype( ++ std::declval()(), ++ std::integral_constant::type>::value>{} ); ++#else ++template ++constexpr auto ++check_is_callable(int) -> decltype( ++ std::declval()(std::declval()...), ++ std::integral_constant::type>::value>{} ); + + template + constexpr auto +@@ -172,6 +183,11 @@ check_is_callable_without_arg(int) -> decltype( + std::declval()(), + std::integral_constant::type>::value>{} ); ++#endif ++ ++template ++constexpr auto ++check_is_callable(long) -> std::false_type; + + template + constexpr auto +-- +2.50.1.windows.1 + diff --git a/ThirdParty/ConanRecipes/clipp/test_package/CMakeLists.txt b/ThirdParty/ConanRecipes/clipp/test_package/CMakeLists.txt new file mode 100644 index 000000000..07a8b0651 --- /dev/null +++ b/ThirdParty/ConanRecipes/clipp/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(clipp REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE clipp::clipp) diff --git a/ThirdParty/ConanRecipes/clipp/test_package/conanfile.py b/ThirdParty/ConanRecipes/clipp/test_package/conanfile.py new file mode 100644 index 000000000..2e77b4246 --- /dev/null +++ b/ThirdParty/ConanRecipes/clipp/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/clipp/test_package/test_package.cpp b/ThirdParty/ConanRecipes/clipp/test_package/test_package.cpp new file mode 100644 index 000000000..6846564a6 --- /dev/null +++ b/ThirdParty/ConanRecipes/clipp/test_package/test_package.cpp @@ -0,0 +1,21 @@ +#include +#include + +using namespace clipp; +using std::cout; +using std::string; + +int main(int argc, char* argv[]) { + bool rec = false, utf16 = false; + string infile = "", fmt = "csv"; + + auto cli = ( + value("input file", infile), + option("-r", "--recursive").set(rec).doc("convert files recursively"), + option("-o") & value("output format", fmt), + option("-utf16").set(utf16).doc("use UTF-16 encoding") + ); + + parse(argc, argv, cli); + return 0; +} diff --git a/ThirdParty/ConanRecipes/debugbreak/conandata.yml b/ThirdParty/ConanRecipes/debugbreak/conandata.yml new file mode 100644 index 000000000..f9dfc2dc9 --- /dev/null +++ b/ThirdParty/ConanRecipes/debugbreak/conandata.yml @@ -0,0 +1,3 @@ +sources: + "1.0-exp": + url: "https://github.com/scottt/debugbreak/archive/refs/tags/v1.0.tar.gz" diff --git a/ThirdParty/ConanRecipes/debugbreak/conanfile.py b/ThirdParty/ConanRecipes/debugbreak/conanfile.py new file mode 100644 index 000000000..5a1d917fb --- /dev/null +++ b/ThirdParty/ConanRecipes/debugbreak/conanfile.py @@ -0,0 +1,35 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.files import apply_conandata_patches, get, copy +import os + +required_conan_version = ">=2.0.9" + +class DebugBreakConan(ConanFile): + name = "debugbreak" + description = "debugbreak" + license = "https://github.com/scottt/debugbreak?tab=BSD-2-Clause-1-ov-file" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/scottt/debugbreak" + topics = ("utils", "debug") + package_type = "header-library" + + def layout(self): + self.folders.source = "src" + self.folders.build = "build" + self.folders.generators = "build/generators" + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + def package(self): + copy(self, "*.h", self.source_folder, os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.includedirs = ["include"] + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/debugbreak/test_package/CMakeLists.txt b/ThirdParty/ConanRecipes/debugbreak/test_package/CMakeLists.txt new file mode 100644 index 000000000..96f2689a3 --- /dev/null +++ b/ThirdParty/ConanRecipes/debugbreak/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(debugbreak REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE debugbreak::debugbreak) diff --git a/ThirdParty/ConanRecipes/debugbreak/test_package/conanfile.py b/ThirdParty/ConanRecipes/debugbreak/test_package/conanfile.py new file mode 100644 index 000000000..2e77b4246 --- /dev/null +++ b/ThirdParty/ConanRecipes/debugbreak/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/debugbreak/test_package/test_package.cpp b/ThirdParty/ConanRecipes/debugbreak/test_package/test_package.cpp new file mode 100644 index 000000000..70c34392e --- /dev/null +++ b/ThirdParty/ConanRecipes/debugbreak/test_package/test_package.cpp @@ -0,0 +1,5 @@ +#include + +int main(void) { + return 0; +} diff --git a/ThirdParty/ConanRecipes/dxc/conandata.yml b/ThirdParty/ConanRecipes/dxc/conandata.yml new file mode 100644 index 000000000..20866f15a --- /dev/null +++ b/ThirdParty/ConanRecipes/dxc/conandata.yml @@ -0,0 +1,3 @@ +sources: + "1.8.2505.1-exp": + commit: "b106a961d09221b3c5bdb37be45b679257da08b8" diff --git a/ThirdParty/ConanRecipes/dxc/conanfile.py b/ThirdParty/ConanRecipes/dxc/conanfile.py new file mode 100644 index 000000000..53d377ea5 --- /dev/null +++ b/ThirdParty/ConanRecipes/dxc/conanfile.py @@ -0,0 +1,74 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd, can_run +from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake +from conan.tools.files import apply_conandata_patches, copy +from conan.tools.scm import Git +import os + +required_conan_version = ">=2.0.9" + +class DXCConan(ConanFile): + name = "dxc" + description = "DirectX shader compiler" + license = "https://github.com/microsoft/DirectXShaderCompiler?tab=License-1-ov-file" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/microsoft/DirectXShaderCompiler" + topics = ("shader", "tool", "compiler") + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + options = {} + default_options = {} + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_cppstd(self, 17) + + def build_requirements(self): + self.tool_requires("ninja/[>=1.12]") + self.tool_requires("cmake/[>=3.16]") + + def source(self): + git = Git(self) + git.clone("https://github.com/microsoft/DirectXShaderCompiler", target=".") + git.checkout(self.conan_data["sources"][self.version]["commit"]) + git.run("submodule update --init --recursive") + apply_conandata_patches(self) + + def generate(self): + cmake_toolchain = CMakeToolchain(self, generator="Ninja") + cmake_toolchain.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + install_folder = os.path.join(self.build_folder, "installed") + predefined_params_file = os.path.join(self.source_folder, "cmake", "caches", "PredefinedParams.cmake") + + cmake = CMake(self) + cmake.configure(cli_args=["-C", predefined_params_file, f"-DCMAKE_INSTALL_PREFIX={install_folder}"]) + cmake.build() + cmake.build(target="install-distribution") + + def package(self): + copy(self, "*", os.path.join(self.build_folder, "installed", "include"), os.path.join(self.package_folder, "include")) + copy(self, "*", os.path.join(self.build_folder, "installed", "bin"), os.path.join(self.package_folder, "bin")) + if self.settings.os == "Windows": + copy(self, "d3d12shader.h", os.path.join(self.source_folder, "external", "DirectX-Headers", "include", "directx"), os.path.join(self.package_folder, "include", "dxc")) + copy(self, "dxil.dll", os.path.join(self.build_folder, "bin"), os.path.join(self.package_folder, "bin")) + copy(self, "dxcompiler.lib", os.path.join(self.build_folder, "lib"), os.path.join(self.package_folder, "lib")) + elif self.settings.os == "Macos": + copy(self, "*", os.path.join(self.build_folder, "installed", "lib"), os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.includedirs = ["include"] + self.cpp_info.libdirs = ["lib"] + self.cpp_info.bindirs = ["bin"] + self.cpp_info.libs = ["dxcompiler"] + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/dxc/test_package/CMakeLists.txt b/ThirdParty/ConanRecipes/dxc/test_package/CMakeLists.txt new file mode 100644 index 000000000..7f644749b --- /dev/null +++ b/ThirdParty/ConanRecipes/dxc/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(dxc REQUIRED) + +add_definitions(-DPLATFORM_WINDOWS=$,1,0>) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE dxc::dxc) diff --git a/ThirdParty/ConanRecipes/dxc/test_package/conanfile.py b/ThirdParty/ConanRecipes/dxc/test_package/conanfile.py new file mode 100644 index 000000000..2e77b4246 --- /dev/null +++ b/ThirdParty/ConanRecipes/dxc/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/dxc/test_package/test_package.cpp b/ThirdParty/ConanRecipes/dxc/test_package/test_package.cpp new file mode 100644 index 000000000..b01f3a2ee --- /dev/null +++ b/ThirdParty/ConanRecipes/dxc/test_package/test_package.cpp @@ -0,0 +1,89 @@ +#include +#include +#include + +#if PLATFORM_WINDOWS +#include +#include +#else +#define __EMULATE_UUID 1 +#endif + +#include + +#if PLATFORM_WINDOWS +#include +using namespace Microsoft::WRL; +#define ComPtrGet(name) name.Get() +#else +// defined in dxc WinAdapter.h +#define ComPtr CComPtr +#define ComPtrGet(name) name +#endif + +int main(void) { + const std::string shaderSource = "[numthreads(8, 8, 1)] void CSMain() { }"; + + ComPtr library; + if (FAILED(DxcCreateInstance(CLSID_DxcLibrary, IID_PPV_ARGS(&library)))) { + std::cout << "failed to create dxc library" << std::endl; + return 1; + } + + ComPtr compiler; + if (FAILED(DxcCreateInstance(CLSID_DxcCompiler, IID_PPV_ARGS(&compiler)))) { + std::cout << "failed to create dxc compiler" << std::endl; + return 1; + } + + ComPtr utils; + if (FAILED(SUCCEEDED(DxcCreateInstance(CLSID_DxcUtils, IID_PPV_ARGS(&utils))))) { + std::cout << "failed to create dxc utils" << std::endl; + return 1; + } + + ComPtr includeHandler; + if (FAILED(SUCCEEDED(utils->CreateDefaultIncludeHandler(&includeHandler)))) { + std::cout << "failed to create dxc include handler" << std::endl; + return 1; + } + + ComPtr source; + if (FAILED(utils->CreateBlobFromPinned(shaderSource.c_str(), std::strlen(shaderSource.c_str()), CP_UTF8, &source))) { + std::cout << "failed to create dxc blob encoding" << std::endl; + return 1; + } + + std::vector arguments = { + DXC_ARG_WARNINGS_ARE_ERRORS, + DXC_ARG_PACK_MATRIX_ROW_MAJOR, + L"-E", L"CSMain", + L"-T", L"cs_6_2" + }; + + DxcBuffer sourceBuffer; + sourceBuffer.Ptr = source->GetBufferPointer(); + sourceBuffer.Size = source->GetBufferSize(); + sourceBuffer.Encoding = 0u; + + ComPtr result; + const HRESULT operationResult = compiler->Compile( + &sourceBuffer, + arguments.data(), + arguments.size(), + ComPtrGet(includeHandler), + IID_PPV_ARGS(&result)); + + ComPtr errorBlob; + if (FAILED(result->GetOutput(DXC_OUT_ERRORS, IID_PPV_ARGS(&errorBlob), nullptr))) { + std::cout << "failed to get error info" << std::endl; + return 1; + } + + if (FAILED(operationResult) || errorBlob->GetBufferSize() > 0) { + std::string error(static_cast(errorBlob->GetBufferPointer()), errorBlob->GetBufferSize()); + std::cout << "dxc compile error: " << error << std::endl; + return 1; + } + return 0; +} diff --git a/ThirdParty/ConanRecipes/glfw/conandata.yml b/ThirdParty/ConanRecipes/glfw/conandata.yml new file mode 100644 index 000000000..576fdd622 --- /dev/null +++ b/ThirdParty/ConanRecipes/glfw/conandata.yml @@ -0,0 +1,3 @@ +sources: + "3.4-exp": + commit: "7b6aead9fb88b3623e3b3725ebb42670cbe4c579" diff --git a/ThirdParty/ConanRecipes/glfw/conanfile.py b/ThirdParty/ConanRecipes/glfw/conanfile.py new file mode 100644 index 000000000..88374883e --- /dev/null +++ b/ThirdParty/ConanRecipes/glfw/conanfile.py @@ -0,0 +1,63 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd, can_run +from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake +from conan.tools.files import apply_conandata_patches +from conan.tools.scm import Git +import os + +required_conan_version = ">=2.0.9" + +class GlfwConan(ConanFile): + name = "glfw" + description = "glfw window library" + license = "https://github.com/glfw/glfw?tab=Zlib-1-ov-file" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/glfw/glfw" + topics = ("opengl", "vulkan", "window-management") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = {} + default_options = {} + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_cppstd(self, 17) + + def build_requirements(self): + self.tool_requires("ninja/[>=1.12]") + self.tool_requires("cmake/[>=3.16]") + + def source(self): + git = Git(self) + git.clone("https://github.com/glfw/glfw", target=".") + git.checkout(self.conan_data["sources"][self.version]["commit"]) + apply_conandata_patches(self) + + def generate(self): + cmake_toolchain = CMakeToolchain(self, generator="Ninja") + cmake_toolchain.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "glfw") + self.cpp_info.includedirs = ["include"] + self.cpp_info.libs = ["glfw3"] + self.cpp_info.libdirs = ["lib"] + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/glfw/test_package/CMakeLists.txt b/ThirdParty/ConanRecipes/glfw/test_package/CMakeLists.txt new file mode 100644 index 000000000..11150a2e7 --- /dev/null +++ b/ThirdParty/ConanRecipes/glfw/test_package/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(glfw REQUIRED) + +if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set(platform_ext_libs + "-framework Cocoa" + "-framework IOKit" + "-framework CoreFoundation") +endif() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE glfw::glfw ${platform_ext_libs}) diff --git a/ThirdParty/ConanRecipes/glfw/test_package/conanfile.py b/ThirdParty/ConanRecipes/glfw/test_package/conanfile.py new file mode 100644 index 000000000..2e77b4246 --- /dev/null +++ b/ThirdParty/ConanRecipes/glfw/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/glfw/test_package/test_package.cpp b/ThirdParty/ConanRecipes/glfw/test_package/test_package.cpp new file mode 100644 index 000000000..56f66423e --- /dev/null +++ b/ThirdParty/ConanRecipes/glfw/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include + +int main(void) { + glfwInit(); + glfwTerminate(); + return 0; +} diff --git a/ThirdParty/ConanRecipes/libclang/conandata.yml b/ThirdParty/ConanRecipes/libclang/conandata.yml new file mode 100644 index 000000000..10e8b0495 --- /dev/null +++ b/ThirdParty/ConanRecipes/libclang/conandata.yml @@ -0,0 +1,3 @@ +sources: + "21.1.7-exp": + url: "https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-21.1.7.tar.gz" diff --git a/ThirdParty/ConanRecipes/libclang/conanfile.py b/ThirdParty/ConanRecipes/libclang/conanfile.py new file mode 100644 index 000000000..07f3f43b6 --- /dev/null +++ b/ThirdParty/ConanRecipes/libclang/conanfile.py @@ -0,0 +1,65 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, get, copy +import os + +required_conan_version = ">=2.0.9" + +class LibclangConan(ConanFile): + name = "libclang" + description = "llvm - libclang" + license = "https://github.com/llvm/llvm-project/blob/main/LICENSE.TXT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/llvm/llvm-project" + topics = ("llvm", "tool") + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_cppstd(self, 17) + + def build_requirements(self): + self.tool_requires("ninja/[>=1.12]") + self.tool_requires("cmake/[>=3.16]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + def generate(self): + cmake_toolchain = CMakeToolchain(self, generator="Ninja") + cmake_toolchain.cache_variables["LLVM_ENABLE_PROJECTS"] = "clang" + cmake_toolchain.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + install_folder = os.path.join(self.build_folder, "installed") + cmake.configure(build_script_folder=os.path.join(self.source_folder, "llvm"), cli_args=[f"-DCMAKE_INSTALL_PREFIX={install_folder}"]) + cmake.build(target="libclang") + cmake.build(target="install-libclang") + cmake.build(target="install-libclang-headers") + + def package(self): + copy(self, "*", os.path.join(self.build_folder, "installed"), self.package_folder) + + def package_info(self): + self.cpp_info.includedirs = ["include"] + self.cpp_info.libdirs = ["lib"] + if self.settings.os == "Windows": + self.cpp_info.libs = ["libclang"] + self.cpp_info.bindirs = ["bin"] + else: + self.cpp_info.libs = ["clang"] + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/libclang/test_package/CMakeLists.txt b/ThirdParty/ConanRecipes/libclang/test_package/CMakeLists.txt new file mode 100644 index 000000000..95d446f16 --- /dev/null +++ b/ThirdParty/ConanRecipes/libclang/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(libclang REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libclang::libclang) diff --git a/ThirdParty/ConanRecipes/libclang/test_package/conanfile.py b/ThirdParty/ConanRecipes/libclang/test_package/conanfile.py new file mode 100644 index 000000000..2e77b4246 --- /dev/null +++ b/ThirdParty/ConanRecipes/libclang/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/libclang/test_package/test_package.cpp b/ThirdParty/ConanRecipes/libclang/test_package/test_package.cpp new file mode 100644 index 000000000..5485d219b --- /dev/null +++ b/ThirdParty/ConanRecipes/libclang/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include + +int main(void) { + CXIndex index = clang_createIndex(0, 0); + CXTranslationUnit translationUnit = clang_parseTranslationUnit(index, nullptr, nullptr, 0, nullptr, 0, CXTranslationUnit_None); + return 0; +} diff --git a/ThirdParty/ConanRecipes/molten-vk/conandata.yml b/ThirdParty/ConanRecipes/molten-vk/conandata.yml new file mode 100644 index 000000000..fc149926a --- /dev/null +++ b/ThirdParty/ConanRecipes/molten-vk/conandata.yml @@ -0,0 +1,3 @@ +sources: + "1.4.1-exp": + commit: "db445ff2042d9ce348c439ad8451112f354b8d2a" diff --git a/ThirdParty/ConanRecipes/molten-vk/conanfile.py b/ThirdParty/ConanRecipes/molten-vk/conanfile.py new file mode 100644 index 000000000..88c28aebb --- /dev/null +++ b/ThirdParty/ConanRecipes/molten-vk/conanfile.py @@ -0,0 +1,88 @@ +import re + +from conan import ConanFile +from conan.tools.build import check_min_cppstd, can_run +from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake +from conan.tools.files import apply_conandata_patches, copy +from conan.tools.scm import Git +import os +import shutil + +required_conan_version = ">=2.0.9" + +class MoltenVKConan(ConanFile): + name = "molten-vk" + description = "molten vk (vulkan driver on macos)" + license = "https://github.com/KhronosGroup/MoltenVK?tab=Apache-2.0-1-ov-file" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/KhronosGroup/MoltenVK" + topics = ("vulkan", "driver", "macos") + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + options = {} + default_options = {} + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_cppstd(self, 17) + + def build_requirements(self): + self.tool_requires("ninja/[>=1.12]") + self.tool_requires("cmake/[>=3.16]") + + def source(self): + git = Git(self) + git.clone("https://github.com/KhronosGroup/MoltenVK", target=".") + git.checkout(self.conan_data["sources"][self.version]["commit"]) + apply_conandata_patches(self) + + def generate(self): + cmake_toolchain = CMakeToolchain(self, generator="Ninja") + cmake_toolchain.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + install_folder = os.path.join(self.build_folder, "installed") + cmake.configure(cli_args=[f"-DCMAKE_INSTALL_PREFIX={install_folder}"]) + cmake.build() + cmake.install(cli_args=["--prefix", install_folder]) + + lib_root = os.path.join(install_folder, "lib") + for entry in os.listdir(lib_root): + entry_path = os.path.join(lib_root, entry) + if os.path.isdir(entry_path): + shutil.rmtree(entry_path) + elif os.path.islink(entry_path): + os.remove(entry_path) + elif entry.startswith("libMoltenVK"): + os.rename(entry_path, os.path.join(lib_root, "libMoltenVK.dylib")) + + icd_descriptor_json = os.path.join(install_folder, "etc", "vulkan", "icd.d", "MoltenVK_icd.json") + new_icd_descriptor_json = os.path.join(install_folder, "lib", "MoltenVK_icd.json") + with open(icd_descriptor_json, "r") as file: + content = file.read() + new_content = re.sub(r"\"library_path\": \".+\"", "\"library_path\": \"libMoltenVK.dylib\"", content) + with open(new_icd_descriptor_json, "w") as file: + file.write(new_content) + + def package(self): + install_folder = os.path.join(self.build_folder, "installed") + copy(self, "*", install_folder, self.package_folder) + os.mkdir(os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "MoltenVK") + self.cpp_info.bindirs = ["bin"] + self.cpp_info.includedirs = ["include"] + self.cpp_info.libs = [] + self.cpp_info.libdirs = [] + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/molten-vk/test_package/CMakeLists.txt b/ThirdParty/ConanRecipes/molten-vk/test_package/CMakeLists.txt new file mode 100644 index 000000000..5b686501b --- /dev/null +++ b/ThirdParty/ConanRecipes/molten-vk/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(MoltenVK REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE molten-vk::molten-vk) +add_custom_command( + TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MoltenVK_INCLUDE_DIR}/../lib/libMoltenVK.dylib $/libMoltenVK.dylib + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MoltenVK_INCLUDE_DIR}/../lib/MoltenVK_icd.json $/MoltenVK_icd.json +) diff --git a/ThirdParty/ConanRecipes/molten-vk/test_package/conanfile.py b/ThirdParty/ConanRecipes/molten-vk/test_package/conanfile.py new file mode 100644 index 000000000..2e77b4246 --- /dev/null +++ b/ThirdParty/ConanRecipes/molten-vk/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/molten-vk/test_package/test_package.cpp b/ThirdParty/ConanRecipes/molten-vk/test_package/test_package.cpp new file mode 100644 index 000000000..489dfc72d --- /dev/null +++ b/ThirdParty/ConanRecipes/molten-vk/test_package/test_package.cpp @@ -0,0 +1,4 @@ +int main(int argc, char* argv[]) +{ + return 0; +} diff --git a/ThirdParty/ConanRecipes/qt/conandata.yml b/ThirdParty/ConanRecipes/qt/conandata.yml new file mode 100644 index 000000000..a244b59c9 --- /dev/null +++ b/ThirdParty/ConanRecipes/qt/conandata.yml @@ -0,0 +1,23 @@ +sources: + "6.10.1-exp": + url: + - "https://mirrors.cloud.tencent.com/qt/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://download.qt.io/official_releases/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://download.qt.io/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://mirrors.ukfast.co.uk/sites/qt.io/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://mirrors.20i.com/pub/qt.io/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://ftp.nluug.nl/languages/qt/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://mirror.netcologne.de/qtproject/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://mirrors.dotsrc.org/qtproject/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://ftp.icm.edu.pl/packages/qt/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://ftp.acc.umu.se/mirror/qt.io/qtproject/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://www.nic.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://qt.mirror.constant.com/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://mirrors.sau.edu.cn/qt/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://mirror.bjtu.edu.cn/qt/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://mirrors.sjtug.sjtu.edu.cn/qt/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://ftp.jaist.ac.jp/pub/qtproject/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + - "https://ftp.yz.yamagata-u.ac.jp/pub/qtproject/archive/qt/6.10/6.10.1/single/qt-everywhere-src-6.10.1.tar.xz" + sha256: "0ed08b079719394303cd2054b66b2dc0c5895ceeb88fb6131c18991c980bf00f" diff --git a/ThirdParty/ConanRecipes/qt/conanfile.py b/ThirdParty/ConanRecipes/qt/conanfile.py new file mode 100644 index 000000000..36defd520 --- /dev/null +++ b/ThirdParty/ConanRecipes/qt/conanfile.py @@ -0,0 +1,104 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, get, copy +from pip._internal import main as pip_main +import os + +required_conan_version = ">=2.0.9" + +class QtConan(ConanFile): + name = "qt" + description = "qt" + license = "https://github.com/qt/qt5/tree/dev/LICENSES" + url = "https://github.com/qt/qt5" + homepage = "https://github.com/qt/qt5" + topics = ("gui", "tool") + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + options = {} + default_options = {} + + __enabled_projects = ( + "qtbase", "qtdeclarative", "qttools", "qtshadertools", "qtpositioning", "qtwebchannel", "qtwebengine", "qtwebsockets" + ) + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_cppstd(self, 17) + + def build_requirements(self): + self.tool_requires("ninja/[>=1.12]") + self.tool_requires("cmake/[>=3.16]") + + # for qtwebengine + self.tool_requires("nodejs/22.20.0") + self.tool_requires("gperf/3.1") + if self.settings.os == "Windows": + self.tool_requires("winflexbison/2.5.25") + else: + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + def generate(self): + # for qtwebengine + print("enabled projects contains qtwebengine, checking html5lib installed...") + try: + import html5lib + print("html5lib import test is OK") + except ImportError: + print("html5lib not installed, try pip install") + if self.settings.os == "Windows": + pip_main(["install", "html5lib"]) + else: + pip_main(["install", "html5lib", "--break-system-packages"]) + try: + import html5lib + except ImportError: + raise RuntimeError("failed to import html5lib") + + # to ensure qtwebengine build success + if self.settings.os != "Windows": + import resource + soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE) + resource.setrlimit(resource.RLIMIT_NOFILE, (1000000, hard_limit)) + soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE) + print(f"set resource.RLIMIT_NOFILE for qtwebengine build to (soft: {soft_limit}, hard: {hard_limit})") + + cmake_toolchain = CMakeToolchain(self, generator="Ninja") + cmake_toolchain.cache_variables["QT_AUTODETECT_ANDROID"] = "" + cmake_toolchain.cache_variables["QT_GENERATE_SBOM"] = "OFF" + for entry in os.listdir(self.source_folder): + if not os.path.isdir(entry) and not entry.startswith('qt'): + continue + cmake_toolchain.cache_variables[f"BUILD_{entry}"] = "ON" if entry in self.__enabled_projects else "OFF" + cmake_toolchain.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = [] + self.cpp_info.builddirs = [os.path.join("lib", "cmake")] + self.cpp_info.set_property("cmake_find_mode", "none") + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/qt/debug.py b/ThirdParty/ConanRecipes/qt/debug.py new file mode 100644 index 000000000..9d99c2ec0 --- /dev/null +++ b/ThirdParty/ConanRecipes/qt/debug.py @@ -0,0 +1,7 @@ +from conan.api.conan_api import ConanAPI +from conan.cli.cli import Cli + +if __name__ == '__main__': + api = ConanAPI() + api.command = Cli(api) + api.command.run(["build", ".\conanfile.py", "--version=\"6.10.1-exp\""]) diff --git a/ThirdParty/ConanRecipes/qt/test_package/CMakeLists.txt b/ThirdParty/ConanRecipes/qt/test_package/CMakeLists.txt new file mode 100644 index 000000000..1e97895ff --- /dev/null +++ b/ThirdParty/ConanRecipes/qt/test_package/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(Qt6 COMPONENTS Core Gui Widgets WebEngineWidgets REQUIRED) +set(QT_ROOT ${_Qt6_COMPONENT_PATH}/../..) + +qt_standard_project_setup() + +if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set(platform_executable_hint MACOSX_BUNDLE) +endif () + +qt_add_executable(${PROJECT_NAME} ${platform_executable_hint} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::WebEngineWidgets) + +if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + set(qt_win_deploy_executable ${QT_ROOT}/bin/windeployqt.exe) + add_custom_command( + TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${qt_win_deploy_executable} $ + ) +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set(qt_mac_deploy_executable ${QT_ROOT}/bin/macdeployqt) + add_custom_command( + TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${qt_mac_deploy_executable} $ -no-strip + ) +endif () diff --git a/ThirdParty/ConanRecipes/qt/test_package/conanfile.py b/ThirdParty/ConanRecipes/qt/test_package/conanfile.py new file mode 100644 index 000000000..04c30ffc1 --- /dev/null +++ b/ThirdParty/ConanRecipes/qt/test_package/conanfile.py @@ -0,0 +1,28 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + if self.settings.os == "Macos": + self.run(f"open {bin_path}.app", env="conanrun") + else: + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/qt/test_package/test_package.cpp b/ThirdParty/ConanRecipes/qt/test_package/test_package.cpp new file mode 100644 index 000000000..810752554 --- /dev/null +++ b/ThirdParty/ConanRecipes/qt/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QWebEngineView view; + view.load(QUrl("https://qt-project.org/")); + view.resize(1024, 768); + + QTimer::singleShot(100, []() -> void { QApplication::quit(); }); + return app.exec(); +} \ No newline at end of file diff --git a/ThirdParty/ConanRecipes/rapidjson/conandata.yml b/ThirdParty/ConanRecipes/rapidjson/conandata.yml new file mode 100644 index 000000000..db1ea5131 --- /dev/null +++ b/ThirdParty/ConanRecipes/rapidjson/conandata.yml @@ -0,0 +1,3 @@ +sources: + "cci.20250205-exp": + commit: "24b5e7a8b27f42fa16b96fc70aade9106cf7102f" diff --git a/ThirdParty/ConanRecipes/rapidjson/conanfile.py b/ThirdParty/ConanRecipes/rapidjson/conanfile.py new file mode 100644 index 000000000..28fc23df9 --- /dev/null +++ b/ThirdParty/ConanRecipes/rapidjson/conanfile.py @@ -0,0 +1,38 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.scm import Git +from conan.tools.files import apply_conandata_patches, get, copy +import os + +required_conan_version = ">=2.0.9" + +class RapidJsonConan(ConanFile): + name = "rapidjson" + description = "rapidjson" + license = "https://github.com/Tencent/rapidjson?tab=License-1-ov-file" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Tencent/rapidjson" + topics = ("utils", "json") + package_type = "header-library" + + def layout(self): + self.folders.source = "src" + self.folders.build = "build" + self.folders.generators = "build/generators" + + def source(self): + git = Git(self) + git.clone("https://github.com/Tencent/rapidjson.git", target=".") + git.checkout(self.conan_data["sources"][self.version]["commit"]) + apply_conandata_patches(self) + + def package(self): + copy(self, "*", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.includedirs = ["include"] + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/rapidjson/test_package/CMakeLists.txt b/ThirdParty/ConanRecipes/rapidjson/test_package/CMakeLists.txt new file mode 100644 index 000000000..3c9040e64 --- /dev/null +++ b/ThirdParty/ConanRecipes/rapidjson/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(rapidjson REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rapidjson::rapidjson) diff --git a/ThirdParty/ConanRecipes/rapidjson/test_package/conanfile.py b/ThirdParty/ConanRecipes/rapidjson/test_package/conanfile.py new file mode 100644 index 000000000..2e77b4246 --- /dev/null +++ b/ThirdParty/ConanRecipes/rapidjson/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/rapidjson/test_package/test_package.cpp b/ThirdParty/ConanRecipes/rapidjson/test_package/test_package.cpp new file mode 100644 index 000000000..0db25650f --- /dev/null +++ b/ThirdParty/ConanRecipes/rapidjson/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include + +int main(void) { + const char* json = "{\"a\": true, \"b\": 1, \"c\": \"2\"}"; + rapidjson::Document document; + document.Parse(json); + assert(document.IsObject()); + return 0; +} diff --git a/ThirdParty/ConanRecipes/vulkan-utility-libraries/conandata.yml b/ThirdParty/ConanRecipes/vulkan-utility-libraries/conandata.yml new file mode 100644 index 000000000..d1483c32a --- /dev/null +++ b/ThirdParty/ConanRecipes/vulkan-utility-libraries/conandata.yml @@ -0,0 +1,3 @@ +sources: + "1.4.313.0-exp": + branch: "vulkan-sdk-1.4.313" diff --git a/ThirdParty/ConanRecipes/vulkan-utility-libraries/conanfile.py b/ThirdParty/ConanRecipes/vulkan-utility-libraries/conanfile.py new file mode 100644 index 000000000..17817d356 --- /dev/null +++ b/ThirdParty/ConanRecipes/vulkan-utility-libraries/conanfile.py @@ -0,0 +1,84 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd, can_run +from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake +from conan.tools.files import apply_conandata_patches +from conan.tools.scm import Git +import os + +required_conan_version = ">=2.0.9" + +class VulkanUtilityLibrariesConan(ConanFile): + name = "vulkan-utility-libraries" + description = "vulkan utility libraries" + license = "https://github.com/KhronosGroup/Vulkan-Utility-Libraries?tab=License-1-ov-file" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/KhronosGroup/Vulkan-Utility-Libraries" + topics = ("vulkan", "utils") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = {} + default_options = {} + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_cppstd(self, 17) + + def requirements(self): + base_version = self.version.replace("-exp", "") + self.requires(f"vulkan-headers/{base_version}", transitive_headers=True) + + def build_requirements(self): + self.tool_requires("ninja/[>=1.12]") + self.tool_requires("cmake/[>=3.16]") + + def source(self): + git = Git(self) + git.clone("https://github.com/KhronosGroup/Vulkan-Utility-Libraries", target=".", args=["-b", self.conan_data["sources"][self.version]["branch"]]) + apply_conandata_patches(self) + + def generate(self): + cmake_toolchain = CMakeToolchain(self, generator="Ninja") + cmake_toolchain.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "VulkanUtilityLibraries") + + self.cpp_info.components["vulkanlayersettings"].set_property("cmake_target_name", "Vulkan::LayerSettings") + self.cpp_info.components["vulkanlayersettings"].bindirs = [] + self.cpp_info.components["vulkanlayersettings"].libdirs = ["lib"] + self.cpp_info.components["vulkanlayersettings"].includedirs = ["include"] + self.cpp_info.components["vulkanlayersettings"].requires = ["vulkan-headers::vulkanheaders"] + self.cpp_info.components["vulkanlayersettings"].libs = ["VulkanLayerSettings"] + + self.cpp_info.components["vulkanutilityheaders"].set_property("cmake_target_name", "Vulkan::UtilityHeaders") + self.cpp_info.components["vulkanutilityheaders"].bindirs = [] + self.cpp_info.components["vulkanutilityheaders"].libdirs = [] + self.cpp_info.components["vulkanutilityheaders"].includedirs = ["include"] + self.cpp_info.components["vulkanutilityheaders"].requires = ["vulkan-headers::vulkanheaders"] + self.cpp_info.components["vulkanutilityheaders"].libs = [] + + self.cpp_info.components["vulkansafestruct"].set_property("cmake_target_name", "Vulkan::SafeStruct") + self.cpp_info.components["vulkansafestruct"].bindirs = [] + self.cpp_info.components["vulkansafestruct"].libdirs = ["lib"] + self.cpp_info.components["vulkansafestruct"].includedirs = ["include"] + self.cpp_info.components["vulkansafestruct"].requires = ["vulkan-headers::vulkanheaders", "vulkanutilityheaders"] + self.cpp_info.components["vulkansafestruct"].libs = ["VulkanSafeStruct"] + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/vulkan-utility-libraries/test_package/CMakeLists.txt b/ThirdParty/ConanRecipes/vulkan-utility-libraries/test_package/CMakeLists.txt new file mode 100644 index 000000000..7c3013bce --- /dev/null +++ b/ThirdParty/ConanRecipes/vulkan-utility-libraries/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(VulkanUtilityLibraries REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Vulkan::LayerSettings Vulkan::UtilityHeaders Vulkan::SafeStruct) diff --git a/ThirdParty/ConanRecipes/vulkan-utility-libraries/test_package/conanfile.py b/ThirdParty/ConanRecipes/vulkan-utility-libraries/test_package/conanfile.py new file mode 100644 index 000000000..2e77b4246 --- /dev/null +++ b/ThirdParty/ConanRecipes/vulkan-utility-libraries/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/vulkan-utility-libraries/test_package/test_package.cpp b/ThirdParty/ConanRecipes/vulkan-utility-libraries/test_package/test_package.cpp new file mode 100644 index 000000000..4f74a9263 --- /dev/null +++ b/ThirdParty/ConanRecipes/vulkan-utility-libraries/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char* argv[]) +{ + vku::safe_VkInstanceCreateInfo safe_info; + return 0; +} diff --git a/ThirdParty/ConanRecipes/vulkan-validationlayers/conandata.yml b/ThirdParty/ConanRecipes/vulkan-validationlayers/conandata.yml new file mode 100644 index 000000000..560d4bdeb --- /dev/null +++ b/ThirdParty/ConanRecipes/vulkan-validationlayers/conandata.yml @@ -0,0 +1,8 @@ +sources: + "1.4.313.0-exp": + branch: "vulkan-sdk-1.4.313" +patches: + "1.4.313.0-exp": + - patch_file: patches/0000-fix-spirv-tools-includes.patch + patch_description: fix spir-v tools includes + patch_type: portability diff --git a/ThirdParty/ConanRecipes/vulkan-validationlayers/conanfile.py b/ThirdParty/ConanRecipes/vulkan-validationlayers/conanfile.py new file mode 100644 index 000000000..6740f2114 --- /dev/null +++ b/ThirdParty/ConanRecipes/vulkan-validationlayers/conanfile.py @@ -0,0 +1,79 @@ +from os import mkdir + +from conan import ConanFile +from conan.tools.build import check_min_cppstd, can_run +from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake +from conan.tools.files import apply_conandata_patches, export_conandata_patches +from conan.tools.scm import Git +import os + +required_conan_version = ">=2.0.9" + +class VulkanValidationLayersConan(ConanFile): + name = "vulkan-validationlayers" + description = "vulkan validation layers" + license = "https://github.com/KhronosGroup/Vulkan-ValidationLayers?tab=License-1-ov-file" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/KhronosGroup/Vulkan-ValidationLayers" + topics = ("vulkan", "debug") + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + options = {} + default_options = {} + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_cppstd(self, 17) + + def requirements(self): + base_version = self.version.replace("-exp", "") + self.requires(f"vulkan-headers/{base_version}") + self.requires(f"spirv-headers/{base_version}") + self.requires(f"spirv-tools/{base_version}") + self.requires(f"vulkan-utility-libraries/{self.version}") + + def build_requirements(self): + self.tool_requires("ninja/[>=1.12]") + self.tool_requires("cmake/[>=3.16]") + + def source(self): + git = Git(self) + git.clone("https://github.com/KhronosGroup/Vulkan-ValidationLayers", target=".", args=["-b", self.conan_data["sources"][self.version]["branch"]]) + apply_conandata_patches(self) + + def generate(self): + cmake_toolchain = CMakeToolchain(self, generator="Ninja") + cmake_toolchain.cache_variables["UPDATE_DEPS"] = "OFF" + cmake_toolchain.cache_variables["BUILD_WERROR"] = "OFF" + cmake_toolchain.cache_variables["BUILD_TESTS"] = "OFF" + cmake_toolchain.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + os.mkdir(os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "VulkanValidationLayers") + self.cpp_info.bindirs = ["bin"] + self.cpp_info.includedirs = ["include"] + self.cpp_info.libs = [] + self.cpp_info.libdirs = [] + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/vulkan-validationlayers/patches/0000-fix-spirv-tools-includes.patch b/ThirdParty/ConanRecipes/vulkan-validationlayers/patches/0000-fix-spirv-tools-includes.patch new file mode 100644 index 000000000..109853572 --- /dev/null +++ b/ThirdParty/ConanRecipes/vulkan-validationlayers/patches/0000-fix-spirv-tools-includes.patch @@ -0,0 +1,25 @@ +From 2e18b94238535157d98b0ccfa9df9e6d8a96fe7b Mon Sep 17 00:00:00 2001 +From: kindem +Date: Sat, 20 Dec 2025 17:16:43 +0800 +Subject: [PATCH] fix: spirv tools includes + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f2c844b7a..9af78879d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -115,7 +115,7 @@ find_package(VulkanUtilityLibraries CONFIG QUIET) + + find_package(SPIRV-Headers CONFIG QUIET) + +-find_package(SPIRV-Tools-opt CONFIG QUIET) ++find_package(SPIRV-Tools CONFIG QUIET) + + # NOTE: Our custom code generation target isn't desirable for system package managers or add_subdirectory users. + # So this target needs to be off by default to avoid obtuse build errors or patches. +-- +2.50.1.windows.1 + diff --git a/ThirdParty/ConanRecipes/vulkan-validationlayers/test_package/CMakeLists.txt b/ThirdParty/ConanRecipes/vulkan-validationlayers/test_package/CMakeLists.txt new file mode 100644 index 000000000..b52a24436 --- /dev/null +++ b/ThirdParty/ConanRecipes/vulkan-validationlayers/test_package/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(VulkanValidationLayers REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) + +if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + add_custom_command( + TARGET ${PROJECT_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VulkanValidationLayers_INCLUDE_DIR}/../bin/VkLayer_khronos_validation.dll $/VkLayer_khronos_validation.dll + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VulkanValidationLayers_INCLUDE_DIR}/../bin/VkLayer_khronos_validation.json $/VkLayer_khronos_validation.json + ) +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + add_custom_command( + TARGET ${PROJECT_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VulkanValidationLayers_INCLUDE_DIR}/../lib/libVkLayer_khronos_validation.dylib $/VkLayer_khronos_validation.dylib + COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${VulkanValidationLayers_INCLUDE_DIR}/../share/vulkan $/vulkan + ) +else () + message(FATAL_ERROR "os ${CMAKE_SYSTEM_NAME} not supported yet in test package") +endif () + diff --git a/ThirdParty/ConanRecipes/vulkan-validationlayers/test_package/conanfile.py b/ThirdParty/ConanRecipes/vulkan-validationlayers/test_package/conanfile.py new file mode 100644 index 000000000..2e77b4246 --- /dev/null +++ b/ThirdParty/ConanRecipes/vulkan-validationlayers/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/ThirdParty/ConanRecipes/vulkan-validationlayers/test_package/test_package.cpp b/ThirdParty/ConanRecipes/vulkan-validationlayers/test_package/test_package.cpp new file mode 100644 index 000000000..e9cdae165 --- /dev/null +++ b/ThirdParty/ConanRecipes/vulkan-validationlayers/test_package/test_package.cpp @@ -0,0 +1,3 @@ +int main() { + return 0; +} \ No newline at end of file diff --git a/ThirdParty/Patch/Qt-Darwin-6.9.1-FindWrapOpenGL.cmake b/ThirdParty/Patch/Qt-Darwin-6.9.1-FindWrapOpenGL.cmake deleted file mode 100644 index fe73ab782..000000000 --- a/ThirdParty/Patch/Qt-Darwin-6.9.1-FindWrapOpenGL.cmake +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause - -# We can't create the same interface imported target multiple times, CMake will complain if we do -# that. This can happen if the find_package call is done in multiple different subdirectories. -if(TARGET WrapOpenGL::WrapOpenGL) - set(WrapOpenGL_FOUND ON) - return() -endif() - -set(WrapOpenGL_FOUND OFF) - -find_package(OpenGL ${WrapOpenGL_FIND_VERSION}) - -if (OpenGL_FOUND) - set(WrapOpenGL_FOUND ON) - - add_library(WrapOpenGL::WrapOpenGL INTERFACE IMPORTED) - if(APPLE) - # CMake 3.27 and older: - # On Darwin platforms FindOpenGL sets IMPORTED_LOCATION to the absolute path of the library - # within the framework. This ends up as an absolute path link flag, which we don't want, - # because that makes our .prl files un-relocatable. - # Extract the framework path instead, and use that in INTERFACE_LINK_LIBRARIES, - # which CMake ends up transforming into a relocatable -framework flag. - # See https://gitlab.kitware.com/cmake/cmake/-/issues/20871 for details. - # - # CMake 3.28 and above: - # IMPORTED_LOCATION is the absolute path the the OpenGL.framework folder. - get_target_property(__opengl_fw_lib_path OpenGL::GL IMPORTED_LOCATION) - if(__opengl_fw_lib_path AND NOT __opengl_fw_lib_path MATCHES "/([^/]+)\\.framework$") - get_filename_component(__opengl_fw_path "${__opengl_fw_lib_path}" DIRECTORY) - endif() - - if(NOT __opengl_fw_path) - # Just a safety measure in case if no OpenGL::GL target exists. - set(__opengl_fw_path "-framework OpenGL") - endif() - - target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE ${__opengl_fw_path}) - else() - target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE OpenGL::GL) - endif() -elseif(UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "Integrity") - # Requesting only the OpenGL component ensures CMake does not mark the package as - # not found if neither GLX nor libGL are available. This allows finding OpenGL - # on an X11-less Linux system. - find_package(OpenGL ${WrapOpenGL_FIND_VERSION} COMPONENTS OpenGL) - if (OpenGL_FOUND) - set(WrapOpenGL_FOUND ON) - add_library(WrapOpenGL::WrapOpenGL INTERFACE IMPORTED) - target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE OpenGL::OpenGL) - endif() -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(WrapOpenGL DEFAULT_MSG WrapOpenGL_FOUND) diff --git a/Tool/MirrorTool/CMakeLists.txt b/Tool/MirrorTool/CMakeLists.txt index af9a5f688..75b78cfef 100644 --- a/Tool/MirrorTool/CMakeLists.txt +++ b/Tool/MirrorTool/CMakeLists.txt @@ -1,17 +1,17 @@ -file(GLOB SOURCES Src/*.cpp) +file(GLOB sources Src/*.cpp) exp_add_library( NAME MirrorTool.Static - SRC ${SOURCES} + SRC ${sources} PUBLIC_INC Include PUBLIC_LIB Mirror - PUBLIC_MERGE_LIB llvm-clang clipp + PUBLIC_MERGE_LIB libclang::libclang clipp::clipp NOT_INSTALL ) -file(GLOB EXE_SOURCES ExeSrc/*.cpp) +file(GLOB exe_sources ExeSrc/*.cpp) exp_add_executable( NAME MirrorTool - SRC ${EXE_SOURCES} + SRC ${exe_sources} INC Include LIB MirrorTool.Static ) diff --git a/Tool/MirrorTool/ExeSrc/Main.cpp b/Tool/MirrorTool/ExeSrc/Main.cpp index 5c0e09653..855a5382c 100644 --- a/Tool/MirrorTool/ExeSrc/Main.cpp +++ b/Tool/MirrorTool/ExeSrc/Main.cpp @@ -9,15 +9,32 @@ #include #include #include +#include #include #define OUTPUT_FULL_CMDLINE 0 +static std::vector ProcessHeaderDirs(const std::vector& headerDirs) +{ + std::unordered_set duplicated; + std::vector result; + for (const auto& headerDir : headerDirs) { + for (auto splitHeaderDirs = Common::StringUtils::Split(headerDir, ";"); + const auto& splitHeaderDir : splitHeaderDirs) { + if (duplicated.contains(splitHeaderDir)) { + continue; + } + result.emplace_back(splitHeaderDir); + duplicated.emplace(splitHeaderDir); + } + } + return result; +} + int main(int argc, char* argv[]) // NOLINT { AutoCoutFlush; -#if OUTPUT_FULL_CMDLINE std::stringstream fullCmdline; for (auto i = 0; i < argc; i++) { fullCmdline << argv[i]; @@ -25,8 +42,7 @@ int main(int argc, char* argv[]) // NOLINT fullCmdline << " "; } } - std::cout << fullCmdline.str() << std::endl; -#endif + const std::string fullCmdLineStr = fullCmdline.str(); std::string inputFile; std::string outputFile; @@ -50,28 +66,47 @@ int main(int argc, char* argv[]) // NOLINT for (auto& headerDir : headerDirs) { headerDir = Common::Path(headerDir).String(); } + headerDirs = ProcessHeaderDirs(headerDirs); + + auto outputErrorWithDebugContext = [fullCmdLineStr, inputFile, outputFile, headerDirs, frameworkDirs, dynamic](const std::string& error) -> void { + std::cout << "MirrorTool fatal error:" << Common::newline; + std::cout << error << Common::newline; + std::cout << "MirrorTool debug context: " << Common::newline; + std::cout << "[fullCmdLine] " << fullCmdLineStr << Common::newline; + std::cout << "[dynamic] " << dynamic << Common::newline; + std::cout << "[inputFile] " << inputFile << Common::newline; + std::cout << "[outputFile] " << outputFile << Common::newline; + std::cout << "[headerDirs]" << Common::newline; + for (const auto& headerDir : headerDirs) { + std::cout << headerDir << Common::newline; + } + std::cout << "[frameworkDirs]" << Common::newline; + for (const auto& frameworkDir : frameworkDirs) { + std::cout << frameworkDir << Common::newline; + } + std::cout << Common::newline; + }; if (!inputFile.ends_with(".h")) { - std::cout << "input header file must ends with .h" << Common::newline; + outputErrorWithDebugContext("input header file must ends with .h"); return 1; } if (!outputFile.ends_with(".cpp")) { - std::cout << "output file must ends with .cpp" << Common::newline; + outputErrorWithDebugContext("output file must ends with .cpp"); return 1; } MirrorTool::Parser parser(inputFile, headerDirs, frameworkDirs); auto [parseSuccess, parseResultOrError] = parser.Parse(); - if (!parseSuccess) { - std::cout << std::get(parseResultOrError) << Common::newline; + outputErrorWithDebugContext(std::get(parseResultOrError)); return 1; } MirrorTool::Generator generator(inputFile, outputFile, headerDirs, std::get(parseResultOrError), dynamic); if (auto [generateSuccess, generateError] = generator.Generate(); !generateSuccess) { - std::cout << generateError << Common::newline; + outputErrorWithDebugContext(generateError); return 1; } return 0; diff --git a/conan_provider.cmake b/conan_provider.cmake new file mode 100644 index 000000000..d9f11413d --- /dev/null +++ b/conan_provider.cmake @@ -0,0 +1,719 @@ +# The MIT License (MIT) +# +# Copyright (c) 2024 JFrog +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +set(CONAN_MINIMUM_VERSION 2.0.5) + +# Create a new policy scope and set the minimum required cmake version so the +# features behind a policy setting like if(... IN_LIST ...) behaves as expected +# even if the parent project does not specify a minimum cmake version or a minimum +# version less than this module requires (e.g. 3.0) before the first project() call. +# (see: https://cmake.org/cmake/help/latest/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.html) +# +# The policy-affecting calls like cmake_policy(SET...) or `cmake_minimum_required` only +# affects the current policy scope, i.e. between the PUSH and POP in this case. +# +# https://cmake.org/cmake/help/book/mastering-cmake/chapter/Policies.html#the-policy-stack +cmake_policy(PUSH) +cmake_minimum_required(VERSION 3.24) + + +function(detect_os os os_api_level os_sdk os_subsystem os_version) + # it could be cross compilation + message(STATUS "CMake-Conan: cmake_system_name=${CMAKE_SYSTEM_NAME}") + if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic") + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(${os} Macos PARENT_SCOPE) + elseif(CMAKE_SYSTEM_NAME STREQUAL "QNX") + set(${os} Neutrino PARENT_SCOPE) + elseif(CMAKE_SYSTEM_NAME STREQUAL "CYGWIN") + set(${os} Windows PARENT_SCOPE) + set(${os_subsystem} cygwin PARENT_SCOPE) + elseif(CMAKE_SYSTEM_NAME MATCHES "^MSYS") + set(${os} Windows PARENT_SCOPE) + set(${os_subsystem} msys2 PARENT_SCOPE) + elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + # https://github.com/emscripten-core/emscripten/blob/4.0.6/cmake/Modules/Platform/Emscripten.cmake#L17C1-L17C34 + set(${os} Emscripten PARENT_SCOPE) + else() + set(${os} ${CMAKE_SYSTEM_NAME} PARENT_SCOPE) + endif() + if(CMAKE_SYSTEM_NAME STREQUAL "Android") + if(DEFINED ANDROID_PLATFORM) + string(REGEX MATCH "[0-9]+" _os_api_level ${ANDROID_PLATFORM}) + elseif(DEFINED CMAKE_SYSTEM_VERSION) + set(_os_api_level ${CMAKE_SYSTEM_VERSION}) + endif() + message(STATUS "CMake-Conan: android api level=${_os_api_level}") + set(${os_api_level} ${_os_api_level} PARENT_SCOPE) + endif() + if(CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS") + # CMAKE_OSX_SYSROOT contains the full path to the SDK for MakeFile/Ninja + # generators, but just has the original input string for Xcode. + if(NOT IS_DIRECTORY ${CMAKE_OSX_SYSROOT}) + set(_os_sdk ${CMAKE_OSX_SYSROOT}) + else() + if(CMAKE_OSX_SYSROOT MATCHES Simulator) + set(apple_platform_suffix simulator) + else() + set(apple_platform_suffix os) + endif() + if(CMAKE_OSX_SYSROOT MATCHES AppleTV) + set(_os_sdk "appletv${apple_platform_suffix}") + elseif(CMAKE_OSX_SYSROOT MATCHES iPhone) + set(_os_sdk "iphone${apple_platform_suffix}") + elseif(CMAKE_OSX_SYSROOT MATCHES Watch) + set(_os_sdk "watch${apple_platform_suffix}") + endif() + endif() + if(DEFINED os_sdk) + message(STATUS "CMake-Conan: cmake_osx_sysroot=${CMAKE_OSX_SYSROOT}") + set(${os_sdk} ${_os_sdk} PARENT_SCOPE) + endif() + if(DEFINED CMAKE_OSX_DEPLOYMENT_TARGET) + message(STATUS "CMake-Conan: cmake_osx_deployment_target=${CMAKE_OSX_DEPLOYMENT_TARGET}") + set(${os_version} ${CMAKE_OSX_DEPLOYMENT_TARGET} PARENT_SCOPE) + endif() + endif() + endif() +endfunction() + + +function(detect_arch arch) + # CMAKE_OSX_ARCHITECTURES can contain multiple architectures, but Conan only supports one. + # Therefore this code only finds one. If the recipes support multiple architectures, the + # build will work. Otherwise, there will be a linker error for the missing architecture(s). + if(DEFINED CMAKE_OSX_ARCHITECTURES) + string(REPLACE " " ";" apple_arch_list "${CMAKE_OSX_ARCHITECTURES}") + list(LENGTH apple_arch_list apple_arch_count) + if(apple_arch_count GREATER 1) + message(WARNING "CMake-Conan: Multiple architectures detected, this will only work if Conan recipe(s) produce fat binaries.") + endif() + endif() + if(CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS" AND NOT CMAKE_OSX_ARCHITECTURES STREQUAL "") + set(host_arch ${CMAKE_OSX_ARCHITECTURES}) + elseif(MSVC) + set(host_arch ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}) + else() + set(host_arch ${CMAKE_SYSTEM_PROCESSOR}) + endif() + if(host_arch MATCHES "aarch64|arm64|ARM64") + set(_arch armv8) + elseif(host_arch MATCHES "armv7|armv7-a|armv7l|ARMV7") + set(_arch armv7) + elseif(host_arch MATCHES armv7s) + set(_arch armv7s) + elseif(host_arch MATCHES "i686|i386|X86") + set(_arch x86) + elseif(host_arch MATCHES "AMD64|amd64|x86_64|x64") + set(_arch x86_64) + endif() + if(EMSCRIPTEN) + # https://github.com/emscripten-core/emscripten/blob/4.0.6/cmake/Modules/Platform/Emscripten.cmake#L294C1-L294C80 + set(_arch wasm) + endif() + message(STATUS "CMake-Conan: cmake_system_processor=${_arch}") + set(${arch} ${_arch} PARENT_SCOPE) +endfunction() + + +function(detect_cxx_standard cxx_standard) + set(${cxx_standard} ${CMAKE_CXX_STANDARD} PARENT_SCOPE) + if(CMAKE_CXX_EXTENSIONS) + set(${cxx_standard} "gnu${CMAKE_CXX_STANDARD}" PARENT_SCOPE) + endif() +endfunction() + + +macro(detect_gnu_libstdcxx) + # _conan_is_gnu_libstdcxx true if GNU libstdc++ + check_cxx_source_compiles(" + #include + #if !defined(__GLIBCXX__) && !defined(__GLIBCPP__) + static_assert(false); + #endif + int main(){}" _conan_is_gnu_libstdcxx) + + # _conan_gnu_libstdcxx_is_cxx11_abi true if C++11 ABI + check_cxx_source_compiles(" + #include + static_assert(sizeof(std::string) != sizeof(void*), \"using libstdc++\"); + int main () {}" _conan_gnu_libstdcxx_is_cxx11_abi) + + set(_conan_gnu_libstdcxx_suffix "") + if(_conan_gnu_libstdcxx_is_cxx11_abi) + set(_conan_gnu_libstdcxx_suffix "11") + endif() + unset (_conan_gnu_libstdcxx_is_cxx11_abi) +endmacro() + + +macro(detect_libcxx) + # _conan_is_libcxx true if LLVM libc++ + check_cxx_source_compiles(" + #include + #if !defined(_LIBCPP_VERSION) + static_assert(false); + #endif + int main(){}" _conan_is_libcxx) +endmacro() + + +function(detect_lib_cxx lib_cxx) + if(CMAKE_SYSTEM_NAME STREQUAL "Android") + message(STATUS "CMake-Conan: android_stl=${CMAKE_ANDROID_STL_TYPE}") + set(${lib_cxx} ${CMAKE_ANDROID_STL_TYPE} PARENT_SCOPE) + return() + endif() + + include(CheckCXXSourceCompiles) + + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + detect_gnu_libstdcxx() + set(${lib_cxx} "libstdc++${_conan_gnu_libstdcxx_suffix}" PARENT_SCOPE) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") + set(${lib_cxx} "libc++" PARENT_SCOPE) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows") + # Check for libc++ + detect_libcxx() + if(_conan_is_libcxx) + set(${lib_cxx} "libc++" PARENT_SCOPE) + return() + endif() + + # Check for libstdc++ + detect_gnu_libstdcxx() + if(_conan_is_gnu_libstdcxx) + set(${lib_cxx} "libstdc++${_conan_gnu_libstdcxx_suffix}" PARENT_SCOPE) + return() + endif() + + # TODO: it would be an error if we reach this point + elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + # Do nothing - compiler.runtime and compiler.runtime_type + # should be handled separately: https://github.com/conan-io/cmake-conan/pull/516 + return() + else() + # TODO: unable to determine, ask user to provide a full profile file instead + endif() +endfunction() + + +function(detect_compiler compiler compiler_version compiler_runtime compiler_runtime_type) + if(DEFINED CMAKE_CXX_COMPILER_ID) + set(_compiler ${CMAKE_CXX_COMPILER_ID}) + set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION}) + else() + if(NOT DEFINED CMAKE_C_COMPILER_ID) + message(FATAL_ERROR "C or C++ compiler not defined") + endif() + set(_compiler ${CMAKE_C_COMPILER_ID}) + set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) + endif() + + message(STATUS "CMake-Conan: CMake compiler=${_compiler}") + message(STATUS "CMake-Conan: CMake compiler version=${_compiler_version}") + + if(_compiler MATCHES MSVC) + set(_compiler "msvc") + string(SUBSTRING ${MSVC_VERSION} 0 3 _compiler_version) + # Configure compiler.runtime and compiler.runtime_type settings for MSVC + if(CMAKE_MSVC_RUNTIME_LIBRARY) + set(_msvc_runtime_library ${CMAKE_MSVC_RUNTIME_LIBRARY}) + else() + set(_msvc_runtime_library MultiThreaded$<$:Debug>DLL) # default value documented by CMake + endif() + + set(_KNOWN_MSVC_RUNTIME_VALUES "") + list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreaded MultiThreadedDLL) + list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreadedDebug MultiThreadedDebugDLL) + list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreaded$<$:Debug> MultiThreaded$<$:Debug>DLL) + + # only accept the 6 possible values, otherwise we don't don't know to map this + if(NOT _msvc_runtime_library IN_LIST _KNOWN_MSVC_RUNTIME_VALUES) + message(FATAL_ERROR "CMake-Conan: unable to map MSVC runtime: ${_msvc_runtime_library} to Conan settings") + endif() + + # Runtime is "dynamic" in all cases if it ends in DLL + if(_msvc_runtime_library MATCHES ".*DLL$") + set(_compiler_runtime "dynamic") + else() + set(_compiler_runtime "static") + endif() + message(STATUS "CMake-Conan: CMake compiler.runtime=${_compiler_runtime}") + + # Only define compiler.runtime_type when explicitly requested + # If a generator expression is used, let Conan handle it conditional on build_type + if(NOT _msvc_runtime_library MATCHES ":Debug>") + if(_msvc_runtime_library MATCHES "Debug") + set(_compiler_runtime_type "Debug") + else() + set(_compiler_runtime_type "Release") + endif() + message(STATUS "CMake-Conan: CMake compiler.runtime_type=${_compiler_runtime_type}") + endif() + + unset(_KNOWN_MSVC_RUNTIME_VALUES) + + elseif(_compiler MATCHES AppleClang) + set(_compiler "apple-clang") + string(REPLACE "." ";" VERSION_LIST ${_compiler_version}) + list(GET VERSION_LIST 0 _compiler_version) + elseif(_compiler MATCHES Clang) + set(_compiler "clang") + string(REPLACE "." ";" VERSION_LIST ${_compiler_version}) + list(GET VERSION_LIST 0 _compiler_version) + elseif(_compiler MATCHES GNU) + set(_compiler "gcc") + string(REPLACE "." ";" VERSION_LIST ${_compiler_version}) + list(GET VERSION_LIST 0 _compiler_version) + endif() + + message(STATUS "CMake-Conan: [settings] compiler=${_compiler}") + message(STATUS "CMake-Conan: [settings] compiler.version=${_compiler_version}") + if (_compiler_runtime) + message(STATUS "CMake-Conan: [settings] compiler.runtime=${_compiler_runtime}") + endif() + if (_compiler_runtime_type) + message(STATUS "CMake-Conan: [settings] compiler.runtime_type=${_compiler_runtime_type}") + endif() + + set(${compiler} ${_compiler} PARENT_SCOPE) + set(${compiler_version} ${_compiler_version} PARENT_SCOPE) + set(${compiler_runtime} ${_compiler_runtime} PARENT_SCOPE) + set(${compiler_runtime_type} ${_compiler_runtime_type} PARENT_SCOPE) +endfunction() + + +function(detect_build_type build_type) + get_property(multiconfig_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(NOT multiconfig_generator) + # Only set when we know we are in a single-configuration generator + # Note: we may want to fail early if `CMAKE_BUILD_TYPE` is not defined + set(${build_type} ${CMAKE_BUILD_TYPE} PARENT_SCOPE) + endif() +endfunction() + + +macro(set_conan_compiler_if_appleclang lang command output_variable) + if(CMAKE_${lang}_COMPILER_ID STREQUAL "AppleClang") + execute_process(COMMAND xcrun --find ${command} + OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE) + cmake_path(GET _xcrun_out PARENT_PATH _xcrun_toolchain_path) + cmake_path(GET CMAKE_${lang}_COMPILER PARENT_PATH _compiler_parent_path) + if ("${_xcrun_toolchain_path}" STREQUAL "${_compiler_parent_path}") + set(${output_variable} "") + endif() + unset(_xcrun_out) + unset(_xcrun_toolchain_path) + unset(_compiler_parent_path) + endif() +endmacro() + + +macro(append_compiler_executables_configuration) + set(_conan_c_compiler "") + set(_conan_cpp_compiler "") + set(_conan_rc_compiler "") + set(_conan_compilers_list "") + if(CMAKE_C_COMPILER) + set(_conan_c_compiler "\"c\":\"${CMAKE_C_COMPILER}\"") + set_conan_compiler_if_appleclang(C cc _conan_c_compiler) + list(APPEND _conan_compilers_list ${_conan_c_compiler}) + else() + message(WARNING "CMake-Conan: The C compiler is not defined. " + "Please define CMAKE_C_COMPILER or enable the C language.") + endif() + if(CMAKE_CXX_COMPILER) + set(_conan_cpp_compiler "\"cpp\":\"${CMAKE_CXX_COMPILER}\"") + set_conan_compiler_if_appleclang(CXX c++ _conan_cpp_compiler) + list(APPEND _conan_compilers_list ${_conan_cpp_compiler}) + else() + message(WARNING "CMake-Conan: The C++ compiler is not defined. " + "Please define CMAKE_CXX_COMPILER or enable the C++ language.") + endif() + if(CMAKE_RC_COMPILER) + set(_conan_rc_compiler "\"rc\":\"${CMAKE_RC_COMPILER}\"") + list(APPEND _conan_compilers_list ${_conan_rc_compiler}) + # Not necessary to warn if RC not defined + endif() + if(NOT "x${_conan_compilers_list}" STREQUAL "x") + string(REPLACE ";" "," _conan_compilers_list "${_conan_compilers_list}") + string(APPEND profile "tools.build:compiler_executables={${_conan_compilers_list}}\n") + endif() + unset(_conan_c_compiler) + unset(_conan_cpp_compiler) + unset(_conan_rc_compiler) + unset(_conan_compilers_list) +endmacro() + + +function(detect_host_profile output_file) + detect_os(os os_api_level os_sdk os_subsystem os_version) + detect_arch(arch) + detect_compiler(compiler compiler_version compiler_runtime compiler_runtime_type) + detect_cxx_standard(compiler_cppstd) + detect_lib_cxx(compiler_libcxx) + detect_build_type(build_type) + + set(profile "") + string(APPEND profile "[settings]\n") + if(arch) + string(APPEND profile arch=${arch} "\n") + endif() + if(os) + string(APPEND profile os=${os} "\n") + endif() + if(os_api_level) + string(APPEND profile os.api_level=${os_api_level} "\n") + endif() + if(os_version) + string(APPEND profile os.version=${os_version} "\n") + endif() + if(os_sdk) + string(APPEND profile os.sdk=${os_sdk} "\n") + endif() + if(os_subsystem) + string(APPEND profile os.subsystem=${os_subsystem} "\n") + endif() + if(compiler) + string(APPEND profile compiler=${compiler} "\n") + endif() + if(compiler_version) + string(APPEND profile compiler.version=${compiler_version} "\n") + endif() + if(compiler_runtime) + string(APPEND profile compiler.runtime=${compiler_runtime} "\n") + endif() + if(compiler_runtime_type) + string(APPEND profile compiler.runtime_type=${compiler_runtime_type} "\n") + endif() + if(compiler_cppstd) + string(APPEND profile compiler.cppstd=${compiler_cppstd} "\n") + endif() + if(compiler_libcxx) + string(APPEND profile compiler.libcxx=${compiler_libcxx} "\n") + endif() + if(build_type) + string(APPEND profile "build_type=${build_type}\n") + endif() + + if(NOT DEFINED output_file) + set(file_name "${CMAKE_BINARY_DIR}/profile") + else() + set(file_name ${output_file}) + endif() + + string(APPEND profile "[conf]\n") + string(APPEND profile "tools.cmake.cmaketoolchain:generator=${CMAKE_GENERATOR}\n") + + # propagate compilers via profile + append_compiler_executables_configuration() + + if(os STREQUAL "Android") + string(APPEND profile "tools.android:ndk_path=${CMAKE_ANDROID_NDK}\n") + endif() + + message(STATUS "CMake-Conan: Creating profile ${file_name}") + file(WRITE ${file_name} ${profile}) + message(STATUS "CMake-Conan: Profile: \n${profile}") +endfunction() + + +function(conan_profile_detect_default) + message(STATUS "CMake-Conan: Checking if a default profile exists") + execute_process(COMMAND ${CONAN_COMMAND} profile path default + RESULT_VARIABLE return_code + OUTPUT_VARIABLE conan_stdout + ERROR_VARIABLE conan_stderr + ECHO_ERROR_VARIABLE # show the text output regardless + ECHO_OUTPUT_VARIABLE + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + if(NOT ${return_code} EQUAL "0") + message(STATUS "CMake-Conan: The default profile doesn't exist, detecting it.") + execute_process(COMMAND ${CONAN_COMMAND} profile detect + RESULT_VARIABLE return_code + OUTPUT_VARIABLE conan_stdout + ERROR_VARIABLE conan_stderr + ECHO_ERROR_VARIABLE # show the text output regardless + ECHO_OUTPUT_VARIABLE + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + endif() +endfunction() + + +function(conan_install) + set(conan_output_folder ${CMAKE_BINARY_DIR}/conan) + # Invoke "conan install" with the provided arguments + set(conan_args -of=${conan_output_folder}) + message(STATUS "CMake-Conan: conan install ${CMAKE_SOURCE_DIR} ${conan_args} ${ARGN}") + + + # In case there was not a valid cmake executable in the PATH, we inject the + # same we used to invoke the provider to the PATH + if(DEFINED PATH_TO_CMAKE_BIN) + set(old_path $ENV{PATH}) + set(ENV{PATH} "$ENV{PATH}:${PATH_TO_CMAKE_BIN}") + endif() + + execute_process(COMMAND ${CONAN_COMMAND} install ${CMAKE_SOURCE_DIR} ${conan_args} ${ARGN} --format=json + RESULT_VARIABLE return_code + OUTPUT_VARIABLE conan_stdout + ERROR_VARIABLE conan_stderr + ECHO_ERROR_VARIABLE # show the text output regardless + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + if(DEFINED PATH_TO_CMAKE_BIN) + set(ENV{PATH} "${old_path}") + endif() + + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan install failed='${return_code}'") + endif() + + # the files are generated in a folder that depends on the layout used, if + # one is specified, but we don't know a priori where this is. + # TODO: this can be made more robust if Conan can provide this in the json output + string(JSON conan_generators_folder GET "${conan_stdout}" graph nodes 0 generators_folder) + cmake_path(CONVERT ${conan_generators_folder} TO_CMAKE_PATH_LIST conan_generators_folder) + + message(STATUS "CMake-Conan: CONAN_GENERATORS_FOLDER=${conan_generators_folder}") + set_property(GLOBAL PROPERTY CONAN_GENERATORS_FOLDER "${conan_generators_folder}") + # reconfigure on conanfile changes + string(JSON conanfile GET "${conan_stdout}" graph nodes 0 label) + message(STATUS "CMake-Conan: CONANFILE=${CMAKE_SOURCE_DIR}/${conanfile}") + set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/${conanfile}") + # success + set_property(GLOBAL PROPERTY CONAN_INSTALL_SUCCESS TRUE) + +endfunction() + + +function(conan_get_version conan_command conan_current_version) + execute_process( + COMMAND ${conan_command} --version + OUTPUT_VARIABLE conan_output + RESULT_VARIABLE conan_result + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(conan_result) + message(FATAL_ERROR "CMake-Conan: Error when trying to run Conan") + endif() + + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" conan_version ${conan_output}) + set(${conan_current_version} ${conan_version} PARENT_SCOPE) +endfunction() + + +function(conan_version_check) + set(options ) + set(one_value_args MINIMUM CURRENT) + set(multi_value_args ) + cmake_parse_arguments(conan_version_check + "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) + + if(NOT conan_version_check_MINIMUM) + message(FATAL_ERROR "CMake-Conan: Required parameter MINIMUM not set!") + endif() + if(NOT conan_version_check_CURRENT) + message(FATAL_ERROR "CMake-Conan: Required parameter CURRENT not set!") + endif() + + if(conan_version_check_CURRENT VERSION_LESS conan_version_check_MINIMUM) + message(FATAL_ERROR "CMake-Conan: Conan version must be ${conan_version_check_MINIMUM} or later") + endif() +endfunction() + + +macro(construct_profile_argument argument_variable profile_list) + set(${argument_variable} "") + if("${profile_list}" STREQUAL "CONAN_HOST_PROFILE") + set(_arg_flag "--profile:host=") + elseif("${profile_list}" STREQUAL "CONAN_BUILD_PROFILE") + set(_arg_flag "--profile:build=") + endif() + + set(_profile_list "${${profile_list}}") + list(TRANSFORM _profile_list REPLACE "auto-cmake" "${CMAKE_BINARY_DIR}/conan_host_profile") + list(TRANSFORM _profile_list PREPEND ${_arg_flag}) + set(${argument_variable} ${_profile_list}) + + unset(_arg_flag) + unset(_profile_list) +endmacro() + + +macro(conan_provide_dependency method package_name) + set_property(GLOBAL PROPERTY CONAN_PROVIDE_DEPENDENCY_INVOKED TRUE) + get_property(_conan_install_success GLOBAL PROPERTY CONAN_INSTALL_SUCCESS) + if(NOT _conan_install_success) + find_program(CONAN_COMMAND "conan" REQUIRED) + conan_get_version(${CONAN_COMMAND} CONAN_CURRENT_VERSION) + conan_version_check(MINIMUM ${CONAN_MINIMUM_VERSION} CURRENT ${CONAN_CURRENT_VERSION}) + message(STATUS "CMake-Conan: first find_package() found. Installing dependencies with Conan") + if("default" IN_LIST CONAN_HOST_PROFILE OR "default" IN_LIST CONAN_BUILD_PROFILE) + conan_profile_detect_default() + endif() + if("auto-cmake" IN_LIST CONAN_HOST_PROFILE) + detect_host_profile(${CMAKE_BINARY_DIR}/conan_host_profile) + endif() + construct_profile_argument(_host_profile_flags CONAN_HOST_PROFILE) + construct_profile_argument(_build_profile_flags CONAN_BUILD_PROFILE) + if(EXISTS "${CMAKE_SOURCE_DIR}/conanfile.py") + file(READ "${CMAKE_SOURCE_DIR}/conanfile.py" outfile) + # ++[kindem] + if(NOT "${outfile}" MATCHES ".*CMakeDeps.*" AND NOT "${outfile}" MATCHES ".*CMakeConfigDeps.*") + # --[kindem] + message(WARNING "Cmake-conan: CMakeDeps generator was not defined in the conanfile") + endif() + set(generator "") + elseif (EXISTS "${CMAKE_SOURCE_DIR}/conanfile.txt") + file(READ "${CMAKE_SOURCE_DIR}/conanfile.txt" outfile) + if(NOT "${outfile}" MATCHES ".*CMakeDeps.*") + message(WARNING "Cmake-conan: CMakeDeps generator was not defined in the conanfile. " + "Please define the generator as it will be mandatory in the future") + endif() + set(generator "-g;CMakeDeps") + endif() + + get_property(_multiconfig_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + + if(DEFINED CONAN_INSTALL_BUILD_CONFIGURATIONS) + # Configurations are specified by the project or user + set(_build_configs "${CONAN_INSTALL_BUILD_CONFIGURATIONS}") + list(LENGTH _build_configs _build_configs_length) + if(NOT _multiconfig_generator AND _build_configs_length GREATER 1) + message(FATAL_ERROR "cmake-conan: when using a single-config CMake generator, " + "please only specify a single configuration in CONAN_INSTALL_BUILD_CONFIGURATIONS") + endif() + unset(_build_configs_length) + else() + # No configuration overrides, provide sensible defaults + if(_multiconfig_generator) + set(_build_configs Release Debug) + else() + set(_build_configs ${CMAKE_BUILD_TYPE}) + endif() + + endif() + list(JOIN _build_configs ", " _build_configs_msg) + message(STATUS "CMake-Conan: Installing configuration(s): ${_build_configs_msg}") + foreach(_build_config IN LISTS _build_configs) + set(_self_build_config "") + if(NOT _multiconfig_generator AND NOT _build_config STREQUAL "${CMAKE_BUILD_TYPE}") + set(_self_build_config -s &:build_type=${CMAKE_BUILD_TYPE}) + endif() + conan_install(${_host_profile_flags} ${_build_profile_flags} -s build_type=${_build_config} ${_self_build_config} ${CONAN_INSTALL_ARGS} ${generator}) + endforeach() + # ++[kindem] + get_property(_conan_generators_folder GLOBAL PROPERTY CONAN_GENERATORS_FOLDER) + if(EXISTS "${_conan_generators_folder}/conan_cmakedeps_paths.cmake") + message(STATUS "CMake-Conan: Loading conan_cmakedeps_paths.cmake file") + include(${_conan_generators_folder}/conan_cmakedeps_paths.cmake) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} CACHE STRING "" FORCE) + set(CMAKE_PREFIX_PATH ${CMAKE_MODULE_PATH} CACHE STRING "" FORCE) + endif() + # --[kindem] + unset(_self_build_config) + unset(_multiconfig_generator) + unset(_build_configs) + unset(_build_configs_msg) + unset(_host_profile_flags) + unset(_build_profile_flags) + unset(_conan_install_success) + else() + message(STATUS "CMake-Conan: find_package(${ARGV1}) found, 'conan install' already ran") + unset(_conan_install_success) + endif() + + get_property(_conan_generators_folder GLOBAL PROPERTY CONAN_GENERATORS_FOLDER) + + # Ensure that we consider Conan-provided packages ahead of any other, + # irrespective of other settings that modify the search order or search paths + # This follows the guidelines from the find_package documentation + # (https://cmake.org/cmake/help/latest/command/find_package.html): + # find_package ( PATHS paths... NO_DEFAULT_PATH) + # find_package () + + # Filter out `REQUIRED` from the argument list, as the first call may fail + set(_find_args_${package_name} "${ARGN}") + list(REMOVE_ITEM _find_args_${package_name} "REQUIRED") + if(NOT "MODULE" IN_LIST _find_args_${package_name}) + find_package(${package_name} ${_find_args_${package_name}} BYPASS_PROVIDER PATHS "${_conan_generators_folder}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + unset(_find_args_${package_name}) + endif() + + # Invoke find_package a second time - if the first call succeeded, + # this will simply reuse the result. If not, fall back to CMake default search + # behaviour, also allowing modules to be searched. + if(NOT ${package_name}_FOUND) + list(FIND CMAKE_MODULE_PATH "${_conan_generators_folder}" _index) + if(_index EQUAL -1) + list(PREPEND CMAKE_MODULE_PATH "${_conan_generators_folder}") + endif() + unset(_index) + find_package(${package_name} ${ARGN} BYPASS_PROVIDER) + list(REMOVE_ITEM CMAKE_MODULE_PATH "${_conan_generators_folder}") + endif() +endmacro() + + +cmake_language( + SET_DEPENDENCY_PROVIDER conan_provide_dependency + SUPPORTED_METHODS FIND_PACKAGE +) + + +macro(conan_provide_dependency_check) + set(_conan_provide_dependency_invoked FALSE) + get_property(_conan_provide_dependency_invoked GLOBAL PROPERTY CONAN_PROVIDE_DEPENDENCY_INVOKED) + if(NOT _conan_provide_dependency_invoked) + message(WARNING "Conan is correctly configured as dependency provider, " + "but Conan has not been invoked. Please add at least one " + "call to `find_package()`.") + if(DEFINED CONAN_COMMAND) + # supress warning in case `CONAN_COMMAND` was specified but unused. + set(_conan_command ${CONAN_COMMAND}) + unset(_conan_command) + endif() + endif() + unset(_conan_provide_dependency_invoked) +endmacro() + + +# Add a deferred call at the end of processing the top-level directory +# to check if the dependency provider was invoked at all. +cmake_language(DEFER DIRECTORY "${CMAKE_SOURCE_DIR}" CALL conan_provide_dependency_check) + +# Configurable variables for Conan profiles +set(CONAN_HOST_PROFILE "default;auto-cmake" CACHE STRING "Conan host profile") +set(CONAN_BUILD_PROFILE "default" CACHE STRING "Conan build profile") +# ++[kindem] +set(CONAN_INSTALL_ARGS "--build=missing;-c;tools.cmake.cmakedeps:new=will_break_next" CACHE STRING "Command line arguments for conan install") +# --[kindem] + +find_program(_cmake_program NAMES cmake NO_PACKAGE_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH) +if(NOT _cmake_program) + get_filename_component(PATH_TO_CMAKE_BIN "${CMAKE_COMMAND}" DIRECTORY) + set(PATH_TO_CMAKE_BIN "${PATH_TO_CMAKE_BIN}" CACHE INTERNAL "Path where the CMake executable is") +endif() + +cmake_policy(POP) diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 000000000..457f62bb6 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,31 @@ +from conan import ConanFile + +class ExplosionConan(ConanFile): + generators = "CMakeConfigDeps" + settings = "os", "compiler", "build_type", "arch" + + def requirements(self): + self.requires("cpp-httplib/0.27.0") + self.requires("stb/cci.20230920") + self.requires("cityhash/1.0.1") + self.requires("gtest/1.17.0") + self.requires("taskflow/3.10.0") + self.requires("vulkan-headers/1.4.313.0") + self.requires("vulkan-loader/1.4.313.0") + self.requires("vulkan-memory-allocator/3.3.0") + self.requires("spirv-cross/1.4.313.0") + if self.settings.os == "Windows": + self.requires("directx-headers/1.610.2") + + # private repo + self.requires("glfw/3.4-exp") + self.requires("libclang/21.1.7-exp") + self.requires("qt/6.10.1-exp") + self.requires("debugbreak/1.0-exp") + self.requires("rapidjson/cci.20250205-exp") + self.requires("assimp/6.0.2-exp") + self.requires("clipp/1.2.3-exp") + self.requires("dxc/1.8.2505.1-exp") + self.requires("vulkan-validationlayers/1.4.313.0-exp") + if self.settings.os == "Macos": + self.requires("molten-vk/1.4.1-exp")