Aufgrund einer Konfigurationsänderung wird die GitLab Registry ab 10 Uhr nur Read Only zur Verfügung stehen. / Due to a configuration change, the GitLab Registry will be available for read-only access from 10am.

CMakeLists.txt 6.73 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 QUIET )
Jonas Stienen's avatar
Jonas Stienen committed
15 16 17

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" )
18
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
19 20 21

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" )
22
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
23 24 25

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" )
26
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
27 28

if( NOT DEFINED ITA_BASE_WITH_OLD_ATOMICS )
29
	set( ITA_BASE_WITH_OLD_ATOMICS OFF CACHE BOOL "Build with old atomic code for non-C++11 compatible compilers" )
30
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
31 32

if( NOT DEFINED ITA_BASE_WITH_REGULAR_EXPRESSIONS )
33
	set( ITA_BASE_WITH_REGULAR_EXPRESSIONS OFF CACHE BOOL "Build with old regular expressions code for string manipulation" )
34
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
35 36

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

40
if( NOT DEFINED ITA_BASE_WITH_OLD_RAVEN_OPS )
41
	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!)" )
42
endif( )
43

Jonas Stienen's avatar
Jonas Stienen committed
44 45 46 47 48 49 50 51 52

# includes
include_directories( "include" )


# files
set( ITABaseHeader
	"include/ITAASCIITable.h"
	"include/ITABaseDefinitions.h"
53
	"include/ITABlockMath.h"
Jonas Stienen's avatar
Jonas Stienen committed
54 55 56 57 58
	"include/ITABufferedAudioFileWriter.h"
	"include/ITAClock.h"
	"include/ITAConstants.h"
	"include/ITACriticalSection.h"
	"include/ITADataLog.h"
59
	"include/ITADebug.h"
Jonas Stienen's avatar
Jonas Stienen committed
60 61 62 63 64
	"include/ITAEndianness.h"
	"include/ITAException.h"
	"include/ITAFade.h"
	"include/ITAFastMath.h"
	"include/ITAFileSystemUtils.h"
65
	"include/ITAHDFTSpectra.h"
Jonas Stienen's avatar
Jonas Stienen committed
66 67
	"include/ITAHDFTSpectrum.h"
	"include/ITAFunctors.h"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
68
	"include/ITALog.h"
Jonas Stienen's avatar
Jonas Stienen committed
69 70 71 72
	"include/ITANumericUtils.h"
	"include/ITASampleBuffer.h"
	"include/ITASampleFrame.h"
	"include/ITASampleTypeConversion.h"
73
	"include/ITASimpleConvolution.h"
Jonas Stienen's avatar
Jonas Stienen committed
74 75 76 77 78 79 80 81 82
	"include/ITAStopWatch.h"
	"include/ITAStringUtils.h"
	"include/ITATimeSeriesAnalyzer.h"
	"include/ITATypes.h"
	"include/ITAUncopyable.h"
	"include/ITAWinPCClock.h"
	)
set( ITABaseSources
	"src/ITAASCIITable.cpp"
83
	"src/ITABlockMath.cpp"
Jonas Stienen's avatar
Jonas Stienen committed
84 85 86 87 88 89
	"src/ITABufferedAudioFileWriter.cpp"
	"src/ITAClock.cpp"
	"src/ITACriticalSection.cpp"
	"src/ITACriticalSectionImpl.h"
	"src/ITACriticalSectionPosixImpl.h"
	"src/ITACriticalSectionWin32Impl.h"
90
	"src/ITADebug.cpp"
Jonas Stienen's avatar
Jonas Stienen committed
91 92 93 94
	"src/ITAEndianness.cpp"
	"src/ITAException.cpp"
	"src/ITAFade.cpp"
	"src/ITAFileSystemUtils.cpp"
95
	"src/ITAHDFTSpectra.cpp"
Jonas Stienen's avatar
Jonas Stienen committed
96
	"src/ITAHDFTSpectrum.cpp"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
97
	"src/ITALog.cpp"
Jonas Stienen's avatar
Jonas Stienen committed
98 99 100 101
	"src/ITANumericUtils.cpp"
	"src/ITASampleBuffer.cpp"
	"src/ITASampleFrame.cpp"
	"src/ITASampleTypeConversion.cpp"
102
	"src/ITASimpleConvolution.cpp"
Jonas Stienen's avatar
Jonas Stienen committed
103
	"src/ITAStopWatch.cpp"
104
	"src/ITATypes.cpp"
Jonas Stienen's avatar
Jonas Stienen committed
105 106 107
	"src/ITAWinPCClock.cpp"
	)

js908001's avatar
js908001 committed
108 109 110

# Win32 implementations
if( WIN32 )
Jonas Stienen's avatar
Jonas Stienen committed
111 112
	list( APPEND ITABaseHeader "include/ITAHPT.h" "include/ITAMutex.h" "include/ITATimer.h" )
	list( APPEND ITABaseSources "src/ITAHPT.cpp" "src/ITAMutex.cpp" "src/ITATimer.cpp" )
113
else( )
Fabian Schlieper's avatar
Fabian Schlieper committed
114 115 116
	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" )
117
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
118

Jonas Stienen's avatar
Jonas Stienen committed
119 120 121 122 123 124 125 126 127 128 129 130 131
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"
		)
132
		add_definitions( -DITABASE_WITH_SNDFILE )
133
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
134 135 136 137 138

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
139
else( )
Jonas Stienen's avatar
Jonas Stienen committed
140
	set( ITABaseSources "${ITABaseSources}" "src/ITAFastMathImpl.cpp" )
141
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
142 143

if( ITA_BASE_WITH_OLD_ATOMICS )
144
	set( ITABaseHeader "${ITABaseHeader}" "include/ITAAtomicOps.h" "include/ITAAtomicPrimitives.h" )
Jonas Stienen's avatar
Jonas Stienen committed
145 146
	if( WIN32 )
		set( ITABaseSources "${ITABaseSources}" "src/ITAAtomicOpsWin32Impl.cpp" )
147
	else( )
Jonas Stienen's avatar
Jonas Stienen committed
148
		set( ITABaseSources "${ITABaseSources}" "src/ITAAtomicOpsGCCBuiltinsImpl.cpp" )
149 150
	endif( )
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
151

152
if( ITA_BASE_WITH_OLD_RAVEN_OPS )
153 154
	if( NOT ITA_BASE_WITH_CONFIG_OLD_IMPL )
		message( FATAL_ERROR "ITABase old RAVEN ops requires regular expressions and old config implementation. Please activate." )
155
	endif( )
156 157 158
	if( NOT VSPLINE_FOUND )
		message( FATAL_ERROR "ITABase old RAVEN ops requires SPLINE, which was not found. Please provide." )
	endif( )
159 160
	set( ITABaseHeader "${ITABaseHeader}" "include/ITAOps.h" )
	set( ITABaseSources "${ITABaseSources}" "src/ITAOps.cpp" )
161
endif( )
162

Jonas Stienen's avatar
Jonas Stienen committed
163 164
if( VPCRE_FOUND AND ITA_BASE_WITH_REGULAR_EXPRESSIONS )
	add_definitions( -DPCRE_STATIC )
165
	list( APPEND ITABaseSources "src/ITAStringUtilsPCRE.cpp" )
166
else( )
167
	list( APPEND ITABaseSources "src/ITAStringUtils.cpp" )
168
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
169 170 171 172

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." )
173
	endif( )
174 175
	list( APPEND ITABaseHeader "include/ITAConfigUtils.h" )
	list( APPEND ITABaseSources "src/ITAConfigUtils.cpp" "src/ITAConfigUtilsWin32Impl.cpp" )
176
endif( )
177

178

179 180
# preprocessor
if( BUILD_SHARED_LIBS )
181
	add_definitions( -DITA_BASE_EXPORT )
182
else( )
183
	add_definitions( -DITA_BASE_STATIC )
184
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
185

186 187 188
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
189

Fabian Schlieper's avatar
Fabian Schlieper committed
190 191
if( NOT WIN32 )
	add_definitions( -std=gnu++11 )
192 193
endif( )

Fabian Schlieper's avatar
Fabian Schlieper committed
194

Jonas Stienen's avatar
Jonas Stienen committed
195
# linker
196
add_library( ITABase ${ITABaseHeader} ${ITABaseSources} )
Jonas Stienen's avatar
Jonas Stienen committed
197 198 199 200 201 202 203 204 205 206 207 208 209 210
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
211 212 213
if( ITA_CORE_LIBS_WITH_TESTS )
	set( ITABASE_COMMON_BUILD TRUE )
	add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/tests" )
214
endif( )