Skip to content

Commit 59d2d78

Browse files
authored
Merge pull request #6 from compnerd/cmake
2 parents c425824 + b77c1ac commit 59d2d78

File tree

6 files changed

+84
-0
lines changed

6 files changed

+84
-0
lines changed

CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#[[
2+
This source file is part of the DocC open source project
3+
4+
Copyright (c) 2024 Apple Inc. and the DocC project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See https://swift.org/LICENSE.txt for license information
8+
#]]
9+
10+
cmake_minimum_required(VERSION 3.24)
11+
12+
project(LMDB
13+
LANGUAGES C)
14+
15+
# Set the build artifact directories to ensure that the generated products are
16+
# colocated and findable for wiring up into the test suites across repositories.
17+
# This pattern is applied to all Swift and LLVM repositories.
18+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
19+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
20+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
21+
22+
add_subdirectory(Sources)
23+
add_subdirectory(cmake/modules)

Sources/CLMDB/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#[[
2+
This source file is part of the DocC open source project
3+
4+
Copyright (c) 2024 Apple Inc. and the DocC project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See https://swift.org/LICENSE.txt for license information
8+
#]]
9+
10+
add_library(CLMDB
11+
mdb.c
12+
midl.c)
13+
target_include_directories(CLMDB PUBLIC
14+
include)
15+
16+
set_property(GLOBAL APPEND PROPERTY LMDB_EXPORTS CLMDB)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
module CLMDB {
3+
header "lmdb.h"
4+
}

Sources/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#[[
2+
This source file is part of the DocC open source project
3+
4+
Copyright (c) 2024 Apple Inc. and the DocC project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See https://swift.org/LICENSE.txt for license information
8+
#]]
9+
10+
add_subdirectory(CLMDB)

cmake/modules/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#[[
2+
This source file is part of the DocC open source project
3+
4+
Copyright (c) 2024 Apple Inc. and the DocC project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See https://swift.org/LICENSE.txt for license information
8+
#]]
9+
10+
set(LMDB_EXPORTS_FILE
11+
${CMAKE_CURRENT_BINARY_DIR}/LMDBExports.cmake)
12+
configure_file(LMDBConfig.cmake.in
13+
${CMAKE_CURRENT_BINARY_DIR}/LMDBConfig.cmake)
14+
15+
get_property(LMDB_EXPORTS GLOBAL PROPERTY LMDB_EXPORTS)
16+
export(TARGETS ${LMDB_EXPORTS}
17+
NAMESPACE LMDB::
18+
FILE ${LMDB_EXPORTS_FILE}
19+
EXPORT_LINK_INTERFACE_LIBRARIES)

cmake/modules/LMDBConfig.cmake.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#[[
2+
This source file is part of the DocC open source project
3+
4+
Copyright (c) 2024 Apple Inc. and the DocC project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See https://swift.org/LICENSE.txt for license information
8+
#]]
9+
10+
if(NOT TARGET LMDB::CLMDB)
11+
include("@LMDB_EXPORTS_FILE@")
12+
endif()

0 commit comments

Comments
 (0)