-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
80 lines (66 loc) · 2.05 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
cmake_minimum_required(VERSION 3.10)
project(dmusic LANGUAGES C VERSION 0.0.1)
set(CMAKE_C_STANDARD 11)
option(DM_ENABLE_ASAN "DirectMusic: Enable sanitizers in debug builds." ON)
option(DM_BUILD_EXAMPLES "DirectMusic: Build the examples." OFF)
option(DM_BUILD_STATIC "DirectMusic: Build as a static library instead of a shared one." OFF)
add_subdirectory(vendor)
list(APPEND _DM_SOURCE
src/util/Array.h
src/util/Tsf.c
src/io/Band.c
src/io/Common.c
src/io/Dls.c
src/io/Segment.c
src/io/Style.c
src/thread/Thread.h
src/thread/Thread.Posix.c
src/thread/Thread.Win32.c
src/_Dls.h
src/_Internal.h
src/_Riff.h
src/Array.c
src/Common.c
src/Composer.c
src/Dls.c
src/Band.c
src/Loader.c
src/Logger.c
src/Memory.c
src/Message.c
src/Performance.c
src/Riff.c
src/Rng.c
src/Segment.c
src/Style.c
src/Synth.c
)
include(support/BuildSupport.cmake)
bs_select_cflags(${DM_ENABLE_ASAN} _DM_COMPILE_FLAGS _DM_LINK_FLAGS)
if (${DM_BUILD_STATIC})
add_library(dmusic STATIC)
target_compile_definitions(dmusic PUBLIC DM_STATIC=1)
else ()
add_library(dmusic SHARED)
endif ()
target_sources(dmusic PRIVATE ${_DM_SOURCE})
target_include_directories(dmusic PUBLIC include)
target_include_directories(dmusic PRIVATE src)
target_compile_definitions(dmusic PRIVATE DM_BUILD=1)
target_compile_options(dmusic PRIVATE ${_DM_COMPILE_FLAGS})
target_link_options(dmusic PRIVATE ${_DM_LINK_FLAGS})
target_link_libraries(dmusic PRIVATE dmusic-tsf)
if (MINGW)
target_compile_definitions(dmusic PRIVATE _POSIX_C_SOURCE=1)
endif ()
set_target_properties(dmusic PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN 1
DEBUG_POSTFIX "d"
VERSION ${PROJECT_VERSION}
)
install(TARGETS dmusic ARCHIVE LIBRARY RUNTIME)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include" TYPE INCLUDE)
if (DM_BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()