cmake: handle private vs. public headers

This commit is contained in:
Ben Boeckel 2014-10-21 12:38:00 -04:00
parent 55ca7d3b34
commit f53f04724c
11 changed files with 81 additions and 20 deletions

View File

@ -32,6 +32,19 @@ add_definitions(-DSTATICLIB)
# miniupnp changed their static define
add_definitions(-DMINIUPNP_STATICLIB)
function (bitmonero_private_headers group)
source_group("${group}\\Private"
FILES
${ARGN})
endfunction ()
function (bitmonero_install_headers subdir)
install(
FILES ${ARGN}
DESTINATION "include/${subdir}"
COMPONENT development)
endfunction ()
function (bitmonero_add_executable name)
source_group("${name}"
FILES

View File

@ -32,7 +32,9 @@ set(common_sources
dns_utils.cpp
util.cpp)
set(common_headers
set(common_headers)
set(common_private_headers
base58.h
boost_serialization_helper.h
command_line.h
@ -43,9 +45,12 @@ set(common_headers
util.h
varint.h)
bitmonero_private_headers(common
${common_private_headers})
bitmonero_add_library(common
${common_sources}
${common_headers})
${common_headers}
${common_private_headers})
target_link_libraries(common
PRIVATE
crypto
@ -54,3 +59,6 @@ target_link_libraries(common
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${EXTRA_LIBRARIES})
#bitmonero_install_headers(common
# ${common_headers})

View File

@ -29,11 +29,11 @@
set(connectivity_tool_sources
conn_tool.cpp)
set(connectivity_tool_headers)
set(connectivity_tool_private_headers)
bitmonero_add_executable(connectivity_tool
${connectivity_tool_sources}
${connectivity_tool_headers})
${connectivity_tool_private_headers})
target_link_libraries(connectivity_tool
PRIVATE
cryptonote_core

View File

@ -47,7 +47,9 @@ set(crypto_sources
slow-hash.c
tree-hash.c)
set(crypto_headers
set(crypto_headers)
set(crypto_private_headers
blake256.h
chacha8.h
crypto-ops.h
@ -66,6 +68,9 @@ set(crypto_headers
skein.h
skein_port.h)
bitmonero_private_headers(crypto
${crypto_private_headers})
bitmonero_add_library(crypto
${crypto_sources}
${crypto_headers})
${crypto_headers}
${crypto_private_headers})

View File

@ -38,7 +38,9 @@ set(cryptonote_core_sources
miner.cpp
tx_pool.cpp)
set(cryptonote_core_headers
set(cryptonote_core_headers)
set(cryptonote_core_private_headers
account.h
account_boost_serialization.h
blockchain_storage.h
@ -58,9 +60,12 @@ set(cryptonote_core_headers
tx_pool.h
verification_context.h)
bitmonero_private_headers(cryptonote_core
${crypto_private_headers})
bitmonero_add_library(cryptonote_core
${cryptonote_core_sources}
${cryptonote_core_headers})
${cryptonote_core_headers}
${cryptonote_core_private_headers})
target_link_libraries(cryptonote_core
PUBLIC
common

View File

@ -29,7 +29,9 @@
set(daemon_sources
daemon.cpp)
set(daemon_headers
set(daemon_headers)
set(daemon_private_headers
daemon_commands_handler.h
# cryptonote_protocol
@ -48,9 +50,12 @@ set(daemon_headers
../p2p/p2p_protocol_defs.h
../p2p/stdafx.h)
bitmonero_private_headers(daemon
${daemon_private_headers})
bitmonero_add_executable(daemon
${daemon_sources}
${daemon_headers})
${daemon_headers}
${daemon_private_headers})
target_link_libraries(daemon
PRIVATE
rpc

View File

@ -29,14 +29,19 @@
set(simpleminer_sources
simpleminer.cpp)
set(simpleminer_headers
set(simpleminer_headers)
set(simpleminer_private_headers
simpleminer.h
simpleminer_protocol_defs.h
target_helper.h)
bitmonero_private_headers(simpleminer
${simpleminer_private_headers})
bitmonero_add_executable(simpleminer
${simpleminer_sources}
${simpleminer_headers})
${simpleminer_headers}
${simpleminer_private_headers})
target_link_libraries(simpleminer
PRIVATE
cryptonote_core

View File

@ -29,7 +29,9 @@
set(mnemonics_sources
electrum-words.cpp)
set(mnemonics_headers
set(mnemonics_headers)
set(mnemonics_private_headers
electrum-words.h
english.h
japanese.h
@ -39,9 +41,12 @@ set(mnemonics_headers
singleton.h
spanish.h)
bitmonero_private_headers(mnemonics
${mnemonics_private_headers})
bitmonero_add_library(mnemonics
${mnemonics_sources}
${mnemonics_headers})
${mnemonics_headers}
${mnemonics_private_headers})
target_link_libraries(mnemonics
PRIVATE
${Boost_SYSTEM_LIBRARY})

View File

@ -29,14 +29,19 @@
set(rpc_sources
core_rpc_server.cpp)
set(rpc_headers
set(rpc_headers)
set(rpc_private_headers
core_rpc_server.h
core_rpc_server_commands_defs.h
core_rpc_server_error_codes.h)
bitmonero_private_headers(rpc
${rpc_private_headers})
bitmonero_add_library(rpc
${rpc_sources}
${rpc_headers})
${rpc_headers}
${rpc_private_headers})
target_link_libraries(rpc
PRIVATE
cryptonote_core

View File

@ -30,13 +30,18 @@ set(simplewallet_sources
simplewallet.cpp
password_container.cpp)
set(simplewallet_headers
set(simplewallet_headers)
set(simplewallet_private_headers
simplewallet.h
password_container.h)
bitmonero_private_headers(simplewallet
${simplewallet_private_headers})
bitmonero_add_executable(simplewallet
${simplewallet_sources}
${simplewallet_headers})
${simplewallet_headers}
${simplewallet_private_headers})
target_link_libraries(simplewallet
PRIVATE
wallet

View File

@ -30,16 +30,21 @@ set(wallet_sources
wallet2.cpp
wallet_rpc_server.cpp)
set(wallet_headers
set(wallet_headers)
set(wallet_private_headers
wallet2.h
wallet_errors.h
wallet_rpc_server.h
wallet_rpc_server_commands_defs.h
wallet_rpc_server_error_codes.h)
bitmonero_private_headers(wallet
${wallet_private_headers})
bitmonero_add_library(wallet
${wallet_sources}
${wallet_headers})
${wallet_headers}
${wallet_private_headers})
target_link_libraries(wallet
PUBLIC
cryptonote_core