From f3b8576d1241749ccab179c65ad40839df3e6344 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Mon, 6 Mar 2023 16:04:25 -0600 Subject: [PATCH 1/3] feat: Add pkgconfig output for installed target --- cpp/cmake/barretenberg.pc.in | 12 ++++++++++++ cpp/src/aztec/CMakeLists.txt | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 cpp/cmake/barretenberg.pc.in diff --git a/cpp/cmake/barretenberg.pc.in b/cpp/cmake/barretenberg.pc.in new file mode 100644 index 0000000000..6aecb0c9ad --- /dev/null +++ b/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/cpp/src/aztec/CMakeLists.txt b/cpp/src/aztec/CMakeLists.txt index 301be6ab13..ac4c7af3ea 100644 --- a/cpp/src/aztec/CMakeLists.txt +++ b/cpp/src/aztec/CMakeLists.txt @@ -174,5 +174,18 @@ else() ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 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() From 3d8774aa1187c0288cdafe77696504fd2dd73554 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Mon, 6 Mar 2023 16:22:31 -0600 Subject: [PATCH 2/3] fix: Specify version with the project function --- cpp/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index bff44b7bbf..5cc744d9ed 100644 --- a/cpp/CMakeLists.txt +++ b/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) From 325546b3463c9c57d4d9b2164f240b8448f4a7bf Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Tue, 7 Mar 2023 11:30:44 -0600 Subject: [PATCH 3/3] chore: Add documentation to install targets --- cpp/src/aztec/CMakeLists.txt | 7 +++++++ cpp/src/aztec/common/CMakeLists.txt | 2 ++ 2 files changed, 9 insertions(+) diff --git a/cpp/src/aztec/CMakeLists.txt b/cpp/src/aztec/CMakeLists.txt index ac4c7af3ea..98a1e1a158 100644 --- a/cpp/src/aztec/CMakeLists.txt +++ b/cpp/src/aztec/CMakeLists.txt @@ -168,10 +168,17 @@ 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} ) diff --git a/cpp/src/aztec/common/CMakeLists.txt b/cpp/src/aztec/common/CMakeLists.txt index 4f815063ff..612adc04b0 100644 --- a/cpp/src/aztec/common/CMakeLists.txt +++ b/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