-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
85 lines (66 loc) · 2.51 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
cmake_minimum_required(VERSION 3.8.0) #need 3.8 for FindProtobuf.cmake
project(tcpb NONE)
#version number
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------
set(tcpb_MAJOR_VERSION 1)
set(tcpb_MINOR_VERSION 0)
set(tcpb_TWEAK_VERSION 0)
set(tcpb_VERSION "${tcpb_MAJOR_VERSION}.${tcpb_MINOR_VERSION}.${tcpb_TWEAK_VERSION}")
if(NOT INSIDE_AMBER)
# initialization and include paths
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------
include(cmake/AmberBuildSystemInit.cmake)
#now enable the languages
enable_language(C CXX Fortran)
include(AmberBuildSystem2ndInit)
set(LINALG_LIBS_REQUIRED FALSE)
set(NEEDED_3RDPARTY_TOOLS protobuf)
set(REQUIRED_3RDPARTY_TOOLS )
include(3rdPartyTools)
include(CompilerFlags)
#CPack setup
# --------------------------------------------------------------------
set(PACKAGE_NAME "tcpb")
set(PACKAGE_FILENAME "tcpb")
set(BUNDLE_IDENTIFIER org.martinezlab.tcpb)
set(BUNDLE_SIGNATURE TCPB)
include(Packaging)
# build options
option(INSTALL_HEADERS "Copy headers to the include/tcpb folder of the install directory." TRUE)
option(INSTALL_EXAMPLES "Compile examples in the exemples folder of the install directory" TRUE)
option(BUILD_PYTHON "Install pytcpb in the Python environment" TRUE)
# Ensure that protobuf will be read from the environment
string(REPLACE ":" ";" _lib_path "$ENV{LD_LIBRARY_PATH}")
set( CMAKE_LIBRARY_PATH ${_lib_path} )
string(REPLACE ":" ";" _inc_path "$ENV{CPATH}")
set( CMAKE_INCLUDE_PATH ${_inc_path} )
# Locate the protobuf library
find_package(Protobuf)
if(NOT Protobuf_FOUND)
message(FATAL_ERROR "Protobuf was not found!")
endif()
else()
set(INSTALL_HEADERS TRUE)
set(INSTALL_EXAMPLES FALSE)
endif()
# Ensure that Threads is in the environment
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
# on Windows, make MSVC auto-create import libraries just like MinGW does
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
add_subdirectory(src)
if (BUILD_PYTHON AND NOT INSIDE_AMBER)
if (NOT DEFINED PYTHON_EXECUTABLE)
set(PYTHON_EXECUTABLE "python")
endif()
add_subdirectory(pytcpb)
if (BUILD_PYTHON)
add_subdirectory(pytcpb)
endif()
if (INSTALL_EXAMPLES)
add_subdirectory(examples)
endif()
#--------------------------------------------------------------
if(NOT INSIDE_AMBER)
print_build_report()
endif()