forked from stripwax/SAASound
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
102 lines (88 loc) · 3.09 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
cmake_minimum_required(VERSION 3.10)
if (APPLE)
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "OSX Architectures")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9")
option(BUILD_FRAMEWORK "Build a Mac OS X framework instead of a shared library" ON)
endif ()
project(SAASound)
if (MSVC)
add_definitions(-DUNICODE -D_UNICODE)
endif ()
set(EXTERNAL_CLK_HZ "8000000" CACHE STRING "External clock in Hz")
option(SAAFREQ_FIXED_CLOCKRATE "Use precomputed frequency table, external clock is locked" OFF)
set(SAMPLE_RATE_HZ "44100" CACHE STRING "Output sample rate in Hz")
set(DEFAULT_OVERSAMPLE "6" CACHE STRING "Default oversample factor")
set(DEFAULT_UNBOOSTED_MULTIPLIER "11.3" CACHE STRING "Default scaling factor (before volume boost), not configurable in SAAConfig.cfg")
set(DEFAULT_BOOST "1" CACHE STRING "Default volume boost multiplier, configurable in SAAConfig.cfg")
option(DEBUGSAA "Create a text log of all register:value writes as well as a raw PCM output file" OFF)
set(DEBUG_SAA_REGISTER_LOG "debugsaa.txt" CACHE STRING "Path to register log file (if DEBUGSAA)")
set(DEBUG_SAA_PCM_LOG "debugsaa.pcm" CACHE STRING "Path to raw PCM output file (if DEBUGSAA)")
option(USE_CONFIG_FILE "Compile support for loading a config file on startup (SAAsound.cfg)" ON)
set(CONFIG_FILE_PATH "SAASound.cfg" CACHE STRING "Path to config file (if USE_CONFIG_FILE)")
#include(CheckStructHasMember)
#CHECK_STRUCT_HAS_MEMBER("struct dirent" d_type dirent.h HAVE_STRUCT_DIRENT_D_TYPE LANGUAGE CXX)
if (MSVC)
set(RESOURCES resources/SAASound.def)
endif ()
add_library(SAASound SHARED)
set(API_HEADERS include/SAASound.h)
target_sources(SAASound
PRIVATE
src/defns.h
src/SAAAmp.cpp
src/SAAAmp.h
src/SAADevice.cpp
src/SAADevice.h
src/SAAEnv.cpp
src/SAAEnv.h
src/SAAFreq.cpp
src/SAAFreq.h
src/SAAImpl.cpp
src/SAAImpl.h
src/SAANoise.cpp
src/SAANoise.h
src/SAASndC.cpp
src/SAASound.cpp
src/types.h
src/SAASndC.h
${RESOURCES}
${API_HEADERS}
)
if (USE_CONFIG_FILE)
target_sources(SAASound
PRIVATE
src/SAAConfig.cpp
src/SAAConfig.h
src/minIni/minIni.h
src/minIni/minIni.c
src/minIni/minGlue.h
)
endif ()
set_target_properties(SAASound PROPERTIES
VERSION 3.5
SOVERSION 3
CXX_STANDARD 11)
target_include_directories(SAASound PRIVATE
${CMAKE_BINARY_DIR}
PUBLIC
include)
if (APPLE AND BUILD_FRAMEWORK)
set_target_properties(SAASound PROPERTIES
OUTPUT_NAME SAASound
FRAMEWORK TRUE
FRAMEWORK_VERSION C
MACOSX_FRAMEWORK_IDENTIFIER com.beermex)
set_source_files_properties(${API_HEADERS} PROPERTIES
MACOSX_PACKAGE_LOCATION Headers)
endif ()
configure_file(src/config.h.in ${CMAKE_BINARY_DIR}/saasound_cmake_config.h)
target_compile_definitions(SAASound PRIVATE HAVE_CONFIG_H=1)
install(TARGETS SAASound
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
FRAMEWORK DESTINATION lib
PUBLIC_HEADER DESTINATION include)
if (NOT APPLE OR NOT BUILD_FRAMEWORK)
install(FILES ${API_HEADERS} DESTINATION include)
endif ()