diff --git a/circuits/cpp/barretenberg/cpp/CMakeLists.txt b/circuits/cpp/barretenberg/cpp/CMakeLists.txt index bff44b7bbf9..5cc744d9eda 100644 --- a/circuits/cpp/barretenberg/cpp/CMakeLists.txt +++ b/circuits/cpp/barretenberg/cpp/CMakeLists.txt @@ -3,10 +3,12 @@ cmake_minimum_required(VERSION 3.24) -set(PROJECT_VERSION 0.1.0) -project(Barretenberg +project( + Barretenberg DESCRIPTION "BN254 elliptic curve library, and PLONK SNARK prover" - LANGUAGES CXX C) + VERSION 0.1.0 + LANGUAGES CXX C +) option(DISABLE_ASM "Disable custom assembly" OFF) option(DISABLE_ADX "Disable ADX assembly variant" OFF) diff --git a/circuits/cpp/barretenberg/cpp/cmake/barretenberg.pc.in b/circuits/cpp/barretenberg/cpp/cmake/barretenberg.pc.in new file mode 100644 index 00000000000..6aecb0c9ad7 --- /dev/null +++ b/circuits/cpp/barretenberg/cpp/cmake/barretenberg.pc.in @@ -0,0 +1,12 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: @PROJECT_NAME@ +Description: Optimized elliptic curve library for the bn128 curve, and PLONK SNARK prover +Version: @PROJECT_VERSION@ + +Libs: -L${libdir} +Libs.private: -lomp +Cflags: -I${includedir} diff --git a/circuits/cpp/barretenberg/cpp/src/aztec/CMakeLists.txt b/circuits/cpp/barretenberg/cpp/src/aztec/CMakeLists.txt index 301be6ab139..98a1e1a1586 100644 --- a/circuits/cpp/barretenberg/cpp/src/aztec/CMakeLists.txt +++ b/circuits/cpp/barretenberg/cpp/src/aztec/CMakeLists.txt @@ -168,11 +168,31 @@ else() ) if(INSTALL_BARRETENBERG) + # The `install` function takes targets to install in different destinations on the system. install( TARGETS barretenberg barretenberg_headers + # We also give it an optional export name in case something wants to target the install. EXPORT barretenbergTargets + # The ARCHIVE output signifies static libraries that should be installed + # and we use the GNUInstallDirs location to install into the standard system library location ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + # The FILE_SET output is used instead of PUBLIC_HEADER & PRIVATE_HEADER outputs because + # our headers don't have a clear delineation between public & private, but we still use + # the GNUInstallDirs location to install into the standard system header location FILE_SET HEADERS DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) + + set(pkg_config "${PROJECT_BINARY_DIR}/barretenberg.pc") + + configure_file( + "${PROJECT_SOURCE_DIR}/cmake/barretenberg.pc.in" + "${pkg_config}" + @ONLY + ) + + install( + FILES "${pkg_config}" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" + ) endif() endif() diff --git a/circuits/cpp/barretenberg/cpp/src/aztec/common/CMakeLists.txt b/circuits/cpp/barretenberg/cpp/src/aztec/common/CMakeLists.txt index 4f815063ff4..612adc04b0f 100644 --- a/circuits/cpp/barretenberg/cpp/src/aztec/common/CMakeLists.txt +++ b/circuits/cpp/barretenberg/cpp/src/aztec/common/CMakeLists.txt @@ -1,4 +1,6 @@ # Collect our common/*.hpp files and include in installation +# This is only necessary because nothing in `common/` has an +# implementation and doesn't use the `barretenberg_module` function file(GLOB_RECURSE HEADER_FILES *.hpp) target_sources( barretenberg_headers