diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 4a40879..c2d3c49 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -29,23 +29,23 @@ jobs: with: cmakeVersion: ${{ env.cmake_version }} - #- name: Download Catch2 - # run: | - # git clone https://github.com/catchorg/Catch2.git catch2 \ - # --branch v3.4.0 - - #- name: Build Catch2 - # run: | - # prefix=`pwd`/catch2_install - # cd catch2 - # cmake -H. -Bbuild -DCMAKE_INSTALL_PREFIX="${prefix}" - # cmake --build build --parallel 2 - # echo "CMAKE_PREFIX_PATH=${prefix}" >> $GITHUB_ENV - - #- name: Install Catch2 - # run: | - # cd catch2 - # cmake --build build --target install + - name: Download Catch2 + run: | + git clone https://github.com/catchorg/Catch2.git catch2 \ + --branch v3.4.0 + + - name: Build Catch2 + run: | + prefix=`pwd`/catch2_install + cd catch2 + cmake -H. -Bbuild -DCMAKE_INSTALL_PREFIX="${prefix}" + cmake --build build --parallel 2 + echo "CMAKE_PREFIX_PATH=${prefix}" >> $GITHUB_ENV + + - name: Install Catch2 + run: | + cd catch2 + cmake --build build --target install - name: Configure Project run: > diff --git a/cmake/cmaize/package_managers/cmake/cmake_package_manager.cmake b/cmake/cmaize/package_managers/cmake/cmake_package_manager.cmake index b33857e..aab2a8f 100644 --- a/cmake/cmaize/package_managers/cmake/cmake_package_manager.cmake +++ b/cmake/cmaize/package_managers/cmake/cmake_package_manager.cmake @@ -127,13 +127,23 @@ cpp_class(CMakePackageManager PackageManager) CMakePackageManager(GET "${self}" _rd_dependencies dependencies) cpp_map(GET "${_rd_dependencies}" _rd_depend "${_rd_pkg_name}") + cpp_map(KEYS "${_rd_dependencies}" _rd_keys) + foreach(_rd_key ${_rd_keys}) + cpp_map(GET "${_rd_dependencies}" _rd_temp "${_rd_key}") + message("${_rd_key} = ${_rd_temp}") + endforeach() + + + message("PackageManager had ${_rd_pkg_name} = ${_rd_depend}") if("${_rd_depend}" STREQUAL "") message(DEBUG "Registering dependency to package manager: ${_rd_pkg_name}") set(_rd_depend "") if("${ARGN}" MATCHES "github") + message("Creating a GitHub dependency") GitHubDependency(CTOR _rd_depend) else() + message("Creating a non-GitHub dependency") RemoteURLDependency(CTOR _rd_depend) endif() @@ -182,6 +192,8 @@ cpp_class(CMakePackageManager PackageManager) PackageSpecification(GET "${_fi_package_specs}" _fi_pkg_name name) + message("Looking for ${_fi_pkg_name}") + CMakePackageManager(register_dependency "${self}" _fi_depend diff --git a/cmake/cmaize/package_managers/cmake/dependency/dependency_class.cmake b/cmake/cmaize/package_managers/cmake/dependency/dependency_class.cmake index 33b41e1..c39dd40 100644 --- a/cmake/cmaize/package_managers/cmake/dependency/dependency_class.cmake +++ b/cmake/cmaize/package_managers/cmake/dependency/dependency_class.cmake @@ -102,6 +102,7 @@ cpp_class(Dependency) # Check if it was already found? If so short-circuit and return TRUE Dependency(GET "${self}" "${_fd_found}" found) + message("Was already found? ${${_fd_found}}") if("${${_fd_found}}") cpp_return("${_fd_found}") endif() @@ -202,4 +203,3 @@ cpp_class(Dependency) endfunction() cpp_end_class() - diff --git a/cmake/cmaize/package_managers/cmake/dependency/github.cmake b/cmake/cmaize/package_managers/cmake/dependency/github.cmake index edf68f3..5b0fb83 100644 --- a/cmake/cmaize/package_managers/cmake/dependency/github.cmake +++ b/cmake/cmaize/package_managers/cmake/dependency/github.cmake @@ -88,7 +88,17 @@ cpp_class(GitHubDependency RemoteURLDependency) set(_bd_url "https://${_bd_url}") endif() - RemoteURLDependency(_cache_args "${_bd_this}" _bd_old_cmake_args) + # The only reliable way to forward arguments to subprojects seems to be + # through the cache, so we need to record the current values, set the + # temporary values, call the subproject, reset the old values + set(_bd_old_cmake_args) + foreach(_bd_pair ${_bd_cmake_args}) + string(REPLACE "=" [[;]] _bd_split_pair "${_bd_pair}") + list(GET _bd_split_pair 0 _bd_var) + list(GET _bd_split_pair 1 _bd_val) + list(APPEND _bd_old_cmake_args "${_bd_var}=${${_bd_var}}") + set("${_bd_var}" "${_bd_val}" CACHE BOOL "" FORCE) + endforeach() # It's possible GitHub URLs link to an "asset" (i.e., a tarball) string(FIND "${_bd_url}" ".tgz" _bd_is_tarball) @@ -103,7 +113,12 @@ cpp_class(GitHubDependency RemoteURLDependency) cmaize_fetch_and_available("${_bd_name}" URL "${_bd_url}") endif() - RemoteURLDependency(_uncache_args "${_bd_this}" _bd_old_cmake_args) + foreach(_bd_pair ${_bd_old_cmake_args}) + string(REPLACE "=" [[;]] _bd_split_pair "${_bd_pair}") + list(GET _bd_split_pair 0 _bd_var) + list(GET _bd_split_pair 1 _bd_val) + set("${_bd_var}" "${_bd_val}" CACHE BOOL "" FORCE) + endforeach() _cmaize_dependency_check_target("${_bd_this}" "build") # It's now "found" since it's been added to our build system diff --git a/cmake/cmaize/package_managers/cmake/dependency/remote_url.cmake b/cmake/cmaize/package_managers/cmake/dependency/remote_url.cmake index fe7f0dc..9239059 100644 --- a/cmake/cmaize/package_managers/cmake/dependency/remote_url.cmake +++ b/cmake/cmaize/package_managers/cmake/dependency/remote_url.cmake @@ -26,47 +26,6 @@ cpp_class(RemoteURLDependency Dependency) #]] cpp_attr(RemoteURLDependency location "") - #[[[ - # Updates the values of the CMake cache to be consistent with the values - # requested by this dependency. - # - # :param old_cmake_args: Variable to assign the old values to. - # :type old_cmake_args: list* - #]] - - cpp_member(_cache_args RemoteURLDependency list*) - function("${_cache_args}" _ca_this _ca_old_cmake_args) - RemoteURLDependency(GET "${_ca_this}" _ca_cmake_args cmake_args) - - # The only reliable way to forward arguments to subprojects seems to be - # through the cache, so we need to record the current values, set the - # temporary values, call the subproject, reset the old values - foreach(_ca_pair ${_ca_cmake_args}) - string(REPLACE "=" [[;]] _ca_split_pair "${_ca_pair}") - list(GET _ca_split_pair 0 _ca_var) - list(GET _ca_split_pair 1 _ca_val) - list(APPEND "${_ca_old_cmake_args}" "${_ca_var}=${${_ca_var}}") - set("${_ca_var}" "${_ca_val}" CACHE BOOL "" FORCE) - endforeach() - cpp_return("${_ca_old_cmake_args}") - endfunction() - - #[[[ - # Restores the values in the CMake cach to those in old_cmake_args. - # - # :param old_cmake_args: The values to put back into the cache. - # :type old_cmake_args: desc* - #]] - cpp_member(_uncache_args RemoteURLDependency list*) - function("${_uncache_args}" _ua_this _ua_old_cmake_args) - foreach(_ua_pair ${${_ua_old_cmake_args}}) - string(REPLACE "=" [[;]] _ua_split_pair "${_ua_pair}") - list(GET _ua_split_pair 0 _ua_var) - list(GET _ua_split_pair 1 _ua_val) - set("${_ua_var}" "${_ua_val}" CACHE BOOL "" FORCE) - endforeach() - endfunction() - #[[[ # Attempts to fetch and build the dependency. # @@ -80,11 +39,26 @@ cpp_class(RemoteURLDependency Dependency) RemoteURLDependency(GET "${_bd_this}" _bd_url location) RemoteURLDependency(GET "${_bd_this}" _bd_name name) - RemoteURLDependency(_cache_args "${_bd_this}" _bd_old_cmake_args) + # The only reliable way to forward arguments to subprojects seems to be + # through the cache, so we need to record the current values, set the + # temporary values, call the subproject, reset the old values + set(_bd_old_cmake_args) + foreach(_bd_pair ${_bd_cmake_args}) + string(REPLACE "=" [[;]] _bd_split_pair "${_bd_pair}") + list(GET _bd_split_pair 0 _bd_var) + list(GET _bd_split_pair 1 _bd_val) + list(APPEND _bd_old_cmake_args "${_bd_var}=${${_bd_var}}") + set("${_bd_var}" "${_bd_val}" CACHE BOOL "" FORCE) + endforeach() cmaize_fetch_and_available("${_bd_name}" GIT_REPOSITORY "${_bd_url}.git") - RemoteURLDependency(_uncache_args "${_bd_this}" _bd_old_cmake_args) + foreach(_bd_pair ${_bd_old_cmake_args}) + string(REPLACE "=" [[;]] _bd_split_pair "${_bd_pair}") + list(GET _bd_split_pair 0 _bd_var) + list(GET _bd_split_pair 1 _bd_val) + set("${_bd_var}" "${_bd_val}" CACHE BOOL "" FORCE) + endforeach() _cmaize_dependency_check_target("${_bd_this}" "build")