1 |
capela |
4032 |
cmake_minimum_required (VERSION 3.13) |
2 |
capela |
3866 |
|
3 |
capela |
4032 |
project (liblscp |
4 |
capela |
4108 |
VERSION 0.9.90 |
5 |
capela |
3866 |
DESCRIPTION "LinuxSampler Control Protocol API library" |
6 |
capela |
4069 |
HOMEPAGE_URL "https://qsampler.sourceforge.io" |
7 |
capela |
3866 |
LANGUAGES C) |
8 |
|
|
|
9 |
capela |
4073 |
set (PROJECT_COPYRIGHT "Copyright (C) 2004-2024, rncbc aka Rui Nuno Capela. All rights reserved.") |
10 |
|
|
set (PROJECT_DOMAIN "linuxsampler.org") |
11 |
|
|
|
12 |
capela |
3866 |
execute_process ( |
13 |
|
|
COMMAND git describe --tags --dirty --abbrev=6 |
14 |
capela |
3872 |
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} |
15 |
capela |
3866 |
OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT |
16 |
|
|
RESULT_VARIABLE GIT_DESCRIBE_RESULT |
17 |
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
18 |
|
|
if (GIT_DESCRIBE_RESULT EQUAL 0) |
19 |
capela |
4069 |
set (GIT_VERSION "${GIT_DESCRIBE_OUTPUT}") |
20 |
|
|
string (REGEX REPLACE "^[^0-9]+" "" GIT_VERSION "${GIT_VERSION}") |
21 |
|
|
string (REGEX REPLACE "^1_" "" GIT_VERSION "${GIT_VERSION}") |
22 |
|
|
string (REGEX REPLACE "^[_vV]+" "" GIT_VERSION "${GIT_VERSION}") |
23 |
|
|
string (REGEX REPLACE "-g" "git." GIT_VERSION "${GIT_VERSION}") |
24 |
|
|
string (REGEX REPLACE "[_|-]" "." GIT_VERSION "${GIT_VERSION}") |
25 |
capela |
3866 |
execute_process ( |
26 |
|
|
COMMAND git rev-parse --abbrev-ref HEAD |
27 |
capela |
3872 |
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} |
28 |
capela |
3866 |
OUTPUT_VARIABLE GIT_REVPARSE_OUTPUT |
29 |
|
|
RESULT_VARIABLE GIT_REVPARSE_RESULT |
30 |
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
31 |
capela |
4069 |
if (GIT_REVPARSE_RESULT EQUAL 0 AND NOT GIT_REVPARSE_OUTPUT STREQUAL "main") |
32 |
|
|
set (GIT_VERSION "${GIT_VERSION} [${GIT_REVPARSE_OUTPUT}]") |
33 |
capela |
3866 |
endif () |
34 |
capela |
4069 |
set (PROJECT_VERSION "${GIT_VERSION}") |
35 |
capela |
3866 |
endif () |
36 |
|
|
|
37 |
|
|
|
38 |
capela |
3906 |
set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}") |
39 |
|
|
|
40 |
|
|
include (GNUInstallDirs) |
41 |
|
|
set (CONFIG_LIBDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_LIBDIR}") |
42 |
|
|
set (CONFIG_INCLUDEDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") |
43 |
|
|
|
44 |
|
|
|
45 |
capela |
3866 |
#------------------------------------------------------------------------------------ |
46 |
|
|
# Rules for library version information: |
47 |
|
|
# |
48 |
|
|
# 1. Start with version information of `0:0:0' for each libtool library. |
49 |
|
|
# 2. Update the version information only immediately before a public release of |
50 |
|
|
# your software. More frequent updates are unnecessary, and only guarantee |
51 |
|
|
# that the current interface number gets larger faster. |
52 |
|
|
# 3. If the library source code has changed at all since the last update, then |
53 |
|
|
# increment revision (`c:r:a' becomes `c:r+1:a'). |
54 |
|
|
# 4. If any interfaces have been added, removed, or changed since the last update, |
55 |
|
|
# increment current, and set revision to 0. |
56 |
|
|
# 5. If any interfaces have been added since the last public release, then increment |
57 |
|
|
# age. |
58 |
|
|
# 6. If any interfaces have been removed since the last public release, then set age |
59 |
|
|
# to 0. |
60 |
|
|
# |
61 |
|
|
#set (BUILD_SHARED_LIBS ON) |
62 |
|
|
|
63 |
|
|
set (SHARED_VERSION_CURRENT 6) |
64 |
|
|
set (SHARED_VERSION_AGE 0) |
65 |
capela |
4049 |
set (SHARED_VERSION_REVISION 6) |
66 |
capela |
3866 |
set (SHARED_VERSION_INFO "${SHARED_VERSION_CURRENT}.${SHARED_VERSION_AGE}.${SHARED_VERSION_REVISION}") |
67 |
|
|
|
68 |
capela |
3906 |
if (CMAKE_BUILD_TYPE MATCHES "Debug") |
69 |
|
|
set (CONFIG_DEBUG 1) |
70 |
|
|
set (CONFIG_BUILD_TYPE "debug") |
71 |
capela |
3866 |
else () |
72 |
capela |
4055 |
set (CONFIG_DEBUG 0) |
73 |
capela |
3866 |
set (CONFIG_BUILD_TYPE "release") |
74 |
capela |
4055 |
set (CMAKE_BUILD_TYPE "Release") |
75 |
capela |
3866 |
endif () |
76 |
|
|
|
77 |
|
|
set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}") |
78 |
|
|
|
79 |
|
|
include (GNUInstallDirs) |
80 |
|
|
set (CONFIG_BINDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_BINDIR}") |
81 |
|
|
set (CONFIG_LIBDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_LIBDIR}") |
82 |
|
|
set (CONFIG_DATADIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_DATADIR}") |
83 |
|
|
set (CONFIG_INCLUDEDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") |
84 |
|
|
|
85 |
|
|
# |
86 |
|
|
# No special build options... |
87 |
|
|
# |
88 |
|
|
|
89 |
|
|
# Fix for new CMAKE_REQUIRED_LIBRARIES policy. |
90 |
|
|
if (POLICY CMP0075) |
91 |
|
|
cmake_policy (SET CMP0075 NEW) |
92 |
|
|
endif () |
93 |
|
|
|
94 |
|
|
include (CheckIncludeFiles) |
95 |
|
|
include (CheckFunctionExists) |
96 |
|
|
|
97 |
|
|
# Checks for standard header files. |
98 |
|
|
if (UNIX AND NOT APPLE) |
99 |
|
|
check_include_files ("stdlib.h;string.h;netdb.h;arpa/inet.h;netinet/tcp.h;netinet/in.h;sys/socket.h;unistd.h" HAVE_HEADERS_H) |
100 |
|
|
if (NOT HAVE_HEADERS_H) |
101 |
|
|
message (FATAL_ERROR "*** Standard headers not found.") |
102 |
|
|
endif () |
103 |
|
|
endif () |
104 |
|
|
|
105 |
|
|
# Checks for standard functions. |
106 |
|
|
if (UNIX AND NOT APPLE) |
107 |
|
|
set (FUNCS "strdup;strtok_r;memset;memmove;socket;connect;bind;listen;setsockopt;getsockopt;getsockname;gethostbyname") |
108 |
|
|
foreach (FUNC ${FUNCS}) |
109 |
|
|
check_function_exists (${FUNC} HAVE_${FUNC}_C) |
110 |
|
|
if (NOT HAVE_${FUNC}_C) |
111 |
|
|
message (FATAL_ERROR "*** Standard functions not found.") |
112 |
|
|
endif () |
113 |
|
|
endforeach () |
114 |
|
|
endif () |
115 |
|
|
|
116 |
|
|
# |
117 |
|
|
# No additional packages or libraries... |
118 |
|
|
# |
119 |
|
|
|
120 |
|
|
add_subdirectory (src) |
121 |
|
|
add_subdirectory (doc) |
122 |
|
|
add_subdirectory (examples) |
123 |
|
|
|