CMakeLists.txt 3.59 KB
Newer Older
1
2
3
4
5
6
7
# ******************************************************************************
# * Copyright (c) 2017 UT-Battelle, LLC. All rights reserved. This program and
#   the accompanying materials are made available under the terms of the Eclipse
#   Public License v1.0 and Eclipse Distribution License v.10 which accompany
#   this distribution. The Eclipse Public License is available at
#   http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
#   License is available at https://eclipse.org/org/documents/edl-v10.php
Mccaskey, Alex's avatar
Mccaskey, Alex committed
8
#
9
10
11
12
# Contributors: Alexander J. McCaskey - initial API and implementation
# ******************************************************************************
# */
set(LIBRARY_NAME xacc-quantum-gate)
13

14
15
16
17
18
19
20
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/utils)
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ir)
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/compiler)
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ir/instructions)
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ir/algorithms)
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ir/transformations)
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/accelerator)
21

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
file(GLOB_RECURSE HEADERS *.hpp)
file(GLOB SRC
          *.cpp
          accelerator/*.cpp
          compiler/*.cpp
          ir/*.cpp
          ir/instructions/*.cpp
          utils/*.cpp
          ir/algorithms/*.cpp
          ir/transformations/*.cpp)
add_library(${LIBRARY_NAME} SHARED ${SRC})

target_include_directories(${LIBRARY_NAME}
                           PRIVATE utils
                                   ir
                                   compiler
                                   ir/instructions
                                   ir/algorithms
                                   accelerator
                                   ${CMAKE_BINARY_DIR}
                                   ${CMAKE_SOURCE_DIR}/quantum/utils
                                   ${CMAKE_SOURCE_DIR}/tpls/exprtk
                                   ${CMAKE_SOURCE_DIR}/tpls/rapidjson/include)
45
46

# Set up dependencies to resources to track changes
47
usfunctiongetresourcesource(TARGET ${LIBRARY_NAME} OUT SRC)
48
# Generate bundle initialization code
49
usfunctiongeneratebundleinit(TARGET ${LIBRARY_NAME} OUT SRC)
50

51
set(_bundle_name xacc_quantum_gate)
52
53
54
55
56
57
58
set_target_properties(${LIBRARY_NAME}
                      PROPERTIES # This is required for every bundle
                                 COMPILE_DEFINITIONS
                                 US_BUNDLE_NAME=${_bundle_name}
                                 # This is for convenience, used by other CMake
                                 # functions
                                 US_BUNDLE_NAME ${_bundle_name})
59
60

# Embed meta-data from a manifest.json file
61
62
63
64
65
66
67
68
usfunctionembedresources(TARGET
                         ${LIBRARY_NAME}
                         WORKING_DIRECTORY
                         ${CMAKE_CURRENT_SOURCE_DIR}
                         FILES
                         manifest.json)

target_link_libraries(${LIBRARY_NAME} PUBLIC xacc Boost::graph)
69
70

if(APPLE)
71
72
73
74
  set_target_properties(xacc-quantum-gate
                        PROPERTIES INSTALL_RPATH "@loader_path")
  set_target_properties(xacc-quantum-gate
                        PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
75
else()
76
77
  set_target_properties(xacc-quantum-gate PROPERTIES INSTALL_RPATH "$ORIGIN")
  set_target_properties(xacc-quantum-gate PROPERTIES LINK_FLAGS "-shared")
78
79
endif()

80
add_subdirectory(compiler)
Mccaskey, Alex's avatar
Mccaskey, Alex committed
81
add_subdirectory(ir)
82
add_subdirectory(utils)
83
add_subdirectory(accelerator)
84

85
86
install(FILES ${HEADERS} DESTINATION include/quantum/gate)
install(TARGETS ${LIBRARY_NAME} DESTINATION lib)