forked from whoozle/clunk
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
95 lines (78 loc) · 2.03 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
project(clunk)
cmake_minimum_required(VERSION 3.9)
set(CMAKE_USE_RELATIVE_PATHS TRUE)
include(CheckCXXSymbolExists)
SET(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
# modules
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(SDL2 REQUIRED)
option(WITH_SSE "Use highly optimized SSE FFT/MDCT routines" false)
# Build clunk as a shared library by default
set(BUILD_SHARED_LIBS ON CACHE BOOL INTERNAL)
# For install like macports for easy dylibbundler
set(CMAKE_SKIP_RPATH true)
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
if ( NOT SDL2_FOUND )
message ( FATAL_ERROR "SDL2 not found!" )
endif ( NOT SDL2_FOUND )
set(clunk_VERSION_MAJOR 1)
set(clunk_VERSION_MINOR 0)
if(WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_WINDOWS)
endif(WIN32)
add_definitions(-DCLUNKAPI=DLLEXPORT)
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
include_directories(${SDL2_INCLUDE_DIR})
set(SOURCES
buffer.cpp
clunk_ex.cpp
context.cpp
distance_model.cpp
kemar.c
logger.cpp
object.cpp
sample.cpp
sdl_ex.cpp
source.cpp
stream.cpp
clunk_c.cpp
)
set(PUBLIC_HEADERS
buffer.h
clunk.h
clunk_assert.h
context.h
distance_model.h
export_clunk.h
fft_context.h
locker.h
logger.h
mdct_context.h
object.h
sample.h
source.h
sse_fft_context.h
stream.h
v3.h
clunk_c.h
)
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -ftree-vectorize -ffast-math")
if (WITH_SSE)
set(SOURCES ${SOURCES} sse_fft_context.cpp)
add_definitions(-DCLUNK_USES_SSE)
add_definitions(-msse2)
endif(WITH_SSE)
check_cxx_symbol_exists(pow10f "math.h" HAVE_POW10F_FUNCTION)
check_cxx_symbol_exists(log2f "math.h" HAVE_LOG2F_FUNCTION)
if(NOT HAVE_POW10F_FUNCTION)
add_definitions(-DNEED_POW10F)
endif()
if(NOT HAVE_LOG2F_FUNCTION)
add_definitions(-DNEED_LOG2F)
endif()
message(STATUS "Build clunk as a shared library: ${BUILD_SHARED_LIBS}")
add_library(clunk ${SOURCES})
install(TARGETS clunk DESTINATION lib)
install(FILES ${PUBLIC_HEADERS} DESTINATION include/clunk)
target_link_libraries(clunk ${SDL2_LIBRARY})