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

Standalone 1/N: Move driver source and test files to separate directories #293

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

aliddell
Copy link
Member

@aliddell aliddell commented Sep 17, 2024

Splitting up #291. Moves files and updates CMakeLists.txt files accordingly.

@aliddell aliddell changed the title Move driver source and test files to separate directories Standalone 1/N: Move driver source and test files to separate directories Sep 17, 2024
Copy link
Collaborator

@shlomnissan shlomnissan left a comment

Choose a reason for hiding this comment

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

I've made a few minor suggestions to improve the CMake configuration. While not blocking, I believe these changes are worth implementing.

if (NOT TARGET acquire-core-logger)
add_subdirectory(../acquire-common/acquire-core-libs ${CMAKE_CURRENT_BINARY_DIR}/acquire-core-libs)
endif ()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question: Why do we need to specify PIC? I understand it's typically required for shared libraries, but is it necessary for the driver code or the API? If it's needed for the driver, should we relocate the PIC settings to the driver's CMakeLists file?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can save this for the streaming library.

@@ -0,0 +1,61 @@
option(BUILD_ACQUIRE_DRIVER_ZARR "Build the Acquire Zarr driver" ON)
Copy link
Collaborator

@shlomnissan shlomnissan Sep 18, 2024

Choose a reason for hiding this comment

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

It makes more sense to set this option in the root CMakeLists file and conditionally add the driver's subdirectory, rather than wrapping this entire configuration file in an if statement.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean the top level or the one in src/?

add_dependencies(${tgt} ${project}-copy-${driver}-for-tests)
endforeach ()
endforeach ()
add_subdirectory(driver)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than using a separate top-level CMake file for tests, you could simply include this subdirectory in the driver's CMake file.

@@ -0,0 +1,87 @@
if (BUILD_ACQUIRE_DRIVER_ZARR)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This relates to the previous comment. If you add this subdirectory from the driver's CMake file (which is already added based on the same condition), you could remove this if-statement.

#
# Tests
#
set(tests
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note: While I believe it's important to manually list all source and header files in the project's main build configuration, I prefer using file(GLOB TEST_SOURCES ${CMAKE_CURRENT_LIST_DIR}/**/*.cpp) for test-related builds. This dynamic file loading reduces overhead for test configurations.

This is just a suggestion—feel free to disregard. However, I'd be interested in your thoughts if you disagree.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's an interesting suggestion, but I think I'll save it for later experimentation.

@aliddell aliddell merged commit 8084499 into main Sep 18, 2024
3 checks passed
@aliddell aliddell deleted the standalone-sequence-2 branch September 18, 2024 19:52
aliddell added a commit that referenced this pull request Sep 24, 2024
Defines but does not implement the API. Depends on #293.
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