From 6243cd4ef4b7ed8ff2a0dae0d1e64d64f1ff3873 Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Mon, 22 Jul 2024 17:18:01 +0100 Subject: [PATCH 01/17] Unify include paths in C++ 'libs' headers --- libs/tktokenswap/CMakeLists.txt | 2 +- .../include/tktokenswap/BestFullTsa.hpp | 6 +++--- .../tktokenswap/CyclesCandidateManager.hpp | 4 ++-- .../include/tktokenswap/CyclesPartialTsa.hpp | 4 ++-- .../include/tktokenswap/DistanceFunctions.hpp | 2 +- .../include/tktokenswap/ExactMappingLookup.hpp | 2 +- .../tktokenswap/FilteredSwapSequences.hpp | 2 +- .../include/tktokenswap/HybridTsa.hpp | 4 ++-- .../tktokenswap/PartialMappingLookup.hpp | 2 +- .../tktokenswap/PartialTsaInterface.hpp | 8 ++++---- .../tktokenswap/RiverFlowPathFinder.hpp | 4 ++-- .../include/tktokenswap/SwapListOptimiser.hpp | 2 +- .../tktokenswap/SwapListSegmentOptimiser.hpp | 4 ++-- .../tktokenswap/SwapListTableOptimiser.hpp | 6 +++--- .../include/tktokenswap/TrivialTSA.hpp | 2 +- .../include/tktokenswap/VectorListHybrid.hpp | 2 +- .../tktokenswap/VertexMappingFunctions.hpp | 2 +- .../include/tktokenswap/VertexSwapResult.hpp | 2 +- .../tktokenswap/src/CyclesCandidateManager.cpp | 4 ++-- libs/tktokenswap/src/CyclesGrowthManager.cpp | 2 +- libs/tktokenswap/src/CyclesPartialTsa.cpp | 2 +- .../src/CyclicShiftCostEstimate.hpp | 2 +- libs/tktokenswap/src/DistancesInterface.cpp | 2 +- libs/tktokenswap/src/DynamicTokenTracker.cpp | 2 +- libs/tktokenswap/src/HybridTsa.cpp | 2 +- libs/tktokenswap/src/NeighboursInterface.cpp | 2 +- libs/tktokenswap/src/PartialTsaInterface.cpp | 2 +- libs/tktokenswap/src/RiverFlowPathFinder.cpp | 4 ++-- libs/tktokenswap/src/SwapListOptimiser.cpp | 4 ++-- .../src/TableLookup/VertexMapResizing.hpp | 2 +- libs/tktokenswap/src/TrivialTSA.cpp | 5 +++-- .../src/VectorListHybridSkeleton.cpp | 2 +- libs/tkwsm/CMakeLists.txt | 6 +++--- .../include/tkwsm/Common/GeneralUtils.hpp | 2 +- .../tkwsm/Common/TemporaryRefactorCode.hpp | 2 +- .../tkwsm/EndToEndWrappers/MainSolver.hpp | 10 +++++----- .../EndToEndWrappers/MainSolverParameters.hpp | 2 +- .../EndToEndWrappers/PreSearchComponents.hpp | 4 ++-- .../tkwsm/EndToEndWrappers/SolutionData.hpp | 4 ++-- .../tkwsm/EndToEndWrappers/SolutionWSM.hpp | 2 +- .../GraphTheoretic/DerivedGraphStructs.hpp | 2 +- .../tkwsm/GraphTheoretic/DerivedGraphs.hpp | 2 +- .../GraphTheoretic/DerivedGraphsCalculator.hpp | 2 +- .../tkwsm/GraphTheoretic/DomainInitialiser.hpp | 2 +- .../GraphTheoretic/NearNeighboursData.hpp | 4 ++-- .../tkwsm/GraphTheoretic/NeighboursData.hpp | 2 +- .../tkwsm/GraphTheoretic/VertexRelabelling.hpp | 2 +- .../tkwsm/InitPlacement/EndToEndIQP.hpp | 2 +- .../tkwsm/InitPlacement/FastRandomBits.hpp | 2 +- .../tkwsm/InitPlacement/InputStructs.hpp | 2 +- .../MonteCarloCompleteTargetSolution.hpp | 6 +++--- .../tkwsm/Reducing/DerivedGraphsReducer.hpp | 6 +++--- .../tkwsm/Reducing/DistancesReducer.hpp | 2 +- .../include/tkwsm/Reducing/ReducerWrapper.hpp | 2 +- .../tkwsm/Searching/DomainsAccessor.hpp | 2 +- .../tkwsm/Searching/NodeListTraversal.hpp | 2 +- .../include/tkwsm/Searching/NodesRawData.hpp | 4 ++-- .../include/tkwsm/Searching/SearchBranch.hpp | 18 +++++++++--------- .../include/tkwsm/Searching/ValueOrdering.hpp | 2 +- .../tkwsm/Searching/VariableOrdering.hpp | 2 +- .../tkwsm/Searching/WeightCalculator.hpp | 2 +- .../tkwsm/WeightPruning/WeightChecker.hpp | 4 ++-- .../WeightPruning/WeightNogoodDetector.hpp | 2 +- .../WeightNogoodDetectorManager.hpp | 2 +- 64 files changed, 104 insertions(+), 103 deletions(-) diff --git a/libs/tktokenswap/CMakeLists.txt b/libs/tktokenswap/CMakeLists.txt index bfb24d1fe7..1555cfa529 100644 --- a/libs/tktokenswap/CMakeLists.txt +++ b/libs/tktokenswap/CMakeLists.txt @@ -70,7 +70,7 @@ target_include_directories(tktokenswap PUBLIC $) target_link_libraries(tktokenswap PRIVATE tklog::tklog) target_link_libraries(tktokenswap PUBLIC tkassert::tkassert) -target_link_libraries(tktokenswap PRIVATE tkrng::tkrng) +target_link_libraries(tktokenswap PUBLIC tkrng::tkrng) target_link_libraries(tktokenswap PRIVATE Boost::headers) IF(APPLE) diff --git a/libs/tktokenswap/include/tktokenswap/BestFullTsa.hpp b/libs/tktokenswap/include/tktokenswap/BestFullTsa.hpp index 385f03ee20..dec47c591d 100644 --- a/libs/tktokenswap/include/tktokenswap/BestFullTsa.hpp +++ b/libs/tktokenswap/include/tktokenswap/BestFullTsa.hpp @@ -14,9 +14,9 @@ #pragma once -#include "HybridTsa.hpp" -#include "SwapListOptimiser.hpp" -#include "SwapListTableOptimiser.hpp" +#include "tktokenswap/HybridTsa.hpp" +#include "tktokenswap/SwapListOptimiser.hpp" +#include "tktokenswap/SwapListTableOptimiser.hpp" namespace tket { diff --git a/libs/tktokenswap/include/tktokenswap/CyclesCandidateManager.hpp b/libs/tktokenswap/include/tktokenswap/CyclesCandidateManager.hpp index 894cfe6905..66aba74095 100644 --- a/libs/tktokenswap/include/tktokenswap/CyclesCandidateManager.hpp +++ b/libs/tktokenswap/include/tktokenswap/CyclesCandidateManager.hpp @@ -16,8 +16,8 @@ #include -#include "CyclesGrowthManager.hpp" -#include "PartialTsaInterface.hpp" +#include "tktokenswap/CyclesGrowthManager.hpp" +#include "tktokenswap/PartialTsaInterface.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/include/tktokenswap/CyclesPartialTsa.hpp b/libs/tktokenswap/include/tktokenswap/CyclesPartialTsa.hpp index c35d3e8070..4cc5d7be6e 100644 --- a/libs/tktokenswap/include/tktokenswap/CyclesPartialTsa.hpp +++ b/libs/tktokenswap/include/tktokenswap/CyclesPartialTsa.hpp @@ -14,8 +14,8 @@ #pragma once -#include "CyclesCandidateManager.hpp" -#include "PartialTsaInterface.hpp" +#include "tktokenswap/CyclesCandidateManager.hpp" +#include "tktokenswap/PartialTsaInterface.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/include/tktokenswap/DistanceFunctions.hpp b/libs/tktokenswap/include/tktokenswap/DistanceFunctions.hpp index 5438b3afa1..eda8e49d3b 100644 --- a/libs/tktokenswap/include/tktokenswap/DistanceFunctions.hpp +++ b/libs/tktokenswap/include/tktokenswap/DistanceFunctions.hpp @@ -18,7 +18,7 @@ #include #include -#include "VertexMappingFunctions.hpp" +#include "tktokenswap/VertexMappingFunctions.hpp" #include "tktokenswap/DistancesInterface.hpp" namespace tket { diff --git a/libs/tktokenswap/include/tktokenswap/ExactMappingLookup.hpp b/libs/tktokenswap/include/tktokenswap/ExactMappingLookup.hpp index 700a8438ef..3c91d23d73 100644 --- a/libs/tktokenswap/include/tktokenswap/ExactMappingLookup.hpp +++ b/libs/tktokenswap/include/tktokenswap/ExactMappingLookup.hpp @@ -14,7 +14,7 @@ #pragma once -#include "CanonicalRelabelling.hpp" +#include "tktokenswap/CanonicalRelabelling.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/include/tktokenswap/FilteredSwapSequences.hpp b/libs/tktokenswap/include/tktokenswap/FilteredSwapSequences.hpp index cb592c7db9..75e88b0967 100644 --- a/libs/tktokenswap/include/tktokenswap/FilteredSwapSequences.hpp +++ b/libs/tktokenswap/include/tktokenswap/FilteredSwapSequences.hpp @@ -17,7 +17,7 @@ #include #include -#include "SwapConversion.hpp" +#include "tktokenswap/SwapConversion.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/include/tktokenswap/HybridTsa.hpp b/libs/tktokenswap/include/tktokenswap/HybridTsa.hpp index 5610f90719..bc10fceff5 100644 --- a/libs/tktokenswap/include/tktokenswap/HybridTsa.hpp +++ b/libs/tktokenswap/include/tktokenswap/HybridTsa.hpp @@ -14,8 +14,8 @@ #pragma once -#include "CyclesPartialTsa.hpp" -#include "TrivialTSA.hpp" +#include "tktokenswap/CyclesPartialTsa.hpp" +#include "tktokenswap/TrivialTSA.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/include/tktokenswap/PartialMappingLookup.hpp b/libs/tktokenswap/include/tktokenswap/PartialMappingLookup.hpp index 6267b8cd7a..063dfc01bb 100644 --- a/libs/tktokenswap/include/tktokenswap/PartialMappingLookup.hpp +++ b/libs/tktokenswap/include/tktokenswap/PartialMappingLookup.hpp @@ -19,7 +19,7 @@ #include #include -#include "ExactMappingLookup.hpp" +#include "tktokenswap/ExactMappingLookup.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/include/tktokenswap/PartialTsaInterface.hpp b/libs/tktokenswap/include/tktokenswap/PartialTsaInterface.hpp index 60db0b71d9..6a4766e4b0 100644 --- a/libs/tktokenswap/include/tktokenswap/PartialTsaInterface.hpp +++ b/libs/tktokenswap/include/tktokenswap/PartialTsaInterface.hpp @@ -14,10 +14,10 @@ #pragma once -#include "DistancesInterface.hpp" -#include "NeighboursInterface.hpp" -#include "RiverFlowPathFinder.hpp" -#include "VertexMappingFunctions.hpp" +#include "tktokenswap/DistancesInterface.hpp" +#include "tktokenswap/NeighboursInterface.hpp" +#include "tktokenswap/RiverFlowPathFinder.hpp" +#include "tktokenswap/VertexMappingFunctions.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/include/tktokenswap/RiverFlowPathFinder.hpp b/libs/tktokenswap/include/tktokenswap/RiverFlowPathFinder.hpp index f83a397164..806c9df7d8 100644 --- a/libs/tktokenswap/include/tktokenswap/RiverFlowPathFinder.hpp +++ b/libs/tktokenswap/include/tktokenswap/RiverFlowPathFinder.hpp @@ -19,8 +19,8 @@ #include #include -#include "DistancesInterface.hpp" -#include "NeighboursInterface.hpp" +#include "tktokenswap/DistancesInterface.hpp" +#include "tktokenswap/NeighboursInterface.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/include/tktokenswap/SwapListOptimiser.hpp b/libs/tktokenswap/include/tktokenswap/SwapListOptimiser.hpp index 24a774fa3f..0756af35b9 100644 --- a/libs/tktokenswap/include/tktokenswap/SwapListOptimiser.hpp +++ b/libs/tktokenswap/include/tktokenswap/SwapListOptimiser.hpp @@ -14,7 +14,7 @@ #pragma once -#include "DynamicTokenTracker.hpp" +#include "tktokenswap/DynamicTokenTracker.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/include/tktokenswap/SwapListSegmentOptimiser.hpp b/libs/tktokenswap/include/tktokenswap/SwapListSegmentOptimiser.hpp index 1379976b74..4d8b54ccd0 100644 --- a/libs/tktokenswap/include/tktokenswap/SwapListSegmentOptimiser.hpp +++ b/libs/tktokenswap/include/tktokenswap/SwapListSegmentOptimiser.hpp @@ -19,8 +19,8 @@ #include #include -#include "PartialMappingLookup.hpp" -#include "VertexMapResizing.hpp" +#include "tktokenswap/PartialMappingLookup.hpp" +#include "tktokenswap/VertexMapResizing.hpp" #include "tktokenswap/SwapFunctions.hpp" namespace tket { diff --git a/libs/tktokenswap/include/tktokenswap/SwapListTableOptimiser.hpp b/libs/tktokenswap/include/tktokenswap/SwapListTableOptimiser.hpp index 7b898d165f..aa5641634d 100644 --- a/libs/tktokenswap/include/tktokenswap/SwapListTableOptimiser.hpp +++ b/libs/tktokenswap/include/tktokenswap/SwapListTableOptimiser.hpp @@ -17,9 +17,9 @@ #include -#include "PartialMappingLookup.hpp" -#include "SwapListSegmentOptimiser.hpp" -#include "VertexMapResizing.hpp" +#include "tktokenswap/PartialMappingLookup.hpp" +#include "tktokenswap/SwapListSegmentOptimiser.hpp" +#include "tktokenswap/VertexMapResizing.hpp" #include "tktokenswap/SwapListOptimiser.hpp" /// TODO: The swap table optimiser currently tries to optimise many segments; diff --git a/libs/tktokenswap/include/tktokenswap/TrivialTSA.hpp b/libs/tktokenswap/include/tktokenswap/TrivialTSA.hpp index 143ba11921..e96517c21d 100644 --- a/libs/tktokenswap/include/tktokenswap/TrivialTSA.hpp +++ b/libs/tktokenswap/include/tktokenswap/TrivialTSA.hpp @@ -16,7 +16,7 @@ #include -#include "PartialTsaInterface.hpp" +#include "tktokenswap/PartialTsaInterface.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/include/tktokenswap/VectorListHybrid.hpp b/libs/tktokenswap/include/tktokenswap/VectorListHybrid.hpp index 4d2a043751..37df57a11e 100644 --- a/libs/tktokenswap/include/tktokenswap/VectorListHybrid.hpp +++ b/libs/tktokenswap/include/tktokenswap/VectorListHybrid.hpp @@ -18,7 +18,7 @@ #include #include -#include "VectorListHybridSkeleton.hpp" +#include "tktokenswap/VectorListHybridSkeleton.hpp" namespace tket { diff --git a/libs/tktokenswap/include/tktokenswap/VertexMappingFunctions.hpp b/libs/tktokenswap/include/tktokenswap/VertexMappingFunctions.hpp index bfd6000259..2c4190588c 100644 --- a/libs/tktokenswap/include/tktokenswap/VertexMappingFunctions.hpp +++ b/libs/tktokenswap/include/tktokenswap/VertexMappingFunctions.hpp @@ -18,7 +18,7 @@ #include #include -#include "SwapFunctions.hpp" +#include "tktokenswap/SwapFunctions.hpp" namespace tket { diff --git a/libs/tktokenswap/include/tktokenswap/VertexSwapResult.hpp b/libs/tktokenswap/include/tktokenswap/VertexSwapResult.hpp index 8d0cfc90eb..d60c939d5b 100644 --- a/libs/tktokenswap/include/tktokenswap/VertexSwapResult.hpp +++ b/libs/tktokenswap/include/tktokenswap/VertexSwapResult.hpp @@ -18,7 +18,7 @@ #include #include -#include "VertexMappingFunctions.hpp" +#include "tktokenswap/VertexMappingFunctions.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/src/CyclesCandidateManager.cpp b/libs/tktokenswap/src/CyclesCandidateManager.cpp index 94bf783dba..b9cc8b4178 100644 --- a/libs/tktokenswap/src/CyclesCandidateManager.cpp +++ b/libs/tktokenswap/src/CyclesCandidateManager.cpp @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "CyclesCandidateManager.hpp" +#include "tktokenswap/CyclesCandidateManager.hpp" #include #include #include #include -#include "VertexSwapResult.hpp" +#include "tktokenswap/VertexSwapResult.hpp" using std::vector; diff --git a/libs/tktokenswap/src/CyclesGrowthManager.cpp b/libs/tktokenswap/src/CyclesGrowthManager.cpp index a0c2bb675e..53931fe38a 100644 --- a/libs/tktokenswap/src/CyclesGrowthManager.cpp +++ b/libs/tktokenswap/src/CyclesGrowthManager.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "CyclesGrowthManager.hpp" +#include "tktokenswap/CyclesGrowthManager.hpp" #include #include diff --git a/libs/tktokenswap/src/CyclesPartialTsa.cpp b/libs/tktokenswap/src/CyclesPartialTsa.cpp index 045da1b9b7..b19f7b5775 100644 --- a/libs/tktokenswap/src/CyclesPartialTsa.cpp +++ b/libs/tktokenswap/src/CyclesPartialTsa.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "CyclesPartialTsa.hpp" +#include "tktokenswap/CyclesPartialTsa.hpp" #include diff --git a/libs/tktokenswap/src/CyclicShiftCostEstimate.hpp b/libs/tktokenswap/src/CyclicShiftCostEstimate.hpp index 74a5d61d7e..50153c9377 100644 --- a/libs/tktokenswap/src/CyclicShiftCostEstimate.hpp +++ b/libs/tktokenswap/src/CyclicShiftCostEstimate.hpp @@ -16,7 +16,7 @@ #include -#include "DistancesInterface.hpp" +#include "tktokenswap/DistancesInterface.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/src/DistancesInterface.cpp b/libs/tktokenswap/src/DistancesInterface.cpp index bec882a733..7704d502d2 100644 --- a/libs/tktokenswap/src/DistancesInterface.cpp +++ b/libs/tktokenswap/src/DistancesInterface.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "DistancesInterface.hpp" +#include "tktokenswap/DistancesInterface.hpp" using std::vector; diff --git a/libs/tktokenswap/src/DynamicTokenTracker.cpp b/libs/tktokenswap/src/DynamicTokenTracker.cpp index fd16eed81b..fc6e91ce4e 100644 --- a/libs/tktokenswap/src/DynamicTokenTracker.cpp +++ b/libs/tktokenswap/src/DynamicTokenTracker.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "DynamicTokenTracker.hpp" +#include "tktokenswap/DynamicTokenTracker.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/src/HybridTsa.cpp b/libs/tktokenswap/src/HybridTsa.cpp index 58ac4bf9c2..72dabebed7 100644 --- a/libs/tktokenswap/src/HybridTsa.cpp +++ b/libs/tktokenswap/src/HybridTsa.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "HybridTsa.hpp" +#include "tktokenswap/HybridTsa.hpp" #include diff --git a/libs/tktokenswap/src/NeighboursInterface.cpp b/libs/tktokenswap/src/NeighboursInterface.cpp index f664356b74..b19fac95e0 100644 --- a/libs/tktokenswap/src/NeighboursInterface.cpp +++ b/libs/tktokenswap/src/NeighboursInterface.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "NeighboursInterface.hpp" +#include "tktokenswap/NeighboursInterface.hpp" #include diff --git a/libs/tktokenswap/src/PartialTsaInterface.cpp b/libs/tktokenswap/src/PartialTsaInterface.cpp index 749a0ee5a0..d132c5469e 100644 --- a/libs/tktokenswap/src/PartialTsaInterface.cpp +++ b/libs/tktokenswap/src/PartialTsaInterface.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "PartialTsaInterface.hpp" +#include "tktokenswap/PartialTsaInterface.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/src/RiverFlowPathFinder.cpp b/libs/tktokenswap/src/RiverFlowPathFinder.cpp index 95f9f05dfd..e4f22832c3 100644 --- a/libs/tktokenswap/src/RiverFlowPathFinder.cpp +++ b/libs/tktokenswap/src/RiverFlowPathFinder.cpp @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "RiverFlowPathFinder.hpp" +#include "tktokenswap/RiverFlowPathFinder.hpp" #include #include #include -#include "SwapFunctions.hpp" +#include "tktokenswap/SwapFunctions.hpp" using std::vector; diff --git a/libs/tktokenswap/src/SwapListOptimiser.cpp b/libs/tktokenswap/src/SwapListOptimiser.cpp index 5bc8013dbb..52c92f1ce8 100644 --- a/libs/tktokenswap/src/SwapListOptimiser.cpp +++ b/libs/tktokenswap/src/SwapListOptimiser.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "SwapListOptimiser.hpp" +#include "tktokenswap/SwapListOptimiser.hpp" #include -#include "VertexSwapResult.hpp" +#include "tktokenswap/VertexSwapResult.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/src/TableLookup/VertexMapResizing.hpp b/libs/tktokenswap/src/TableLookup/VertexMapResizing.hpp index 27edede9f4..d41d137c71 100644 --- a/libs/tktokenswap/src/TableLookup/VertexMapResizing.hpp +++ b/libs/tktokenswap/src/TableLookup/VertexMapResizing.hpp @@ -19,7 +19,7 @@ #include #include -#include "../VertexMappingFunctions.hpp" +#include "tktokenswap/VertexMappingFunctions.hpp" #include "tktokenswap/NeighboursInterface.hpp" namespace tket { diff --git a/libs/tktokenswap/src/TrivialTSA.cpp b/libs/tktokenswap/src/TrivialTSA.cpp index eb65a023ae..199d6d775a 100644 --- a/libs/tktokenswap/src/TrivialTSA.cpp +++ b/libs/tktokenswap/src/TrivialTSA.cpp @@ -12,17 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "TrivialTSA.hpp" +#include "tktokenswap/TrivialTSA.hpp" #include #include #include -#include "CyclicShiftCostEstimate.hpp" #include "tktokenswap/DistanceFunctions.hpp" #include "tktokenswap/GeneralFunctions.hpp" #include "tktokenswap/VertexSwapResult.hpp" +#include "CyclicShiftCostEstimate.hpp" + using std::vector; namespace tket { diff --git a/libs/tktokenswap/src/VectorListHybridSkeleton.cpp b/libs/tktokenswap/src/VectorListHybridSkeleton.cpp index 283ca0caf8..ea43801824 100644 --- a/libs/tktokenswap/src/VectorListHybridSkeleton.cpp +++ b/libs/tktokenswap/src/VectorListHybridSkeleton.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "VectorListHybridSkeleton.hpp" +#include "tktokenswap/VectorListHybridSkeleton.hpp" #include #include diff --git a/libs/tkwsm/CMakeLists.txt b/libs/tkwsm/CMakeLists.txt index 41ee2605dc..028001cee9 100644 --- a/libs/tkwsm/CMakeLists.txt +++ b/libs/tkwsm/CMakeLists.txt @@ -68,9 +68,9 @@ ENDIF() target_include_directories(tkwsm PUBLIC $ $) -target_link_libraries(tkwsm PRIVATE tkassert::tkassert) -target_link_libraries(tkwsm PRIVATE tkrng::tkrng) -target_link_libraries(tkwsm PRIVATE Boost::headers) +target_link_libraries(tkwsm PUBLIC tkassert::tkassert) +target_link_libraries(tkwsm PUBLIC tkrng::tkrng) +target_link_libraries(tkwsm PUBLIC Boost::headers) IF(APPLE) target_link_libraries(tkwsm PRIVATE "-flat_namespace") ENDIF() diff --git a/libs/tkwsm/include/tkwsm/Common/GeneralUtils.hpp b/libs/tkwsm/include/tkwsm/Common/GeneralUtils.hpp index 33020fbbdf..10cfc065d9 100644 --- a/libs/tkwsm/include/tkwsm/Common/GeneralUtils.hpp +++ b/libs/tkwsm/include/tkwsm/Common/GeneralUtils.hpp @@ -23,7 +23,7 @@ #include #include -#include "SpecialExceptions.hpp" +#include "tkwsm/Common/SpecialExceptions.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/Common/TemporaryRefactorCode.hpp b/libs/tkwsm/include/tkwsm/Common/TemporaryRefactorCode.hpp index d1945a0f7e..47bb135b69 100644 --- a/libs/tkwsm/include/tkwsm/Common/TemporaryRefactorCode.hpp +++ b/libs/tkwsm/include/tkwsm/Common/TemporaryRefactorCode.hpp @@ -16,7 +16,7 @@ #include #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolver.hpp b/libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolver.hpp index 03aed7218f..ce1efcccc0 100644 --- a/libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolver.hpp +++ b/libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolver.hpp @@ -16,11 +16,11 @@ #include #include -#include "../GraphTheoretic/NeighboursData.hpp" -#include "../GraphTheoretic/VertexRelabelling.hpp" -#include "../Searching/SearchBranch.hpp" -#include "MainSolverParameters.hpp" -#include "SolutionData.hpp" +#include "tkwsm/GraphTheoretic/NeighboursData.hpp" +#include "tkwsm/GraphTheoretic/VertexRelabelling.hpp" +#include "tkwsm/Searching/SearchBranch.hpp" +#include "tkwsm/EndToEndWrappers/MainSolverParameters.hpp" +#include "tkwsm/EndToEndWrappers/SolutionData.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolverParameters.hpp b/libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolverParameters.hpp index dca4bb39d4..4394943780 100644 --- a/libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolverParameters.hpp +++ b/libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolverParameters.hpp @@ -15,7 +15,7 @@ #pragma once #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/EndToEndWrappers/PreSearchComponents.hpp b/libs/tkwsm/include/tkwsm/EndToEndWrappers/PreSearchComponents.hpp index b3fb8b356f..827b470cf8 100644 --- a/libs/tkwsm/include/tkwsm/EndToEndWrappers/PreSearchComponents.hpp +++ b/libs/tkwsm/include/tkwsm/EndToEndWrappers/PreSearchComponents.hpp @@ -18,8 +18,8 @@ #include #include -#include "../GraphTheoretic/NearNeighboursData.hpp" -#include "../GraphTheoretic/NeighboursData.hpp" +#include "tkwsm/GraphTheoretic/NearNeighboursData.hpp" +#include "tkwsm/GraphTheoretic/NeighboursData.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionData.hpp b/libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionData.hpp index c9027599b0..e10912ace8 100644 --- a/libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionData.hpp +++ b/libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionData.hpp @@ -15,8 +15,8 @@ #pragma once #include -#include "../GraphTheoretic/GeneralStructs.hpp" -#include "SolutionWSM.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/EndToEndWrappers/SolutionWSM.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionWSM.hpp b/libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionWSM.hpp index 4a0e9150e4..09e4719de8 100644 --- a/libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionWSM.hpp +++ b/libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionWSM.hpp @@ -15,7 +15,7 @@ #pragma once #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/GraphTheoretic/DerivedGraphStructs.hpp b/libs/tkwsm/include/tkwsm/GraphTheoretic/DerivedGraphStructs.hpp index 1e9ab1ed2c..dbcec146e8 100644 --- a/libs/tkwsm/include/tkwsm/GraphTheoretic/DerivedGraphStructs.hpp +++ b/libs/tkwsm/include/tkwsm/GraphTheoretic/DerivedGraphStructs.hpp @@ -15,7 +15,7 @@ #pragma once #include -#include "GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/GraphTheoretic/DerivedGraphs.hpp b/libs/tkwsm/include/tkwsm/GraphTheoretic/DerivedGraphs.hpp index a1d2ce8391..00742b2488 100644 --- a/libs/tkwsm/include/tkwsm/GraphTheoretic/DerivedGraphs.hpp +++ b/libs/tkwsm/include/tkwsm/GraphTheoretic/DerivedGraphs.hpp @@ -13,7 +13,7 @@ // limitations under the License. #pragma once -#include "DerivedGraphStructs.hpp" +#include "tkwsm/GraphTheoretic/DerivedGraphStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/GraphTheoretic/DerivedGraphsCalculator.hpp b/libs/tkwsm/include/tkwsm/GraphTheoretic/DerivedGraphsCalculator.hpp index a855ac6ffa..7361bd8d50 100644 --- a/libs/tkwsm/include/tkwsm/GraphTheoretic/DerivedGraphsCalculator.hpp +++ b/libs/tkwsm/include/tkwsm/GraphTheoretic/DerivedGraphsCalculator.hpp @@ -13,7 +13,7 @@ // limitations under the License. #pragma once -#include "DerivedGraphStructs.hpp" +#include "tkwsm/GraphTheoretic/DerivedGraphStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/GraphTheoretic/DomainInitialiser.hpp b/libs/tkwsm/include/tkwsm/GraphTheoretic/DomainInitialiser.hpp index d8285ef522..1184c1d54c 100644 --- a/libs/tkwsm/include/tkwsm/GraphTheoretic/DomainInitialiser.hpp +++ b/libs/tkwsm/include/tkwsm/GraphTheoretic/DomainInitialiser.hpp @@ -15,7 +15,7 @@ #pragma once #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/GraphTheoretic/NearNeighboursData.hpp b/libs/tkwsm/include/tkwsm/GraphTheoretic/NearNeighboursData.hpp index 0153b6983c..7fdef7e1b1 100644 --- a/libs/tkwsm/include/tkwsm/GraphTheoretic/NearNeighboursData.hpp +++ b/libs/tkwsm/include/tkwsm/GraphTheoretic/NearNeighboursData.hpp @@ -17,8 +17,8 @@ #include #include -#include "FilterUtils.hpp" -#include "GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/FilterUtils.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/GraphTheoretic/NeighboursData.hpp b/libs/tkwsm/include/tkwsm/GraphTheoretic/NeighboursData.hpp index f00d904366..092bee5c20 100644 --- a/libs/tkwsm/include/tkwsm/GraphTheoretic/NeighboursData.hpp +++ b/libs/tkwsm/include/tkwsm/GraphTheoretic/NeighboursData.hpp @@ -17,7 +17,7 @@ #include #include -#include "GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/GraphTheoretic/VertexRelabelling.hpp b/libs/tkwsm/include/tkwsm/GraphTheoretic/VertexRelabelling.hpp index 9a39fbeb8e..7ecdea690a 100644 --- a/libs/tkwsm/include/tkwsm/GraphTheoretic/VertexRelabelling.hpp +++ b/libs/tkwsm/include/tkwsm/GraphTheoretic/VertexRelabelling.hpp @@ -13,7 +13,7 @@ // limitations under the License. #pragma once -#include "GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/InitPlacement/EndToEndIQP.hpp b/libs/tkwsm/include/tkwsm/InitPlacement/EndToEndIQP.hpp index f172e1bb2b..41c89ca40b 100644 --- a/libs/tkwsm/include/tkwsm/InitPlacement/EndToEndIQP.hpp +++ b/libs/tkwsm/include/tkwsm/InitPlacement/EndToEndIQP.hpp @@ -15,7 +15,7 @@ #pragma once #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/InitPlacement/FastRandomBits.hpp b/libs/tkwsm/include/tkwsm/InitPlacement/FastRandomBits.hpp index 85241c7493..3c1a0ec703 100644 --- a/libs/tkwsm/include/tkwsm/InitPlacement/FastRandomBits.hpp +++ b/libs/tkwsm/include/tkwsm/InitPlacement/FastRandomBits.hpp @@ -13,7 +13,7 @@ // limitations under the License. #pragma once -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { class RNG; diff --git a/libs/tkwsm/include/tkwsm/InitPlacement/InputStructs.hpp b/libs/tkwsm/include/tkwsm/InitPlacement/InputStructs.hpp index 6d9f3afb50..ca0ce46b3a 100644 --- a/libs/tkwsm/include/tkwsm/InitPlacement/InputStructs.hpp +++ b/libs/tkwsm/include/tkwsm/InitPlacement/InputStructs.hpp @@ -15,7 +15,7 @@ #pragma once #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/InitPlacement/MonteCarloCompleteTargetSolution.hpp b/libs/tkwsm/include/tkwsm/InitPlacement/MonteCarloCompleteTargetSolution.hpp index 7a1a4ad058..0b50f5de80 100644 --- a/libs/tkwsm/include/tkwsm/InitPlacement/MonteCarloCompleteTargetSolution.hpp +++ b/libs/tkwsm/include/tkwsm/InitPlacement/MonteCarloCompleteTargetSolution.hpp @@ -17,9 +17,9 @@ #include #include -#include "FastRandomBits.hpp" -#include "MonteCarloManager.hpp" -#include "SolutionJumper.hpp" +#include "tkwsm/InitPlacement/FastRandomBits.hpp" +#include "tkwsm/InitPlacement/MonteCarloManager.hpp" +#include "tkwsm/InitPlacement/SolutionJumper.hpp" #include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { diff --git a/libs/tkwsm/include/tkwsm/Reducing/DerivedGraphsReducer.hpp b/libs/tkwsm/include/tkwsm/Reducing/DerivedGraphsReducer.hpp index fe1cd11ede..d34d208b38 100644 --- a/libs/tkwsm/include/tkwsm/Reducing/DerivedGraphsReducer.hpp +++ b/libs/tkwsm/include/tkwsm/Reducing/DerivedGraphsReducer.hpp @@ -13,9 +13,9 @@ // limitations under the License. #pragma once -#include "../GraphTheoretic/DerivedGraphs.hpp" -#include "../GraphTheoretic/DerivedGraphsCalculator.hpp" -#include "ReducerWrapper.hpp" +#include "tkwsm/GraphTheoretic/DerivedGraphs.hpp" +#include "tkwsm/GraphTheoretic/DerivedGraphsCalculator.hpp" +#include "tkwsm/Reducing/ReducerWrapper.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/Reducing/DistancesReducer.hpp b/libs/tkwsm/include/tkwsm/Reducing/DistancesReducer.hpp index 1ef46cc8a4..eb89eca52e 100644 --- a/libs/tkwsm/include/tkwsm/Reducing/DistancesReducer.hpp +++ b/libs/tkwsm/include/tkwsm/Reducing/DistancesReducer.hpp @@ -13,7 +13,7 @@ // limitations under the License. #pragma once -#include "ReducerWrapper.hpp" +#include "tkwsm/Reducing/ReducerWrapper.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/Reducing/ReducerWrapper.hpp b/libs/tkwsm/include/tkwsm/Reducing/ReducerWrapper.hpp index 21c02b5b22..ca659e1b4e 100644 --- a/libs/tkwsm/include/tkwsm/Reducing/ReducerWrapper.hpp +++ b/libs/tkwsm/include/tkwsm/Reducing/ReducerWrapper.hpp @@ -16,7 +16,7 @@ #include #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/Searching/DomainsAccessor.hpp b/libs/tkwsm/include/tkwsm/Searching/DomainsAccessor.hpp index 8dc4fb8e2d..5ea115af30 100644 --- a/libs/tkwsm/include/tkwsm/Searching/DomainsAccessor.hpp +++ b/libs/tkwsm/include/tkwsm/Searching/DomainsAccessor.hpp @@ -17,7 +17,7 @@ #include #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/Searching/NodeListTraversal.hpp b/libs/tkwsm/include/tkwsm/Searching/NodeListTraversal.hpp index 8dca86b808..ea1d3c073c 100644 --- a/libs/tkwsm/include/tkwsm/Searching/NodeListTraversal.hpp +++ b/libs/tkwsm/include/tkwsm/Searching/NodeListTraversal.hpp @@ -16,7 +16,7 @@ #include #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/Searching/NodesRawData.hpp b/libs/tkwsm/include/tkwsm/Searching/NodesRawData.hpp index a2eea4dd70..23f3051809 100644 --- a/libs/tkwsm/include/tkwsm/Searching/NodesRawData.hpp +++ b/libs/tkwsm/include/tkwsm/Searching/NodesRawData.hpp @@ -16,8 +16,8 @@ #include #include -#include "../Common/LogicalStack.hpp" -#include "../GraphTheoretic/DomainInitialiser.hpp" +#include "tkwsm/Common/LogicalStack.hpp" +#include "tkwsm/GraphTheoretic/DomainInitialiser.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/Searching/SearchBranch.hpp b/libs/tkwsm/include/tkwsm/Searching/SearchBranch.hpp index 2b012146e6..11cfd3ae71 100644 --- a/libs/tkwsm/include/tkwsm/Searching/SearchBranch.hpp +++ b/libs/tkwsm/include/tkwsm/Searching/SearchBranch.hpp @@ -15,15 +15,15 @@ #pragma once #include -#include "../GraphTheoretic/DomainInitialiser.hpp" -#include "../Reducing/DerivedGraphsReducer.hpp" -#include "../Reducing/DistancesReducer.hpp" -#include "../Reducing/HallSetReduction.hpp" -#include "../Reducing/ReducerWrapper.hpp" -#include "DomainsAccessor.hpp" -#include "NodeListTraversal.hpp" -#include "NodesRawData.hpp" -#include "WeightCalculator.hpp" +#include "tkwsm/GraphTheoretic/DomainInitialiser.hpp" +#include "tkwsm/Reducing/DerivedGraphsReducer.hpp" +#include "tkwsm/Reducing/DistancesReducer.hpp" +#include "tkwsm/Reducing/HallSetReduction.hpp" +#include "tkwsm/Reducing/ReducerWrapper.hpp" +#include "tkwsm/Searching/DomainsAccessor.hpp" +#include "tkwsm/Searching/NodeListTraversal.hpp" +#include "tkwsm/Searching/NodesRawData.hpp" +#include "tkwsm/Searching/WeightCalculator.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/Searching/ValueOrdering.hpp b/libs/tkwsm/include/tkwsm/Searching/ValueOrdering.hpp index b98b6bc1c8..b4a207ec65 100644 --- a/libs/tkwsm/include/tkwsm/Searching/ValueOrdering.hpp +++ b/libs/tkwsm/include/tkwsm/Searching/ValueOrdering.hpp @@ -15,7 +15,7 @@ #pragma once #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { class RNG; diff --git a/libs/tkwsm/include/tkwsm/Searching/VariableOrdering.hpp b/libs/tkwsm/include/tkwsm/Searching/VariableOrdering.hpp index 855b6cc788..62751009c2 100644 --- a/libs/tkwsm/include/tkwsm/Searching/VariableOrdering.hpp +++ b/libs/tkwsm/include/tkwsm/Searching/VariableOrdering.hpp @@ -15,7 +15,7 @@ #pragma once #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { class RNG; diff --git a/libs/tkwsm/include/tkwsm/Searching/WeightCalculator.hpp b/libs/tkwsm/include/tkwsm/Searching/WeightCalculator.hpp index 2ce793b393..5a42e94256 100644 --- a/libs/tkwsm/include/tkwsm/Searching/WeightCalculator.hpp +++ b/libs/tkwsm/include/tkwsm/Searching/WeightCalculator.hpp @@ -16,7 +16,7 @@ #include #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/WeightPruning/WeightChecker.hpp b/libs/tkwsm/include/tkwsm/WeightPruning/WeightChecker.hpp index 68bb6aede3..6e57474810 100644 --- a/libs/tkwsm/include/tkwsm/WeightPruning/WeightChecker.hpp +++ b/libs/tkwsm/include/tkwsm/WeightPruning/WeightChecker.hpp @@ -16,8 +16,8 @@ #include #include -#include "../GraphTheoretic/GeneralStructs.hpp" -#include "WeightNogoodDetectorManager.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/WeightPruning/WeightNogoodDetectorManager.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/WeightPruning/WeightNogoodDetector.hpp b/libs/tkwsm/include/tkwsm/WeightPruning/WeightNogoodDetector.hpp index df9a05e75a..e7b8a5c7d8 100644 --- a/libs/tkwsm/include/tkwsm/WeightPruning/WeightNogoodDetector.hpp +++ b/libs/tkwsm/include/tkwsm/WeightPruning/WeightNogoodDetector.hpp @@ -15,7 +15,7 @@ #pragma once #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/WeightPruning/WeightNogoodDetectorManager.hpp b/libs/tkwsm/include/tkwsm/WeightPruning/WeightNogoodDetectorManager.hpp index 86b98c7c93..467acdddeb 100644 --- a/libs/tkwsm/include/tkwsm/WeightPruning/WeightNogoodDetectorManager.hpp +++ b/libs/tkwsm/include/tkwsm/WeightPruning/WeightNogoodDetectorManager.hpp @@ -16,7 +16,7 @@ #include #include -#include "../GraphTheoretic/GeneralStructs.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { From 1bccba2a1e6bb83b0ef857884f0c4d2ce69cd1a2 Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Mon, 22 Jul 2024 17:18:52 +0100 Subject: [PATCH 02/17] Set libraries required by TKET dependencies as PUBLIC --- tket/CMakeLists.txt | 42 +++++----- tket/cmake/tketConfig.cmake.in | 11 +++ tket/test/CMakeLists.txt | 149 ++------------------------------- 3 files changed, 41 insertions(+), 161 deletions(-) diff --git a/tket/CMakeLists.txt b/tket/CMakeLists.txt index 2d5a40a0d3..8e094a432e 100644 --- a/tket/CMakeLists.txt +++ b/tket/CMakeLists.txt @@ -15,6 +15,9 @@ cmake_minimum_required(VERSION 3.23) project(tket CXX) +cmake_policy(SET CMP0022 NEW) + + list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake) find_package(Boost CONFIG REQUIRED) @@ -108,14 +111,14 @@ endif() target_include_directories(tket PUBLIC $ $) -target_link_libraries(tket PRIVATE Boost::headers) -target_link_libraries(tket PRIVATE symengine::symengine) -target_link_libraries(tket PRIVATE Eigen3::Eigen) -target_link_libraries(tket PRIVATE nlohmann_json::nlohmann_json) -target_link_libraries(tket PRIVATE tklog::tklog) -target_link_libraries(tket PRIVATE tkassert::tkassert) -target_link_libraries(tket PRIVATE tkrng::tkrng) -target_link_libraries(tket PRIVATE tktokenswap::tktokenswap) +target_link_libraries(tket PUBLIC Boost::headers) +target_link_libraries(tket PUBLIC symengine::symengine) +target_link_libraries(tket PUBLIC Eigen3::Eigen) +target_link_libraries(tket PUBLIC nlohmann_json::nlohmann_json) +target_link_libraries(tket PUBLIC tklog::tklog) +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) IF(APPLE) target_link_libraries(tket PRIVATE "-flat_namespace") @@ -443,16 +446,13 @@ include(GNUInstallDirs) set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/tket) install(TARGETS tket - EXPORT tket-targets - FILE_SET HEADERS) - -if(MSVC) - install(TARGETS tket + EXPORT tket-targets + FILE_SET HEADERS RUNTIME DESTINATION bin - RUNTIME DESTINATION lib ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib) -endif() + LIBRARY DESTINATION lib + INCLUDES DESTINATION include +) install(EXPORT tket-targets FILE tketTargets.cmake @@ -462,7 +462,8 @@ install(EXPORT tket-targets include(CMakePackageConfigHelpers) -configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/tketConfig.cmake.in +configure_package_config_file( + ${CMAKE_CURRENT_LIST_DIR}/cmake/tketConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/tketConfig.cmake INSTALL_DESTINATION ${INSTALL_CONFIGDIR} ) @@ -472,8 +473,9 @@ install(FILES DESTINATION ${INSTALL_CONFIGDIR} ) -export(EXPORT tket-targets - FILE ${CMAKE_CURRENT_BINARY_DIR}/tketTargets.cmake - NAMESPACE tket::) +#install(EXPORT tket-targets +# FILE ${CMAKE_CURRENT_BINARY_DIR}/tketTargets.cmake +# NAMESPACE tket:: +# DESTINATION ${INSTALL_CONFIGDIR}/cmake/) export(PACKAGE tket) diff --git a/tket/cmake/tketConfig.cmake.in b/tket/cmake/tketConfig.cmake.in index 3fe7dd05e8..0939348878 100644 --- a/tket/cmake/tketConfig.cmake.in +++ b/tket/cmake/tketConfig.cmake.in @@ -1,6 +1,17 @@ +@PACKAGE_INIT@ + get_filename_component(TKET_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) include(CMakeFindDependencyMacro) +find_package(Boost CONFIG REQUIRED) +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() diff --git a/tket/test/CMakeLists.txt b/tket/test/CMakeLists.txt index ecfa0dd601..3d6c1b1470 100644 --- a/tket/test/CMakeLists.txt +++ b/tket/test/CMakeLists.txt @@ -15,21 +15,7 @@ cmake_minimum_required(VERSION 3.23) project(test-tket CXX) -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) -find_package(tkwsm CONFIG REQUIRED) -find_package(Catch2 CONFIG REQUIRED) +find_package(tket CONFIG REQUIRED) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_EXTENSIONS OFF) @@ -56,8 +42,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang") # remove -Wno-deprecated-declarations once https://github.com/boostorg/boost/issues/688 is resolved endif() -add_executable(test-tket - # test utils: +FILE(GLOB_RECURSE JSON_FILES src/*.json) +FILE(GLOB_RECURSE TEST_SOURCES src/test_*.cpp) +SET(TEST_UTILS src/tests_main.cpp src/testutil.cpp src/CircuitsForTesting.cpp @@ -78,125 +65,10 @@ add_executable(test-tket src/TokenSwapping/TestUtils/ProblemGeneration.cpp src/TokenSwapping/TestUtils/TestStatsStructs.cpp src/Gate/GatesData.cpp - src/Simulation/ComparisonFunctions.cpp - # test sources: - src/Utils/test_CosSinDecomposition.cpp - src/Utils/test_HelperFunctions.cpp - src/Utils/test_MatrixAnalysis.cpp - src/Graphs/test_GraphColouring.cpp - src/Graphs/test_GraphFindComponents.cpp - src/Graphs/test_GraphFindMaxClique.cpp - src/Graphs/test_GraphUtils.cpp - src/Graphs/test_DirectedGraph.cpp - src/Graphs/test_ArticulationPoints.cpp - src/Graphs/test_TreeSearch.cpp - src/TokenSwapping/test_ArchitectureMappingEndToEnd.cpp - src/TokenSwapping/test_BestTsaFixedSwapSequences.cpp - src/TokenSwapping/test_DistancesFromArchitecture.cpp - src/TokenSwapping/test_FullTsa.cpp - src/TokenSwapping/test_RiverFlowPathFinder.cpp - src/TokenSwapping/test_SwapsFromQubitMapping.cpp - src/TokenSwapping/test_VariousPartialTsa.cpp - src/Architecture/test_SubgraphMonomorphisms.cpp - src/test_PauliTensor.cpp - src/Ops/test_ClassicalOps.cpp - src/Ops/test_Expression.cpp - src/Ops/test_Ops.cpp - src/OpType/test_OpTypeFunctions.cpp - src/Passes/test_CliffordResynthesis.cpp - src/Passes/test_SynthesiseTK.cpp - src/Passes/test_SynthesiseTket.cpp - src/Gate/test_Rotation.cpp - src/Gate/test_GateUnitaryMatrix.cpp - src/Simulation/test_CircuitSimulator.cpp - src/Simulation/test_PauliExpBoxUnitaryCalculator.cpp - src/Circuit/test_Boxes.cpp - src/Circuit/test_PauliExpBoxes.cpp - src/Circuit/test_Circ.cpp - src/Circuit/test_CircPool.cpp - src/Circuit/test_Symbolic.cpp - src/Circuit/test_ThreeQubitConversion.cpp - src/Circuit/test_Multiplexor.cpp - src/Circuit/test_StatePreparation.cpp - src/Circuit/test_DiagonalBox.cpp - src/Circuit/test_ToffoliBox.cpp - src/Circuit/test_ConjugationBox.cpp - src/Circuit/test_DummyBox.cpp - src/test_UnitaryTableau.cpp - src/test_ChoiMixTableau.cpp - src/test_Diagonalisation.cpp - src/test_PhasePolynomials.cpp - src/test_PauliGraph.cpp - src/test_Architectures.cpp - src/test_ArchitectureAwareSynthesis.cpp - src/Placement/test_GraphPlacement.cpp - src/Placement/test_LinePlacement.cpp - src/Placement/test_NoiseAwarePlacement.cpp - src/Placement/test_Placement.cpp - src/Placement/test_NeighbourPlacements.cpp - src/Transformations/test_RedundancyRemoval.cpp - src/test_MappingVerification.cpp - src/test_MappingFrontier.cpp - src/test_RoutingMethod.cpp - src/test_MappingManager.cpp - src/test_LexicographicalComparison.cpp - src/test_LexiRoute.cpp - src/test_AASRoute.cpp - src/test_MultiGateReorder.cpp - src/test_BoxDecompRoutingMethod.cpp - src/test_RoutingPasses.cpp - src/test_DeviceCharacterisation.cpp - src/test_Clifford.cpp - src/test_MeasurementSetup.cpp - src/test_Partition.cpp - src/test_MeasurementReduction.cpp - src/test_PhaseGadget.cpp - src/test_Rebase.cpp - src/test_PhasedXFrontier.cpp - src/test_GlobalisePhasedX.cpp - src/test_Synthesis.cpp - src/test_TwoQubitCanonical.cpp - src/test_ControlDecomp.cpp - src/test_Combinators.cpp - src/test_Predicates.cpp - src/test_CompilerPass.cpp - src/test_ContextOpt.cpp - src/test_FrameRandomisation.cpp - src/test_Assertion.cpp - src/test_json.cpp - src/test_Path.cpp - src/test_SteinerTree.cpp - src/test_SteinerForest.cpp - src/test_wasm.cpp - src/test_RoundAngles.cpp - src/test_GreedyPauli.cpp - src/ZX/test_ZXDiagram.cpp - src/ZX/test_ZXAxioms.cpp - src/ZX/test_ZXSimp.cpp - src/ZX/test_ZXRebase.cpp - src/ZX/test_Flow.cpp - src/ZX/test_ZXConverters.cpp - src/ZX/test_ZXExtraction.cpp - ) - -if (NOT TARGET gmp::gmp) - add_library(gmp::gmp ALIAS PkgConfig::gmp) -endif() -if (NOT TARGET symengine::symengine) - add_library(symengine::symengine ALIAS symengine) -endif() + src/Simulation/ComparisonFunctions.cpp) -target_link_libraries(test-tket PRIVATE tket) -target_link_libraries(test-tket PRIVATE Boost::headers) -target_link_libraries(test-tket PRIVATE gmp::gmp) -target_link_libraries(test-tket PRIVATE symengine::symengine) -target_link_libraries(test-tket PRIVATE Eigen3::Eigen) -target_link_libraries(test-tket PRIVATE Catch2::Catch2WithMain) -target_link_libraries(test-tket PRIVATE tklog::tklog) -target_link_libraries(test-tket PRIVATE tkrng::tkrng) -target_link_libraries(test-tket PRIVATE tkassert::tkassert) -target_link_libraries(test-tket PRIVATE tktokenswap::tktokenswap) -target_link_libraries(test-tket PRIVATE nlohmann_json::nlohmann_json) +add_executable(test-tket ${TEST_UTILS} ${TEST_SOURCES}) +target_link_libraries(test-tket PRIVATE tket::tket) set(WITH_COVERAGE no CACHE BOOL "Link library with profiling for test coverage") IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -205,12 +77,7 @@ IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") ENDIF() ENDIF() -install(FILES - src/test_circuits/lexiroute_circuit.json - src/test_circuits/lexiroute_circuit_relabel_to_ancilla.json - src/test_circuits/bug777_circuit.json - src/test_architectures/ibm_montreal.json - DESTINATION bin) +install(FILES ${JSON_FILES} DESTINATION bin) install(TARGETS test-tket DESTINATION "." RUNTIME DESTINATION bin From 197782ba5760beafa157be0e5f17ca9ad347fd5c Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Mon, 22 Jul 2024 17:25:20 +0100 Subject: [PATCH 03/17] Updated pytket's CMake build and nix build wrapper Previously Nix had its own special build, but with the changes to tket's CMake this is no longer necessary. As such, Nix now uses the CMake build path, which has only had to change in one manner: ./build had to be renamed to ./cmake_build, so as not to remove python files previously placed there by setup.py. --- nix-support/pytket.nix | 69 +++++++++++++++--------------------------- pytket/CMakeLists.txt | 35 ++++++--------------- pytket/setup.py | 43 ++++++-------------------- 3 files changed, 44 insertions(+), 103 deletions(-) diff --git a/nix-support/pytket.nix b/nix-support/pytket.nix index 8dae5ff3dd..797551a345 100644 --- a/nix-support/pytket.nix +++ b/nix-support/pytket.nix @@ -17,30 +17,23 @@ let }; }); in { - binders = super.stdenv.mkDerivation { - name = "binders"; - nativeBuildInputs = [ + pytket = super.python3.pkgs.buildPythonPackage { + pname = "pytket"; + inherit version; + src = ../pytket; + nativeBuildInputs = with super.python3.pkgs; [ + setuptools super.cmake super.pkg-config - super.python3Packages.pybind11 - super.pybind11_json ]; - cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ]; propagatedBuildInputs = [ super.tket + super.pybind11_json ]; - unpackPhase = '' - cp -r ${../pytket/binders} binders; - cp ${../pytket/CMakeLists.txt} CMakeLists.txt; - ''; - }; - pytket = super.python3.pkgs.buildPythonPackage { - pname = "pytket"; - inherit version; - propagatedBuildInputs = with super.python3.pkgs; [ - self.binders + dependencies = with super.python3.pkgs; [ super.lark super.qwasm + pybind11 graphviz networkx jinja2 @@ -49,35 +42,23 @@ in { numpy typing-extensions ]; + configurePhase = "true"; # skip configure + # (by default it runs cmake, which we + # want python to manage instead) + preBuild = '' + # explicitly provide the pytket version to setup.py + # and to _version.py, as we can't rely on git version + # information in nix. - unpackPhase = '' - cp -r ${../pytket/pytket} pytket; - cp ${../pytket/package.md} package.md; - cp -r ${../schemas} schemas; - cp -r ${../pytket/mypy.ini} mypy.ini; - - # The usual build depends on setuptools-scm to extract the version. - # We have already extracted the version within nix, so we can simply - # inject it into setup.py. - cat ${../pytket/setup.py} | sed 's/setup(/setup(version="${version}",/' > setup.py; - - mkdir test_root; - cp -r ${../pytket/tests} test_root/tests; - # hardcode the version extracted from docs/conf.py. - chmod 755 pytket + cat ${../pytket/setup.py} \ + | sed 's/setup(/setup(version="${version}",/' \ + > setup.py; echo '__version__ = "${version}"' > pytket/_version.py; - ''; - preBuild = '' - export USE_NIX=1; - ''; - postFixup = '' - # these directories aren't copied by setup.py, so we do it manually - cp -r ${ - ../pytket/pytket/circuit/display/js - } $out/lib/python${super.python3.pythonVersion}/site-packages/pytket/circuit/display/js; - cp -r ${ - ../pytket/pytket/circuit/display/static - } $out/lib/python${super.python3.pythonVersion}/site-packages/pytket/circuit/display/static; + + # instruct python to build with cmake instead of conan, + # and to build in a temporary directory. + export NO_CONAN=1; + export INSTALL_DIR=$(mktemp -d); ''; checkInputs = with super.python3.pkgs; [ mypy @@ -100,6 +81,6 @@ in { cd test_root/tests; python -m pytest -s . ''; - doCheck = true; + doCheck = false; #TODO revert to true }; } diff --git a/pytket/CMakeLists.txt b/pytket/CMakeLists.txt index 9b66d5c6c2..3f23763f5f 100644 --- a/pytket/CMakeLists.txt +++ b/pytket/CMakeLists.txt @@ -16,21 +16,12 @@ cmake_minimum_required(VERSION 3.23) project(pytket CXX) add_definitions(-DPYBIND11_DETAILED_ERROR_MESSAGES) -find_package(Boost CONFIG REQUIRED) -find_package(Eigen3 CONFIG REQUIRED) find_package(tket CONFIG REQUIRED) -find_package(tklog CONFIG REQUIRED) -find_package(tkassert CONFIG REQUIRED) -find_package(tkrng CONFIG REQUIRED) -find_package(tktokenswap CONFIG REQUIRED) -find_package(tkwsm CONFIG REQUIRED) -find_package(tkassert 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(gmp CONFIG) +#if (NOT gmp_FOUND) +# find_package(PkgConfig REQUIRED) +# pkg_search_module(gmp REQUIRED IMPORTED_TARGET gmp) +#endif() find_package(pybind11 CONFIG REQUIRED) find_package(pybind11_json CONFIG REQUIRED) @@ -71,22 +62,14 @@ endif() if (NOT TARGET pybind11_json::pybind11_json) add_library(pybind11_json::pybind11_json ALIAS pybind11_json) endif() -if (NOT TARGET gmp::gmp) - add_library(gmp::gmp ALIAS PkgConfig::gmp) -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() list(APPEND lib_deps tket::tket - tklog::tklog - tkassert::tkassert pybind11::headers - pybind11_json::pybind11_json - Eigen3::Eigen - gmp::gmp - symengine::symengine) + pybind11_json::pybind11_json) if (WIN32) list(APPEND lib_deps bcrypt) # For boost::uuid endif() diff --git a/pytket/setup.py b/pytket/setup.py index bf365ece59..722408bbbf 100755 --- a/pytket/setup.py +++ b/pytket/setup.py @@ -57,7 +57,7 @@ def run(self): os.path.dirname(self.get_ext_fullpath(self.extensions[0].name)) ) extsource = self.extensions[0].sourcedir - build_dir = os.path.join(extsource, "build") + build_dir = os.path.join(extsource, "cmake_build") shutil.rmtree(build_dir, ignore_errors=True) os.mkdir(build_dir) install_dir = os.getenv("INSTALL_DIR") @@ -75,9 +75,8 @@ def run(self): ) subprocess.run(["cmake", "--install", os.curdir], cwd=build_dir) lib_folder = os.path.join(install_dir, "lib") - lib_names = ["libtklog.so", "libtket.so"] ext_suffix = get_config_var("EXT_SUFFIX") - lib_names.extend(f"{binder}{ext_suffix}" for binder in binders) + lib_names = [f"{binder}{ext_suffix}" for binder in binders] # TODO make the above generic os.makedirs(extdir, exist_ok=True) for lib_name in lib_names: @@ -128,38 +127,10 @@ def run(self): shutil.copy(libpath, extdir) -class NixBuild(build_ext): - def run(self): - self.check_extensions_list(self.extensions) - extdir = os.path.abspath( - os.path.dirname(self.get_ext_fullpath(self.extensions[0].name)) - ) - if os.path.exists(extdir): - shutil.rmtree(extdir) - os.makedirs(extdir) - - nix_ldflags = os.environ["NIX_LDFLAGS"].split() - build_inputs = os.environ["propagatedBuildInputs"].split() - - binders = [f"{l}/lib" for l in build_inputs if "-binders" in l] - for binder in binders: - for lib in os.listdir(binder): - libpath = os.path.join(binder, lib) - if not os.path.isdir(libpath): - shutil.copy(libpath, extdir) - - for interface_file in os.listdir("pytket/_tket"): - if interface_file.endswith(".pyi") or interface_file.endswith(".py"): - shutil.copy(os.path.join("pytket/_tket", interface_file), extdir) - - plat_name = os.getenv("WHEEL_PLAT_NAME") - def get_build_ext(): - if os.getenv("USE_NIX"): - return NixBuild - elif os.getenv("NO_CONAN"): + if os.getenv("NO_CONAN"): return CMakeBuild else: return ConanBuild @@ -228,6 +199,12 @@ def finalize_options(self): "Topic :: Scientific/Engineering", ], include_package_data=True, - package_data={"pytket": ["py.typed"]}, + package_data={ + "pytket": [ + "py.typed", + "circuit/display/js/*.js", + "circuit/display/static/*.html" + ] + }, zip_safe=False, ) From 1cc8d9351d9deb9302bcc1cb1edb0327bc313c68 Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Thu, 25 Jul 2024 11:34:55 +0100 Subject: [PATCH 04/17] Increasing compatibility with existing setup Previously, the build directory being CWD/build caused problems in the pytket setup.py process in a Nix build. Changing this to CWD/cmake_build fixed the issue temporarily. Now I am defaulting back to CWD/build, but allowing another directory to be provided with a BUILD_DIR environment variable. This means the setup should be, for all intents and purposes, identical on non-nix builds. --- nix-support/pytket.nix | 1 + pytket/CMakeLists.txt | 8 -------- pytket/setup.py | 19 +++++++++++++++---- tket/test/CMakeLists.txt | 3 ++- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/nix-support/pytket.nix b/nix-support/pytket.nix index 797551a345..301636731e 100644 --- a/nix-support/pytket.nix +++ b/nix-support/pytket.nix @@ -59,6 +59,7 @@ in { # and to build in a temporary directory. export NO_CONAN=1; export INSTALL_DIR=$(mktemp -d); + export BUILD_DIR=$(mktemp -d); ''; checkInputs = with super.python3.pkgs; [ mypy diff --git a/pytket/CMakeLists.txt b/pytket/CMakeLists.txt index 3f23763f5f..b1711d889d 100644 --- a/pytket/CMakeLists.txt +++ b/pytket/CMakeLists.txt @@ -17,11 +17,6 @@ project(pytket CXX) add_definitions(-DPYBIND11_DETAILED_ERROR_MESSAGES) find_package(tket 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(pybind11 CONFIG REQUIRED) find_package(pybind11_json CONFIG REQUIRED) @@ -62,9 +57,6 @@ endif() if (NOT TARGET pybind11_json::pybind11_json) add_library(pybind11_json::pybind11_json ALIAS pybind11_json) endif() -#if (NOT TARGET gmp::gmp) -# add_library(gmp::gmp ALIAS PkgConfig::gmp) -#endif() list(APPEND lib_deps tket::tket diff --git a/pytket/setup.py b/pytket/setup.py index 722408bbbf..b6e1e16540 100755 --- a/pytket/setup.py +++ b/pytket/setup.py @@ -57,12 +57,23 @@ def run(self): os.path.dirname(self.get_ext_fullpath(self.extensions[0].name)) ) extsource = self.extensions[0].sourcedir - build_dir = os.path.join(extsource, "cmake_build") - shutil.rmtree(build_dir, ignore_errors=True) - os.mkdir(build_dir) + build_dir = os.getenv("BUILD_DIR") or os.path.join(extsource, "build") + if os.path.exists(build_dir): + # Remove contents of build_dir, but not the directory itself. + # This avoids issues with a BUILD_DIR being provided but with + # permission settings that prevent it being removed. + for f in os.listdir(build_dir): + fpath = os.path.join(build_dir, f) + if os.path.isdir(fpath): + shutil.rmtree(fpath) + else: + os.remove(fpath) + else: + os.mkdir(build_dir) + install_dir = os.getenv("INSTALL_DIR") subprocess.run( - ["cmake", f"-DCMAKE_INSTALL_PREFIX={install_dir}", os.pardir], cwd=build_dir + ["cmake", f"-DCMAKE_INSTALL_PREFIX={install_dir}", os.path.abspath(os.curdir)], cwd=build_dir ) subprocess.run( [ diff --git a/tket/test/CMakeLists.txt b/tket/test/CMakeLists.txt index 3d6c1b1470..3cfa748f9c 100644 --- a/tket/test/CMakeLists.txt +++ b/tket/test/CMakeLists.txt @@ -16,6 +16,7 @@ cmake_minimum_required(VERSION 3.23) project(test-tket CXX) find_package(tket CONFIG REQUIRED) +find_package(Catch2 CONFIG REQUIRED) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_EXTENSIONS OFF) @@ -68,7 +69,7 @@ SET(TEST_UTILS src/Simulation/ComparisonFunctions.cpp) add_executable(test-tket ${TEST_UTILS} ${TEST_SOURCES}) -target_link_libraries(test-tket PRIVATE tket::tket) +target_link_libraries(test-tket PRIVATE tket::tket Catch2::Catch2WithMain) set(WITH_COVERAGE no CACHE BOOL "Link library with profiling for test coverage") IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") From c481e58eb74784a71157083050558a81d7594f34 Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Thu, 25 Jul 2024 11:58:47 +0100 Subject: [PATCH 05/17] Reformatted setup.py --- pytket/setup.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pytket/setup.py b/pytket/setup.py index b6e1e16540..301b46c310 100755 --- a/pytket/setup.py +++ b/pytket/setup.py @@ -73,7 +73,12 @@ def run(self): install_dir = os.getenv("INSTALL_DIR") subprocess.run( - ["cmake", f"-DCMAKE_INSTALL_PREFIX={install_dir}", os.path.abspath(os.curdir)], cwd=build_dir + [ + "cmake", + f"-DCMAKE_INSTALL_PREFIX={install_dir}", + os.path.abspath(os.curdir), + ], + cwd=build_dir, ) subprocess.run( [ @@ -140,6 +145,7 @@ def run(self): plat_name = os.getenv("WHEEL_PLAT_NAME") + def get_build_ext(): if os.getenv("NO_CONAN"): return CMakeBuild @@ -214,7 +220,7 @@ def finalize_options(self): "pytket": [ "py.typed", "circuit/display/js/*.js", - "circuit/display/static/*.html" + "circuit/display/static/*.html", ] }, zip_safe=False, From 6a5eac2c02795473d57000dcec5fd11340a0678a Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:34:02 +0100 Subject: [PATCH 06/17] Revert prior export removal in CMakeLists.txt --- tket/CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tket/CMakeLists.txt b/tket/CMakeLists.txt index 8e094a432e..03ef960b19 100644 --- a/tket/CMakeLists.txt +++ b/tket/CMakeLists.txt @@ -473,9 +473,8 @@ install(FILES DESTINATION ${INSTALL_CONFIGDIR} ) -#install(EXPORT tket-targets -# FILE ${CMAKE_CURRENT_BINARY_DIR}/tketTargets.cmake -# NAMESPACE tket:: -# DESTINATION ${INSTALL_CONFIGDIR}/cmake/) +export(EXPORT tket-targets + FILE ${CMAKE_CURRENT_BINARY_DIR}/tketTargets.cmake + NAMESPACE tket::) export(PACKAGE tket) From 4e46a5b3f37df4d7ca17ef0c75233a55083ef19b Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Thu, 25 Jul 2024 14:54:03 +0100 Subject: [PATCH 07/17] Updated cmake for tests Previously tests were compiled into executables, but not registered with ctest using catch's catch_discover_tests. I've added that in, and added enable_testing to tket's CMakeLists.txt in the presence of test flags. This also allows for a simplification of the nix derivation - TKET and its tests are now built as one project, then checked. --- flake.lock | 6 ++--- flake.nix | 3 ++- nix-support/tket.nix | 44 +++++++++++++++----------------- pytket/conanfile.py | 2 +- tket/CMakeLists.txt | 3 +++ tket/conanfile.py | 2 +- tket/proptest/CMakeLists.txt | 29 ++------------------- tket/proptest/src/proptest.cpp | 6 +++-- tket/test/CMakeLists.txt | 18 +++++++++++-- tket/test/src/test_LexiRoute.cpp | 8 +++--- 10 files changed, 56 insertions(+), 65 deletions(-) diff --git a/flake.lock b/flake.lock index dacae6f678..1ff706a830 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1721812269, - "narHash": "sha256-qcI00YJBrLMmyPktlTS0UUvX/qGA7tVp73K6lJpRdy4=", + "lastModified": 1721906734, + "narHash": "sha256-NU8lvif2nGmJnk5UwMwTtrPLTWTW2KtqRrC9c6zxvVQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5c31ee6b23a06da40bf2dfc9017a60308a4adc53", + "rev": "62a20c2a9c543c076df06c482efc37ff91b2aff2", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 44dddc80e0..842d2c0145 100644 --- a/flake.nix +++ b/flake.nix @@ -27,9 +27,10 @@ }; devShells = { default = pkgs.mkShell { buildInputs = [ pkgs.tket pkgs.pytket ]; }; + conan = pkgs.mkShell { buildInputs = with pkgs; [ conan cmake ninja gcc python3 ]; }; }; checks = { - tket-tests = pkgs.run-tket-tests; + tket-tests = pkgs.tket; pytket-tests = pkgs.pytket; }; }); diff --git a/nix-support/tket.nix b/nix-support/tket.nix index 5dc0fa43a2..6223c1f282 100644 --- a/nix-support/tket.nix +++ b/nix-support/tket.nix @@ -1,9 +1,9 @@ self: super: let - postFixup = import ./includes-fixup.nix; + #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 = '' @@ -11,34 +11,30 @@ let 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; + inherit src; 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; - 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; - ''; + ++ (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; + #inherit postFixup; }; } diff --git a/pytket/conanfile.py b/pytket/conanfile.py index 6bc2dc7af3..ac4c88c7ef 100644 --- a/pytket/conanfile.py +++ b/pytket/conanfile.py @@ -32,7 +32,7 @@ def package(self): cmake.install() def requirements(self): - self.requires("tket/1.3.17@tket/stable") + self.requires("tket/1.3.18@tket/stable") self.requires("tklog/0.3.3@tket/stable") self.requires("tkrng/0.3.3@tket/stable") self.requires("tkassert/0.3.4@tket/stable") diff --git a/tket/CMakeLists.txt b/tket/CMakeLists.txt index 03ef960b19..b772854277 100644 --- a/tket/CMakeLists.txt +++ b/tket/CMakeLists.txt @@ -435,6 +435,9 @@ target_sources(tket include/tket/Predicates/Predicates.hpp ) +if (BUILD_TKET_TEST OR BUILD_TKET_PROPTEST) + enable_testing() +endif() if (BUILD_TKET_TEST) add_subdirectory(test) endif() diff --git a/tket/conanfile.py b/tket/conanfile.py index 7c4ed09f49..677220d90e 100644 --- a/tket/conanfile.py +++ b/tket/conanfile.py @@ -23,7 +23,7 @@ class TketConan(ConanFile): name = "tket" - version = "1.3.17" + version = "1.3.18" package_type = "library" license = "Apache 2" homepage = "https://github.com/CQCL/tket" diff --git a/tket/proptest/CMakeLists.txt b/tket/proptest/CMakeLists.txt index e13032aeed..3d118d809e 100644 --- a/tket/proptest/CMakeLists.txt +++ b/tket/proptest/CMakeLists.txt @@ -15,20 +15,6 @@ cmake_minimum_required(VERSION 3.23) project(proptest-tket CXX) -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) -find_package(tkwsm CONFIG REQUIRED) find_package(rapidcheck CONFIG REQUIRED) set(CMAKE_CXX_STANDARD 20) @@ -61,26 +47,15 @@ add_executable(proptest-tket src/proptest.cpp ) -if (NOT TARGET gmp::gmp) - add_library(gmp::gmp ALIAS PkgConfig::gmp) -endif() -if (NOT TARGET symengine::symengine) - add_library(symengine::symengine ALIAS symengine) -endif() if (NOT TARGET rapidcheck::rapidcheck) add_library(rapidcheck::rapidcheck ALIAS rapidcheck) endif() target_link_libraries(proptest-tket PRIVATE tket) -target_link_libraries(proptest-tket PRIVATE Boost::headers) -target_link_libraries(proptest-tket PRIVATE gmp::gmp) -target_link_libraries(proptest-tket PRIVATE symengine::symengine) -target_link_libraries(proptest-tket PRIVATE Eigen3::Eigen) -target_link_libraries(proptest-tket PRIVATE tklog::tklog) -target_link_libraries(proptest-tket PRIVATE tkassert::tkassert) -target_link_libraries(proptest-tket PRIVATE nlohmann_json::nlohmann_json) target_link_libraries(proptest-tket PRIVATE rapidcheck::rapidcheck) + + install(TARGETS proptest-tket DESTINATION "." RUNTIME DESTINATION bin ARCHIVE DESTINATION lib diff --git a/tket/proptest/src/proptest.cpp b/tket/proptest/src/proptest.cpp index 02a2bbc7b7..2dfb157dc8 100644 --- a/tket/proptest/src/proptest.cpp +++ b/tket/proptest/src/proptest.cpp @@ -14,8 +14,8 @@ #include -#include "ComparisonFunctions.hpp" -#include "rapidcheck.h" +#include + #include "tket/Architecture/Architecture.hpp" #include "tket/Circuit/Circuit.hpp" #include "tket/Circuit/Simulation/CircuitSimulator.hpp" @@ -25,6 +25,8 @@ #include "tket/Transformations/ContextualReduction.hpp" #include "tket/Transformations/Transform.hpp" +#include "ComparisonFunctions.hpp" + using namespace tket; #define ALL_PASSES(DO) \ diff --git a/tket/test/CMakeLists.txt b/tket/test/CMakeLists.txt index 3cfa748f9c..de68b2ba65 100644 --- a/tket/test/CMakeLists.txt +++ b/tket/test/CMakeLists.txt @@ -15,8 +15,9 @@ cmake_minimum_required(VERSION 3.23) project(test-tket CXX) -find_package(tket CONFIG REQUIRED) find_package(Catch2 CONFIG REQUIRED) +include(CTest) +include(Catch) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_EXTENSIONS OFF) @@ -69,7 +70,20 @@ SET(TEST_UTILS src/Simulation/ComparisonFunctions.cpp) add_executable(test-tket ${TEST_UTILS} ${TEST_SOURCES}) -target_link_libraries(test-tket PRIVATE tket::tket Catch2::Catch2WithMain) +target_link_libraries(test-tket PUBLIC tket Catch2::Catch2WithMain) + +add_custom_target(copy-test_circuits ALL + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/src/test_circuits + ${CMAKE_CURRENT_BINARY_DIR}/test_circuits) + +add_custom_target(copy-test_architectures ALL + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/src/test_architectures + ${CMAKE_CURRENT_BINARY_DIR}/test_architectures) + +add_dependencies(test-tket copy-test_circuits copy-test_architectures) +catch_discover_tests(test-tket) set(WITH_COVERAGE no CACHE BOOL "Link library with profiling for test coverage") IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/tket/test/src/test_LexiRoute.cpp b/tket/test/src/test_LexiRoute.cpp index b333996eb3..72cd334377 100644 --- a/tket/test/src/test_LexiRoute.cpp +++ b/tket/test/src/test_LexiRoute.cpp @@ -1626,7 +1626,7 @@ SCENARIO("Lexi relabel with partially mapped circuit") { } SCENARIO("Test failing case") { - std::ifstream circuit_file("lexiroute_circuit.json"); + std::ifstream circuit_file("test_circuits/lexiroute_circuit.json"); nlohmann::json j = nlohmann::json::parse(circuit_file); auto c = j.get(); Architecture arc(std::vector>{ @@ -2173,7 +2173,7 @@ SCENARIO( {5, 6}, {5, 9}, {6, 8}, {7, 8}, {9, 8}, {9, 10}, {11, 3}, {11, 10}, {11, 12}, {12, 2}, {13, 1}, {13, 12}}; Architecture architecture(coupling_map); - std::ifstream circuit_file("lexiroute_circuit_relabel_to_ancilla.json"); + std::ifstream circuit_file("test_circuits/lexiroute_circuit_relabel_to_ancilla.json"); nlohmann::json j = nlohmann::json::parse(circuit_file); auto c = j.get(); std::map p_map = { @@ -2334,10 +2334,10 @@ SCENARIO( } SCENARIO("Lexi route produces incorrect bimaps") { // segfault Github #777 - std::ifstream arch_file("ibm_montreal.json"); + std::ifstream arch_file("test_architectures/ibm_montreal.json"); nlohmann::json j_arch = nlohmann::json::parse(arch_file); auto arch = j_arch.get(); - std::ifstream circ_file("bug777_circuit.json"); + std::ifstream circ_file("test_circuits/bug777_circuit.json"); nlohmann::json j_circ = nlohmann::json::parse(circ_file); auto circ = j_circ.get(); std::map p_map = { From 85056ad87bbf4d2ec86703553dfed4a0a0e7b33a Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:06:33 +0100 Subject: [PATCH 08/17] Remove now-defunct includes-fixup (include paths are now uniform) --- nix-support/includes-fixup.nix | 7 ------- nix-support/libs.nix | 6 ------ nix-support/tket.nix | 2 -- 3 files changed, 15 deletions(-) delete mode 100644 nix-support/includes-fixup.nix diff --git a/nix-support/includes-fixup.nix b/nix-support/includes-fixup.nix deleted file mode 100644 index b9a1fa43d2..0000000000 --- a/nix-support/includes-fixup.nix +++ /dev/null @@ -1,7 +0,0 @@ -'' - # fix bogus include paths - # trick found here: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/crc32c/default.nix - for f in $(find $out/lib/cmake -name '*.cmake'); do - substituteInPlace "$f" --replace "\''${_IMPORT_PREFIX}/$out/include" "\''${_IMPORT_PREFIX}/include" - done -'' diff --git a/nix-support/libs.nix b/nix-support/libs.nix index 59f1f65524..88e488b3d3 100644 --- a/nix-support/libs.nix +++ b/nix-support/libs.nix @@ -1,21 +1,18 @@ 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"; @@ -23,7 +20,6 @@ in { nativeBuildInputs = [ super.cmake ]; buildInputs = [ self.tklog ]; cmakeFlags = default-flags; - inherit postFixup; }; tktokenswap = super.stdenv.mkDerivation { name = "tktokenswap"; @@ -31,7 +27,6 @@ in { nativeBuildInputs = [ super.cmake super.boost ]; buildInputs = [ self.tklog self.tkassert self.tkrng ]; cmakeFlags = default-flags; - inherit postFixup; }; tkwsm = super.stdenv.mkDerivation { name = "tkwsm"; @@ -39,7 +34,6 @@ in { 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 ]; } diff --git a/nix-support/tket.nix b/nix-support/tket.nix index 6223c1f282..70d9c68a89 100644 --- a/nix-support/tket.nix +++ b/nix-support/tket.nix @@ -1,6 +1,5 @@ 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 src = super.stdenv.mkDerivation { @@ -35,6 +34,5 @@ in { "-DBUILD_TKET_PROPTEST=OFF" ]; doCheck = true; - #inherit postFixup; }; } From f95582b821f64afc528c523d02dd487f9bc0471f Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:08:45 +0100 Subject: [PATCH 09/17] Reverted previous disabling of pytket testing upon build --- nix-support/pytket.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-support/pytket.nix b/nix-support/pytket.nix index 301636731e..6652f176eb 100644 --- a/nix-support/pytket.nix +++ b/nix-support/pytket.nix @@ -82,6 +82,6 @@ in { cd test_root/tests; python -m pytest -s . ''; - doCheck = false; #TODO revert to true + doCheck = true; }; } From 13802cc792494149c2b63b4e188fadd89e46b664 Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:12:35 +0100 Subject: [PATCH 10/17] Applying clang-format --- libs/tktokenswap/include/tktokenswap/DistanceFunctions.hpp | 2 +- .../include/tktokenswap/SwapListSegmentOptimiser.hpp | 2 +- .../include/tktokenswap/SwapListTableOptimiser.hpp | 2 +- libs/tktokenswap/src/TableLookup/VertexMapResizing.hpp | 2 +- libs/tktokenswap/src/TrivialTSA.cpp | 3 +-- libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolver.hpp | 4 ++-- libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionData.hpp | 2 +- .../InitPlacement/MonteCarloCompleteTargetSolution.hpp | 2 +- tket/proptest/src/proptest.cpp | 7 +++---- tket/test/src/test_LexiRoute.cpp | 3 ++- 10 files changed, 14 insertions(+), 15 deletions(-) diff --git a/libs/tktokenswap/include/tktokenswap/DistanceFunctions.hpp b/libs/tktokenswap/include/tktokenswap/DistanceFunctions.hpp index eda8e49d3b..9ca39f5727 100644 --- a/libs/tktokenswap/include/tktokenswap/DistanceFunctions.hpp +++ b/libs/tktokenswap/include/tktokenswap/DistanceFunctions.hpp @@ -18,8 +18,8 @@ #include #include -#include "tktokenswap/VertexMappingFunctions.hpp" #include "tktokenswap/DistancesInterface.hpp" +#include "tktokenswap/VertexMappingFunctions.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/include/tktokenswap/SwapListSegmentOptimiser.hpp b/libs/tktokenswap/include/tktokenswap/SwapListSegmentOptimiser.hpp index 4d8b54ccd0..9dd61f72b5 100644 --- a/libs/tktokenswap/include/tktokenswap/SwapListSegmentOptimiser.hpp +++ b/libs/tktokenswap/include/tktokenswap/SwapListSegmentOptimiser.hpp @@ -20,8 +20,8 @@ #include #include "tktokenswap/PartialMappingLookup.hpp" -#include "tktokenswap/VertexMapResizing.hpp" #include "tktokenswap/SwapFunctions.hpp" +#include "tktokenswap/VertexMapResizing.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/include/tktokenswap/SwapListTableOptimiser.hpp b/libs/tktokenswap/include/tktokenswap/SwapListTableOptimiser.hpp index aa5641634d..3006387fdc 100644 --- a/libs/tktokenswap/include/tktokenswap/SwapListTableOptimiser.hpp +++ b/libs/tktokenswap/include/tktokenswap/SwapListTableOptimiser.hpp @@ -18,9 +18,9 @@ #include #include "tktokenswap/PartialMappingLookup.hpp" +#include "tktokenswap/SwapListOptimiser.hpp" #include "tktokenswap/SwapListSegmentOptimiser.hpp" #include "tktokenswap/VertexMapResizing.hpp" -#include "tktokenswap/SwapListOptimiser.hpp" /// TODO: The swap table optimiser currently tries to optimise many segments; /// solving ~2300 problems with Best TSA takes ~20 seconds, most of which diff --git a/libs/tktokenswap/src/TableLookup/VertexMapResizing.hpp b/libs/tktokenswap/src/TableLookup/VertexMapResizing.hpp index d41d137c71..2aa54fadc6 100644 --- a/libs/tktokenswap/src/TableLookup/VertexMapResizing.hpp +++ b/libs/tktokenswap/src/TableLookup/VertexMapResizing.hpp @@ -19,8 +19,8 @@ #include #include -#include "tktokenswap/VertexMappingFunctions.hpp" #include "tktokenswap/NeighboursInterface.hpp" +#include "tktokenswap/VertexMappingFunctions.hpp" namespace tket { namespace tsa_internal { diff --git a/libs/tktokenswap/src/TrivialTSA.cpp b/libs/tktokenswap/src/TrivialTSA.cpp index 199d6d775a..2e5e372456 100644 --- a/libs/tktokenswap/src/TrivialTSA.cpp +++ b/libs/tktokenswap/src/TrivialTSA.cpp @@ -18,12 +18,11 @@ #include #include +#include "CyclicShiftCostEstimate.hpp" #include "tktokenswap/DistanceFunctions.hpp" #include "tktokenswap/GeneralFunctions.hpp" #include "tktokenswap/VertexSwapResult.hpp" -#include "CyclicShiftCostEstimate.hpp" - using std::vector; namespace tket { diff --git a/libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolver.hpp b/libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolver.hpp index ce1efcccc0..0d68077a47 100644 --- a/libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolver.hpp +++ b/libs/tkwsm/include/tkwsm/EndToEndWrappers/MainSolver.hpp @@ -16,11 +16,11 @@ #include #include +#include "tkwsm/EndToEndWrappers/MainSolverParameters.hpp" +#include "tkwsm/EndToEndWrappers/SolutionData.hpp" #include "tkwsm/GraphTheoretic/NeighboursData.hpp" #include "tkwsm/GraphTheoretic/VertexRelabelling.hpp" #include "tkwsm/Searching/SearchBranch.hpp" -#include "tkwsm/EndToEndWrappers/MainSolverParameters.hpp" -#include "tkwsm/EndToEndWrappers/SolutionData.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionData.hpp b/libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionData.hpp index e10912ace8..4991fe2e9f 100644 --- a/libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionData.hpp +++ b/libs/tkwsm/include/tkwsm/EndToEndWrappers/SolutionData.hpp @@ -15,8 +15,8 @@ #pragma once #include -#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" #include "tkwsm/EndToEndWrappers/SolutionWSM.hpp" +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/libs/tkwsm/include/tkwsm/InitPlacement/MonteCarloCompleteTargetSolution.hpp b/libs/tkwsm/include/tkwsm/InitPlacement/MonteCarloCompleteTargetSolution.hpp index 0b50f5de80..58c7fe6b03 100644 --- a/libs/tkwsm/include/tkwsm/InitPlacement/MonteCarloCompleteTargetSolution.hpp +++ b/libs/tkwsm/include/tkwsm/InitPlacement/MonteCarloCompleteTargetSolution.hpp @@ -17,10 +17,10 @@ #include #include +#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" #include "tkwsm/InitPlacement/FastRandomBits.hpp" #include "tkwsm/InitPlacement/MonteCarloManager.hpp" #include "tkwsm/InitPlacement/SolutionJumper.hpp" -#include "tkwsm/GraphTheoretic/GeneralStructs.hpp" namespace tket { namespace WeightedSubgraphMonomorphism { diff --git a/tket/proptest/src/proptest.cpp b/tket/proptest/src/proptest.cpp index 2dfb157dc8..99eea8753f 100644 --- a/tket/proptest/src/proptest.cpp +++ b/tket/proptest/src/proptest.cpp @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include +#include + +#include "ComparisonFunctions.hpp" #include "tket/Architecture/Architecture.hpp" #include "tket/Circuit/Circuit.hpp" #include "tket/Circuit/Simulation/CircuitSimulator.hpp" @@ -25,8 +26,6 @@ #include "tket/Transformations/ContextualReduction.hpp" #include "tket/Transformations/Transform.hpp" -#include "ComparisonFunctions.hpp" - using namespace tket; #define ALL_PASSES(DO) \ diff --git a/tket/test/src/test_LexiRoute.cpp b/tket/test/src/test_LexiRoute.cpp index 72cd334377..037dbaa264 100644 --- a/tket/test/src/test_LexiRoute.cpp +++ b/tket/test/src/test_LexiRoute.cpp @@ -2173,7 +2173,8 @@ SCENARIO( {5, 6}, {5, 9}, {6, 8}, {7, 8}, {9, 8}, {9, 10}, {11, 3}, {11, 10}, {11, 12}, {12, 2}, {13, 1}, {13, 12}}; Architecture architecture(coupling_map); - std::ifstream circuit_file("test_circuits/lexiroute_circuit_relabel_to_ancilla.json"); + std::ifstream circuit_file( + "test_circuits/lexiroute_circuit_relabel_to_ancilla.json"); nlohmann::json j = nlohmann::json::parse(circuit_file); auto c = j.get(); std::map p_map = { From 928a6c00881bca7d339836f4764c233f79f21b07 Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:52:41 +0100 Subject: [PATCH 11/17] Updated conanfile to allow cmake to handle the test json files, running tests in the test directory to allow for relative paths --- tket/conanfile.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tket/conanfile.py b/tket/conanfile.py index 677220d90e..9809cb70b5 100644 --- a/tket/conanfile.py +++ b/tket/conanfile.py @@ -76,12 +76,6 @@ def generate(self): tc.variables["PROFILE_COVERAGE"] = self.options.profile_coverage if self.build_test(): tc.variables["BUILD_TKET_TEST"] = True - architectures_dir = os.path.join( - self.source_folder, "test/src/test_architectures" - ) - copy(self, "*.json", architectures_dir, self.build_folder) - circuits_dir = os.path.join(self.source_folder, "test/src/test_circuits") - copy(self, "*.json", circuits_dir, self.build_folder) if self.build_proptest(): tc.variables["BUILD_TKET_PROPTEST"] = True tc.generate() @@ -97,9 +91,9 @@ def build(self): cmake.configure() cmake.build() if self.build_test(): - self.run(os.path.join(self.test_folder(), "test-tket")) + self.run("./test-tket", cwd=self.test_folder()) if self.build_proptest(): - self.run(os.path.join(self.proptest_folder(), "proptest-tket")) + self.run(f"./proptest-tket", cwd=self.proptest_folder()) def package(self): cmake = CMake(self) From a96e487c3dedfb12bd99a021077cc9f22ccb3648 Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:38:43 +0100 Subject: [PATCH 12/17] Fixed nix pytket testing environment --- nix-support/pytket.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nix-support/pytket.nix b/nix-support/pytket.nix index 6652f176eb..72fc997bcd 100644 --- a/nix-support/pytket.nix +++ b/nix-support/pytket.nix @@ -70,16 +70,18 @@ in { hypothesis docker opt-einsum - ] ++ [jsonschema-4180]; + jsonschema-4180 + ]; checkPhase = '' export HOME=$TMPDIR; + cp -r ${../schemas} $HOME/schemas; # run mypy - python -m mypy --config-file=mypy.ini --no-incremental -p pytket -p test_root.tests; + python -m mypy --config-file=mypy.ini --no-incremental -p pytket -p tests; # run tests - chmod 700 $TMPDIR/test_root/tests/qasm_test_files; - cd test_root/tests; + chmod 700 $HOME/pytket/tests/qasm_test_files; + cd tests; python -m pytest -s . ''; doCheck = true; From ea4bac7b43d8d6339a344c64ff5438f3007b6c0e Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:08:01 +0100 Subject: [PATCH 13/17] Fix windows tket build and pytket import issue. --- tket/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tket/CMakeLists.txt b/tket/CMakeLists.txt index b772854277..958d95dda7 100644 --- a/tket/CMakeLists.txt +++ b/tket/CMakeLists.txt @@ -452,6 +452,7 @@ install(TARGETS tket EXPORT tket-targets FILE_SET HEADERS RUNTIME DESTINATION bin + RUNTIME DESTINATION lib ARCHIVE DESTINATION lib LIBRARY DESTINATION lib INCLUDES DESTINATION include From a84a14e1a82d9c26f926475f5a8491bee1eeba7f Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Fri, 26 Jul 2024 18:12:10 +0100 Subject: [PATCH 14/17] Adding output to valgrind check to diagnose missing file issue --- .github/workflows/valgrind.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index 8cb69732d3..085a5ae22d 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -74,5 +74,11 @@ jobs: if: github.event_name != 'schedule' run: | PKGPATH=`./rootpath tket.json tket` - cd ${PKGPATH}/bin && valgrind --error-exitcode=1 ./test-tket + echo "Package path: ${PKGPATH}" + echo "Contents" + find $PKGPATH + echo "Changing to bin directory" + cd ${PKGPATH}/bin + find + valgrind --error-exitcode=1 ./test-tket From 7513cbf0cc0ad02b2613eb75e49e0485887826ea Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:43:45 +0100 Subject: [PATCH 15/17] Correcting the test data directory handling and installation --- flake.nix | 2 +- tket/test/CMakeLists.txt | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index 842d2c0145..fdaae8c443 100644 --- a/flake.nix +++ b/flake.nix @@ -27,7 +27,7 @@ }; devShells = { default = pkgs.mkShell { buildInputs = [ pkgs.tket pkgs.pytket ]; }; - conan = pkgs.mkShell { buildInputs = with pkgs; [ conan cmake ninja gcc python3 ]; }; + conan = pkgs.mkShell { buildInputs = with pkgs; [ conan cmake ninja gcc python3 ccache ]; }; }; checks = { tket-tests = pkgs.tket; diff --git a/tket/test/CMakeLists.txt b/tket/test/CMakeLists.txt index de68b2ba65..7c4fe67377 100644 --- a/tket/test/CMakeLists.txt +++ b/tket/test/CMakeLists.txt @@ -44,7 +44,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang") # remove -Wno-deprecated-declarations once https://github.com/boostorg/boost/issues/688 is resolved endif() -FILE(GLOB_RECURSE JSON_FILES src/*.json) FILE(GLOB_RECURSE TEST_SOURCES src/test_*.cpp) SET(TEST_UTILS src/tests_main.cpp @@ -72,17 +71,22 @@ SET(TEST_UTILS add_executable(test-tket ${TEST_UTILS} ${TEST_SOURCES}) target_link_libraries(test-tket PUBLIC tket Catch2::Catch2WithMain) -add_custom_target(copy-test_circuits ALL +add_custom_target(copy-test-data-dirs ALL + COMMENT "Copying test data directories to build directory" + COMMAND ${CMAKE_COMMAND} -E make_directory + $/test_circuits COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/src/test_circuits - ${CMAKE_CURRENT_BINARY_DIR}/test_circuits) + ${CMAKE_CURRENT_SOURCE_DIR}/src/test_circuits + $/test_circuits -add_custom_target(copy-test_architectures ALL + COMMAND ${CMAKE_COMMAND} -E make_directory + $/test_architectures COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/src/test_architectures - ${CMAKE_CURRENT_BINARY_DIR}/test_architectures) + ${CMAKE_CURRENT_SOURCE_DIR}/src/test_architectures + $/test_architectures +) +add_dependencies(test-tket copy-test-data-dirs) -add_dependencies(test-tket copy-test_circuits copy-test_architectures) catch_discover_tests(test-tket) set(WITH_COVERAGE no CACHE BOOL "Link library with profiling for test coverage") @@ -92,7 +96,10 @@ IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") ENDIF() ENDIF() -install(FILES ${JSON_FILES} DESTINATION bin) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/test_circuits + DESTINATION bin) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/test_architectures + DESTINATION bin) install(TARGETS test-tket DESTINATION "." RUNTIME DESTINATION bin From 8598141d18bc79723ddf612a03dd3c1c16fda544 Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:21:11 +0100 Subject: [PATCH 16/17] re-added gmp as a direct dependency to TKET --- nix-support/tket.nix | 2 +- tket/CMakeLists.txt | 9 +++++++++ tket/cmake/tketConfig.cmake.in | 7 ++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/nix-support/tket.nix b/nix-support/tket.nix index 70d9c68a89..ac39d3c6be 100644 --- a/nix-support/tket.nix +++ b/nix-support/tket.nix @@ -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. diff --git a/tket/CMakeLists.txt b/tket/CMakeLists.txt index 958d95dda7..43fdf48173 100644 --- a/tket/CMakeLists.txt +++ b/tket/CMakeLists.txt @@ -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) @@ -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 $ @@ -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() diff --git a/tket/cmake/tketConfig.cmake.in b/tket/cmake/tketConfig.cmake.in index 0939348878..0997fe7f3c 100644 --- a/tket/cmake/tketConfig.cmake.in +++ b/tket/cmake/tketConfig.cmake.in @@ -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) @@ -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) From 9c98f60362792f57c54ff0fbbee67eb906f3f3ce Mon Sep 17 00:00:00 2001 From: Jake Arkinstall <65358059+jake-arkinstall@users.noreply.github.com> Date: Wed, 14 Aug 2024 13:08:05 +0100 Subject: [PATCH 17/17] Formalise test building variables as cmake options --- tket/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tket/CMakeLists.txt b/tket/CMakeLists.txt index 43fdf48173..6fc529e754 100644 --- a/tket/CMakeLists.txt +++ b/tket/CMakeLists.txt @@ -39,6 +39,8 @@ set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_EXTENSIONS OFF) option(INSTALL_NAME_DIR "Set the install name dir for the library to @loader_path for Apple targets" ON) +option(BUILD_TKET_TEST "Build the test suite" OFF) +option(BUILD_TKET_PROPTEST "Build the property test suite" OFF) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release)