Skip to content

Convert exemplar into an INTERFACE library#262

Merged
ednolan merged 1 commit intomainfrom
enolan_interface1
Jan 5, 2026
Merged

Convert exemplar into an INTERFACE library#262
ednolan merged 1 commit intomainfrom
enolan_interface1

Conversation

@ednolan
Copy link
Copy Markdown
Member

@ednolan ednolan commented Sep 29, 2025

This commit eliminates the src/ directory, moving the contents of src/beman/exemplar/CMakeLists.txt into the top level CMakeLists.txt (except for the header FILE_SET, which now lives in include/beman/exemplar/CMakeLists.txt), removing identity.cpp, and changing beman.exemplar from STATIC/SHARED into INTERFACE.

The cookiecutter template now allows the user to specify whether they want to stamp out an "interface" or "static" library, where the "static" option is similar to exemplar's previous status quo.

To ensure that cookiecutter's "static" option remains valid, we add a new CI test that smoke tests that building, testing, and installing it completes without error.

Closes bemanproject/beman#175

@coveralls
Copy link
Copy Markdown

coveralls commented Sep 29, 2025

Coverage Status

coverage: 100.0%. remained the same
when pulling bae3375 on enolan_interface1
into bd9e4f4 on main.

@ednolan
Copy link
Copy Markdown
Member Author

ednolan commented Sep 29, 2025

@ednolan ednolan marked this pull request as draft September 29, 2025 15:18
Comment thread CMakeLists.txt Outdated
FILE_SET HEADERS
BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include"
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/beman/exemplar/identity.hpp"
Copy link
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

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.

The latest version of this PR uses this approach.

@wusatosi
Copy link
Copy Markdown
Member

wusatosi commented Oct 13, 2025

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

@wusatosi wusatosi force-pushed the enolan_interface1 branch 3 times, most recently from 8ed607f to 36dd20f Compare November 24, 2025 05:05
@ednolan ednolan force-pushed the enolan_interface1 branch from 36dd20f to ffff523 Compare January 4, 2026 19:46
@ednolan ednolan changed the title WIP Draft: Convert exemplar into an INTERFACE library Convert exemplar into an INTERFACE library Jan 4, 2026
@ednolan ednolan marked this pull request as ready for review January 4, 2026 19:47
Comment thread cookiecutter/{{cookiecutter.project_name}}/CMakeLists.txt Outdated
@JeffGarland
Copy link
Copy Markdown
Member

It would be good to move this forward asap. I think you're going to need to rectify with main -- in particular this PR which got merged:

#275

Comment thread CMakeLists.txt Outdated

include(CTest)

find_package(beman-install-library REQUIRED)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See my comment about merging from main -- this should be include not find_package

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed by rebasing on bd9e4f4

Copy link
Copy Markdown
Member

@wusatosi wusatosi left a comment

Choose a reason for hiding this comment

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

I agree we should move forward with this ASAP...
This is currently blocking infra upstream to inplace vector.

The trouble I had when I was working on it is we need to come up with a way to test the template effectively, preferably create a CI job that just runs something like make --preset llvm-debug for most possible cookie cutter variants. Otherwise I see challenges on maintaining more cookie cutter parameters going forward.

Edit: oh such test is included, nice job @ednolan

@wusatosi

This comment was marked as outdated.

Copy link
Copy Markdown
Member

@wusatosi wusatosi left a comment

Choose a reason for hiding this comment

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

Thanks for picking up the work Eddie.

This commit eliminates the src/ directory, moving the contents of
src/beman/exemplar/CMakeLists.txt into the top level CMakeLists.txt
(except for the header FILE_SET, which now lives in
include/beman/exemplar/CMakeLists.txt), removing identity.cpp, and
changing beman.exemplar from STATIC/SHARED into INTERFACE.

The cookiecutter template now allows the user to specify whether they
want to stamp out an "interface" or "static" library, where the
"static" option is similar to exemplar's previous status quo.

To ensure that cookiecutter's "static" option remains valid, we add a
new CI test that smoke tests that building, testing, and installing it
completes without error.
@ednolan ednolan force-pushed the enolan_interface1 branch from ffff523 to bae3375 Compare January 5, 2026 00:12
@ednolan ednolan merged commit b7e7b54 into main Jan 5, 2026
90 checks passed
@ednolan ednolan deleted the enolan_interface1 branch January 5, 2026 00:20
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