forked from libaudioverse/libaudioverse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
77 lines (64 loc) · 2.96 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
cmake_MINIMUM_REQUIRED(VERSION 3.0.0)
#Force release as our default, if the user hasn't overridden.
#Libaudioverse is almost completely useless in debug.
#The project command sets this, if we haven't.
if(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "The build type. Either Debug, Release, RelWithDebInfo, or MinSizeRel." FORCE)
endif()
project(Libaudioverse)
if("$ENV{APPVEYOR}")
set(PYTHON_COMMAND "$ENV{PYTHON_COMMAND}")
#Are we using the Windows Python launcher?
#If so, we rely on PY_VERSION being set by the user. This is unfortunate, but there doesn't seem to be a better way.
elseif(${WIN32})
set(PYTHON_COMMAND "py")
elseif(UNIX)
set(PYTHON_COMMAND python3)
else()
set(PYTHON_COMMAND python)
endif()
message("Python command is ${PYTHON_COMMAND} with args ${PYTHON_ARGS}")
include_directories("${CMAKE_SOURCE_DIR}/include")
option(LIBAUDIOVERSE_DEVMODE "Whether this is being built for official release. Makes some targets (documentation) optional" ON)
#Which CPU extensions to enable?
option(LIBAUDIOVERSE_USE_SSE2 "Use SSE2" ON)
#this is the required alignment for allocation, a default which is configured in case sse/other processor extensions are disabled.
SET(LIBAUDIOVERSE_MALLOC_ALIGNMENT 1)
if(${LIBAUDIOVERSE_USE_SSE2})
SET(LIBAUDIOVERSE_MALLOC_ALIGNMENT 16)
ENDIF()
#sets up compiler flags for things: sse, vc++ silencing, etc.
#This needs to be first to force MSVC static runtime.
#We declare its options here so that they are advertised to readers of this file.
option(LIBAUDIOVERSE_MSVC_FORCE_STATIC_RUNTIME "Force VC++ to statically link the runtime" ON)
include("cmake_include/compiler_flags.txt")
#Libraries CMake has modules for.
find_package(Threads REQUIRED)
if(NOT MSVC)
find_package(Boost REQUIRED
COMPONENTS locale iostreams filesystem thread)
else()
message("You are on MSVC. Skipping boost and assuming it exists.")
message("NOTE: Boost will auto-link needed libraries.")
endif()
#Libraries we vendor.
include("vendoring/libsndfile.txt")
include("vendoring/glm.txt")
include("vendoring/kissfft.txt")
#mine. Order matters because of include directories.
include("vendoring/logger_singleton.txt")
include("vendoring/powercores.txt")
include("vendoring/speex_resampler_cpp.txt")
include("vendoring/audio_io.txt")
#All the libraries we need to link with. Platform-specific libraries are set in the include file for compiler flags.
SET(libaudioverse_required_libraries ${libaudioverse_required_libraries} ${libsndfile_name} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} kissfft audio_io logger_singleton speex_resampler_cpp powercores)
add_subdirectory(src)
#this makes the bindings generation step always run after a Libaudioverse build.
ADD_CUSTOM_TARGET(libaudioverse_bindings ALL
COMMAND ${PYTHON_COMMAND} ${PYTHON_ARGS} "\"${CMAKE_CURRENT_SOURCE_DIR}/scripts/build_bindings.py\""
DEPENDS libaudioverse
)
ADD_CUSTOM_TARGET(libaudioverse_cfiles ALL
COMMAND ${PYTHON_COMMAND} ${PYTHON_ARGS} "\"${CMAKE_CURRENT_SOURCE_DIR}/scripts/make_zip.py\""
DEPENDS libaudioverse
)