Skip to content

moves the registration TU out of the core library into the final targets - #33

Merged
astronomerdave merged 2 commits into
mainfrom
DH/split-registration-tu
Sep 24, 2026
Merged

astronomerdave merged 2 commits into
mainfrom
DH/split-registration-tu

Conversation

@astronomerdave

Copy link
Copy Markdown
Contributor

Required to meet camera 2.0 design

One of the design requirements was that:

The shared core library contains no registration of its own, so composing it as a dependency never forces a choice, and the executable target alone determines which registration is linked.

The previous build violates this by appending ${INSTRUMENT_SOURCES} into INTERFACE_SOURCES, which becomes the controller library. So the shared library carries a registration, and with an instrument selected, the instrument's sources.

This moves ${INSTRUMENT_SOURCES} to the camerad executable and the camera_interface python module. Both call Interface::create(), so both need it, and each ends up with exactly one. No runtime behavior changes.

Verified with generic build, -DINSTRUMENT=hispec_tracking_camera, and -DBUILD_PYTHON_MODULE=ON. With hispec selected:

  • libarchon.a — 0 hispec symbols, 0 Interface::create definitions; previously it carried all four instrument objects
  • bin/camerad — 262 hispec symbols, 1 Interface::create
  • open, load, power on, expose 1 against the emulator all return DONE, and a FITS file is written

the shared library no longer forces a choice of interface.
camerad and the python module each link exactly one registration.
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-24 14:57 UTC

Comment thread camerad/CMakeLists.txt Outdated
add_executable(camerad
${CAMERAD_DIR}/camerad.cpp
${CAMERAD_DIR}/camera_server.cpp
${INSTRUMENT_SOURCES}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

By doing this change, I think it will compile the instrument sources twice
We can instead build specifically the interface factory <instrument_name>_interface_factory.cpp

set (INSTRUMENT_REGISTRATION ${INSTRUMENT_SOURCES})
list (FILTER INSTRUMENT_REGISTRATION INCLUDE REGEX "_interface_factory\\.cpp$")
list (FILTER INSTRUMENT_SOURCES EXCLUDE REGEX "_interface_factory\\.cpp$")

then you can do

add_executable(camerad
  ${CAMERAD_DIR}/camerad.cpp
  ${CAMERAD_DIR}/camera_server.cpp
  ${INSTRUMENT_REGISTRATION}
  )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right, give me a moment

@astronomerdave

Copy link
Copy Markdown
Contributor Author

@prkrtg implementation goes into an object library so it compiles once without landing back in the core library.

@astronomerdave
astronomerdave merged commit 31274de into main Sep 24, 2026
6 checks passed
@mikelangmayr
mikelangmayr deleted the DH/split-registration-tu branch September 24, 2026 17:50
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.

2 participants