Skip to content

Conversation

@ednolan
Copy link
Member

@ednolan ednolan commented Sep 29, 2025

This commit eliminates the src/ directory, moving
beman.examplar-config.cmake.in into the top level directory, moving the contents of src/beman/exemplar/CMakeLists.txt into the top level CMakeLists.txt, removing identity.cpp, and changing beman.exemplar from STATIC/SHARED into INTERFACE.

This commit is currently just intended to be a jumping-off point for discussion. What I would like to do if we are okay with this direction is to preserve the option for users to create STATIC/SHARED libraries by configuring cookiecutter differently. That feature is not present yet here.

Edit(River):
closes bemanproject/beman#175

Copy pasted from bemanproject/beman#175 :

Remaining todos:

  • Update CI so it doesn't run a shared library build on the header only configuration
  • Update the README to reflect an accurate install tree
  • Update cookiecutter so that users can optionally configure the repository to create a src directory/static library/etc

This commit eliminates the src/ directory, moving
beman.examplar-config.cmake.in into the top level directory, moving
the contents of src/beman/exemplar/CMakeLists.txt into the top level
CMakeLists.txt, removing identity.cpp, and changing beman.exemplar
from STATIC/SHARED into INTERFACE.

This commit is currently just intended to be a jumping-off point for
discussion. What I would like to do if we are okay with this direction
is to preserve the option for users to create STATIC/SHARED libraries
by configuring cookiecutter differently. That feature is not present
yet here.
@coveralls
Copy link

coveralls commented Sep 29, 2025

Coverage Status

coverage: 100.0%. remained the same
when pulling 36dd20f on enolan_interface1
into ea33d50 on main.

@ednolan
Copy link
Member Author

ednolan commented Sep 29, 2025

@ednolan ednolan marked this pull request as draft September 29, 2025 15:18
FILE_SET HEADERS
BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include"
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/beman/exemplar/identity.hpp"
Copy link
Member

Choose a reason for hiding this comment

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

It's interesting how the header list moves to the top-level directory when it's a header-only library. This has two drawbacks:

  1. A header-only -> with-source-file transition is more dramatic.
  2. For a repository with multiple libraries, the top-level CMake file would grow quite large and we lose the "one CMakeLists.txt file per library" separation of concerns.

What are your thoughts on peeing the src/beman/exemplar directory and having it contain only a CMakeLists.txt that builds the target?

Copy link
Member

Choose a reason for hiding this comment

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

It shouldn't be necessary to have the list of files in the root, but I have found that creating the library and naming the header set at the root makes it more local.

https://github.com/steve-downey/optional/blob/main/CMakeLists.txt#L23-L28
and
https://github.com/steve-downey/optional/blob/main/include/beman/optional/CMakeLists.txt#L4-L15

@wusatosi
Copy link
Member

wusatosi commented Oct 13, 2025

Updated the TODOs. I might help out. Got the permission from @ednolan to push directly on this branch.

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.

Address header-only repositories

6 participants