forked from LMDB/lmdb
-
Notifications
You must be signed in to change notification settings - Fork 14
build: introduce CMake based build #6
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#[[ | ||
This source file is part of the DocC open source project | ||
|
||
Copyright (c) 2024 Apple Inc. and the DocC project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See https://swift.org/LICENSE.txt for license information | ||
#]] | ||
|
||
cmake_minimum_required(VERSION 3.24) | ||
|
||
project(LMDB | ||
LANGUAGES C) | ||
|
||
# Set the build artifact directories to ensure that the generated products are | ||
# colocated and findable for wiring up into the test suites across repositories. | ||
# This pattern is applied to all Swift and LLVM repositories. | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
add_subdirectory(Sources) | ||
add_subdirectory(cmake/modules) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#[[ | ||
This source file is part of the DocC open source project | ||
|
||
Copyright (c) 2024 Apple Inc. and the DocC project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See https://swift.org/LICENSE.txt for license information | ||
#]] | ||
|
||
add_library(CLMDB | ||
mdb.c | ||
midl.c) | ||
target_include_directories(CLMDB PUBLIC | ||
include) | ||
|
||
set_property(GLOBAL APPEND PROPERTY LMDB_EXPORTS CLMDB) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
module CLMDB { | ||
header "lmdb.h" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#[[ | ||
This source file is part of the DocC open source project | ||
|
||
Copyright (c) 2024 Apple Inc. and the DocC project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See https://swift.org/LICENSE.txt for license information | ||
#]] | ||
|
||
add_subdirectory(CLMDB) | ||
compnerd marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#[[ | ||
This source file is part of the DocC open source project | ||
|
||
Copyright (c) 2024 Apple Inc. and the DocC project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See https://swift.org/LICENSE.txt for license information | ||
#]] | ||
|
||
set(LMDB_EXPORTS_FILE | ||
${CMAKE_CURRENT_BINARY_DIR}/LMDBExports.cmake) | ||
configure_file(LMDBConfig.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/LMDBConfig.cmake) | ||
|
||
get_property(LMDB_EXPORTS GLOBAL PROPERTY LMDB_EXPORTS) | ||
export(TARGETS ${LMDB_EXPORTS} | ||
NAMESPACE LMDB:: | ||
FILE ${LMDB_EXPORTS_FILE} | ||
EXPORT_LINK_INTERFACE_LIBRARIES) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#[[ | ||
This source file is part of the DocC open source project | ||
|
||
Copyright (c) 2024 Apple Inc. and the DocC project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See https://swift.org/LICENSE.txt for license information | ||
#]] | ||
|
||
if(NOT TARGET LMDB::CLMDB) | ||
include("@LMDB_EXPORTS_FILE@") | ||
endif() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use
GNUInstallDirs
?There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.