diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a9d9ffa3..af3d38f9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,14 +37,16 @@ option(USE_MFEM "Build libROM with MFEM" OFF) option(MFEM_USE_GSLIB "Build libROM with MFEM using GSLIB" OFF) option(BUILD_STATIC "Build libROM as a static library" OFF) option(ENABLE_EXAMPLES "Build examples and regression tests" ON) +option(ENABLE_DOCS "Build docs using Doxygen" OFF) ## Set a bunch of variables to generate a configure header # Enable assertion checking if debug symbols generated if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) set(DEBUG_CHECK_ASSERTIONS "1") -endif((CMAKE_BUILD_TYPE STREQUAL "Debug") OR - (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") +endif() set(CAROM_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") set(CAROM_VERSION_MINOR "${PROJECT_VERSION_MINOR}") @@ -107,8 +109,6 @@ find_package(MPI 1.2 REQUIRED) find_package(ZLIB 1.2.3 REQUIRED) -find_package(Doxygen 1.8.5) - find_package(GTest 1.6.0) if (USE_MFEM) @@ -297,7 +297,9 @@ endif(GTEST_FOUND) # NOTE(goxberry@gmail.com, oxberry1@llnl.gov): This code snippet # builds the Doxygen documentation, but outputs said documentation to # ${CMAKE_CURRENT_SOURCE_DIR}/docs)... -if(DOXYGEN_FOUND) +if(${ENABLE_DOCS}) + find_package(Doxygen 1.8.5 REQUIRED) + set(doxyfile ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile) add_custom_target( @@ -316,4 +318,4 @@ if(DOXYGEN_FOUND) ${CMAKE_CURRENT_BINARY_DIR}/docs/html/rom.tag) add_dependencies(doxygen_tagfile documentation) -endif(DOXYGEN_FOUND) +endif() diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 0e546061d..6a85038d2 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -61,7 +61,7 @@ set(module_list utils/mpi_utils) set(source_files) foreach(module IN LISTS module_list) - list(APPEND source_files ${module}.cpp) + list(APPEND source_files ${module}.cpp ${module}.h) endforeach(module) # IN LISTS module_list list(APPEND source_files @@ -141,3 +141,24 @@ target_include_directories(ROM PUBLIC ${MPI_C_INCLUDE_DIRS} ${MFEM_C_INCLUDE_DIRS} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + +# Find headers from the source file list that need to be installed +set(HEADERS "") +foreach(file IN LISTS source_files) + if(file MATCHES ".(hpp|h)$") + list(APPEND HEADERS ${file}) + endif() +endforeach(file) + +# Only install libROM.so if installing to a different directory. Otherwise, libROM.so is already in lib/ +if (NOT ${CMAKE_INSTALL_PREFIX} STREQUAL ${CMAKE_BINARY_DIR}) + install(TARGETS ROM EXPORT ROM LIBRARY DESTINATION lib INCLUDES DESTINATION include) +endif() + +# Install libROM headers +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/CAROM_config.h ${CMAKE_CURRENT_SOURCE_DIR}/FCMangle.h DESTINATION include) +foreach(file IN LISTS HEADERS) + # get the directory component so the include directory structure is preserved + get_filename_component(dir ${file} DIRECTORY) + install(FILES ${file} DESTINATION include/${dir}) +endforeach(file)