-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (56 loc) · 2.02 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
cmake_minimum_required(VERSION 3.17)
project(MIDIPlayer)
set(CMAKE_CXX_STANDARD 20)
include(GNUInstallDirs)
option(MIDIPLAYER_PORTABLE_INSTALL "Generate local/portable installation, that will not use absolute paths.")
if(MIDIPLAYER_PORTABLE_INSTALL)
message(STATUS "Creating portable installation. CMAKE_INSTALL_PREFIX will be overridden.")
set(CMAKE_INSTALL_PREFIX root)
endif()
include(FetchContent)
FetchContent_Declare(fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 10.2.1
)
FetchContent_MakeAvailable(fmt)
find_package(SFML 2.5.1 COMPONENTS graphics audio REQUIRED)
add_executable(midiplayer
src/Config/Action.cpp
src/Config/Condition.cpp
src/Config/Configuration.cpp
src/Config/Info.cpp
src/Config/Lexer.cpp
src/Config/Parser.cpp
src/Config/Property.cpp
src/Config/Reader.cpp
src/Config/Selector.cpp
src/Config/Statement.cpp
src/AnimatableBackground.cpp
src/Event.cpp
src/FileWatcher.cpp
src/MIDIDevice.cpp
src/MIDIFile.cpp
src/MIDIInput.cpp
src/MIDIKey.cpp
src/MIDIPlayer.cpp
src/MIDIPlayerConfig.cpp
src/Resources.cpp
src/RoundedEdgeRectangleShape.cpp
src/TileWorld.cpp
src/Track.cpp
src/main.cpp
)
target_compile_options(midiplayer PUBLIC -Werror -Wnon-virtual-dtor -fdiagnostics-color=always)
target_link_libraries(midiplayer pthread sfml-graphics sfml-audio fmt rtmidi)
target_include_directories(midiplayer PUBLIC ${CMAKE_BINARY_DIR}/src)
install(TARGETS midiplayer DESTINATION bin)
if(MIDIPLAYER_PORTABLE_INSTALL)
# This is a big HACK to support running executable from `bin` for local installations (but idk the proper solution)
install(DIRECTORY res DESTINATION ".")
set(MIDIPLAYER_RESOURCE_DIR "../res")
else()
install(DIRECTORY res/ DESTINATION ${CMAKE_INSTALL_DATADIR}/midiplayer)
set(MIDIPLAYER_RESOURCE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/midiplayer)
endif()
message(STATUS "Using resource path: '${MIDIPLAYER_RESOURCE_DIR}'")
configure_file(src/ResourceDir.h.in src/ResourceDir.h)