forked from msoeken/cirkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
104 lines (85 loc) · 2.78 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# CirKit: A circuit toolkit
# Copyright (C) 2009-2015 University of Bremen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Authors of Build system: Finn Haedicke, Stefan Frehse, Heinz Riener, Mathias Soeken
project("CirKit" C CXX)
cmake_minimum_required(VERSION 3.0)
include(cmake/CCache.cmake)
include(cmake/CompilerFlags.cmake)
include(cmake/ListDir.cmake)
include(cmake/AddExtLibrary.cmake)
include(cmake/CirKitTools.cmake)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/")
include(CTest)
# Dependencies
set( MAIN_Boost_LIBRARIES
unit_test_framework
filesystem
graph
program_options
system
timer
)
find_package(Boost REQUIRED COMPONENTS ${MAIN_Boost_LIBRARIES} )
find_package(GMP REQUIRED)
include_directories(SYSTEM /usr/include ${Boost_INCLUDE_DIR} ${GMP_INCLUDE_DIR} ext/include)
add_subdirectory(ext)
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/programs )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/programs )
# Options
option(cirkit_ENABLE_PROGRAMS "build programs" on)
option(cirkit_BUILD_SHARED "build shared libraries" on)
option(cirkit_ENABLE_PYTHON_API "build Python APIs (experimental)" off)
set(cirkit_PACKAGES "" CACHE STRING "if non-empty, then only the packages in the semicolon-separated lists are build")
set(cirkit_addon_command_libraries "" CACHE INTERNAL "" FORCE )
set(cirkit_addon_command_includes "" CACHE INTERNAL "" FORCE )
set(cirkit_addon_command_defines "" CACHE INTERNAL "" FORCE )
# Readline
include(CheckCXXSourceRuns)
set(CMAKE_REQUIRED_LIBRARIES readline)
check_cxx_source_runs("
#include <stdio.h>
#include <readline/readline.h>
void foo() { readline(\"foo\"); }
int main() { return 0; }
" READLINE_WORKS)
unset(CMAKE_REQUIRED_LIBRARIES)
if( READLINE_WORKS )
set(USE_READLINE 1)
set(READLINE_LIBRARY readline)
add_definitions(-DUSE_READLINE=1)
else( )
set(USE_READLINE 0)
set(READLINE_LIBRARY)
endif( )
# ABC
add_definitions(-DABC_NAMESPACE=abc)
# Libraries (include)
include_directories(src)
# 3rd party libraries
add_subdirectory( lib )
# Main code
add_subdirectory(src)
# Addons
add_subdirectory(addons)
# Programs
if(cirkit_ENABLE_PROGRAMS)
add_subdirectory(programs)
endif()
# Tests
if(BUILD_TESTING)
add_subdirectory(test)
endif()