CMakeLists.txt 7.18 KB
Newer Older
Jonas Stienen's avatar
Jonas Stienen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
cmake_minimum_required( VERSION 2.8 )

project( ITABase )

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

# dependencies
vista_use_package( VistaCoreLibs REQUIRED FIND_DEPENDENCIES COMPONENTS VistaInterProcComm VistaTools )
vista_use_package( sndfile )
vista_use_package( IPP QUIET )
vista_use_package( PCRE QUIET )
vista_use_package( SimpleIni QUIET )

15 16 17 18
if( NOT DEFINED ITA_CORE_LIBS_BUILD_STATIC )
	set( ITA_CORE_LIBS_BUILD_STATIC OFF CACHE BOOL "Build all ITA core libs in static mode" )
endif( NOT DEFINED ITA_CORE_LIBS_BUILD_STATIC )

Jonas Stienen's avatar
Jonas Stienen committed
19 20 21 22 23 24 25 26 27 28 29 30 31
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" )
endif( NOT DEFINED ITA_BASE_WITH_FASTMATH_IPP )

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" )
endif( NOT DEFINED ITA_BASE_WITH_FASTMATH_ASSEMBLER )

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" )
endif( NOT DEFINED ITA_BASE_WITH_SNDFILE )

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

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

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

43 44 45 46
if( NOT DEFINED ITA_BASE_WITH_OLD_RAVEN_OPS )
	set( ITA_BASE_WITH_OLD_RAVEN_OPS OFF CACHE BOOL "Build with old ITAOps helper functions implementation (legacy code for RAVEN compatibility)" )
endif( NOT DEFINED ITA_BASE_WITH_OLD_RAVEN_OPS )

Jonas Stienen's avatar
Jonas Stienen committed
47 48 49 50 51 52 53 54 55

# includes
include_directories( "include" )


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

js908001's avatar
js908001 committed
110 111 112

# Win32 implementations
if( WIN32 )
Jonas Stienen's avatar
Jonas Stienen committed
113 114
	list( APPEND ITABaseHeader "include/ITAHPT.h" "include/ITAMutex.h" "include/ITATimer.h" )
	list( APPEND ITABaseSources "src/ITAHPT.cpp" "src/ITAMutex.cpp" "src/ITATimer.cpp" )
js908001's avatar
js908001 committed
115 116
endif( WIN32 )

Jonas Stienen's avatar
Jonas Stienen committed
117

Jonas Stienen's avatar
Jonas Stienen committed
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
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"
		)
endif( VSNDFILE_FOUND AND ITA_BASE_WITH_SNDFILE )


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
else( VIPP_FOUND AND ITA_BASE_WITH_FASTMATH_IPP )
	set( ITABaseSources "${ITABaseSources}" "src/ITAFastMathImpl.cpp" )
endif( VIPP_FOUND AND ITA_BASE_WITH_FASTMATH_IPP )

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

151 152 153 154 155
if( ITA_BASE_WITH_OLD_RAVEN_OPS )
	set( ITABaseHeader "${ITABaseHeader}" "include/ITAOps.h" )
	set( ITABaseSources "${ITABaseSources}" "src/ITAOps.cpp" )
endif( ITA_BASE_WITH_OLD_RAVEN_OPS )

Jonas Stienen's avatar
Jonas Stienen committed
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
if( VPCRE_FOUND AND ITA_BASE_WITH_REGULAR_EXPRESSIONS )
	list( APPEND ITABaseHeader "include/ITAConfigUtils.h" )
	list( APPEND ITABaseSources "src/ITAConfigUtils.cpp" "src/ITAStringUtilsPCRE.cpp" )
	add_definitions( -DPCRE_STATIC )
else( VPCRE_FOUND AND ITA_BASE_WITH_REGULAR_EXPRESSIONS )
	list( APPEND ITABaseSources "src/ITAStringUtils.cpp" )
endif( VPCRE_FOUND AND ITA_BASE_WITH_REGULAR_EXPRESSIONS )

if( VSIMPLEINI_FOUND AND 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." )
	endif( NOT ITA_BASE_WITH_REGULAR_EXPRESSIONS )
	list( APPEND ITABaseSources "src/ITAConfigUtilsSimpleIniImpl.cpp" )
endif( VSIMPLEINI_FOUND AND ITA_BASE_WITH_CONFIG_SIMPLE_INI )

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." )
	endif( NOT ITA_BASE_WITH_REGULAR_EXPRESSIONS )
	list( APPEND ITABaseSources "src/ITAConfigUtilsWin32Impl.cpp" )
endif( ITA_BASE_WITH_CONFIG_OLD_IMPL AND NOT ITA_BASE_WITH_CONFIG_SIMPLE_INI )

178

179
# ITA defaults to shared library build mode, so extra definition is required if you want to build against a static library
180
if( NOT ITA_CORE_LIBS_BUILD_STATIC )
181
	add_definitions( -DITA_BASE_EXPORT )
182
else( NOT ITA_CORE_LIBS_BUILD_STATIC )
183
	add_definitions( -DITA_BASE_STATIC )
184
endif( NOT ITA_CORE_LIBS_BUILD_STATIC )
Jonas Stienen's avatar
Jonas Stienen committed
185 186 187


# linker
188
add_library( ITABase ${ITABaseHeader} ${ITABaseSources} )
Jonas Stienen's avatar
Jonas Stienen committed
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
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
set( ITABASE_COMMON_BUILD TRUE )
add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/tests" )