Skip to content

Commit e8255aa

Browse files
committed
CMake: Add install step for libraries
1 parent 930b218 commit e8255aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+125
-82
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ option(TSAN "Enable thread sanitizer" OFF)
5151
option(UBSAN "Enable UB sanitizer" OFF)
5252

5353
include(CheckCXXCompilerFlag)
54+
include(cmake/install.cmake)
55+
include(cmake/filecoin_functions.cmake)
5456
include(cmake/toolchain-util.cmake)
5557
include(cmake/dependencies.cmake)
5658
include(cmake/functions.cmake)

cmake/filecoin_functions.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright Soramitsu Co., Ltd. All Rights Reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
include(GNUInstallDirs)
7+
8+
function(filecoin_add_library target)
9+
add_library(${target}
10+
${ARGN}
11+
)
12+
filecoin_install(${target})
13+
endfunction()

cmake/install.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Copyright Soramitsu Co., Ltd. All Rights Reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
include(GNUInstallDirs)
7+
8+
function (filecoin_install targets)
9+
install(TARGETS ${targets} EXPORT filecoinConfig
10+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
11+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
12+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
13+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
14+
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
15+
FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX}
16+
)
17+
endfunction()
18+
19+
install(
20+
EXPORT filecoinConfig
21+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/filecoin
22+
NAMESPACE filecoin::
23+
)

core/adt/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ add_custom_target(filecoin_adt
99
filecoin_multimap
1010
)
1111

12-
add_library(filecoin_array
12+
filecoin_add_library(filecoin_array
1313
impl/array.cpp
1414
)
1515
target_link_libraries(filecoin_array
1616
filecoin_amt
1717
)
1818

19-
add_library(filecoin_balance_table_hamt
19+
filecoin_add_library(filecoin_balance_table_hamt
2020
impl/balance_table_hamt.cpp
2121
)
2222
target_link_libraries(filecoin_balance_table_hamt
2323
filecoin_address
2424
filecoin_hamt
2525
)
2626

27-
add_library(filecoin_multimap
27+
filecoin_add_library(filecoin_multimap
2828
impl/multimap.cpp
2929
)
3030
target_link_libraries(filecoin_multimap

core/blockchain/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
add_subdirectory(message_pool)
77
add_subdirectory(production)
88

9-
add_library(filecoin_block_validator
9+
filecoin_add_library(filecoin_block_validator
1010
impl/block_validator_impl.cpp
1111
)
1212
target_link_libraries(filecoin_block_validator
1313
filecoin_block
1414
)
1515

16-
add_library(filecoin_weight_calculator
16+
filecoin_add_library(filecoin_weight_calculator
1717
impl/weight_calculator_impl.cpp
1818
)
1919
target_link_libraries(filecoin_weight_calculator

core/blockchain/message_pool/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0
44
#
55

6-
add_library(filecoin_message_pool
6+
filecoin_add_library(filecoin_message_pool
77
impl/gas_price_scored_message_storage.cpp
88
impl/message_pool_error.cpp)
99
target_link_libraries(filecoin_message_pool

core/blockchain/production/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#SPDX - License - Identifier : Apache - 2.0
44
#
55

6-
add_library(filecoin_block_producer
6+
filecoin_add_library(filecoin_block_producer
77
impl/block_producer_impl.cpp
88
)
99
target_link_libraries(filecoin_block_producer

core/clock/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0
44
#
55

6-
add_library(filecoin_clock
6+
filecoin_add_library(filecoin_clock
77
chain_epoch_clock.cpp
88
impl/chain_epoch_clock_impl.cpp
99
impl/utc_clock_impl.cpp

core/codec/cbor/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0
44
#
55

6-
add_library(filecoin_cbor
6+
filecoin_add_library(filecoin_cbor
77
cbor_decode_stream.cpp
88
cbor_encode_stream.cpp
99
cbor_errors.cpp

core/codec/rle/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
add_library(filecoin_rle_plus_codec
1+
#
2+
# Copyright Soramitsu Co., Ltd. All Rights Reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
filecoin_add_library(filecoin_rle_plus_codec
27
rle_plus_encoding_stream.cpp
38
rle_plus_errors.cpp
49
)

0 commit comments

Comments
 (0)