CMakeLists.txt 2.15 KB
Newer Older
virgorun's avatar
virgorun committed
1
2
3
4
5
6
7
#
# CMake packaging for librame
# Copyright 2019  Duncan Macleod <duncan.macleod@ligo.org>
#

cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR)
project(
8
    framel
virgorun's avatar
virgorun committed
9
    LANGUAGES C
10
    VERSION 8.42.2
virgorun's avatar
virgorun committed
11
    DESCRIPTION "LIGO/VIRGO frame library"
mours's avatar
mours committed
12
    HOMEPAGE_URL "https://git.ligo.org/virgo/virgoapp/Fr"
virgorun's avatar
virgorun committed
13
14
15
16
17
)

include(GNUInstallDirs)
include(CheckFunctionExists)

18
19
20
21
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -DG__ROOT -D_XOPEN_SOURCE=700")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -DG__ROOT -D_ISOC99_SOURCE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFR_PATH=\\\"${CMAKE_CURRENT_SOURCE_DIR}\\\"")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFR_VERSION=\\\"${PROJECT_VERSION}\\\"")
virgorun's avatar
virgorun committed
22
23
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -g")
virgorun's avatar
virgorun committed
24

virgorun's avatar
virgorun committed
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
# -- set install paths ------

if (WIN32)
    set(RUNTIME_DESTINATION ${CMAKE_INSTALL_BINDIR})
    set(LIBRARY_DESTINATION ${CMAKE_INSTALL_BINDIR})
else (WIN32)
    set(RUNTIME_DESTINATION ${CMAKE_INSTALL_LIBDIR})
    set(LIBRARY_DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(WIN32)

# -- build components -------

# C library | enable/disable with -DENABLE_C={yes,no} (default yes)
add_subdirectory(src)
add_subdirectory(doc)

# Matlab library | enable/disable with -DENABLE_MATLAB={yes,no} (default no)
add_subdirectory(matlab)

# Python library | enable/disable with -DENABLE_PYTHON={yes,no} (default no)
add_subdirectory(Python)

# -- build tarball ----------
#
# to build a source tarball:
#
# mkdir dist
# pushd dist
# cmake ..
# cmake --build . --target package_source
#

set(CPACK_PACKAGE_MAJOR ${${PROJECT_NAME}_MAJOR_VERSION})
set(CPACK_PACKAGE_MINOR ${${PROJECT_NAME}_MINOR_VERSION})
set(CPACK_PACKAGE_PATCH ${${PROJECT_NAME}_PATCH_VERSION})
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_MAJOR}.${CPACK_PACKAGE_MINOR}.${CPACK_PACKAGE_PATCH}")

set(CPACK_SOURCE_GENERATOR TXZ)
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${PROJECT_NAME}-${${PROJECT_NAME}_VERSION})
set(CPACK_SOURCE_IGNORE_FILES
    "/.*~$/"
    ".*~$"
    "\\\\.svn/"
    "\\\\.git"
    "build/"
    "CMakeFiles/"
    "CMakeCache.txt"
    "_CPack_Packages/"
    "\\\\.cmake"
    "Makefile"
    "\\\\.deps/"
    "autom4te.cache/"
    "\\\\.tar\\\\.xz"
)
include(CPack)