Skip to content

Conversation

@mtaillefumier
Copy link

@mtaillefumier mtaillefumier commented Oct 20, 2025

This pr contains a minimal version of the cmake build system. It compiles the library and generate all necessary config files for use in other cmake and pkg-config projects. It should make the library detection in tmlQCD easier.

NB: there is no changes to the original build system.

  • config files for cmake and pkg-config
  • reformatting
  • add ctests

@kostrzewa
Copy link
Member

@kottnad @chaoos in preparation for the discussion it would be great if you could take a look at this

@kostrzewa
Copy link
Member

@mtaillefumier thanks, this seems to work according to initial tests. It's just not yet installing the two binaries lemon_benchmark and lemon_contents into a bin directory in the install prefix.

@kostrzewa
Copy link
Member

The other thing we should discuss is if we would not prefer to have the library as a static library. Usually we do static libraries to avoid confusion when multiple versions of the same library are around.

@mtaillefumier
Copy link
Author

mtaillefumier commented Feb 11, 2026

We can solve this with CMAKE_BUILD_SHARED OFF by default. I will make the necessary changes

@mtaillefumier
Copy link
Author

Update:

  • install lemon_benchmark and lemon_contents
  • Build the static library by default (with fpic)

Copy link

@chaoos chaoos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can build, but not install. It fails to install lemon_contents with:

$ cmake -S . -B build -DCMAKE_INSTALL_PREFIX=./install_dir
...
$ cmake --build build -j
...
$ cmake --install build
-- Install configuration: ""
-- Installing: /home/roman/projects/tmp/lemon/install_dir/lib/cmake/clemon/ClemonConfig.cmake
-- Installing: /home/roman/projects/tmp/lemon/install_dir/lib/cmake/clemon/ClemonConfigVersion.cmake
-- Installing: /home/roman/projects/tmp/lemon/install_dir/lib/pkgconfig/clemon.pc
-- Installing: /home/roman/projects/tmp/lemon/install_dir/lib/liblemon.so
-- Set non-toolchain portion of runtime path of "/home/roman/projects/tmp/lemon/install_dir/lib/liblemon.so" to ""
-- Installing: /home/roman/projects/tmp/lemon/install_dir/lib/cmake/clemon/ClemonTargets.cmake
-- Installing: /home/roman/projects/tmp/lemon/install_dir/lib/cmake/clemon/ClemonTargets-noconfig.cmake
CMake Error at build/cmake_install.cmake:103 (file):
  file INSTALL cannot find "/home/roman/projects/tmp/lemon/lemon_contents":
  No such file or directory.

It does work if the build directory is equal to the source directory though, ie.

cmake -S . -DCMAKE_INSTALL_PREFIX=./install_dir
cmake --build . -j
cmake --install .

works!

src/reader_latticeParallelNonBlockingMapped.c
src/writer_recordDataNonBlocking.c)

add_library(lemon SHARED ${LEMON_SRCS})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the BUILD_SHARED_LIBS variable this should now be:

Suggested change
add_library(lemon SHARED ${LEMON_SRCS})
add_library(lemon ${LEMON_SRCS})

Else you always get shared libs.

@kottnad
Copy link

kottnad commented Feb 12, 2026

Trying to install on e.g. juwels booster still fails for me, i.e. does not move the binaries to the separate install directory :

CMake Error at cmake_install.cmake:99 (file): file INSTALL cannot find "/p/home/jusers/ottnad1/juwels/source/lemon/lemon_contents": No such file or directory.

(lemon_contents and lemon_benchmark are located in the build not the source directory.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants