This repository has been archived by the owner on Jun 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
81 lines (69 loc) · 2.95 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
cmake_minimum_required (VERSION 3.8)
project(Granite
VERSION 0.1
DESCRIPTION "Granite is a compiler for FHE"
LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules")
####################################################################################
## Dependencies
####################################################################################
find_package(Wool REQUIRED)
####################################################################################
## Build granite library
####################################################################################
set(SOURCE_FILES
src/G.cpp
src/PadVisitor.cpp)
SET(PUBLIC_HEADERS
include/G.hpp)
add_library(granite ${SOURCE_FILES})
add_library(Granite::granite ALIAS granite)
target_include_directories(granite PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
set_target_properties(granite PROPERTIES PUBLIC_HEADER ${PUBLIC_HEADERS})
target_compile_features(granite PUBLIC cxx_std_17)
target_link_libraries(granite PUBLIC Wool::wool)
####################################################################################
## Granite installation
##
## granite installed globally as a library
####################################################################################
# Create a Version File
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
GraniteConfigVersion.cmake
VERSION ${PACKAGE_VERSION}
COMPATIBILITY AnyNewerVersion
)
# Configure (i.e. generate) the GraniteConfig.cmake file and copy both it and the version to install
configure_file(GraniteConfig.cmake.in GraniteConfig.cmake @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/GraniteConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/GraniteConfigVersion.cmake"
DESTINATION lib/cmake/Granite)
install(TARGETS granite
EXPORT GraniteTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
PUBLIC_HEADER DESTINATION include
INCLUDES DESTINATION include)
install(EXPORT GraniteTargets
FILE GraniteTargets.cmake
NAMESPACE Wool::
DESTINATION lib/cmake/Granite)
####################################################################################
## Granite Examples
####################################################################################
add_subdirectory(examples)
####################################################################################
## Granite Benchmarking
####################################################################################
add_subdirectory(benchmark)
####################################################################################
## Granite Testing
####################################################################################
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
enable_testing()
add_subdirectory(tests EXCLUDE_FROM_ALL)
endif()