-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
53 lines (45 loc) · 1.54 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
cmake_minimum_required(VERSION 3.15)
project(
qasm3tools
VERSION 1.0
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
enable_testing()
# Windows issues with Microsoft Visual Studio
if(MSVC)
# Disable spurious warnings with MSVC (warning C4996)
add_compile_definitions(_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
endif()
# qasm3tools root directory
add_compile_definitions(PROJECT_ROOT_DIR="${PROJECT_SOURCE_DIR}")
# antlr4cpp library
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/antlr4cpp_runtime EXCLUDE_FROM_ALL)
# antlr4cpp headers
include_directories(SYSTEM
${CMAKE_CURRENT_SOURCE_DIR}/antlr4cpp_runtime/runtime/src)
# Libs
include_directories(SYSTEM libs)
# Headers
add_library(libqasm3tools INTERFACE)
target_include_directories(
libqasm3tools
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/antlr4cpp_generated/>)
target_include_directories(
libqasm3tools
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>)
# target_link_libraries(libqasm3tools INTERFACE antlr4_static)
target_link_libraries(libqasm3tools INTERFACE antlr4_shared)
# parser executable
set(PARSER "parser")
add_executable(${PARSER} src/parser.cpp)
target_link_libraries(${PARSER} PUBLIC libqasm3tools)
# interpreter
option(WITH_INTERPRETER "Build interpreter. Must have Quantum++ installed" OFF)
if(${WITH_INTERPRETER})
include(cmake/interpreter.cmake)
endif()
# Unit testing
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests/)