diff --git a/CMakeLists.txt b/CMakeLists.txt index 761d00b..c1b5f68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,6 @@ include(cmake/CcpTargetConfigurations.cmake) include(cmake/CcpDocsGenerator.cmake) find_package(yaml-cpp CONFIG REQUIRED) -find_package(Python3 COMPONENTS Interpreter REQUIRED) # Add subdirectory for resource tools static library add_subdirectory(tools) @@ -104,10 +103,14 @@ target_include_directories(resources-static add_subdirectory(cli) -enable_testing() - -add_subdirectory(tests) - +# Enable testing based on option set (on by default) +if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + option(BUILD_TESTING "Build and run tests. Enabled by default." ON) + if (BUILD_TESTING) + include(CTest) + add_subdirectory(tests) + endif () +endif () # Provide an install target if this is the top level project only if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) @@ -123,6 +126,8 @@ if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) option(BUILD_DOCUMENTATION "Build Documentation" ${BUILD_DOCUMENTATION_DEFAULT_FLAG}) if (BUILD_DOCUMENTATION) + find_package(Python3 COMPONENTS Interpreter REQUIRED) + # Run sphinx set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/doc/source) set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/doc/build) diff --git a/CMakePresets.json b/CMakePresets.json index 521f79f..6a225c6 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -17,7 +17,8 @@ "cacheVariables": { "CMAKE_COMPILE_WARNING_AS_ERROR": "ON", "VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/cmake/triplets", - "VCPKG_TARGET_TRIPLET": "x64-windows-carbon" + "VCPKG_TARGET_TRIPLET": "x64-windows-carbon", + "VCPKG_HOST_TRIPLET": "x64-windows-carbon" }, "environment": { "X_VCPKG_REGISTRIES_CACHE": "${sourceDir}/vcpkg_registry_cache" @@ -31,7 +32,8 @@ "cacheVariables": { "CMAKE_COMPILE_WARNING_AS_ERROR": "ON", "VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/cmake/triplets", - "VCPKG_TARGET_TRIPLET": "x64-windows-carbon" + "VCPKG_TARGET_TRIPLET": "x64-windows-carbon", + "VCPKG_HOST_TRIPLET": "x64-windows-carbon" }, "environment": { "X_VCPKG_REGISTRIES_CACHE": "${sourceDir}/vcpkg_registry_cache" @@ -53,11 +55,33 @@ "cacheVariables": { "CMAKE_COMPILE_WARNING_AS_ERROR": "ON", "VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/cmake/triplets", - "VCPKG_TARGET_TRIPLET": "arm64-osx-carbon" + "VCPKG_TARGET_TRIPLET": "arm64-osx-carbon", + "VCPKG_HOST_TRIPLET": "arm64-osx-carbon" }, "environment": { "X_VCPKG_REGISTRIES_CACHE": "${sourceDir}/vcpkg_registry_cache" } + }, + { + "name": "ci", + "hidden": true, + "cacheVariables": { + "BUILD_DOCUMENTATION": "ON", + "BUILD_TESTING": "ON", + "VCPKG_MANIFEST_FEATURES": "docs;tests" + } + }, + { + "name": "carbon_windows_vcpkg_vs_ci", + "inherits": ["carbon_windows_vcpkg_vs", "ci"] + }, + { + "name": "carbon_windows_vcpkg_nmc_ci", + "inherits": ["carbon_windows_vcpkg_nmc", "ci"] + }, + { + "name": "carbon_osx_vcpkg_ci", + "inherits": ["carbon_osx_vcpkg", "ci"] } ] } diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 3c69cc3..9c0fca4 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -7,9 +7,9 @@ "registries": [ { "kind": "git", - "repository": "git@github.com:ccpgames/carbon-vcpkg-registry.git", - "baseline": "4089428d25208720dcf6451cb8b57816bbf9fb9d", - "packages": ["carbon-*", "python3-prebuilt", "bsdiff-drake127"] + "repository": "git@github.com:carbonengine/vcpkg-registry.git", + "baseline": "addd8867a1553f4b7866bb7a36deb84bd59bd1f9", + "packages": ["carbon-*", "python3", "bsdiff-drake127"] } ] } diff --git a/vcpkg.json b/vcpkg.json index a7c7699..bb2353a 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,45 +1,64 @@ { "dependencies": [ { - "name": "python3-prebuilt", - "version>=": "3.12.3#2" + "name": "argparse", + "version>=": "2.2#0" }, - { - "name":"argparse", - "version>=":"2.2#0" + "name": "curl", + "version>=": "8.11.1#1" }, - { - "name":"curl" + "name": "cryptopp", + "version>=": "8.9.0#1" }, - { - "name":"gtest" + "name": "yaml-cpp", + "version>=": "0.8.0#1" }, - { - "name":"cryptopp" + "name": "zlib", + "version>=": "1.3.1" }, - { - "name":"tiny-process-library" - }, - - { - "name":"yaml-cpp" - }, - - { - "name":"zlib" - }, - - { - "name":"bsdiff-drake127" + "name": "bsdiff-drake127", + "version>=": "4.3.3" } ], - + "default-features": [ + "tests" + ], + "features": { + "tests": { + "description": "Enable tests", + "dependencies": [ + { + "name": "gtest", + "version>=": "1.15.2", + "host": true + }, + { + "name": "tiny-process-library", + "version>=": "2.0.4#3", + "host": true + } + ] + }, + "docs": { + "description": "Generate documentation", + "dependencies": [ + { + "name": "python3", + "version>=": "3.12.3", + "host": true + } + ] + } + }, "overrides": [ - { "name": "argparse", "version": "2.2#0" } + { + "name": "argparse", + "version": "2.2#0" + } ] }