oxen-core/src/wallet/api/CMakeLists.txt

152 lines
4.7 KiB
CMake
Raw Normal View History

# Copyright (c) 2018, The Loki Project
# Copyright (c) 2014-2019, The Monero Project
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmake modernization The archaic (i.e. decade old) cmake usage here really got in the way of trying to properly use newer libraries (like lokimq), so this undertakes overhauling it considerably to make it much more sane (and significantly reduce the size). I left more of the architecture-specific bits in the top-level CMakeLists.txt intact; most of the efforts here are about properly loading dependencies, specifying dependencies and avoiding a whole pile of cmake antipatterns. This bumps the required cmake version to 3.5, which is what xenial comes with. - extensive use of interface libraries to include libraries, definitions, and include paths - use Boost::whatever instead of ${Boost_WHATEVER_LIBRARY}. The interface targets are (again) much better as they also give you any needed include or linking flags without needing to worry about them. - don't list header files when building things. This has *never* been correct cmake usage (cmake has always known how to wallet_rpc_headers the headers that .cpp files include to know about build changes). - remove the loki_add_library monstrosity; it breaks target names and makes compiling less efficient because the author couldn't figure out how to link things together. - make loki_add_executable take the output filename, and set the output path to bin/ and install to bin because *every single usage* of loki_add_executable was immediately followed by setting the output filename and setting the output path to bin/ and installing to bin. - move a bunch of crap that is only used in one particular src/whatever/CMakeLists.txt into that particular CMakeLists.txt instead of the top level CMakeLists.txt (or src/CMakeLists.txt). - Remove a bunch of redundant dependencies; most of them look like they were just copy-and-pasted in, and many more aren't needed (since they are implied by the PUBLIC linking of other dependencies). - Removed `die` since it just does a FATAL_ERROR, but adds color (which is useless since CMake already makes FATAL_ERRORs perfectly visible). - Change the way LOKI_DAEMON_AND_WALLET_ONLY works to just change the make targets to daemon and simplewallet rather than changing the build process (this should make it faster, too, since there are various other things that will be excluded).
2020-03-03 04:57:08 +01:00
add_library(wallet_api
wallet.cpp
wallet_manager.cpp
transaction_info.cpp
transaction_history.cpp
pending_transaction.cpp
utils.cpp
address_book.cpp
stake_unlock_result.cpp
subaddress.cpp
subaddress_account.cpp
unsigned_transaction.cpp)
target_link_libraries(wallet_api
PUBLIC
wallet
cryptonote_core
mnemonics
cmake modernization The archaic (i.e. decade old) cmake usage here really got in the way of trying to properly use newer libraries (like lokimq), so this undertakes overhauling it considerably to make it much more sane (and significantly reduce the size). I left more of the architecture-specific bits in the top-level CMakeLists.txt intact; most of the efforts here are about properly loading dependencies, specifying dependencies and avoiding a whole pile of cmake antipatterns. This bumps the required cmake version to 3.5, which is what xenial comes with. - extensive use of interface libraries to include libraries, definitions, and include paths - use Boost::whatever instead of ${Boost_WHATEVER_LIBRARY}. The interface targets are (again) much better as they also give you any needed include or linking flags without needing to worry about them. - don't list header files when building things. This has *never* been correct cmake usage (cmake has always known how to wallet_rpc_headers the headers that .cpp files include to know about build changes). - remove the loki_add_library monstrosity; it breaks target names and makes compiling less efficient because the author couldn't figure out how to link things together. - make loki_add_executable take the output filename, and set the output path to bin/ and install to bin because *every single usage* of loki_add_executable was immediately followed by setting the output filename and setting the output path to bin/ and installing to bin. - move a bunch of crap that is only used in one particular src/whatever/CMakeLists.txt into that particular CMakeLists.txt instead of the top level CMakeLists.txt (or src/CMakeLists.txt). - Remove a bunch of redundant dependencies; most of them look like they were just copy-and-pasted in, and many more aren't needed (since they are implied by the PUBLIC linking of other dependencies). - Removed `die` since it just does a FATAL_ERROR, but adds color (which is useless since CMake already makes FATAL_ERRORs perfectly visible). - Change the way LOKI_DAEMON_AND_WALLET_ONLY works to just change the make targets to daemon and simplewallet rather than changing the build process (this should make it faster, too, since there are various other things that will be excluded).
2020-03-03 04:57:08 +01:00
lmdb
Boost::serialization
filesystem
cmake modernization The archaic (i.e. decade old) cmake usage here really got in the way of trying to properly use newer libraries (like lokimq), so this undertakes overhauling it considerably to make it much more sane (and significantly reduce the size). I left more of the architecture-specific bits in the top-level CMakeLists.txt intact; most of the efforts here are about properly loading dependencies, specifying dependencies and avoiding a whole pile of cmake antipatterns. This bumps the required cmake version to 3.5, which is what xenial comes with. - extensive use of interface libraries to include libraries, definitions, and include paths - use Boost::whatever instead of ${Boost_WHATEVER_LIBRARY}. The interface targets are (again) much better as they also give you any needed include or linking flags without needing to worry about them. - don't list header files when building things. This has *never* been correct cmake usage (cmake has always known how to wallet_rpc_headers the headers that .cpp files include to know about build changes). - remove the loki_add_library monstrosity; it breaks target names and makes compiling less efficient because the author couldn't figure out how to link things together. - make loki_add_executable take the output filename, and set the output path to bin/ and install to bin because *every single usage* of loki_add_executable was immediately followed by setting the output filename and setting the output path to bin/ and installing to bin. - move a bunch of crap that is only used in one particular src/whatever/CMakeLists.txt into that particular CMakeLists.txt instead of the top level CMakeLists.txt (or src/CMakeLists.txt). - Remove a bunch of redundant dependencies; most of them look like they were just copy-and-pasted in, and many more aren't needed (since they are implied by the PUBLIC linking of other dependencies). - Removed `die` since it just does a FATAL_ERROR, but adds color (which is useless since CMake already makes FATAL_ERRORs perfectly visible). - Change the way LOKI_DAEMON_AND_WALLET_ONLY works to just change the make targets to daemon and simplewallet rather than changing the build process (this should make it faster, too, since there are various other things that will be excluded).
2020-03-03 04:57:08 +01:00
Boost::thread
PRIVATE
cmake modernization The archaic (i.e. decade old) cmake usage here really got in the way of trying to properly use newer libraries (like lokimq), so this undertakes overhauling it considerably to make it much more sane (and significantly reduce the size). I left more of the architecture-specific bits in the top-level CMakeLists.txt intact; most of the efforts here are about properly loading dependencies, specifying dependencies and avoiding a whole pile of cmake antipatterns. This bumps the required cmake version to 3.5, which is what xenial comes with. - extensive use of interface libraries to include libraries, definitions, and include paths - use Boost::whatever instead of ${Boost_WHATEVER_LIBRARY}. The interface targets are (again) much better as they also give you any needed include or linking flags without needing to worry about them. - don't list header files when building things. This has *never* been correct cmake usage (cmake has always known how to wallet_rpc_headers the headers that .cpp files include to know about build changes). - remove the loki_add_library monstrosity; it breaks target names and makes compiling less efficient because the author couldn't figure out how to link things together. - make loki_add_executable take the output filename, and set the output path to bin/ and install to bin because *every single usage* of loki_add_executable was immediately followed by setting the output filename and setting the output path to bin/ and installing to bin. - move a bunch of crap that is only used in one particular src/whatever/CMakeLists.txt into that particular CMakeLists.txt instead of the top level CMakeLists.txt (or src/CMakeLists.txt). - Remove a bunch of redundant dependencies; most of them look like they were just copy-and-pasted in, and many more aren't needed (since they are implied by the PUBLIC linking of other dependencies). - Removed `die` since it just does a FATAL_ERROR, but adds color (which is useless since CMake already makes FATAL_ERRORs perfectly visible). - Change the way LOKI_DAEMON_AND_WALLET_ONLY works to just change the make targets to daemon and simplewallet rather than changing the build process (this should make it faster, too, since there are various other things that will be excluded).
2020-03-03 04:57:08 +01:00
extra)
set_property(TARGET wallet_api PROPERTY EXCLUDE_FROM_ALL TRUE)
if(IOS)
set(lib_folder lib-${ARCH})
else()
set(lib_folder lib)
endif()
install(FILES ${wallet_api_headers}
DESTINATION include/wallet/api)
function(combine_archives output_archive)
2020-10-30 17:33:23 +01:00
set(FULL_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib${output_archive}.a)
set(output_archive_dummy_file ${CMAKE_CURRENT_BINARY_DIR}/${output_archive}.dummy.cpp)
add_custom_command(OUTPUT ${output_archive_dummy_file}
COMMAND touch ${output_archive_dummy_file}
DEPENDS ${ARGN})
add_library(${output_archive} STATIC EXCLUDE_FROM_ALL ${output_archive_dummy_file})
if(NOT APPLE)
set(mri_file ${CMAKE_CURRENT_BINARY_DIR}/${output_archive}.mri)
set(mri_content "create ${FULL_OUTPUT_PATH}\n")
foreach(in_archive ${ARGN})
string(APPEND mri_content "addlib $<TARGET_FILE:${in_archive}>\n")
endforeach()
string(APPEND mri_content "save\nend\n")
file(GENERATE OUTPUT ${mri_file} CONTENT "${mri_content}")
add_custom_command(TARGET ${output_archive}
POST_BUILD
COMMAND ar -M < ${mri_file})
2020-10-30 17:33:23 +01:00
else()
set(merge_libs)
foreach(in_archive ${ARGN})
list(APPEND merge_libs $<TARGET_FILE:${in_archive}>)
endforeach()
add_custom_command(TARGET ${output_archive}
POST_BUILD
COMMAND /usr/bin/libtool -static -o ${FULL_OUTPUT_PATH} ${merge_libs})
endif()
endfunction(combine_archives)
2020-10-26 21:59:42 +01:00
if (STATIC AND BUILD_STATIC_DEPS)
set(merged_protobuf)
if(TARGET protobuf_lite)
set(merged_protobuf protobuf_lite)
endif()
combine_archives(wallet_merged
wallet_api
wallet
multisig
cryptonote_core
cryptonote_basic
2020-10-26 21:59:42 +01:00
cryptonote_protocol
mnemonics
common
cncrypto
device
ringct
ringct_basic
checkpoints
version
net
2020-10-26 21:59:42 +01:00
device_trezor
epee
blockchain_db
rpc_http_client
rpc_commands
# Static deps:
Boost::program_options Boost::serialization Boost::system Boost::thread
zlib
2021-10-07 01:04:23 +02:00
SQLite::SQLite3
SQLiteCpp
${merged_protobuf}
2020-10-26 21:59:42 +01:00
sodium
libzmq
CURL::libcurl
2021-01-14 21:28:50 +01:00
oxenmq::oxenmq
2020-10-26 21:59:42 +01:00
lmdb
easylogging
randomx
uSockets
cpr
fmt
2020-10-26 21:59:42 +01:00
)
if(IOS)
set(lib_folder lib-${ARCH})
else()
set(lib_folder lib)
endif()
install(TARGETS wallet_merged
ARCHIVE DESTINATION ${lib_folder}
EXCLUDE_FROM_ALL)
endif()