-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (47 loc) · 1.94 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
set(CMAKE_INSTALL_PREFIX "/opt/deadbeef/lib/deadbeef")
# Setup project
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(GSFdecoder)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_VERSION 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -fno-math-errno -fno-trapping-math")
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -fno-math-errno -fno-trapping-math")
# set build type variable in preprocessor
if(CMAKE_BUILD_TYPE)
string(TOUPPER "${CMAKE_BUILD_TYPE}" _upper_build_type)
add_compile_definitions(BUILD_${_upper_build_type}=1)
endif()
OPTION (ENABLE_LOGGING "Write trace messages to deadbeef's log" OFF)
IF(ENABLE_LOGGING)
add_compile_definitions(ENABLE_LOGGING=1)
ENDIF()
OPTION (STDERR_DEBUGGING "Write trace messages to stderr" OFF)
IF(STDERR_DEBUGGING)
add_compile_definitions(STDERR_DEBUGGING=1)
ENDIF()
SET (DEFAULT_SAMPLE_RATE "44100" CACHE STRING "Set the default sample rate to be used for playback if not specified by the config")
IF(DEFAULT_SAMPLE_RATE)
add_compile_definitions(DEFAULTSAMPLERATE=${DEFAULT_SAMPLE_RATE})
message("-- Default sample rate set to ${DEFAULT_SAMPLE_RATE}Hz")
ENDIF()
# add include dir
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/lib)
# add libraries
link_directories(${PROJECT_SOURCE_DIR}/lib)
# build viogsf
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/viogsf)
# build psflib
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/psflib)
# add sources and headers
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cpp ${PROJECT_SOURCE_DIR}/src/*.c)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.h)
# build library
add_library(GSFdecoder MODULE ${sources} ${headers})
set_property(TARGET GSFdecoder PROPERTY POSITION_INDEPENDENT_CODE ON)
set_target_properties(GSFdecoder PROPERTIES PREFIX "")
target_link_libraries(GSFdecoder viogsf psflib)
install(TARGETS GSFdecoder LIBRARY DESTINATION .)