forked from pure-data/pure-data
-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
151 lines (129 loc) · 3.98 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
cmake_minimum_required(VERSION 3.13)
project(puredata)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR
"CMake generation for pure-data is not allowed within the source directory!"
"\n Remove the CMakeCache.txt file and try again from another folder, e.g.:"
"\n "
"\n rm CMakeCache.txt"
"\n cd .."
"\n mkdir bin"
"\n cd bin"
"\n cmake .."
"\n")
endif()
if(APPLE)
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
set(CMAKE_OSX_ARCHITECTURES "arm64")
else()
set(CMAKE_OSX_ARCHITECTURES "x86_64")
endif()
if(MACOSX_SDK)
set(CMAKE_OSX_SYSROOT ${MACOSX_SDK})
endif()
elseif(WIN32)
if(DEFINED ENV{MINGW_PREFIX})
if(DEFINED ENV{PKG_CONFIG_PATH})
set(pkg_path)
foreach(_path $ENV{PKG_CONFIG_PATH})
string(REGEX REPLACE "^[A-Z]:/" "\\\\" _apath ${_path})
set(pkg_path "${pkg_path}:${_apath}")
endforeach()
string(REGEX REPLACE "^:" "" _xpath ${pkg_path})
set(ENV{PKG_CONFIG_PATH} ${_xpath})
else()
set(_xpath "$ENV{MINGW_PREFIX}/lib/pkgconfig")
string(REGEX REPLACE "^[A-Z]:/" "\\\\" _ypath ${_xpath})
set(ENV{PKG_CONFIG_PATH} ${_ypath})
endif()
message(STATUS "pkg-config path: $ENV{PKG_CONFIG_PATH}")
endif()
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
if(POLICY CMP0074)
#policy for <PackageName>_ROOT variables
cmake_policy(SET CMP0074 NEW)
endif()
if(UNIX)
if(APPLE)
set(CMAKE_MACOSX_RPATH TRUE)
# @rpath on macosx
# set(CMAKE_SKIP_RPATH True)
if(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12")
endif()
# set(CMAKE_SKIP_BUILD_RPATH FALSE)
# set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR TRUE)
set(CMAKE_INSTALL_RPATH "@loader_path")
# set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
else()
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "\$ORIGIN")
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
enable_language(CXX C)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(CheckLSBTypes)
include(build_options)
include(ceammc/external_version.cmake)
include(version)
include(sound)
include(install_paths)
find_package(LeapMotion)
include(PdPlatform)
include(PdExternal)
find_package(Gettext)
#find_package(LibUSB)
include(cmake_uninstall)
if(WITH_CLANG_TIDY)
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
if(NOT CLANG_TIDY_COMMAND)
message(WARNING "WITH_CLANG_TIDY is ON but clang-tidy is not found!")
set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE)
else()
set(CLANG_TIDY_CHECKS "-*,modernize-*")
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
endif()
endif()
# libsndfile backend
if(WITH_LIBSNDFILE)
find_package(LibSndFile REQUIRED)
set(CEAMMC_HAVE_LIBSNDFILE TRUE)
if(PKGCONFIG_LIBSNDFILE_VERSION)
set(LIBSNDFILE_VERSION ${PKGCONFIG_LIBSNDFILE_VERSION})
endif()
endif()
# FFTW3
if(WITH_FFTW)
find_package(FFTW REQUIRED)
if(NOT FFTW_FOUND)
set(WITH_FFTW OFF CACHE BOOL "" FORCE)
endif()
endif()
add_subdirectory(portmidi)
add_subdirectory(src)
add_subdirectory(tcl)
add_subdirectory(extra)
add_subdirectory(doc)
add_subdirectory(mac)
if(GETTEXT_FOUND)
add_subdirectory(po)
endif()
if(ENABLE_TESTS)
enable_testing(true)
endif()
add_subdirectory(ceammc)
include(package)
include(summary)
add_custom_target(puredata_changelog SOURCES CHANGELOG.md)
file(GLOB _DEB_FILES "debian/*")
add_custom_target(deb_files SOURCES ${_DEB_FILES})
add_custom_target(ci_files SOURCES appveyor.yml)