Skip to content

Commit

Permalink
Update cmake exports to use single config file
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmerson committed Apr 30, 2021
1 parent 4679e90 commit 53298b7
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 137 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,9 @@ if (WITH_PETSC)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PETSc REQUIRED IMPORTED_TARGET GLOBAL PETSc)
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lasConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake/lasConfig.cmake @ONLY)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/lasConfig.cmake
DESTINATION ${ConfigPackageLocation})
16 changes: 16 additions & 0 deletions cmake/lasConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
include(CMakeFindDependencyMacro)



if(@WITH_MPI@)
find_dependency(MPI)
endif()
if(@WITH_PUMI@)
find_dependency(SCOREC)
endif()

include(${CMAKE_CURRENT_LIST_DIR}/las_las.cmake)
# las_lascore.cmake needs to be included after las_las.cmake
if(@WITH_PUMI@)
include(${CMAKE_CURRENT_LIST_DIR}/las_lascore.cmake)
endif()
4 changes: 2 additions & 2 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ endif()
set_target_properties(las_core PROPERTIES PUBLIC_HEADER "${las_core_install}")
target_include_directories(las_core PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include> ${include_dirs})
target_link_libraries(las_core PUBLIC las SCOREC::apf ${link_libs})
install(TARGETS las_core EXPORT las_coreConfig LIBRARY DESTINATION lib ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include)
install(EXPORT las_coreConfig DESTINATION lib/cmake)
install(TARGETS las_core EXPORT las_lascore LIBRARY DESTINATION lib ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include)
install(EXPORT las_lascore DESTINATION ${ConfigPackageLocation} )
6 changes: 0 additions & 6 deletions scripts/bgq-env.sh

This file was deleted.

17 changes: 0 additions & 17 deletions scripts/bgq-timing-batch.sh

This file was deleted.

43 changes: 0 additions & 43 deletions scripts/config.sh

This file was deleted.

16 changes: 0 additions & 16 deletions scripts/config_bgq.sh

This file was deleted.

25 changes: 0 additions & 25 deletions scripts/config_dcs.sh

This file was deleted.

16 changes: 0 additions & 16 deletions scripts/config_erp.sh

This file was deleted.

7 changes: 0 additions & 7 deletions scripts/timing-tests.sh

This file was deleted.

2 changes: 1 addition & 1 deletion sparskit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ set(sparskit_source
src/tred2EISPACK.f
src/utils.f )
add_library(sparskit STATIC ${sparskit_source})
install(TARGETS sparskit EXPORT lasConfig DESTINATION lib)
install(TARGETS sparskit EXPORT las_las DESTINATION lib)
8 changes: 4 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ set(include_dirs $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTER
message(STATUS "Include directories for las: ${include_dirs}")
target_include_directories(las PUBLIC ${include_dirs})
target_link_libraries(las PUBLIC ${link_libs} ${MPI_LIBRARIES})
install(TARGETS las EXPORT lasConfig LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT kernel PUBLIC_HEADER DESTINATION include)
install(TARGETS las EXPORT las_las LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT kernel PUBLIC_HEADER DESTINATION include)
set(LAS_COMPONENTS las)

function(add_backend backend headers libraries)
Expand Down Expand Up @@ -139,13 +139,13 @@ function(add_backend backend headers libraries)
set_target_properties(${capi_lib} PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
endif()
if(MPI_COMPILE_FLAGS)
set_target_properties(${capi_lib} PROPERTIES COMPILE_FLAGS ${MPI_COMPILE_DEFINITIONS)
set_target_properties(${capi_lib} PROPERTIES COMPILE_FLAGS ${MPI_COMPILE_DEFINITIONS})
endif()
if(MPI_LINK_FLAGS)
set_target_properties(${capi_lib} PROPERTIES LINK_FLAGS ${MPI_LINK_FLAGS})
endif()
set_target_properties(${capi_lib} PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_BINARY_DIR}/${capi_header};${las_headers}" )
install(TARGETS ${capi_lib} EXPORT lasConfig LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT capi_${backend} PUBLIC_HEADER DESTINATION include)
install(TARGETS ${capi_lib} EXPORT las_las LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT capi_${backend} PUBLIC_HEADER DESTINATION include)
set(LAS_COMPONENTS "${LAS_COMPONENTS} ${capi_lib}")
unset(backend_header_includes)
unset(BACKEND)
Expand All @@ -167,4 +167,4 @@ write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/las/lasConfigVersi
VERSION ${LAS_VERSION} COMPATIBILITY AnyNewerVersion)

#configure_file(${PROJECT_SOURCE_DIR}/cmake/lasConfig.cmake "${CMAKE_CURRENT_BINARY_DIR}/las/lasConfig.cmake" @ONLY)
install(EXPORT lasConfig DESTINATION lib/cmake)
install(EXPORT las_las DESTINATION ${ConfigPackageLocation})

0 comments on commit 53298b7

Please sign in to comment.