This repository was archived by the owner on Jun 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
94 lines (81 loc) · 2.95 KB
/
CMakeLists.txt
File metadata and controls
94 lines (81 loc) · 2.95 KB
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
cmake_minimum_required(VERSION 2.6)
project(dsf2flac)
# check OS before we start
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# On Linux a static executable is made, this maximises portability.
set(static 1)
# link to librt (possibly not required but need to check with compressed dsf before removing).
set (link_rt 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# On OSX statically linked executables are not allowed so instead a dynamic one is made.
set(static 0)
# don't link to librt
set (link_rt 0)
else()
# Error if another system is detected.
message( FATAL_ERROR "Sorry, your operating system is not supported yet.\nIt is probably not too hard to add support but you will need to add some details to CMakeLists.txt" )
endif()
# compiler options
set(CMAKE_CXX_FLAGS "-O3 -Wall")
# linker options
if ( static )
set(CMAKE_EXE_LINKER_FLAGS "-static")
else()
set(CMAKE_EXE_LINKER_FLAGS "")
endif()
# set location of cmake modules for finding required libs
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmakemodules)
# find the required libraries
find_package(Boost REQUIRED COMPONENTS system timer filesystem chrono)
find_package(Ogg REQUIRED)
find_package(Flac REQUIRED)
find_package(Id3 REQUIRED)
find_package(Z REQUIRED)
if ( link_rt )
find_package(Rt REQUIRED)
endif()
# set the include directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/libdstdec)
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${Ogg_INCLUDE_DIRS})
include_directories(${Flac_INCLUDE_DIRS})
include_directories(${Id3_INCLUDE_DIRS})
include_directories(${Z_INCLUDE_DIRS})
# source file locations
set( DSF2FLAC_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/tagConversion.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/dop_packer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/dsd_sample_reader.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/dsf_file_reader.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/filters.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/fstream_plus.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/dsd_decimator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/dsdiff_file_reader.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cmdline.c
)
set( LIBDSTDEC_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/libdstdec/ccp_calc.c
${CMAKE_CURRENT_SOURCE_DIR}/src/libdstdec/unpack_dst.c
${CMAKE_CURRENT_SOURCE_DIR}/src/libdstdec/dst_ac.c
${CMAKE_CURRENT_SOURCE_DIR}/src/libdstdec/dst_data.c
${CMAKE_CURRENT_SOURCE_DIR}/src/libdstdec/dst_fram.c
${CMAKE_CURRENT_SOURCE_DIR}/src/libdstdec/dst_init.c
)
# define the executable that is to be created.
add_executable(dsf2flac
${DSF2FLAC_SOURCE_FILES}
${LIBDSTDEC_SOURCE_FILES}
)
# set the libs for linking
target_link_libraries(dsf2flac
${Flac_LIBRARIES}
${Boost_LIBRARIES}
${Ogg_LIBRARIES}
${Id3_LIBRARIES}
${Z_LIBRARIES}
)
if ( link_rt )
target_link_libraries(dsf2flac ${Rt_LIBRARIES})
endif()