CMakeLists.txt 7.34 KB
Newer Older
Jonas Stienen's avatar
Jonas Stienen committed
1
2
3
4
5
6
7
8
cmake_minimum_required( VERSION 2.8 )

project( ITABase )

list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )

# dependencies
9
vista_use_package( VistaCoreLibs REQUIRED COMPONENTS VistaBase VistaInterProcComm VistaTools FIND_DEPENDENCIES )
Jonas Stienen's avatar
Jonas Stienen committed
10
11
12
13
vista_use_package( sndfile )
vista_use_package( IPP QUIET )
vista_use_package( PCRE QUIET )
vista_use_package( SimpleIni QUIET )
14
vista_use_package( SPLINE REQUIRED )
Jonas Stienen's avatar
Jonas Stienen committed
15

Marco Berzborn's avatar
Marco Berzborn committed
16
17
18
19
20
21
if ( NOT WIN32 )
	vista_use_package ( Threads REQUIRED )
	list ( APPEND VISTA_USE_PACKAGE_LIBRARIES pthread )
endif ()


Jonas Stienen's avatar
Jonas Stienen committed
22
23
if( NOT DEFINED ITA_BASE_WITH_FASTMATH_IPP )
	set( ITA_BASE_WITH_FASTMATH_IPP OFF CACHE BOOL "Build with IPP implementation of fast math ops" )
24
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
25
26
27

if( NOT DEFINED ITA_BASE_WITH_FASTMATH_ASSEMBLER )
	set( ITA_BASE_WITH_FASTMATH_ASSEMBLER OFF CACHE BOOL "Build with assembler implementation of fast math ops" )
28
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
29
30
31

if( NOT DEFINED ITA_BASE_WITH_SNDFILE )
	set( ITA_BASE_WITH_SNDFILE ON CACHE BOOL "Build with libsndfile to read/write audio samples for ITASampleFrame" )
32
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
33
34

if( NOT DEFINED ITA_BASE_WITH_OLD_ATOMICS )
35
	set( ITA_BASE_WITH_OLD_ATOMICS OFF CACHE BOOL "Build with old atomic code for non-C++11 compatible compilers" )
36
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
37
38

if( NOT DEFINED ITA_BASE_WITH_REGULAR_EXPRESSIONS )
39
	set( ITA_BASE_WITH_REGULAR_EXPRESSIONS OFF CACHE BOOL "Build with old regular expressions code for string manipulation" )
40
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
41
42

if( NOT DEFINED ITA_BASE_WITH_CONFIG_OLD_IMPL )
43
	set( ITA_BASE_WITH_CONFIG_OLD_IMPL OFF CACHE BOOL "Build with old INI file configuration implementation (uses legacy regular expressions)" )
44
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
45

46
if( NOT DEFINED ITA_BASE_WITH_OLD_RAVEN_OPS )
47
	set( ITA_BASE_WITH_OLD_RAVEN_OPS OFF CACHE BOOL "Build with old ITAOps helper functions implementation (legacy code for RAVEN compatibility, adds GPL-licensed libs!)" )
48
endif( )
49

Jonas Stienen's avatar
Jonas Stienen committed
50
51
52
53
54
55
56
57

# includes
include_directories( "include" )


# files
set( ITABaseHeader
	"include/ITAASCIITable.h"
58
	"include/ITAAmplitudeSpectrum.h"
Jonas Stienen's avatar
Jonas Stienen committed
59
	"include/ITABaseDefinitions.h"
60
	"include/ITABlockMath.h"
Jonas Stienen's avatar
Jonas Stienen committed
61
62
63
64
65
	"include/ITABufferedAudioFileWriter.h"
	"include/ITAClock.h"
	"include/ITAConstants.h"
	"include/ITACriticalSection.h"
	"include/ITADataLog.h"
66
	"include/ITADebug.h"
Jonas Stienen's avatar
Jonas Stienen committed
67
68
69
70
71
	"include/ITAEndianness.h"
	"include/ITAException.h"
	"include/ITAFade.h"
	"include/ITAFastMath.h"
	"include/ITAFileSystemUtils.h"
72
	"include/ITAFiniteImpulseResponse.h"
73
	"include/ITAHDFTSpectra.h"
Jonas Stienen's avatar
Jonas Stienen committed
74
75
	"include/ITAHDFTSpectrum.h"
	"include/ITAFunctors.h"
76
	"include/ITAInterpolation.h"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
77
	"include/ITALog.h"
78
	"include/ITAMagnitudeSpectrum.h"
79
	"include/ITAMultichannelFiniteImpulseResponse.h"
Jonas Stienen's avatar
Jonas Stienen committed
80
81
82
83
	"include/ITANumericUtils.h"
	"include/ITASampleBuffer.h"
	"include/ITASampleFrame.h"
	"include/ITASampleTypeConversion.h"
84
	"include/ITASimpleConvolution.h"
85
	"include/ITASpectrum.h"
Jonas Stienen's avatar
Jonas Stienen committed
86
87
	"include/ITAStopWatch.h"
	"include/ITAStringUtils.h"
88
	"include/ITAThirdOctaveMagnitudeSpectrum.h"
Jonas Stienen's avatar
Jonas Stienen committed
89
90
91
	"include/ITATimeSeriesAnalyzer.h"
	"include/ITATypes.h"
	"include/ITAUncopyable.h"
92
	"include/ITAWholeOctaveMagnitudeSpectrum.h"
Jonas Stienen's avatar
Jonas Stienen committed
93
94
95
96
	"include/ITAWinPCClock.h"
	)
set( ITABaseSources
	"src/ITAASCIITable.cpp"
97
	"src/ITAAmplitudeSpectrum.cpp"
98
	"src/ITABlockMath.cpp"
Jonas Stienen's avatar
Jonas Stienen committed
99
100
101
102
103
104
	"src/ITABufferedAudioFileWriter.cpp"
	"src/ITAClock.cpp"
	"src/ITACriticalSection.cpp"
	"src/ITACriticalSectionImpl.h"
	"src/ITACriticalSectionPosixImpl.h"
	"src/ITACriticalSectionWin32Impl.h"
105
	"src/ITADebug.cpp"
Jonas Stienen's avatar
Jonas Stienen committed
106
107
108
109
	"src/ITAEndianness.cpp"
	"src/ITAException.cpp"
	"src/ITAFade.cpp"
	"src/ITAFileSystemUtils.cpp"
110
	"src/ITAFiniteImpulseResponse.cpp"
111
	"src/ITAHDFTSpectra.cpp"
Jonas Stienen's avatar
Jonas Stienen committed
112
	"src/ITAHDFTSpectrum.cpp"
113
	"src/ITAInterpolation.cpp"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
114
	"src/ITALog.cpp"
115
	"src/ITAMagnitudeSpectrum.cpp"
116
	"src/ITAMultichannelFiniteImpulseResponse.cpp"
Jonas Stienen's avatar
Jonas Stienen committed
117
118
119
120
	"src/ITANumericUtils.cpp"
	"src/ITASampleBuffer.cpp"
	"src/ITASampleFrame.cpp"
	"src/ITASampleTypeConversion.cpp"
121
	"src/ITASimpleConvolution.cpp"
122
	"src/ITASpectrum.cpp"
Jonas Stienen's avatar
Jonas Stienen committed
123
	"src/ITAStopWatch.cpp"
124
	"src/ITATypes.cpp"
Jonas Stienen's avatar
Jonas Stienen committed
125
126
127
	"src/ITAWinPCClock.cpp"
	)

js908001's avatar
js908001 committed
128
129
130

# Win32 implementations
if( WIN32 )
Jonas Stienen's avatar
Jonas Stienen committed
131
132
	list( APPEND ITABaseHeader "include/ITAHPT.h" "include/ITAMutex.h" "include/ITATimer.h" )
	list( APPEND ITABaseSources "src/ITAHPT.cpp" "src/ITAMutex.cpp" "src/ITATimer.cpp" )
133
else( )
Fabian Schlieper's avatar
Fabian Schlieper committed
134
135
136
	add_definitions( -DUSE_SIMPLEINI )
	list( APPEND ITABaseSources "src/ITAPosixRealtimeClock.cpp" "src/simpleini/SimpleIni.h" "src/simpleini/ConvertUTF.h" "src/simpleini/ConvertUTF.c"  )
	list( APPEND ITABaseSources "src/ITAConfigUtilsSimpleIniImpl.cpp" )
137
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
138

Jonas Stienen's avatar
Jonas Stienen committed
139
140
141
142
143
144
145
146
147
148
149
150
151
if( VSNDFILE_FOUND AND ITA_BASE_WITH_SNDFILE  )
	set( ITABaseHeader "${ITABaseHeader}"
		"include/ITAAudiofileCommon.h"
		"include/ITAAudiofileReader.h"
		"include/ITAAudiofileWriter.h"
		)
	set( ITABaseSources "${ITABaseSources}" 
		"src/ITAAudiofileCommon.cpp"
		"src/ITAAudiofileReader.cpp"
		"src/ITAAudiofileWriter.cpp"
		"src/libsndfileAudiofileReader.cpp"
		"src/libsndfileAudiofileWriter.cpp"
		)
152
		add_definitions( -DITABASE_WITH_SNDFILE )
153
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
154
155
156
157
158

if( VIPP_FOUND AND ITA_BASE_WITH_FASTMATH_IPP )
	set( ITABaseSources "${ITABaseSources}" "src/ITAFastMathImplIPP.cpp" )
elseif( ITA_BASE_WITH_FASTMATH_ASSEMBLER )
	set( ITABaseSources "${ITABaseSources}" "src/ITAFastMathImplAssembler.cpp" ) # not recommended
159
else( )
Jonas Stienen's avatar
Jonas Stienen committed
160
	set( ITABaseSources "${ITABaseSources}" "src/ITAFastMathImpl.cpp" )
161
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
162
163

if( ITA_BASE_WITH_OLD_ATOMICS )
164
	set( ITABaseHeader "${ITABaseHeader}" "include/ITAAtomicOps.h" "include/ITAAtomicPrimitives.h" )
Jonas Stienen's avatar
Jonas Stienen committed
165
166
	if( WIN32 )
		set( ITABaseSources "${ITABaseSources}" "src/ITAAtomicOpsWin32Impl.cpp" )
167
	else( )
Jonas Stienen's avatar
Jonas Stienen committed
168
		set( ITABaseSources "${ITABaseSources}" "src/ITAAtomicOpsGCCBuiltinsImpl.cpp" )
169
170
	endif( )
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
171

172
if( ITA_BASE_WITH_OLD_RAVEN_OPS )
173
174
	if( NOT ITA_BASE_WITH_CONFIG_OLD_IMPL )
		message( FATAL_ERROR "ITABase old RAVEN ops requires regular expressions and old config implementation. Please activate." )
175
	endif( )
176
177
178
	if( NOT VSPLINE_FOUND )
		message( FATAL_ERROR "ITABase old RAVEN ops requires SPLINE, which was not found. Please provide." )
	endif( )
179
180
	set( ITABaseHeader "${ITABaseHeader}" "include/ITAOps.h" )
	set( ITABaseSources "${ITABaseSources}" "src/ITAOps.cpp" )
181
endif( )
182

Jonas Stienen's avatar
Jonas Stienen committed
183
184
if( VPCRE_FOUND AND ITA_BASE_WITH_REGULAR_EXPRESSIONS )
	add_definitions( -DPCRE_STATIC )
185
	list( APPEND ITABaseSources "src/ITAStringUtilsPCRE.cpp" )
186
else( )
187
	list( APPEND ITABaseSources "src/ITAStringUtils.cpp" )
188
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
189
190
191
192

if( ITA_BASE_WITH_CONFIG_OLD_IMPL AND NOT ITA_BASE_WITH_CONFIG_SIMPLE_INI )
	if( NOT ITA_BASE_WITH_REGULAR_EXPRESSIONS )
		message( FATAL_ERROR "ITABase old config implementation requires regular expressions. Please activate." )
193
	endif( )
194
195
	list( APPEND ITABaseHeader "include/ITAConfigUtils.h" )
	list( APPEND ITABaseSources "src/ITAConfigUtils.cpp" "src/ITAConfigUtilsWin32Impl.cpp" )
196
endif( )
197

198

199
200
# preprocessor
if( BUILD_SHARED_LIBS )
201
	add_definitions( -DITA_BASE_EXPORT )
202
else( )
203
	add_definitions( -DITA_BASE_STATIC )
204
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
205

206
207
208
if( ITA_VISTA_BUILD_STATIC )
	add_definitions( -DVISTABASE_STATIC -DVISTAMATH_STATIC -DVISTAASPECTS_STATIC -DVISTATOOLS_STATIC -DVISTAINTERPROCCOMM_STATIC )
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
209

Fabian Schlieper's avatar
Fabian Schlieper committed
210
211
if( NOT WIN32 )
	add_definitions( -std=gnu++11 )
212
213
endif( )

Fabian Schlieper's avatar
Fabian Schlieper committed
214

Jonas Stienen's avatar
Jonas Stienen committed
215
# linker
216
add_library( ITABase ${ITABaseHeader} ${ITABaseSources} )
Jonas Stienen's avatar
Jonas Stienen committed
217
218
219
220
221
222
223
224
225
226
227
228
229
230
target_link_libraries( ITABase ${VISTA_USE_PACKAGE_LIBRARIES} )


# configure
vista_configure_lib( ITABase )
vista_install( ITABase )
set( ITABASE_INCLUDE_OUTDIR "${CMAKE_CURRENT_SOURCE_DIR}/include" )
vista_create_cmake_configs( ITABase )
vista_create_default_info_file( ITABase )

set_property( TARGET ITABase PROPERTY FOLDER "ITACoreLibs" )


# tests
231
232
233
if( ITA_CORE_LIBS_WITH_TESTS )
	set( ITABASE_COMMON_BUILD TRUE )
	add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/tests" )
234
endif( )