Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODOS for fully featured CMake Build System #954

Open
3 of 11 tasks
jmark opened this issue Feb 21, 2024 · 10 comments
Open
3 of 11 tasks

TODOS for fully featured CMake Build System #954

jmark opened this issue Feb 21, 2024 · 10 comments
Labels
CI Continuous Integration New feature Adds a new feature to the code tests

Comments

@jmark
Copy link
Collaborator

jmark commented Feb 21, 2024

A non-exhaustive list of open todos for the still experimental cmake build system in t8code:

  • Build t8code in Github CI
  • Run tests in Github CI
  • Add compile with OCC option
  • Reorganize CMakeLists.txt files. Maybe adapt the structure as done in libsc/p4est.
  • Support MPI parallel testing.
  • Add enable debug mode option
  • Add external libsc and/or external p4est option
  • Write detailed wiki article about compiling t8code with cmake
  • Investigate other compiler and/or linker utilities to speed-up building, e.g. https://github.com/rui314/mold
  • Automatic generation of documentation. For example with doxygen.
  • Generation of release tarballs.
@jmark jmark added New feature Adds a new feature to the code tests CI Continuous Integration labels Feb 21, 2024
@jmark jmark mentioned this issue Feb 21, 2024
14 tasks
@dutkalex
Copy link
Contributor

dutkalex commented Feb 21, 2024

Write detailed wiki article about compiling t8code with cmake

Regarding documentation, I already provided a basic (incomplete but better than nothing) wiki page file in #929 (grep for Installation-CMake.md)

@dutkalex
Copy link
Contributor

Add enable debug mode option

I believe that with what is already currently in main, it is possible to achieve the equivalent for configure CFLAGS="-Wall -O0 -g" CXXFLAGS="-Wall -O0 -g" --enable-mpi --enable-debug --enable-static --disable-shared CC=mpicc CXX=mpicxx with something like cmake .. -DCMAKE_BUILD_TYPE=Debug -DT8CODE_ENBALE_MPI=ON -DT8CODE_BUILD_AS_SHARED_LIBRARY=OFF

@dutkalex dutkalex mentioned this issue Feb 21, 2024
@jmark
Copy link
Collaborator Author

jmark commented Feb 21, 2024

Write detailed wiki article about compiling t8code with cmake

Regarding documentation, I already provided a basic (incomplete but better than nothing) wiki page file in #929 (grep for Installation-CMake.md)

Thanks for reminding! Has been incorporated: https://github.com/DLR-AMR/t8code/wiki/Installation#build-t8code-with-cmake

@jmark
Copy link
Collaborator Author

jmark commented Feb 21, 2024

Add enable debug mode option

I believe that with what is already currently in main, it is possible to achieve the equivalent for configure CFLAGS="-Wall -O0 -g" CXXFLAGS="-Wall -O0 -g" --enable-mpi --enable-debug --enable-static --disable-shared CC=mpicc CXX=mpicxx with something like cmake .. -DCMAKE_BUILD_TYPE=Debug -DT8CODE_ENBALE_MPI=ON -DT8CODE_BUILD_AS_SHARED_LIBRARY=OFF

There is a T8_ENABLE_DEBUG macro in t8code. This is not set by any cmake option as of now.

@dutkalex
Copy link
Contributor

dutkalex commented Feb 21, 2024

Ah yes indeed! This should be very easy to fix though
EDIT: see #956 @jmark

@CsatiZoltan
Copy link
Contributor

CsatiZoltan commented Feb 27, 2024

I would also add the documentation building to the list. My project is based on CMake and uses t8code. To generate the API documentation for my project, I use Doxygen. It is a build target, so I just have to type make docs to regenerate the HTML output of the documentation. I can share my CMakeFiles.txt if you want.

@cburstedde
Copy link
Collaborator

cburstedde commented Feb 28, 2024 via email

@CsatiZoltan
Copy link
Contributor

Would it be synergetic to align the t8code doxygen generation by CMake analogously?

That I don't know. I am not a core developer of t8code, so I just propose ideas. @jmark could answer this question better.

@jmark
Copy link
Collaborator Author

jmark commented Feb 29, 2024

Would it be synergetic to align the t8code doxygen generation by CMake analogously?

That I don't know. I am not a core developer of t8code, so I just propose ideas. @jmark could answer this question better.

@CsatiZoltan Thank you for bringing up this suggestion! Is added to the list! You can send me the lines from yourCMakeList.txt or alternatively create a PR adding this feature. I can take over then from there.

@cburstedde Your suggestions using doxygen sounds reasonable! If you allow to do so I'll take inspiration from the documentation structure in libsc and p4est. I think there already is a doxygen infrastructure in t8code. I'll check it out and report back.

@CsatiZoltan
Copy link
Contributor

CsatiZoltan commented Feb 29, 2024

My main CMakeList.txt (minor modifications added to this code):

cmake_minimum_required(VERSION 3.12.0) # VTK requires CMake 3.12 in order to reliably be used
project(PROJ DESCRIPTION "Your project description" VERSION 0.1.0 LANGUAGES C CXX)

add_subdirectory(examples)
add_subdirectory(tests)

# Documentation
find_package(Doxygen)

if(DOXYGEN_FOUND)
    set(PROJ ${CMAKE_CURRENT_SOURCE_DIR})
    set(PROJ_SRC ${PROJ}/src)
    set(PROJ_DOC ${PROJ}/docs)
    set(PROJ_EXAMPLES ${PROJ}/examples)

    # set input and output files
    set(DOXYGEN_IN ${PROJ_DOC}/Doxyfile.in)
    set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.out)

    # request to configure the file
    configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
    message("Doxygen build started")

    # Note: do not put "ALL" - this builds docs together with application EVERY TIME!
    add_custom_target(docs
        COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
        COMMENT "Generating API documentation with Doxygen"
        VERBATIM)
else(DOXYGEN_FOUND)
    message("Doxygen need to be installed to generate the doxygen documentation")
endif(DOXYGEN_FOUND)

To make sure that the user or the CI uses a recent-enough Doxygen (older versions may not have the keywords that you expect), you can check for a minimum version.


My Doxyfile.in fetches the values of the environment variables that exist when the cmake build is called. Relevant entries:

PROJECT_NAME           = @CMAKE_PROJECT_NAME@
OUTPUT_DIRECTORY       = @CMAKE_CURRENT_BINARY_DIR@/docs/
CITE_BIB_FILES         = @PROJ_DOC@/references.bib
INPUT                  = @PROJ_SRC@ \
                         @PROJ_EXAMPLES@ \
                         @PROJ_DOC@/mainpage.dox \
                         @PROJ_DOC@/about.dox \
                       # $(T8_INCLUDE) \
HTML_FOOTER            = @PROJ_DOC@/doxygen_footer.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration New feature Adds a new feature to the code tests
Projects
None yet
Development

No branches or pull requests

4 participants