CMakeLists.txt 3.43 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
cmake_minimum_required( VERSION 2.8 )

if( NOT VA_COMMON_BUILD )

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

11 12 13 14 15 16 17 18 19 20 21 22
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 )

if( NOT DEFINED ITA_VISTA_BUILD_STATIC )
	set( ITA_VISTA_BUILD_STATIC OFF CACHE BOOL "Build against static ViSTA libraries" )
endif( NOT DEFINED ITA_VISTA_BUILD_STATIC )

if( NOT DEFINED ITA_VA_BUILD_STATIC )
	set( ITA_VA_BUILD_STATIC OFF CACHE BOOL "Build static VA libs" )
endif( NOT DEFINED ITA_VA_BUILD_STATIC )

23 24 25 26 27 28 29 30
if( NOT DEFINED ITA_VA_MATLAB_INSTALL_WITH_DLLS )
	set( ITA_VA_MATLAB_INSTALL_WITH_DLLS ON CACHE BOOL "Install VAMatlab with depending DLLs (use with care)" )
endif( NOT DEFINED ITA_VA_MATLAB_INSTALL_WITH_DLLS )

if( NOT DEFINED ITA_VA_MATLAB_BUILD_WITH_INTERNAL_CORE )
	set( ITA_VA_MATLAB_BUILD_WITH_INTERNAL_CORE OFF CACHE BOOL "Build a VACore into VAMatlab instead of using a network adapter (not recommended)" )
endif( NOT DEFINED ITA_VA_MATLAB_BUILD_WITH_INTERNAL_CORE )

31 32
vista_use_package( VABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( VANet REQUIRED FIND_DEPENDENCIES )
33 34
vista_use_package( Matlab REQUIRED FIND_DEPENDENCIES )
vista_use_package( NatNetSDK REQUIRED )
35

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

# Compiler
if( ITA_CORE_LIBS_BUILD_STATIC )
	add_definitions( -DITA_BASE_STATIC -DITA_DATA_SOURCES_STATIC -DITA_DIFFRACTION_STATIC -DITA_GEO_STATIC -DITA_CONVOLUTION_STATIC -DITA_FFT_STATIC -DITA_CTC_STATIC -DITA_SAMPLER_STATIC )
endif( ITA_CORE_LIBS_BUILD_STATIC )

if( ITA_VISTA_BUILD_STATIC )
	add_definitions( -DVISTABASE_STATIC -DVISTAMATH_STATIC -DVISTAASPECTS_STATIC -DVISTATOOLS_STATIC -DVISTAINTERPROCCOMM_STATIC )
endif( ITA_VISTA_BUILD_STATIC )

if( NOT ITA_VA_BUILD_STATIC )
	add_definitions( -DVAMATLAB_EXPORTS )
else( NOT ITA_VA_BUILD_STATIC )
	add_definitions( -DVABASE_STATIC -DVANET_STATIC  )
	set( BUILD_SHARED_LIBS_TEMP ${BUILD_SHARED_LIBS} )
	if( BUILD_SHARED_LIBS )
		set( BUILD_SHARED_LIBS OFF )
		message( "Ignoring activated BUILD_SHARED_LIBS temporary because static VA requested" )
	endif( BUILD_SHARED_LIBS )
endif( NOT ITA_VA_BUILD_STATIC )
56 57 58 59 60

if( ITA_VA_MATLAB_BUILD_WITH_INTERNAL_CORE )
	vista_use_package( VACore REQUIRED FIND_DEPENDENCIES )
	add_definitions( -DVACORE_DLL -DVAMATLAB_INTERNAL_CORE )
endif( ITA_VA_MATLAB_BUILD_WITH_INTERNAL_CORE )
61

62 63

# Sources
64
set( VAMATLAB_SRC
65 66 67 68 69 70 71 72
	"src/FunctionMappings.h"
	"src/MatlabHelpers.h"
	"src/MatlabHelpers.cpp"
	"src/VAMatlabConnection.cpp"
	"src/VAMatlabConnection.h"
	"src/VAMatlabExecutable.cpp"
	"src/VAMatlabTracking.h"
	"src/VAMatlabTracking.cpp" )
73
	
74

75
add_library( VAMatlab ${VAMATLAB_SRC} VAMatlab.def )
76 77
target_link_libraries( VAMatlab ${VISTA_USE_PACKAGE_LIBRARIES} )

78
vista_configure_lib( VAMatlab )
79 80
vista_install( VAMatlab )
vista_create_default_info_file( VAMatlab )
81
vista_create_cmake_configs( VAMatlab )
82

83
set_property( TARGET VAMatlab PROPERTY FOLDER "VA/VABindings" )
84
set_target_properties( VAMatlab PROPERTIES SUFFIX ".${MATLAB_MEX_EXTENSION}")
85 86 87 88

if( ITA_VA_MATLAB_INSTALL_WITH_DLLS OR ITA_VA_INSTALL_WITH_DLLS )
	vista_install_all_dlls( bin )
endif()
89 90 91 92 93 94 95


# VA core configuration file
set( VAMATLAB_DEPLOY_DIR "${CMAKE_INSTALL_PREFIX}/bin" )
set( VAMATLAB_SCRIPT_DIR "${CMAKE_INSTALL_PREFIX}/matlab" )
set( VAMATLAB_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" )
configure_file( "matlab/itaVA_build.m.proto" "${CMAKE_CURRENT_SOURCE_DIR}/matlab/itaVA_build.m" @ONLY )