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: introduce CMake based build #6

Merged
merged 1 commit into from
Dec 11, 2024
Merged

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Feb 6, 2024

This adds a CMake based build for LMDB to support DocC. By using CMake for the build, we are able to reduce the overall toolchain build time by ~7% on Windows.

project(LMDB
LANGUAGES C)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

Choose a reason for hiding this comment

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

Why not use GNUInstallDirs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Mostly laziness, but that's easy to adopt.

Copy link
Member Author

Choose a reason for hiding this comment

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

Wait, why would we use GNUInstallDirs here? This is the build tree, not the install tree.

Copy link

@etcwilde etcwilde Dec 11, 2024

Choose a reason for hiding this comment

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

oh yeah, fair enough. Do these need to go in special directories then? The build directory locations should all be set in the LMDB config 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.

No, there is no need to go into special directories. We don't really have any install rules for this module (I can add them if you feel like they are important).

The build directory locations should be handled by CMake - we don't define the imported locations, that is generated by CMake.

Choose a reason for hiding this comment

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

I still feel a tad weird about projects poking directly into another project's build directory (unless they're using the *Config.cmake file to get the appropriate locations and layouts), but I'll accept it for now since the rest of the Swift ecosystem does this.

Sources/CMakeLists.txt Show resolved Hide resolved
This adds a CMake based build for LMDB to support DocC. By using CMake
for the build, we are able to reduce the overall toolchain build time by
~7% on Windows.
project(LMDB
LANGUAGES C)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

Choose a reason for hiding this comment

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

I still feel a tad weird about projects poking directly into another project's build directory (unless they're using the *Config.cmake file to get the appropriate locations and layouts), but I'll accept it for now since the rest of the Swift ecosystem does this.

@compnerd compnerd merged commit 59d2d78 into swiftlang:main Dec 11, 2024
@compnerd compnerd deleted the cmake branch December 11, 2024 18:03
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