Skip to content

Commit

Permalink
re-added gmp as a direct dependency to TKET
Browse files Browse the repository at this point in the history
  • Loading branch information
jake-arkinstall committed Aug 13, 2024
1 parent 5ad36c8 commit 06b6e51
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nix-support/tket.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ in {
tket = super.stdenv.mkDerivation {
name = "tket";
inherit src;
nativeBuildInputs = [ super.cmake ];
nativeBuildInputs = [ super.cmake super.pkg-config ];
propagatedBuildInputs = super.tklibs
++ (with super; [ boost symengine eigen nlohmann_json ]);
# TODO: add rapidcheck once nixpkgs packaging is correctly implemented.
Expand Down
9 changes: 9 additions & 0 deletions tket/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ cmake_policy(SET CMP0022 NEW)
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake)

find_package(Boost CONFIG REQUIRED)
find_package(gmp CONFIG)
if (NOT gmp_FOUND)
find_package(PkgConfig REQUIRED)
pkg_search_module(gmp REQUIRED IMPORTED_TARGET gmp)
endif()
find_package(SymEngine CONFIG REQUIRED)
find_package(Eigen3 CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
Expand Down Expand Up @@ -107,6 +112,9 @@ ENDIF()
if (NOT TARGET symengine::symengine)
add_library(symengine::symengine ALIAS symengine)
endif()
if (NOT TARGET gmp::gmp)
add_library(gmp::gmp ALIAS PkgConfig::gmp)
endif()

target_include_directories(tket PUBLIC
$<INSTALL_INTERFACE:include/tket>
Expand All @@ -120,6 +128,7 @@ target_link_libraries(tket PUBLIC tkassert::tkassert)
target_link_libraries(tket PUBLIC tkrng::tkrng)
target_link_libraries(tket PUBLIC tktokenswap::tktokenswap)
target_link_libraries(tket PRIVATE tkwsm::tkwsm)
target_link_libraries(tket PRIVATE gmp::gmp)
IF(APPLE)
target_link_libraries(tket PRIVATE "-flat_namespace")
ENDIF()
Expand Down
7 changes: 6 additions & 1 deletion tket/cmake/tketConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ get_filename_component(TKET_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
include(CMakeFindDependencyMacro)

find_package(Boost CONFIG REQUIRED)
find_package(gmp CONFIG)
if (NOT gmp_FOUND)
find_package(PkgConfig REQUIRED)
pkg_search_module(gmp REQUIRED IMPORTED_TARGET gmp)
endif()
find_package(SymEngine CONFIG REQUIRED)
find_package(Eigen3 CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
Expand All @@ -16,4 +21,4 @@ if(NOT TARGET tket::tket)
include("${TKET_CMAKE_DIR}/tketTargets.cmake")
endif()

set(TKET_lIBRARIES tket::tket)
set(TKET_LIBRARIES tket::tket)

0 comments on commit 06b6e51

Please sign in to comment.