From f36b4c4a116b57ee7fba592ecd88eb4325d0dc83 Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Wed, 20 Dec 2023 10:06:48 +0100 Subject: [PATCH 01/19] make: Add install targets --- CMakeLists.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72bc024f..05d7dbea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,3 +127,26 @@ if ( BUILD_PYTHON_BINDINGS ) add_subdirectory(pybind11) pybind11_add_module(${PROJECT_NAME} ${PYTHONBIND}) endif() + +# installation +include(GNUInstallDirs) +configure_file(comma.pc.in comma.pc @ONLY) + +# ${SOURCE_DIR} (no slash) considers the directory itself +# ${SOURCE_DIR}/ (with slash) considers its files only +install(DIRECTORY ${SOURCE_DIR}/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} + FILES_MATCHING PATTERN "*.h" + REGEX "deprecated" EXCLUDE +) +install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/comma.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + +if ( BUILD_PYTHON_BINDINGS ) + install(TARGETS ${PROJECT_NAME} + COMPONENT python + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ) +endif() From 56f0e4a3ce122b937429527eb2ed79ead583733d Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Wed, 20 Dec 2023 11:23:33 +0100 Subject: [PATCH 02/19] test!: Change test name --- .gitlab-ci.yml | 4 ++-- CMakeLists.txt | 6 +++--- README.md | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 89f4d73d..35df57e0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -82,7 +82,7 @@ job:test_dbg: script: - cd $CUSTOM_CI_DIR - cd build - - ./Comma_test -r junit > test_a.xml + - ./CoMMA_test -r junit > test_a.xml - python3 -m gcovr --xml-pretty --exclude '\.\./pybind11/' --exclude '\.\./Catch2/' --exclude '\.\./build_rel/' --exclude '\.\./CoMMA_lib/CoMMA.cpp' --print-summary -o coverage.xml --root .. coverage: /^\s*lines:\s*\d+.\d+\%/ artifacts: @@ -121,7 +121,7 @@ job:test_rel: script: - cd $CUSTOM_CI_DIR - cd build_rel - - ./Comma_test + - ./CoMMA_test pages: stage: documentation needs: ['job:init', 'job:build_dbg', 'job:test_dbg'] diff --git a/CMakeLists.txt b/CMakeLists.txt index 05d7dbea..c0c2d30e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ project(CoMMA VERSION 1.3) # https://stackoverflow.com/questions/36358217/what-is-the-difference-between-option-and-set-cache-bool-for-a-cmake-variabl #set(BUILD_TESTS On CACHE BOOL "Build tests") option(BUILD_TESTS "Build tests" ON) -set(CoMMA_TEST "Comma_test") +set(CoMMA_TEST "CoMMA_test") option(COVERAGE "Build tests with coverage support" OFF) #set(BUILD_PYTHON_BINDINGS On CACHE BOOL "Build python bindings via pybind11") @@ -119,8 +119,8 @@ if ( BUILD_TESTS ) target_link_libraries(${CoMMA_TEST} gcov) endif() endif() -#target_link_libraries(Comma_test Boost) -#set_source_files_properties( Comma_test PROPERTIES COMPILE_FLAGS "--coverage" ) +#target_link_libraries(${CoMMA_TEST} Boost) +#set_source_files_properties(${CoMMA_TEST} PROPERTIES COMPILE_FLAGS "--coverage") ######################## Pybind11 bindings #################################### if ( BUILD_PYTHON_BINDINGS ) message("Python bindings enabled") diff --git a/README.md b/README.md index 074470c1..68d6c34a 100644 --- a/README.md +++ b/README.md @@ -127,14 +127,14 @@ framework, which is why the related submodule is included in this repository. To run the tests, build the library (see [above](#wrench-building-the-library), the `cmake` commands related to the tests are already part of the reference [`CMakeLists.txt`](CMakeLists.txt)), -this will generate an executable `Comma_test` in the building directory, simply +this will generate an executable `CoMMA_test` in the building directory, simply run it. ```shell mkdir build cd build cmake .. make -./Comma_test +./CoMMA_test ``` Tests are included in the From 07cfd7090611ea00c4847a98a18594c0f56816c3 Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Wed, 20 Dec 2023 11:24:48 +0100 Subject: [PATCH 03/19] make: Minor Improve out messages --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0c2d30e..915d6e8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.14) if(NOT CMAKE_BUILD_TYPE) - message("No build type received, using Debug") + message(STATUS "No build type received, using Debug") set(CMAKE_BUILD_TYPE Debug) # Debug version endif() @@ -108,10 +108,10 @@ SET(TESTS # Generate a test executable with covergae report if ( BUILD_TESTS ) - message("Tests enabled") + message(STATUS "Tests enabled") include_directories(Catch2/single_include) if ( COVERAGE ) - message("Coverage support enabled") + message(STATUS "Coverage support enabled") add_compile_options("--coverage") endif() add_executable(${CoMMA_TEST} ${TESTS}) @@ -123,7 +123,7 @@ endif() #set_source_files_properties(${CoMMA_TEST} PROPERTIES COMPILE_FLAGS "--coverage") ######################## Pybind11 bindings #################################### if ( BUILD_PYTHON_BINDINGS ) - message("Python bindings enabled") + message(STATUS "Python bindings enabled") add_subdirectory(pybind11) pybind11_add_module(${PROJECT_NAME} ${PYTHONBIND}) endif() From 5330ee66e596154e0cd235e06bfeda26b40f0f93 Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Wed, 20 Dec 2023 11:25:41 +0100 Subject: [PATCH 04/19] make|test!: Add test target to cmake --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 915d6e8f..c59e972b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,9 @@ if ( BUILD_TESTS ) if ( COVERAGE ) target_link_libraries(${CoMMA_TEST} gcov) endif() + + enable_testing() + add_test(NAME ${CoMMA_TEST}_global COMMAND ${CoMMA_TEST}) endif() #target_link_libraries(${CoMMA_TEST} Boost) #set_source_files_properties(${CoMMA_TEST} PROPERTIES COMPILE_FLAGS "--coverage") From c59280b2c7332960091fb7070cb7f7fe838ac373 Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Wed, 20 Dec 2023 12:03:05 +0100 Subject: [PATCH 05/19] build: Comment out useless (for the moment) config files --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c59e972b..e6e8a9b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,7 @@ endif() # installation include(GNUInstallDirs) -configure_file(comma.pc.in comma.pc @ONLY) +# configure_file(comma.pc.in comma.pc @ONLY) # ${SOURCE_DIR} (no slash) considers the directory itself # ${SOURCE_DIR}/ (with slash) considers its files only @@ -143,7 +143,7 @@ install(DIRECTORY ${SOURCE_DIR}/ REGEX "deprecated" EXCLUDE ) install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/comma.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/comma.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) if ( BUILD_PYTHON_BINDINGS ) install(TARGETS ${PROJECT_NAME} From 7b85850bc6d1b9481f46a6bcc4cef19fb585409b Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Wed, 20 Dec 2023 12:05:13 +0100 Subject: [PATCH 06/19] build: Forgotten `message(STATUS )`, completes 07cfd70 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6e8a9b0..9e5e6b34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ if ( CODAFLAGS ) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-finite-math-only -fno-math-errno -fvisibility-inlines-hidden -Wall -Wno-absolute-value -Wno-deprecated-register -Wno-unused-lambda-capture") endif() - message("Added CODA-like extra flags. Current flags are: ${CMAKE_CXX_FLAGS}") + message(STATUS "Added CODA-like extra flags. Current flags are: ${CMAKE_CXX_FLAGS}") endif() # Effective library From e13f20a9171ba7452fb14b4bc5e984c96374239c Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Wed, 20 Dec 2023 14:43:17 +0100 Subject: [PATCH 07/19] build: Add documentation target It is added to ALL as well --- CMakeLists.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e5e6b34..60dfeb3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,10 @@ option(COVERAGE "Build tests with coverage support" OFF) #set(BUILD_PYTHON_BINDINGS On CACHE BOOL "Build python bindings via pybind11") option(BUILD_PYTHON_BINDINGS "Build python bindings via pybind11" ON) +# https://vicrucann.github.io/tutorials/quick-cmake-doxygen/ and +# https://stackoverflow.com/questions/34878276/build-doxygen-from-cmake-script +option(BUILD_DOC "Build documentation (with Doxygen)" OFF) + if ( CODAFLAGS ) # We just do not set the optimization flags nor the parallelism-related ones if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -131,6 +135,22 @@ if ( BUILD_PYTHON_BINDINGS ) pybind11_add_module(${PROJECT_NAME} ${PYTHONBIND}) endif() +if ( BUILD_DOC ) + message(STATUS "Documentation enabled") + find_package(Doxygen) + if ( NOT DOXYGEN_FOUND ) + message(FATAl_ERROR "Doxygen is needed to build the documentation.") + endif() + + # We add it to all-target as well + add_custom_target(doc + ALL + COMMAND ${DOXYGEN_EXECUTABLE} Documentation/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Generating documentation with Doxygen" + ) +endif() + # installation include(GNUInstallDirs) # configure_file(comma.pc.in comma.pc @ONLY) @@ -153,3 +173,7 @@ if ( BUILD_PYTHON_BINDINGS ) ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) endif() + +if ( BUILD_DOC ) + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/documentation/html TYPE DOC) +endif() From 039fb42f633443368803158f6413d1a7e22639ef Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Wed, 20 Dec 2023 14:50:23 +0100 Subject: [PATCH 08/19] build: Fix e13f20a - documentation target --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60dfeb3d..b3c3a9ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,7 +139,7 @@ if ( BUILD_DOC ) message(STATUS "Documentation enabled") find_package(Doxygen) if ( NOT DOXYGEN_FOUND ) - message(FATAl_ERROR "Doxygen is needed to build the documentation.") + message(FATAL_ERROR "Doxygen is needed to build the documentation.") endif() # We add it to all-target as well From a917aedc752c68272df5a8c7f858ca2000a5b3ab Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Wed, 20 Dec 2023 16:46:35 +0100 Subject: [PATCH 09/19] build: [Doc target] Add user manual --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3c3a9ca..df67b9eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,4 +176,8 @@ endif() if ( BUILD_DOC ) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/documentation/html TYPE DOC) + install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/CoMMA_user_manual.pdf + TYPE DOC + ) endif() From 0500bcf5561e56d08c4c45b23f61619288eb57a5 Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Thu, 21 Dec 2023 08:55:38 +0100 Subject: [PATCH 10/19] build: Minor - Format and insights --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index df67b9eb..876fec96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,9 +175,7 @@ if ( BUILD_PYTHON_BINDINGS ) endif() if ( BUILD_DOC ) + # Instead of "TYPE DOC" could have use ${CMAKE_INSTALL_DOCDIR} or similarly ${CMAKE_INSTALL_FULL_DOCDIR} install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/documentation/html TYPE DOC) - install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/CoMMA_user_manual.pdf - TYPE DOC - ) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/CoMMA_user_manual.pdf TYPE DOC) endif() From 1497810df23110cf8507648892c0dc16c1d0fcf1 Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Thu, 21 Dec 2023 09:40:17 +0100 Subject: [PATCH 11/19] build: Improve CMake project description --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 876fec96..a29b1938 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,12 @@ set(CMAKE_CXX_STANDARD 17) # https://github.com/catchorg/Catch2/issues/1204 ################################### PROJECT ################################# -project(CoMMA VERSION 1.3) +project(CoMMA + VERSION 1.3 + DESCRIPTION "Geometric agglomerator for unstructured grids" + HOMEPAGE_URL "https://github.com/onera/CoMMA" + LANGUAGES CXX +) # https://stackoverflow.com/questions/57860026/cmake-override-variable-set-in-cmakelists-txt-via-commandline # For the current application, better to use an `option`: From 5e8a15a4e2a04ebfd242b5030cc8920e810a3e4d Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Thu, 21 Dec 2023 09:41:18 +0100 Subject: [PATCH 12/19] doc: Improve doxygen Add logo and brief --- Documentation/Doxyfile | 6 ++++-- images/logos/logo-CoMMA_70x70.jpg | Bin 0 -> 4035 bytes 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 images/logos/logo-CoMMA_70x70.jpg diff --git a/Documentation/Doxyfile b/Documentation/Doxyfile index ef02e8b1..70139836 100644 --- a/Documentation/Doxyfile +++ b/Documentation/Doxyfile @@ -44,14 +44,16 @@ PROJECT_NUMBER = "v1.3" # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = "" +PROJECT_BRIEF = "A geometric agglomerator for unstructured meshes" # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. +# PERSONAL EDIT: 55 looks good if no project brief. With the brief it's too +# small. 70 looks good, might also be a little more, like 72, but 75 is too much -PROJECT_LOGO = +PROJECT_LOGO = images/logos/logo-CoMMA_70x70.jpg # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is diff --git a/images/logos/logo-CoMMA_70x70.jpg b/images/logos/logo-CoMMA_70x70.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b2a00aad0e6eadd9acf8ba9f0def831856333926 GIT binary patch literal 4035 zcmb79_dnHt{C!)wxaeM^aIMU1l@*!UD_mPh!Zj}Ua_z0m?2%EDm36Pk-uaL{6IU{` zM~TRm?pKe;_xlHY&+GZa^YuE90ee z3=9l3bd1c5Q0A*1`p<;qpOTy$L_q<9f~mpK|2K%800eXuNt28O0+2#T$RH%d9)KMH zNUx$@ZSa4f1YM&dr2xpt|ItdCrFVT^zS6Ui0AwWp@PF>Wm6!}5p(MQ`r65=4S9VuB z{qFz?aCL=HaEn7#jD9gN-n#Ox`F!nJT45IxkFotSvnp{G0A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/19] build!: Bump cmake version from 3.14 to 3.15 --- CMakeLists.txt | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a29b1938..3ef067be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ ############################### CMAKE VERSION and FLAGS ########################## -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.15) if(NOT CMAKE_BUILD_TYPE) message(STATUS "No build type received, using Debug") diff --git a/README.md b/README.md index 68d6c34a..4c2e2ca7 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ very convenient for testing and debugging purposes. Moreover, some tests via `Catch2` have been written to check the integrity of CoMMA. Both the `python` module and the tests need compilation. -To build this library you just need a fairly recent `cmake` (3.14+). Then, a +To build this library you just need a fairly recent `cmake` (3.15+). Then, a standard out-of-source build with `cmake` in a freshly created directory will suffice to compile ```shell From ef9a8516da963e9112aee29143c5dee929da6cdc Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Thu, 21 Dec 2023 11:58:05 +0100 Subject: [PATCH 14/19] build: Check for python and change python installing directory It now is, e.g., $PREFIX/lib64/site-packages/CoMMA.... --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ef067be..9ca8e914 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,8 @@ endif() ######################## Pybind11 bindings #################################### if ( BUILD_PYTHON_BINDINGS ) message(STATUS "Python bindings enabled") + # find the Python interpreter (including pybind might lead to other find files being used) + find_package(Python COMPONENTS Interpreter Development) add_subdirectory(pybind11) pybind11_add_module(${PROJECT_NAME} ${PYTHONBIND}) endif() @@ -171,11 +173,12 @@ install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}) # install(FILES ${CMAKE_CURRENT_BINARY_DIR}/comma.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) if ( BUILD_PYTHON_BINDINGS ) + set(PYTHON_SUB_DIR "python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages") install(TARGETS ${PROJECT_NAME} COMPONENT python RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/${PYTHON_SUB_DIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/${PYTHON_SUB_DIR}" ) endif() From c585b423fa3bdb67126c712a43455b1149c7ca29 Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Thu, 28 Dec 2023 17:28:25 +0100 Subject: [PATCH 15/19] build: Add support for pkg-config --- CMakeLists.txt | 10 ++++++++-- config_files/comma.pc.in | 12 ++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 config_files/comma.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ca8e914..602e0a59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,8 @@ option(BUILD_PYTHON_BINDINGS "Build python bindings via pybind11" ON) # https://stackoverflow.com/questions/34878276/build-doxygen-from-cmake-script option(BUILD_DOC "Build documentation (with Doxygen)" OFF) +option(PKGCONFIG_SUPPORT "Prepare and install file to be used with pkg-config" OFF) + if ( CODAFLAGS ) # We just do not set the optimization flags nor the parallelism-related ones if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -160,7 +162,7 @@ endif() # installation include(GNUInstallDirs) -# configure_file(comma.pc.in comma.pc @ONLY) + # ${SOURCE_DIR} (no slash) considers the directory itself # ${SOURCE_DIR}/ (with slash) considers its files only @@ -170,7 +172,11 @@ install(DIRECTORY ${SOURCE_DIR}/ REGEX "deprecated" EXCLUDE ) install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}) -# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/comma.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + +if ( PKGCONFIG_SUPPORT ) + configure_file(config_files/comma.pc.in comma.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/comma.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +endif() if ( BUILD_PYTHON_BINDINGS ) set(PYTHON_SUB_DIR "python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages") diff --git a/config_files/comma.pc.in b/config_files/comma.pc.in new file mode 100644 index 00000000..f0ccb5c3 --- /dev/null +++ b/config_files/comma.pc.in @@ -0,0 +1,12 @@ +prefix="@CMAKE_INSTALL_PREFIX@" +exec_prefix="${prefix}" +libdir="@CMAKE_INSTALL_FULL_LIBDIR@" +includedir="@CMAKE_INSTALL_FULL_INCLUDEDIR@" + +Name: @PROJECT_NAME@ +Description: @CMAKE_PROJECT_DESCRIPTION@ +Version: @PROJECT_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} @LINK_FLAGS@ + +Requires: From 9ad55f2e1f884b1a3b4f3a89fff0ddf4d05454ac Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Fri, 29 Dec 2023 15:22:21 +0100 Subject: [PATCH 16/19] doc: Update REAMDE with new cmake options --- README.md | 63 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 4c2e2ca7..af3123bb 100644 --- a/README.md +++ b/README.md @@ -27,16 +27,20 @@ IDDN.FR.001.420013.000.S.X.2023.000.31235. CoMMA is a `C++` **header-only library** hence it does not need compilation, per se. Nonetheless, a `python` module can be generated using `pybind11`: this is very convenient for testing and debugging purposes. Moreover, some tests via -`Catch2` have been written to check the integrity of CoMMA. Both the `python` -module and the tests need compilation. +`Catch2` have been written to check the integrity of CoMMA (for more details see +the [dedicated section](#mag-testing-comma) below). Both the `python` module and +the tests need compilation. Finally, one can install the headers and, when +applies, the `python` module in a given directory. To build this library you just need a fairly recent `cmake` (3.15+). Then, a standard out-of-source build with `cmake` in a freshly created directory will suffice to compile ```shell -mkdir build +mkdir build install cd build -cmake .. +cmake --prefix=../install .. +make +make install ``` `cmake` should be able to find the simple dependencies by itself if they're installed in standard location. @@ -56,15 +60,24 @@ support (default is off) cmake -DCOVERAGE=On .. ``` +Support for `pkg-config` can be enabled by passing the related option to +`cmake`: +```shell +cmake -DPKGCONFIG_SUPPORT=On --prefix=../install .. +``` +A template of such configuration file can be found +[in the repository](config_files/comma.pc.in); given the prefix provided above, +it will be installed in `path/to/CoMMA/install/lib64/pkgconfig`. + An option is available to use the flags usually considered when compiling the CODA-CFD library: ```shell -cmake -DCODAFLAGS=ON .. +cmake -DCODAFLAGS=On .. ``` ## :construction_worker: Usage The interface to CoMMA is very simple and consists in only one function -[`agglomerate_one_level`](https://numerics.gitlab-pages.onera.net/solver/comma/_co_m_m_a_8h.html#abfb7a4b061c35873233941bb1329ea09). +[`agglomerate_one_level`](https://onera.github.io/CoMMA/_co_m_m_a_8h.html#a906c231be20a1f53a240618bae81d95f). ## :book: Documentation CoMMA is documented via `doxygen`. If you have it and wish to have the full @@ -74,7 +87,7 @@ doxygen Documentation/Doxyfile ``` and related html pages will be built in `documentation`. -An [online version](https://numerics.gitlab-pages.onera.net/solver/comma/) of +An [online version](https://onera.github.io/CoMMA/) of the doc hosted by GitLab is available. A user manual is also available, see @@ -90,18 +103,18 @@ how they will impact the final results...). Here are two animations about the agglomeration on a 2D mesh of a ring for two different option settings: * Seeds pool with - [full initialization](https://numerics.gitlab-pages.onera.net/solver/comma/struct_s_p_full_initializator.html) + [full initialization](https://onera.github.io/CoMMA/struct_s_p_full_initializator.html) and - [boundary priority](https://numerics.gitlab-pages.onera.net/solver/comma/class_seeds___pool___boundary___priority.html) + [boundary priority](https://onera.github.io/CoMMA/class_seeds___pool___boundary___priority.html)
* Seeds pool with - [one-point initialization](https://numerics.gitlab-pages.onera.net/solver/comma/struct_s_p_one_point_initializator.html) + [one-point initialization](https://onera.github.io/CoMMA/struct_s_p_one_point_initializator.html) and - [neighbourhood priority](https://numerics.gitlab-pages.onera.net/solver/comma/class_seeds___pool___neighbourhood___priority.html) + [neighbourhood priority](https://onera.github.io/CoMMA/class_seeds___pool___neighbourhood___priority.html)
@@ -126,9 +139,8 @@ A set of tests to verify code and algorithm integrity has been set up, see framework, which is why the related submodule is included in this repository. To run the tests, build the library (see [above](#wrench-building-the-library), the `cmake` commands related to the tests are already part of the reference -[`CMakeLists.txt`](CMakeLists.txt)), -this will generate an executable `CoMMA_test` in the building directory, simply -run it. +[`CMakeLists.txt`](CMakeLists.txt)), this will generate an executable +`CoMMA_test` in the building directory, simply run it. ```shell mkdir build cd build @@ -141,14 +153,17 @@ Tests are included in the [continuous integration](#robot-continuous-integration) set of actions. ## :snake: A `python` interface to CoMMA -A `python` module which interfaces to CoMMA can be obtained using `pybind11` (a submodule of -CoMMA). To have it, just "build" (see [above](#wrench-building-the-library), -related the `cmake` commands are already part of the reference -[`CMakeLists.txt`](CMakeLists.txt)): a library called -`CoMMA.cpython-38-x86_64-linux-gnu.so` (or similar) appears in the build -directory. To use it, add the directory to your `python` path: +A `python` module which interfaces to CoMMA can be obtained using `pybind11` (a +submodule of CoMMA). To have it, just "build" (see +[above](#wrench-building-the-library), related the `cmake` commands are already +part of the reference [`CMakeLists.txt`](CMakeLists.txt)). A library called +`CoMMA.cpython-38-x86_64-linux-gnu.so` (or similar) is installed in the +`${CMAKE_INSTALL_LIBDIR}/python3.X/site-packages`, which, supposing one has +given `install` as prefix in the `cmake` configuration step and using +`python3.10`, will develop to `install/lib64/python3.10/site-packages`. To use +it, add that directory to your `python` path: ```shell -export PYTHONPATH:/path/to/CoMMA/build:$PYTHONPATH +export PYTHONPATH:/path/to/CoMMA/install/lib64/python3.10/site-packages:$PYTHONPATH ``` then just load CoMMA module in a `python` session: ```python @@ -175,9 +190,9 @@ fc_to_cc, aggloLines_Idx, aggloLines = CoMMA.agglomerate_one_level(*[args]) ``` Several `python` scripts showcasing the CoMMA package (as well as its two main -dependencies, `meshio` and `dualGPy`are [available](examples/scripts). +dependencies), `meshio` and `dualGPy`are [available](examples/scripts). -## :robot: Continuous Integration + From d5d5969193cae66c165ef6348702689ca2e21ae3 Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Fri, 29 Dec 2023 15:31:02 +0100 Subject: [PATCH 17/19] doc: Bad parenthesis --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af3123bb..26935208 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ fc_to_cc, aggloLines_Idx, aggloLines = CoMMA.agglomerate_one_level(*[args]) ``` Several `python` scripts showcasing the CoMMA package (as well as its two main -dependencies), `meshio` and `dualGPy`are [available](examples/scripts). +dependencies, `meshio` and `dualGPy`) are [available](examples/scripts).