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

project( ITAFFT )

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

# dependencies
vista_use_package( ITABase REQUIRED FIND_DEPENDENCIES )
10
vista_use_package( fftw )
Jonas Stienen's avatar
Jonas Stienen committed
11 12 13
vista_use_package( MKL )
#vista_find_package( FFTS )

14 15 16 17 18
if ( NOT WIN32 )
	vista_use_package ( Threads REQUIRED )
	list ( APPEND VISTA_USE_PACKAGE_LIBRARIES pthread )
endif ()

Jonas Stienen's avatar
Jonas Stienen committed
19
if( NOT DEFINED ITA_FFT_WITH_FFTW3 )
20
	set( ITA_FFT_WITH_FFTW3 ON CACHE BOOL "Build with FFTW3 for fast fourier transforms (will force the ITA libraries to select the GNU GPL license)" )
21
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
22 23 24

if( NOT DEFINED ITA_FFT_WITH_INTEL_MKL10 )
	set( ITA_FFT_WITH_INTEL_MKL10 OFF CACHE BOOL "Build with Intel MKL for fast fourier transforms" )
25
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
26 27 28

if( NOT DEFINED ITA_FFT_WITH_INTEL_TBB )
	set( ITA_FFT_WITH_INTEL_TBB OFF CACHE BOOL "Build with Intel TBB for fast fourier transforms" )
29
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
30 31 32

if( NOT DEFINED ITA_FFT_WITH_FFTS )
	set( ITA_FFT_WITH_FFTS OFF CACHE BOOL "Build with FFTS for fast fourier transforms" )
33
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
34 35 36 37 38 39 40 41 42 43


# includes
include_directories( "include" )


# sources
set( ITAFFTHeader
	include/ITAFFT.h
	include/ITAFFTDefinitions.h
44
	include/ITAFFTUtils.h
Jonas Stienen's avatar
Jonas Stienen committed
45 46 47 48 49 50
	)
set( ITAFFTSources
	src/ITAFFT.cpp
	src/ITAFFTBackend.h
	src/ITAFFTFactory.h
	src/ITAFFTRealization.h
51
	src/ITAFFTUtils.cpp
Jonas Stienen's avatar
Jonas Stienen committed
52 53
	)	

54
set( ITA_SELECTIVE_LICENSE_DEPENDENCY_GPL OFF )
Jonas Stienen's avatar
Jonas Stienen committed
55 56
if( ITA_FFT_WITH_FFTW3 )
	set( ITAFFTSources "${ITAFFTSources}" src/FFTW3Backend.h src/FFTW3Backend.cpp )
57
	add_definitions( -DITAFFT_WITH_FFTW3 )	
58
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
59 60 61 62

if( ITA_FFT_WITH_INTEL_MKL10 )
	set( ITAFFTSources "${ITAFFTSources}" src/MKL10Backend.h src/MKL10Backend.cpp )
	add_definitions( -DITAFFT_WITH_MKL10 )
63
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
64 65
	

66 67 68 69 70
# compiler settings
if( ITA_VISTA_BUILD_STATIC )
	add_definitions( -DVISTABASE_STATIC -DVISTAMATH_STATIC -DVISTAASPECTS_STATIC -DVISTATOOLS_STATIC -DVISTAINTERPROCCOMM_STATIC )
endif( )
if( BUILD_SHARED_LIBS )
71
	add_definitions( -DITA_FFT_EXPORT )
72 73 74
else( )
	add_definitions( -DITA_BASE_STATIC -DITA_FFT_STATIC )
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
75

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
76 77 78 79
if( NOT WIN32 )
	add_definitions( -std=gnu++11 )
endif( )

Jonas Stienen's avatar
Jonas Stienen committed
80 81

# linker
82
add_library( ITAFFT ${ITAFFTHeader} ${ITAFFTSources} )
Jonas Stienen's avatar
Jonas Stienen committed
83 84 85
target_link_libraries( ITAFFT ${VISTA_USE_PACKAGE_LIBRARIES} )


86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
# selective license

if( ITA_FFT_WITH_FFTW3 )
	
	if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )	
	
		# Take care of license here
		message( "FFTW3 requires copying under the terms of the GNU General Public License. This license includes a copyleft and may require your source code to be published under the same terms. Please respect the license agreements. Will include the GNU GPL COPYING file into distribution." )
			
		set( SELECTED_LICENSE "GNU General Public License" )
		set( GPL_DEPENDENCIES "FFTW3" )
		configure_file( COPYING.proto ${CMAKE_CURRENT_SOURCE_DIR}/COPYING @ONLY )
		install( FILES COPYING DESTINATION . )

	else( )
	
		# Pass it on to parent
		set( ITA_SELECTIVE_LICENSE_DEPENDENCY_GPL ON PARENT_SCOPE )
		
	endif( )
	
endif( )


Jonas Stienen's avatar
Jonas Stienen committed
110 111 112 113 114 115 116 117 118
# config
vista_configure_lib( ITAFFT )
vista_install( ITAFFT )
set( ITAFFT_INCLUDE_OUTDIR "${CMAKE_CURRENT_SOURCE_DIR}/include" )
vista_create_cmake_configs( ITAFFT )
vista_create_default_info_file( ITAFFT )

set_property( TARGET ITAFFT PROPERTY FOLDER "ITACoreLibs" )

119

Jonas Stienen's avatar
Jonas Stienen committed
120
# tests
121 122 123
if( ITA_CORE_LIBS_WITH_TESTS )
	set( ITAFFT_COMMON_BUILD TRUE )
	add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/tests" )
124
endif( )