Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add pkgconfig output for installed target #208

Merged
merged 3 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions cpp/cmake/barretenberg.pc.in
Original file line number Diff line number Diff line change
@@ -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}
20 changes: 20 additions & 0 deletions cpp/src/aztec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 2 additions & 0 deletions cpp/src/aztec/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down