|
| 1 | +# Copyright (c) 2023-present The Bitcoin Core developers |
| 2 | +# Distributed under the MIT software license, see the accompanying |
| 3 | +# file COPYING or https://opensource.org/license/mit/. |
| 4 | + |
| 5 | +# Must be included before CMAKE_INSTALL_INCLUDEDIR is used. |
| 6 | +include(GNUInstallDirs) |
| 7 | + |
| 8 | +set(bitcoinconsensus_src |
| 9 | + $<TARGET_OBJECTS:bitcoin_crypto> |
| 10 | + interpreter.cpp |
| 11 | + script.cpp |
| 12 | + script_error.cpp |
| 13 | + ../arith_uint256.cpp |
| 14 | + ../consensus/merkle.cpp |
| 15 | + ../consensus/tx_check.cpp |
| 16 | + ../hash.cpp |
| 17 | + ../primitives/block.cpp |
| 18 | + ../primitives/transaction.cpp |
| 19 | + ../pubkey.cpp |
| 20 | + ../uint256.cpp |
| 21 | + ../util/strencodings.cpp |
| 22 | +) |
| 23 | + |
| 24 | +if(BUILD_SHARED) |
| 25 | + add_library(bitcoinconsensus SHARED "") |
| 26 | + target_sources(bitcoinconsensus |
| 27 | + PRIVATE |
| 28 | + bitcoinconsensus.cpp |
| 29 | + ../support/cleanse.cpp |
| 30 | + ${bitcoinconsensus_src} |
| 31 | + ) |
| 32 | + target_compile_definitions(bitcoinconsensus |
| 33 | + PRIVATE |
| 34 | + BUILD_BITCOIN_INTERNAL |
| 35 | + ) |
| 36 | + target_include_directories(bitcoinconsensus |
| 37 | + PUBLIC |
| 38 | + $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src> |
| 39 | + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> |
| 40 | + ) |
| 41 | + target_link_libraries(bitcoinconsensus |
| 42 | + PRIVATE |
| 43 | + core |
| 44 | + secp256k1 |
| 45 | + ) |
| 46 | + set_target_properties(bitcoinconsensus PROPERTIES |
| 47 | + SOVERSION 0 |
| 48 | + VERSION 0.0.0 |
| 49 | + ) |
| 50 | +endif() |
| 51 | + |
| 52 | +if(BUILD_STATIC) |
| 53 | + add_library(bitcoinconsensus_static STATIC "") |
| 54 | + target_sources(bitcoinconsensus_static |
| 55 | + PRIVATE |
| 56 | + bitcoinconsensus.cpp |
| 57 | + ../support/cleanse.cpp |
| 58 | + ${bitcoinconsensus_src} |
| 59 | + ) |
| 60 | + target_compile_definitions(bitcoinconsensus_static |
| 61 | + PRIVATE |
| 62 | + BUILD_BITCOIN_INTERNAL |
| 63 | + ) |
| 64 | + target_include_directories(bitcoinconsensus_static |
| 65 | + PUBLIC |
| 66 | + $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src> |
| 67 | + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> |
| 68 | + ) |
| 69 | + target_link_libraries(bitcoinconsensus_static |
| 70 | + PRIVATE |
| 71 | + core |
| 72 | + secp256k1 |
| 73 | + ) |
| 74 | + if(NOT MSVC) |
| 75 | + set_target_properties(bitcoinconsensus_static PROPERTIES |
| 76 | + OUTPUT_NAME bitcoinconsensus |
| 77 | + ) |
| 78 | + endif() |
| 79 | +endif() |
| 80 | + |
| 81 | +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/bitcoinconsensus.h" |
| 82 | + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} |
| 83 | +) |
| 84 | + |
| 85 | +set(prefix ${CMAKE_INSTALL_PREFIX}) |
| 86 | +set(exec_prefix "\${prefix}") |
| 87 | +set(libdir "\${exec_prefix}/lib") |
| 88 | +set(includedir "\${prefix}/include") |
| 89 | +configure_file(${CMAKE_SOURCE_DIR}/libbitcoinconsensus.pc.in libbitcoinconsensus.pc @ONLY) |
| 90 | +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libbitcoinconsensus.pc DESTINATION lib/pkgconfig) |
0 commit comments