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

build: put conan-generated Find<lib>.cmake files in a separate directory from build/ #621

Merged
merged 3 commits into from
Oct 24, 2024

Conversation

Taepper
Copy link
Collaborator

@Taepper Taepper commented Oct 23, 2024

Summary

This follows the convention of putting helper .cmake files in to a separate directory as in: https://cmake.org/cmake/help/latest/variable/CMAKE_MODULE_PATH.html.

This additionally helps with developer setupt. There is now a separate folder (build/) to deleting all generated of the build system (cmake), and a folder (cmake/) of configuration files generated by the package manager (conan)

PR Checklist

  • All necessary documentation has been adapted or there is an issue to do so.
  • The implemented feature is covered by an appropriate test.

Copy link
Contributor

There is no change in the changelog. This PR will not produce a new releasable version.

Copy link
Contributor

@fengelniederhammer fengelniederhammer left a comment

Choose a reason for hiding this comment

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

Nice!

@@ -16,4 +16,4 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
mv conanprofile.docker conanprofile; \
fi

RUN conan install . --build=missing --profile ./conanprofile --profile:build ./conanprofile --output-folder=build
RUN conan install . --build=missing --profile ./conanprofile --profile:build ./conanprofile --output-folder=cmake
Copy link
Contributor

Choose a reason for hiding this comment

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

(Not necessarily for this PR): I wonder why we don't simply use the build_with_conan script here? Actually there is no need to replicate this command in several places. And installing Python in the build stage of the Dockerfile would be no big deal.

build_with_conan.py Outdated Show resolved Hide resolved
@@ -18,7 +18,8 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif ()

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/build/")

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_BINARY_DIR}/generators/")
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of interest: Is there a reason to use CMAKE_BINARY_DIR instead of CMAKE_SOURCE_DIR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

First, we save the /build/ that was necessary before. (${CMAKE_SOURCE_DIR}/build/ was always equivalent to ${CMAKE_BINARY_DIR}/build)

But more importantly, CMAKE_BINARY_DIR is now a lot less magical in the discovery of the dependency files. For example before, CLion used cmake-build-debug/ as the build folder. Still, build/ was used to find the dependencies. Now, CMAKE_BINARY_DIR will already point at cmake-build-debug/ and looking for dependencies is relative to this directory

…ory in build/ and split up into Debug and Release

Now the generated cmake files are put in build/Debug/generators/ and build/Release/generators/ respectively
@Taepper Taepper merged commit be5fa16 into main Oct 24, 2024
9 checks passed
@Taepper Taepper deleted the build-folder-split branch October 24, 2024 06:18
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