-
Notifications
You must be signed in to change notification settings - Fork 49
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
Cmake improvements and Nix unification with existing pytket setup #1501
Open
jake-arkinstall
wants to merge
17
commits into
main
Choose a base branch
from
1482-investigate-potential-cmake-improvements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+284
−451
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6243cd4
Unify include paths in C++ 'libs' headers
jake-arkinstall 1bccba2
Set libraries required by TKET dependencies as PUBLIC
jake-arkinstall 197782b
Updated pytket's CMake build and nix build wrapper
jake-arkinstall 1cc8d93
Increasing compatibility with existing setup
jake-arkinstall c481e58
Reformatted setup.py
jake-arkinstall 6a5eac2
Revert prior export removal in CMakeLists.txt
jake-arkinstall 4e46a5b
Updated cmake for tests
jake-arkinstall 85056ad
Remove now-defunct includes-fixup (include paths are now uniform)
jake-arkinstall f95582b
Reverted previous disabling of pytket testing upon build
jake-arkinstall 13802cc
Applying clang-format
jake-arkinstall 928a6c0
Updated conanfile to allow cmake to handle the test json files, runni…
jake-arkinstall a96e487
Fixed nix pytket testing environment
jake-arkinstall ea4bac7
Fix windows tket build and pytket import issue.
jake-arkinstall a84a14e
Adding output to valgrind check to diagnose missing file issue
jake-arkinstall 7513cbf
Correcting the test data directory handling and installation
jake-arkinstall 8598141
re-added gmp as a direct dependency to TKET
jake-arkinstall 9c98f60
Formalise test building variables as cmake options
jake-arkinstall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,39 @@ | ||
self: super: | ||
let | ||
default-flags = [ "-DBUILD_SHARED_LIBS=ON" "-DINSTALL_NAME_DIR=OFF" ]; | ||
postFixup = import ./includes-fixup.nix; | ||
in { | ||
tklog = super.stdenv.mkDerivation { | ||
name = "tklog"; | ||
src = ../libs/tklog; | ||
nativeBuildInputs = [ super.cmake ]; | ||
cmakeFlags = default-flags; | ||
inherit postFixup; | ||
}; | ||
tkrng = super.stdenv.mkDerivation { | ||
name = "tkrng"; | ||
src = ../libs/tkrng; | ||
nativeBuildInputs = [ super.cmake ]; | ||
cmakeFlags = default-flags; | ||
inherit postFixup; | ||
}; | ||
tkassert = super.stdenv.mkDerivation { | ||
name = "tkassert"; | ||
src = ../libs/tkassert; | ||
nativeBuildInputs = [ super.cmake ]; | ||
buildInputs = [ self.tklog ]; | ||
cmakeFlags = default-flags; | ||
inherit postFixup; | ||
}; | ||
tktokenswap = super.stdenv.mkDerivation { | ||
name = "tktokenswap"; | ||
src = ../libs/tktokenswap; | ||
nativeBuildInputs = [ super.cmake super.boost ]; | ||
buildInputs = [ self.tklog self.tkassert self.tkrng ]; | ||
cmakeFlags = default-flags; | ||
inherit postFixup; | ||
}; | ||
tkwsm = super.stdenv.mkDerivation { | ||
name = "tkwsm"; | ||
src = ../libs/tkwsm; | ||
nativeBuildInputs = [ super.cmake super.boost ]; | ||
buildInputs = [ self.tklog self.tkassert self.tkrng ]; | ||
cmakeFlags = default-flags; | ||
inherit postFixup; | ||
}; | ||
tklibs = [ self.tklog self.tkrng self.tkassert self.tktokenswap self.tkwsm ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,38 @@ | ||
self: super: | ||
let | ||
postFixup = import ./includes-fixup.nix; | ||
# only import necessary directories so that changes to unrelated | ||
# files inside of ../tket won't trigger a rebuild | ||
tket-without-tests = super.stdenv.mkDerivation { | ||
src = super.stdenv.mkDerivation { | ||
name = "tket-sources"; | ||
phases = [ "installPhase" ]; | ||
installPhase = '' | ||
mkdir -p $out; | ||
cp -r ${../tket/cmake} $out/cmake; | ||
cp -r ${../tket/include} $out/include; | ||
cp -r ${../tket/src} $out/src; | ||
cp -r ${../tket/CMakeLists.txt} $out/CMakeLists.txt; | ||
cp -r ${../tket/test} $out/test; | ||
cp -r ${../tket/proptest} $out/proptest; | ||
cp ${../tket/CMakeLists.txt} $out/CMakeLists.txt; | ||
''; | ||
}; | ||
in { | ||
tket = super.stdenv.mkDerivation { | ||
name = "tket"; | ||
src = tket-without-tests; | ||
nativeBuildInputs = [ super.cmake ]; | ||
propagatedBuildInputs = super.tklibs | ||
++ [ super.boost super.symengine super.eigen super.nlohmann_json ]; | ||
cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" "-DINSTALL_NAME_DIR=OFF" ]; | ||
inherit postFixup; | ||
}; | ||
|
||
tket-tests = super.stdenv.mkDerivation { | ||
name = "tket-tests"; | ||
src = ../tket/test; | ||
inherit src; | ||
nativeBuildInputs = [ super.cmake super.pkg-config ]; | ||
buildInputs = [ self.tket super.catch2_3 ]; | ||
}; | ||
run-tket-tests = super.stdenv.mkDerivation { | ||
name = "run-tket-tests"; | ||
stages = [ "build" ]; | ||
buildCommand = '' | ||
pushd ${self.tket-tests}/bin; | ||
mkdir -p $out; | ||
./test-tket > $out/test_result.txt; | ||
popd; | ||
''; | ||
propagatedBuildInputs = super.tklibs | ||
++ (with super; [ boost symengine eigen nlohmann_json ]); | ||
# TODO: add rapidcheck once nixpkgs packaging is correctly implemented. | ||
# At current the package fails because the .pc files incorrectly reference | ||
# the library dir rather than the dev dir. | ||
# See https://github.com/NixOS/nixpkgs/issues/296348 | ||
buildInputs = with super; [ catch2_3 ]; | ||
cmakeFlags = [ | ||
"-DBUILD_SHARED_LIBS=ON" | ||
"-DINSTALL_NAME_DIR=OFF" | ||
"-DBUILD_TKET_TEST=ON" | ||
"-DBUILD_TKET_PROPTEST=OFF" | ||
]; | ||
doCheck = true; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,24 @@ | ||
@PACKAGE_INIT@ | ||
|
||
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) | ||
find_package(tklog CONFIG REQUIRED) | ||
find_package(tkassert CONFIG REQUIRED) | ||
find_package(tkrng CONFIG REQUIRED) | ||
find_package(tktokenswap CONFIG REQUIRED) | ||
|
||
if(NOT TARGET tket::tket) | ||
include("${TKET_CMAKE_DIR}/tketTargets.cmake") | ||
endif() | ||
|
||
set(TKET_lIBRARIES tket::tket) | ||
set(TKET_LIBRARIES tket::tket) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have removed libtket.so from lib_names here, is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is - the binders are already linked to tket.
So if I run
nix build .#pytket
and it outputs, say,/nix/store/afanh2nndhwmnjx393pwry7di3gs0gf8-python3.12-pytket-1.30.0
, I get:I believe this to be sufficient, as the cmake builds of pytket are working on nix, ubuntu and macos.
The windows conan build, however, is failing, and and I'm scratching my head over that as the changes to the conan build are trivial.