Skip to content

Conversation

BorissovAnton
Copy link
Contributor

Summary

Made staq FetchContent-compatible by fixing absolute path issues in CMake configuration.

Changes

  • Fixed all CMAKE_SOURCE_DIR references to use CMAKE_CURRENT_SOURCE_DIR
  • Made unit_tests inclusion conditional with relative paths
  • Fixed GMP header inclusion for tools compilation
  • Added FetchContent detection guard
  • Added example CMake file with FetchContent builtin

Matu67 and others added 6 commits July 23, 2024 14:26
* PYSTAQ: add predefined opt. levels in python bindings

* Add example to compile a simple circuit
* Minor update

Signed-off-by: Vlad Gheorghiu <[email protected]>

* Minor update cmake.yml

Signed-off-by: Vlad Gheorghiu <[email protected]>

* Removed triling whitespace in qasm files

Signed-off-by: Vlad Gheorghiu <[email protected]>

* Updated pystaq

Changed .h to .hpp

Signed-off-by: Vlad Gheorghiu <[email protected]>

* Added getter method for std_include in Program astnode. (softwareQinc#79)

Co-authored-by: matu67 <[email protected]>
Co-authored-by: James Lambert <[email protected]>

* Added getter method for std_include in Program astnode. (softwareQinc#80)

Co-authored-by: matu67 <[email protected]>
Co-authored-by: James Lambert <[email protected]>

* updated (c) notice

* Added CODE_OF_CONDUCT.md

Signed-off-by: Vlad Gheorghiu <[email protected]>

* Update

Signed-off-by: Vlad Gheorghiu <[email protected]>

* Updated fmt

Signed-off-by: Vlad Gheorghiu <[email protected]>

* Fix MSVC Windows build

Signed-off-by: Vlad Gheorghiu <[email protected]>

* Updated CHANGES

Signed-off-by: Vlad Gheorghiu <[email protected]>

* Update

Signed-off-by: Vlad Gheorghiu <[email protected]>

* Update

Signed-off-by: Vlad Gheorghiu <[email protected]>

* staq_json (softwareQinc#83)

* init json.cpp

* added pybindings

* added pybindings

* upd tool

* staq_json fix read/write (softwareQinc#84)

* fixed declared gates saving to json

* staq_json accepts input from stdin now

* Minor updates

Signed-off-by: Vlad Gheorghiu <[email protected]>

* Updated Docker config

Signed-off-by: Vlad Gheorghiu <[email protected]>

---------

Signed-off-by: Vlad Gheorghiu <[email protected]>
Co-authored-by: matu67 <[email protected]>
Co-authored-by: James Lambert <[email protected]>
Co-authored-by: Anton Borissov <[email protected]>
…Make configuration:

Fixed Path References:

- src/tools/CMakeLists.txt:5: Changed CMAKE_SOURCE_DIR to CMAKE_CURRENT_SOURCE_DIR for grid_synth.cmake inclusion
- CMakeLists.txt:111: Made unit_tests inclusion conditional with relative paths and proper binary directory
- CMakeLists.txt:12-13: Updated CMAKE_MODULE_PATH to use CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR
- CMakeLists.txt:21: Fixed PROJECT_ROOT_DIR definition to use CMAKE_CURRENT_SOURCE_DIR
- CMakeLists.txt:148: Fixed installation path for staq_msvc.cmake
- unit_tests/CMakeLists.txt:41: Fixed grid_synth.cmake inclusion path

Fixed GMP Compilation:

- cmake/grid_synth.cmake: Added proper include directory setup for GMP headers
- src/tools/CMakeLists.txt: Added target-specific include directories for GMP-dependent tools

Added FetchContent Support:

- Added detection guard at beginning of main CMakeLists.txt for FetchContent usage

Results:

- CMake configuration now works correctly with relative paths
- All executables build successfully including GMP-dependent tools (grid_synth, qasm_synth, etc.)
- Project is now properly relocatable and FetchContent-compatible

The project now uses CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_LIST_DIR instead of CMAKE_SOURCE_DIR, ensuring compatibility with FetchContent usage patterns.
@BorissovAnton
Copy link
Contributor Author

Comments:

  • prevent compilation of tools upon a fresh "FetchContent"
  • explain why GMP header inclusion is necessary
    NB. Take a look at examples/standalone/CMakeLists.txt for the original method for how to include staq into your project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants