-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
94 lines (79 loc) · 2.32 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
cmake_minimum_required(VERSION 3.6)
project(
domino
VERSION 0.0.1
LANGUAGES C CXX
)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_BUILD_TYPE "Debug")
set(project_version "${${PROJECT_NAME}_VERSION}")
message(STATUS "Project '${PROJECT_NAME}', version: '${project_version}'")
option(DOMINO_OPT_BUILD_UNITTESTS "Build all domino unittests" ON)
option(DOMINO_OPT_BUILD_BENCHMARK "Build all domino benchmark" OFF)
option(DOMINO_OPT_BUILD_EXAMPLES "Build all domino examples" ON)
option(DOMINO_OPT_BUILD_UNITTESTS_SCRIPT "Build domino script" OFF)
# temp define: https://discourse.llvm.org/t/python-api-problem/945
add_compile_options(-fno-rtti)
# CMake helpers:
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(CTest)
include_directories(include)
# Create the domino C++ library
set(domino_SRCS
lib/http/UriParser.cc
lib/support/Error.cc
lib/support/FormatVariadic.cc
lib/support/NativeFormatting.cc
lib/support/Process.cc
lib/support/Program.cc
lib/support/raw_ostream.cc
lib/support/hash/MD5.cc
lib/support/hash/SHA1.cc
lib/support/hash/SHA256.cc
lib/support/filesystem/Errno.cc
lib/support/filesystem/Path.cc
lib/util/StringRef.cc
lib/util/Twine.cc
lib/util/Hashing.cc
lib/util/StringExtras.cc
lib/rpc/concurrency/Mutex.cc
lib/rpc/transport/Socket.cc
)
set(STATIC_LIB_NAME ${PROJECT_NAME})
set(SHARED_LIB_NAME ${PROJECT_NAME}-shared)
if (DOMINO_OPT_BUILD_UNITTESTS_SCRIPT)
set(MLIR_DIR /usr/local/lib/cmake/mlir)
find_package(LLVM REQUIRED CONFIG)
find_package(MLIR REQUIRED CONFIG)
list(APPEND domino_SRCS
lib/script/AST.cc
lib/script/Dialect.cc
lib/script/MLIRCodeGen.cc
)
add_library(${STATIC_LIB_NAME} STATIC ${domino_SRCS})
target_link_libraries(${STATIC_LIB_NAME}
MLIRAnalysis
MLIRIR
MLIRParser
MLIRSideEffectInterfaces
MLIRTransforms
LLVMSupport
LLVMOption
)
#add_library(${SHARED_LIB_NAME} SHARED ${domino_SRCS})
else()
add_library(${STATIC_LIB_NAME} STATIC ${domino_SRCS})
#add_library(${SHARED_LIB_NAME} SHARED ${domino_SRCS})
endif()
if (DOMINO_OPT_BUILD_UNITTESTS)
add_subdirectory(unittests #[[EXCLUDE_FROM_ALL]])
endif()
if (DOMINO_OPT_BUILD_BENCHMARK)
add_subdirectory(benchmark)
endif()
if (DOMINO_OPT_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()