blob: ea5144bad2cda403c8c38876929eea14a1af13d2 (
plain) (
blame)
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
103
|
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_C_STANDARD 11)
#add_definitions( "-Wall -O2 -g -Rpass-analysis=loop-vectorize" )
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=address -fno-omit-frame-pointer")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE)
endif()
include(CheckCXXCompilerFlag)
function(enable_cxx_compiler_flag_if_supported flag)
string(FIND "${CMAKE_CXX_FLAGS}" "${flag}" flag_already_set)
if(flag_already_set EQUAL -1)
check_cxx_compiler_flag("${flag}" flag_supported)
if(flag_supported)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE)
endif()
unset(flag_supported CACHE)
endif()
endfunction()
enable_cxx_compiler_flag_if_supported("-Wall")
enable_cxx_compiler_flag_if_supported("-Wextra")
project(atracdenc)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
if (WIN32)
add_compile_definitions(PLATFORM_WINDOWS)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
include_directories("platform/win/getopt")
set(SOURCE_PCM_IO_LIB
platform/win/pcm_io/mf/pcm_io_mf.cpp
platform/win/pcm_io/win32/pcm_io_win32.cpp
platform/win/pcm_io/pcm_io.cpp
)
else()
INCLUDE(FindLibSndFile)
include_directories(${LIBSNDFILE_INCLUDE_DIR})
set(SOURCE_PCM_IO_LIB
pcm_io_sndfile.cpp
)
endif()
include (TestBigEndian)
TEST_BIG_ENDIAN(BIGENDIAN_ORDER)
if (${BIGENDIAN})
add_compile_definitions(BIGENDIAN_ORDER)
endif()
include_directories(
"lib"
"oma/liboma/include"
)
set(SOURCE_FFT_LIB fft/kissfft_impl/kiss_fft.c)
set_source_files_properties(fft/kissfft_impl/kiss_fft.c PROPERTIES COMPILE_FLAGS -Dkiss_fft_scalar=double)
set(SOURCE_OMA_LIB oma/liboma/src/liboma.c)
set(SOURCE_BITSTREAM_LIB bitstream/bitstream.cpp)
set(SOURCE_ATRACDENC_IMPL
wav.cpp
aea.cpp
env.cpp
transient_detector.cpp
atrac1denc.cpp
atrac/atrac1.cpp
atrac/atrac1_dequantiser.cpp
atrac/atrac_scale.cpp
atrac/atrac_psy_common.cpp
atrac/atrac1_bitalloc.cpp
oma.cpp
rm.cpp
at3.cpp
atrac3denc.cpp
atrac/atrac3.cpp
atrac/atrac3_bitstream.cpp
mdct/mdct.cpp
)
add_library(fft_impl STATIC ${SOURCE_FFT_LIB})
add_library(pcm_io STATIC ${SOURCE_PCM_IO_LIB})
if (NOT WIN32)
target_link_libraries(pcm_io ${SNDFILE_LIBRARIES})
endif()
add_library(oma STATIC ${SOURCE_OMA_LIB})
add_library(bitstream STATIC ${SOURCE_BITSTREAM_LIB})
add_library(atracdenc_impl STATIC ${SOURCE_ATRACDENC_IMPL})
target_link_libraries(atracdenc_impl fft_impl pcm_io oma bitstream ${SNDFILE_LIBRARIES})
set(SOURCE_EXE
main.cpp
help.cpp
)
add_executable(atracdenc ${SOURCE_EXE})
target_link_libraries(atracdenc pcm_io oma atracdenc_impl ${SNDFILE_LIBRARIES})
install(TARGETS atracdenc)
|