Commit 44c21c16 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

updating to use xacc imported targets in cmake

parent 52db5221
Loading
Loading
Loading
Loading
+1 −28
Original line number Diff line number Diff line
@@ -10,45 +10,18 @@ set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/Modules)
set(CLANG_COMPILER /usr/bin/clang++-9)

message(STATUS "${CMAKE_MODULE_PATH}")
project(qcor LANGUAGES CXX)

option(QCOR_BUILD_TESTS "Build qcor tests" OFF)

include(CTest)

find_package(Clang 9.0.0 REQUIRED)
find_package(XACC REQUIRED)
set(CLANG_COMPILER /usr/bin/clang++-9)

if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
    set (CMAKE_INSTALL_PREFIX "${XACC_ROOT}" CACHE PATH "default install path" FORCE )
endif()

set(CppMicroServicesConfig_DIR "${XACC_ROOT}/share/cppmicroservices4/cmake")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${XACC_ROOT}/share/xacc")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CppMicroServicesConfig_DIR}")
include(CppMicroServicesConfig)

include_directories(${XACC_INCLUDE_DIRS})

link_directories(${XACC_LIBRARY_DIR})

configure_file(${CMAKE_SOURCE_DIR}/scripts/qcor.in
               ${CMAKE_BINARY_DIR}/qcor)

macro(qcor_enable_rpath LIBNAME)
  if(APPLE)
    set_target_properties(${LIBNAME} PROPERTIES INSTALL_RPATH "@loader_path/../lib")
    set_target_properties(${LIBNAME}
                          PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
  else()
    set_target_properties(${LIBNAME} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib")
    set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS "-shared")
  endif()
endmacro()

add_subdirectory(runtime)
add_subdirectory(compiler)
add_subdirectory(ir)
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ target_include_directories(${LIBRARY_NAME}
                                ${LLVM_INCLUDE_DIRS}
                                )

target_link_libraries(${LIBRARY_NAME} PUBLIC xacc qcor-ast-plugin ${CLANG_LIBS} ${LLVM_LIBS})
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc::xacc qcor-ast-plugin ${CLANG_LIBS} ${LLVM_LIBS})

set(_bundle_name qcor_compiler)
set_target_properties(${LIBRARY_NAME}
@@ -32,7 +32,7 @@ usfunctionembedresources(TARGET
                         FILES
                         manifest.json)

qcor_enable_rpath(${LIBRARY_NAME})
xacc_configure_plugin_rpath(${LIBRARY_NAME})

if(QCOR_BUILD_TESTS)
  #add_subdirectory(tests)
+7 −14
Original line number Diff line number Diff line
@@ -6,21 +6,14 @@ add_library(${LIBRARY_NAME}
            QCORASTConsumer.cpp)
target_include_directories(${LIBRARY_NAME}
                           PUBLIC .
                                  ${CMAKE_SOURCE_DIR}/runtime
                                  ${CLANG_INCLUDE_DIRS}
                                  ${LLVM_INCLUDE_DIRS}
                                  ${XACC_INCLUDE_ROOT}
                                  ${XACC_INCLUDE_ROOT}/xacc
                                  ${XACC_INCLUDE_ROOT}/cppmicroservices4)
                                  ${LLVM_INCLUDE_DIRS})

target_link_libraries(${LIBRARY_NAME}
                      PUBLIC ${CLANG_LIBS} ${LLVM_LIBS} ${XACC_LIBRARIES} qcor)
if(APPLE)
   set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
   set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
   set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
   set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-shared")
endif()
                      PUBLIC ${CLANG_LIBS} ${LLVM_LIBS} qcor)

xacc_configure_library_rpath(${LIBRARY_NAME})

install(TARGETS ${LIBRARY_NAME} DESTINATION lib)

if(QCOR_BUILD_TESTS)
@@ -30,6 +23,6 @@ endif()
configure_file(qcor-driver.in.cpp
               ${CMAKE_BINARY_DIR}/compiler/clang/qcor-driver.cpp)
add_executable(qcor-driver ${CMAKE_BINARY_DIR}/compiler/clang/qcor-driver.cpp)
target_link_libraries(qcor-driver PRIVATE qcor-ast-plugin qcor xacc)
target_link_libraries(qcor-driver PRIVATE qcor-ast-plugin qcor)
install(PROGRAMS ${CMAKE_BINARY_DIR}/compiler/clang/qcor-driver DESTINATION bin)
install (FILES QCORPragmaHandler.hpp DESTINATION include/qcor)
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -3,4 +3,4 @@ configure_file(LambdaVisitorTester.in.cpp
include_directories(${CMAKE_SOURCE_DIR}/compiler/clang)

add_xacc_test(LambdaVisitor)
target_link_libraries(LambdaVisitorTester qcor qcor-ast-plugin ${CLANG_LIBS})
 No newline at end of file
target_link_libraries(LambdaVisitorTester qcor qcor-ast-plugin xacc::quantum_gate ${CLANG_LIBS})
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ target_include_directories(
  ${LIBRARY_NAME}
  PUBLIC . generators/hwe generators/exp)

target_link_libraries(${LIBRARY_NAME} PUBLIC xacc CppMicroServices PRIVATE xacc-pauli xacc-fermion)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc::xacc PRIVATE xacc::pauli xacc::fermion)

set(_bundle_name qcor_digital)
set_target_properties(${LIBRARY_NAME}
@@ -27,7 +27,7 @@ usfunctionembedresources(TARGET
                         FILES
                         manifest.json)

qcor_enable_rpath(${LIBRARY_NAME})
xacc_configure_plugin_rpath(${LIBRARY_NAME})

if(QCOR_BUILD_TESTS)
  add_subdirectory(generators/hwe/tests)
Loading