From a2f9512f9d38d50ee601066f6dd4fa74dfd7b29c Mon Sep 17 00:00:00 2001 From: "Rutherford, Cameron" Date: Thu, 2 Nov 2023 15:25:12 -0400 Subject: [PATCH 1/3] Remove several blanket include_directories. --- CMakeLists.txt | 7 ------- resolve/cpu/CMakeLists.txt | 7 +------ resolve/utilities/logger/CMakeLists.txt | 5 +++-- resolve/workspace/CMakeLists.txt | 7 ++++--- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db4e8e74..e4c6c8fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,18 +100,11 @@ endif(RESOLVE_USE_HIP) configure_file( ${CMAKE_SOURCE_DIR}/resolve/resolve_defs.hpp.in ${CMAKE_BINARY_DIR}/resolve/resolve_defs.hpp) - -# include build directory for Fortran name mangling header -# TODO - target based includes -include_directories(${CMAKE_BINARY_DIR}) - install( FILES ${CMAKE_BINARY_DIR}/resolve/resolve_defs.hpp DESTINATION include/resolve ) -# TODO - fix this -include_directories(${CMAKE_SOURCE_DIR}) # Enable testing enable_testing() diff --git a/resolve/cpu/CMakeLists.txt b/resolve/cpu/CMakeLists.txt index 7105655c..893b35dc 100644 --- a/resolve/cpu/CMakeLists.txt +++ b/resolve/cpu/CMakeLists.txt @@ -17,12 +17,7 @@ set(ReSolve_CPU_HEADER_INSTALL # First create dummy backend add_library(resolve_backend_cpu SHARED ${ReSolve_CPU_SRC}) -target_link_libraries(resolve_backend_cpu PRIVATE resolve_logger) - -target_include_directories(resolve_backend_cpu INTERFACE - $ - $ -) +target_link_libraries(resolve_backend_cpu PUBLIC resolve_logger) # install include headers install(FILES ${ReSolve_CPU_HEADER_INSTALL} DESTINATION include/resolve/cpu) diff --git a/resolve/utilities/logger/CMakeLists.txt b/resolve/utilities/logger/CMakeLists.txt index 91b29dfc..29800942 100644 --- a/resolve/utilities/logger/CMakeLists.txt +++ b/resolve/utilities/logger/CMakeLists.txt @@ -17,8 +17,9 @@ set(Logger_HEADER_INSTALL # Build shared library ReSolve add_library(resolve_logger SHARED ${Logger_SRC}) -target_include_directories(resolve_logger INTERFACE - $ +target_include_directories(resolve_logger PUBLIC + $ + $ $ ) diff --git a/resolve/workspace/CMakeLists.txt b/resolve/workspace/CMakeLists.txt index a34c2191..a44f74f8 100644 --- a/resolve/workspace/CMakeLists.txt +++ b/resolve/workspace/CMakeLists.txt @@ -47,9 +47,10 @@ if(RESOLVE_USE_HIP) target_link_libraries(resolve_workspace PUBLIC resolve_backend_hip) endif(RESOLVE_USE_HIP) -target_include_directories(resolve_workspace INTERFACE - $ - $ +target_include_directories(resolve_workspace PUBLIC + $ + $ + $ ) # install include headers From 26fbfe597ad78fbff1221d8009b2ea7298bc9c22 Mon Sep 17 00:00:00 2001 From: "Rutherford, Cameron" Date: Thu, 2 Nov 2023 16:04:01 -0400 Subject: [PATCH 2/3] Fix exported CMake bug in CXX_STANDARD --- CMakePresets.json | 2 +- cmake/ReSolveConfig.cmake.in | 4 ++++ examples/CMakeLists.txt | 3 +++ examples/resolve_consumer/CMakeLists.txt | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index c00f9919..b1b89009 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -25,7 +25,7 @@ "installDir": "${sourceDir}/install", "generator": "Unix Makefiles" }, - { + { "name": "ascent", "inherits": "cuda", "displayName": "Ascent Build", diff --git a/cmake/ReSolveConfig.cmake.in b/cmake/ReSolveConfig.cmake.in index 47f9fe35..1e1fbfb0 100644 --- a/cmake/ReSolveConfig.cmake.in +++ b/cmake/ReSolveConfig.cmake.in @@ -4,6 +4,10 @@ include("${CMAKE_CURRENT_LIST_DIR}/ReSolveTargets.cmake") +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD @CMAKE_CXX_STANDARD@) +endif() + include(CheckLanguage) # This must come before enable_language(CUDA) if(@RESOLVE_USE_CUDA@) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 9113ce17..faa53807 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -71,8 +71,11 @@ set(CONSUMER_PATH ${CMAKE_INSTALL_PREFIX}/share/examples) install(PROGRAMS test.sh DESTINATION ${CONSUMER_PATH}) # Select consumer app +# TODO - have an outer loop that adds a unique consumer test for each backend supproted if(RESOLVE_USE_CUDA) set(RESOLVE_CONSUMER_APP "testKLU_Rf_FGMRES.cpp") +elseif(RESOLVE_USE_HIP) + set(RESOLVE_CONSUMER_APP "testKLU_RocSolver.cpp") else() set(RESOLVE_CONSUMER_APP "testKLU.cpp") endif() diff --git a/examples/resolve_consumer/CMakeLists.txt b/examples/resolve_consumer/CMakeLists.txt index e03a4e6f..06370119 100644 --- a/examples/resolve_consumer/CMakeLists.txt +++ b/examples/resolve_consumer/CMakeLists.txt @@ -11,7 +11,7 @@ find_package(ReSolve REQUIRED) # Build example with KLU factorization and KLU refactorization add_executable(consume.exe consumer.cpp) -target_link_libraries(consume.exe PRIVATE ReSolve::ReSolve) +target_link_libraries(consume.exe PUBLIC ReSolve::ReSolve) #------------------------------------------------------------------------------------ # Testing of exported Resolve Configurations From 58d65076c16ad0634934f0769d3578dfd8cf4764 Mon Sep 17 00:00:00 2001 From: Cameron Rutherford Date: Thu, 2 Nov 2023 16:40:57 -0400 Subject: [PATCH 3/3] Update examples/resolve_consumer/CMakeLists.txt --- examples/resolve_consumer/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/resolve_consumer/CMakeLists.txt b/examples/resolve_consumer/CMakeLists.txt index 06370119..e03a4e6f 100644 --- a/examples/resolve_consumer/CMakeLists.txt +++ b/examples/resolve_consumer/CMakeLists.txt @@ -11,7 +11,7 @@ find_package(ReSolve REQUIRED) # Build example with KLU factorization and KLU refactorization add_executable(consume.exe consumer.cpp) -target_link_libraries(consume.exe PUBLIC ReSolve::ReSolve) +target_link_libraries(consume.exe PRIVATE ReSolve::ReSolve) #------------------------------------------------------------------------------------ # Testing of exported Resolve Configurations