Commit a3436630 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

adding versioning file, setup qcor to take arg that prints xacc and qcor version

parent 690e3f39
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -19,6 +19,14 @@ project(qcor LANGUAGES CXX)

option(QCOR_BUILD_TESTS "Build qcor tests" OFF)

find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
    execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD WORKING_DIRECTORY "${local_dir}"
                            OUTPUT_VARIABLE QCOR_BUILD_VERSION ERROR_QUIET
                            OUTPUT_STRIP_TRAILING_WHITESPACE)
  message( STATUS "QCOR GIT hash: ${QCOR_BUILD_VERSION}")
endif()

find_package(Clang 10.0.0 REQUIRED)
find_package(XACC REQUIRED)

+5 −0
Original line number Diff line number Diff line

configure_file("${CMAKE_SOURCE_DIR}/runtime/version.in"
               "${CMAKE_BINARY_DIR}/runtime/version")
install(FILES "${CMAKE_BINARY_DIR}/runtime/version" DESTINATION include/qcor)

set(LIBRARY_NAME qcor)

file(GLOB SRC observable/qcor_observable.cpp 

runtime/version.in

0 → 100644
+1 −0
Original line number Diff line number Diff line
@QCOR_BUILD_VERSION@
 No newline at end of file
+12 −0
Original line number Diff line number Diff line
@@ -48,8 +48,20 @@ def main(argv=None):
        parser.add_argument('-xacc-install', nargs=1, help='returns the install directory for xacc.')
        parser.add_argument('-qcor-install', nargs=1, help='returns the install directory for qcor.')
        parser.add_argument('-clear-jit-cache', help='delete existing QJIT cache.')
        parser.add_argument('-xacc-version', nargs=1, help='returns the current build version for underlying xacc install.')
        parser.add_argument('-version', nargs=1, help='returns the current qcor build version.')
        args = parser.parse_args(sys.argv)

    if '-version' in sys.argv[1:]:
        version = open('@CMAKE_INSTALL_PREFIX@/include/qcor/version', 'r').read().rstrip()
        print('qcor build version = {}'.format(version))
        exit(0)

    if '-xacc-version' in sys.argv[1:]:
        version = open('@XACC_ROOT@/include/xacc/version', 'r').read().rstrip()
        print('xacc build version = {}'.format(version))
        exit(0)
    
    if '-xacc-install' in sys.argv[1:]:
        print('@XACC_ROOT@')
        exit(0)
+13 −0
Original line number Diff line number Diff line
@@ -45,11 +45,24 @@ def main(argv=None):
        parser.add_argument('-xacc-install', nargs=1, help='returns the install directory for xacc.')
        parser.add_argument('-qcor-install', nargs=1, help='returns the install directory for qcor.')
        parser.add_argument('-clear-jit-cache', help='delete existing QJIT cache.')
        parser.add_argument('-xacc-version', nargs=1, help='returns the current build version for underlying xacc install.')
        parser.add_argument('-version', nargs=1, help='returns the current qcor build version.')
        args = parser.parse_args(sys.argv)

    if '-version' in sys.argv[1:]:
        version = open('@CMAKE_INSTALL_PREFIX@/include/qcor/version', 'r').read().rstrip()
        print('qcor build version = {}'.format(version))
        exit(0)

    if '-xacc-version' in sys.argv[1:]:
        version = open('@XACC_ROOT@/include/xacc/version', 'r').read().rstrip()
        print('xacc build version = {}'.format(version))
        exit(0)

    if '-xacc-install' in sys.argv[1:]:
        print('@XACC_ROOT@')
        exit(0)

    if '-qcor-install' in sys.argv[1:]:
        print('@CMAKE_INSTALL_PREFIX@')
        exit(0)