-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
82 lines (74 loc) · 2.79 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
cmake_minimum_required(VERSION 3.4)
project(timeloop_python)
if(DEFINED ENV{TIMELOOP_INCLUDE_PATH})
message(STATUS "Using timeloop includes from: $ENV{TIMELOOP_INCLUDE_PATH}")
set(TIMELOOP_INCLUDE_PATH $ENV{TIMELOOP_INCLUDE_PATH})
else()
message(FATAL_ERROR "Please point TIMELOOP_INCLUDE_PATH to your Timeloop headers.")
endif()
if(DEFINED ENV{TIMELOOP_LIB_PATH})
set(TIMELOOP_LIB_PATH $ENV{TIMELOOP_LIB_PATH})
message(STATUS "Using timeloop libraries from: $ENV{TIMELOOP_LIB_PATH}")
find_library(LIBTIMELOOP timeloop-mapper HINTS ${TIMELOOP_LIB_PATH} REQUIRED)
else()
find_library(LIBTIMELOOP timeloop-mapper REQUIRED)
endif()
find_package(Threads REQUIRED)
add_library(define_gterminate STATIC bindings/gterminate.cpp)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(PYTIMELOOP_SRC
src/mapper/coupled-mapper.cpp
src/mapspace/status.cpp
src/model/accelerator.cpp
src/model/bounded-queue-accelerator-pool.cpp
src/model/unbounded-queue-accelerator-pool.cpp
src/model/util.cpp)
set(PYTIMELOOP_HDR
include/pytimeloop/mapper/coupled-mapper.h
include/pytimeloop/mapper/mapper-base.h
include/pytimeloop/model/accelerator-pool.h
include/pytimeloop/model/accelerator.h
include/pytimeloop/model/eval-result.h
include/pytimeloop/model/util.h
include/pytimeloop/search/mapspace-search.h)
add_library(pytimeloop SHARED ${PYTIMELOOP_SRC} ${PYTIMELOOP_HDR})
set_property(TARGET pytimeloop PROPERTY CXX_STANDARD 17)
target_include_directories(pytimeloop PRIVATE
include
${TIMELOOP_INCLUDE_PATH}
lib/pybind11/include)
target_link_libraries(pytimeloop PRIVATE ${LIBTIMELOOP} define_gterminate)
set(BINDINGS_SRC
src/configurator/configurator.cpp
src/mapper/coupled-mapper.cpp
src/mapspace/status.cpp
src/model/accelerator.cpp
src/model/bounded-queue-accelerator-pool.cpp
src/model/unbounded-queue-accelerator-pool.cpp
src/model/util.cpp
bindings/accelergy_interface.cpp
bindings/applications.cpp
bindings/bindings.cpp
bindings/buffer.cpp
bindings/config.cpp
bindings/looptree.cpp
bindings/mapper.cpp
bindings/mapping.cpp
bindings/mapspace.cpp
bindings/model.cpp
bindings/problem.cpp
bindings/search.cpp
bindings/topology.cpp)
add_subdirectory(lib/pybind11)
pybind11_add_module(bindings ${BINDINGS_SRC})
set_property(TARGET bindings PROPERTY CXX_STANDARD 17)
target_include_directories(bindings PUBLIC
include
${TIMELOOP_INCLUDE_PATH}
lib/pybind11/include)
target_link_libraries(bindings PUBLIC config++ yaml-cpp rt ${LIBTIMELOOP} define_gterminate)
# VERSION_INFO is defined by setup.py and passed into the C++ code as a
# define (VERSION_INFO) here.
target_compile_definitions(bindings PRIVATE VERSION_INFO=${VERSION_INFO})