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 # miniupnp changed their static define
add_definitions(-DMINIUPNP_STATICLIB) 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) function (bitmonero_add_executable name)
source_group("${name}" source_group("${name}"
FILES FILES

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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