Git Product home page Git Product logo

Comments (5)

taalexander avatar taalexander commented on June 16, 2024 2

Thank you @Zhaoyilunnn, happy to help however you might like. In general, as you're making progress I'd love to chat to understand better what you are trying to do and how to enable it.

from qe-compiler.

Zhaoyilunnn avatar Zhaoyilunnn commented on June 16, 2024 1

An obfuscated version of our top-level CMakeLists to integrate the project

cmake_minimum_required(VERSION 3.25)
project(target-compiler)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/cmake ${CMAKE_MODULE_PATH})

set(QSSC_SYSTEMS_DIR
        "${CMAKE_CURRENT_SOURCE_DIR}/targets/systems"
        CACHE STRING
        "The directory containing the common systems"
        )

option(QSSC_WITH_MOCK_TARGET "Available targets include the built-in mock target" ON)
option(QSSC_WITH_SYSTEM_CONFIG "Use system_config to retrieve configuration for targets" OFF)
option(QSSC_BUILD_DOCS "Build the documentation for the compiler" ON)

# List of directories containing compiler targets. Subtargets should be
# listed first so that they are built before top-level targets
set(QSSC_TARGET_DIRS
        ${CMAKE_CURRENT_SOURCE_DIR}/targets/systems/YourTarget;
        CACHE PATH
        "List of directories containing compiler targets."
        )

set(QSSC_TARGET_TEST_DIRS
        ${CMAKE_CURRENT_SOURCE_DIR}/targets/systems/YourTarget/test;
        CACHE PATH
        "List of directories containing compiler LIT test suites."
        )

set(QSSC_TARGET_PYTHON_DIRS
        ${CMAKE_CURRENT_SOURCE_DIR}/targets/systems/YourTarget/python_lib/
        CACHE PATH
        "List of directories containing compiler target python additions."
        )

# Build type
if (NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Debug)
endif()
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)

# Here is the submodule which we integrate through
# the Cmake build system with
add_subdirectory(qe-compiler)

In this way our internal project contains our targets in a very similar way to https://github.com/openqasm/qe-compiler/tree/main/targets/systems/mock with a top-level cmake file which we use to generate internal binaries. The rough project structure is

  • target-compiler/

    • qe-compiler/ (submodule)
    • targets/systems/YourTarget/
    • CMakeLists.txt

We could be very interested in enabling the pathway to remove the qe-compiler submodule and replace it with a Conan dependency.

@taalexander Thanks a lot for your example CMakeLists.txt, actually I gave up making qe-compiler a conan package and adopted a similar top-level CMakeLists.txt ^_^

I am still in the progress of finding the correct way to make it a Conan package. I will make a PR once I figure it out

from qe-compiler.

Zhaoyilunnn avatar Zhaoyilunnn commented on June 16, 2024

I made some changes to existing config files main...Zhaoyilunnn:qe-compiler:zhaoyilun-local-conan-package

Then a local conan package can be built through conan create . zhaoyilun/qe-compiler --build=outdated -pr:h default -pr:b default -o qss-compiler:pythonlib=False

from qe-compiler.

taalexander avatar taalexander commented on June 16, 2024

Hi @Zhaoyilunnn, thank you for writing up this issue. The qe-compiler is still in its infancy of being an opensource project and we certainly have a lot of work to do in migrating documentation that needs to be resumed.

Note that I can seamlessly build qe-compiler locally, but I just cannot build a conan package of it and then make my own project dependent on qe-compiler.

In particular, we have not attempted this path to development yet, but are very interested in this. Internally, we are using the project as a submodule with integration through the Cmake build system.

I made some changes to existing config files main...Zhaoyilunnn:qe-compiler:zhaoyilun-local-conan-package
Then a local conan package can be built through conan create . zhaoyilun/qe-compiler --build=outdated -pr:h default -pr:b default -o qss-compiler:pythonlib=False

We would be very interested if you could make a draft PR demonstrating this work so that we could discuss how it might be incorporated in-tree.

from qe-compiler.

taalexander avatar taalexander commented on June 16, 2024

An obfuscated version of our top-level CMakeLists to integrate the project

cmake_minimum_required(VERSION 3.25)
project(target-compiler)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/cmake ${CMAKE_MODULE_PATH})

set(QSSC_SYSTEMS_DIR
        "${CMAKE_CURRENT_SOURCE_DIR}/targets/systems"
        CACHE STRING
        "The directory containing the common systems"
        )

option(QSSC_WITH_MOCK_TARGET "Available targets include the built-in mock target" ON)
option(QSSC_WITH_SYSTEM_CONFIG "Use system_config to retrieve configuration for targets" OFF)
option(QSSC_BUILD_DOCS "Build the documentation for the compiler" ON)

# List of directories containing compiler targets. Subtargets should be
# listed first so that they are built before top-level targets
set(QSSC_TARGET_DIRS
        ${CMAKE_CURRENT_SOURCE_DIR}/targets/systems/YourTarget;
        CACHE PATH
        "List of directories containing compiler targets."
        )

set(QSSC_TARGET_TEST_DIRS
        ${CMAKE_CURRENT_SOURCE_DIR}/targets/systems/YourTarget/test;
        CACHE PATH
        "List of directories containing compiler LIT test suites."
        )

set(QSSC_TARGET_PYTHON_DIRS
        ${CMAKE_CURRENT_SOURCE_DIR}/targets/systems/YourTarget/python_lib/
        CACHE PATH
        "List of directories containing compiler target python additions."
        )

# Build type
if (NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Debug)
endif()
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)

# Here is the submodule which we integrate through
# the Cmake build system with
add_subdirectory(qe-compiler)

In this way our internal project contains our targets in a very similar way to https://github.com/openqasm/qe-compiler/tree/main/targets/systems/mock with a top-level cmake file which we use to generate internal binaries. The rough project structure is

  • target-compiler/
    • qe-compiler/ (submodule)
    • targets/systems/YourTarget/
    • CMakeLists.txt

We could be very interested in enabling the pathway to remove the qe-compiler submodule and replace it with a Conan dependency.

from qe-compiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.