forked from feelpp/verdandi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
87 lines (76 loc) · 3.13 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
cmake_minimum_required(VERSION 3.16)
project(verdandi CXX)
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
option(ENABLE_BUILD_WITH_TIME_TRACE "Enable -ftime-trace to generate time tracing .json files on clang" OFF)
if(ENABLE_BUILD_WITH_TIME_TRACE)
target_compile_options(project_options INTERFACE -ftime-trace)
endif()
endif()
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
#set(BLA_VENDOR Intel10_64lp)
find_package(BLAS)
find_package(LAPACK)
include(GNUInstallDirs)
include(FetchContent)
# get seldon from github
set(FETCHCONTENT_SOURCE_DIR_SELDON /home/prudhomm/Devel/seldon)
FetchContent_Declare(seldon GIT_REPOSITORY https://github.com/feelpp/seldon.git )
FetchContent_GetProperties(seldon)
if(NOT seldon_POPULATED)
FetchContent_Populate(seldon)
endif()
add_library(seldon SHARED ${seldon_SOURCE_DIR}/Seldon.cpp)
#target_compile_definitions(seldon PUBLIC -DSELDON_WITH_COMPILED_LIBRARY)
target_compile_features(seldon PUBLIC cxx_std_17)
target_link_libraries(seldon ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
ADD_CUSTOM_TARGET(seldon_link_target ALL
COMMAND ${CMAKE_COMMAND} -E create_symlink ${seldon_SOURCE_DIR} ${seldon_SOURCE_DIR}/seldon)
add_dependencies(seldon seldon_link_target)
#set_target_properties(seldon PROPERTIES OUTPUT_NAME "seldon")
target_include_directories(seldon PUBLIC
$<BUILD_INTERFACE:${seldon_SOURCE_DIR}/>
$<INSTALL_INTERFACE:include/seldon> )
install(TARGETS seldon EXPORT VerdandiTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
find_library(MATH_LIBRARY_FOR_LUA m)
message(STATUS "${MATH_LIBRARY_FOR_LUA}")
find_package(Lua 5.2)
message(STATUS "${LUA_LIBRARY_lua}")
message(STATUS "${LUA_INCLUDE_DIR}")
add_library(lua INTERFACE)
target_include_directories(lua INTERFACE
$<BUILD_INTERFACE:${LUA_INCLUDE_DIR}/>
$<INSTALL_INTERFACE:${LUA_INCLUDE_DIR}> )
target_link_libraries(lua INTERFACE ${LUA_LIBRARIES})
#
# Ops
#
FetchContent_Declare(libops GIT_REPOSITORY https://github.com/feelpp/libops.git GIT_TAG be65e19ab337f52305d4a98b7361acc8e7d6db1f)
FetchContent_GetProperties(libops)
if(NOT libops_POPULATED)
FetchContent_Populate(libops)
endif()
file(GLOB OPS_CPP_FILES ${libops_SOURCE_DIR}/*.cxx)
add_library(ops SHARED ${OPS_CPP_FILES})
#target_compile_definitions(ops PUBLIC -DOPS_WITH_EXCEPTION)
ADD_CUSTOM_TARGET(ops_link_target ALL
COMMAND ${CMAKE_COMMAND} -E create_symlink ${libops_SOURCE_DIR} ${libops_SOURCE_DIR}/ops)
add_dependencies(ops ops_link_target)
target_link_libraries(ops PUBLIC lua)
#set_target_properties(seldon PROPERTIES OUTPUT_NAME "seldon")
target_include_directories(ops PUBLIC
$<BUILD_INTERFACE:${libops_SOURCE_DIR}/>
$<INSTALL_INTERFACE:include/ops> )
install(TARGETS ops EXPORT VerdandiTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
add_subdirectory(share)
add_subdirectory(python)
add_subdirectory(example)