CMakeLists.txt 4.04 KB
Newer Older
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
1 2 3 4 5 6 7 8 9 10 11 12
cmake_minimum_required( VERSION 3.0 )

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

set( CMAKE_AUTOMOC ON )

vista_use_package( ITAQtWidgets REQUIRED FIND_DEPENDENCIES )
vista_use_package( VABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( VANet REQUIRED FIND_DEPENDENCIES )
vista_use_package( VACore REQUIRED FIND_DEPENDENCIES )
13
vista_use_package( ITADataSources REQUIRED FIND_DEPENDENCIES )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
find_package( Qt5 REQUIRED COMPONENTS Core Gui Widgets ) # no vista cmake find


# config
if( NOT ITA_REDSTART_INSTALL_WITH_DLLS )
	set( ITA_REDSTART_INSTALL_WITH_DLLS ON CACHE BOOL "Install Redstart with depending DLLs (use this switch with care)" )	
endif( )

if( NOT ITA_REDSTART_DEFAULT_SERVER_ADDRESS )
	set( ITA_REDSTART_DEFAULT_SERVER_ADDRESS "localhost" CACHE STRING "Default Redstart bind address" )
endif( )

if( NOT ITA_REDSTART_DEFAULT_SERVER_PORT )
	set( ITA_REDSTART_DEFAULT_SERVER_PORT 12340 CACHE INT "Default Redstart server bind port" )
endif( )


# compiler
if( ITA_ACOUSTIC_VISUALIZATION_BUILD_STATIC )
	add_definitions( -DITA_QT_WIDGETS_STATIC )
endif()

if( ITA_VA_BUILD_STATIC )
	add_definitions( -DVABASE_STATIC -DVACORE_STATIC -DVANET_STATIC )
endif( )

if( ITA_VISTA_BUILD_STATIC )
	add_definitions( -DVISTABASE_STATIC -DVISTAINTERPROCCOMM_STATIC -DVISTAASPECTS_STATIC -DVISTATOOLS_STATIC -DVISTAMATH_STATIC )
	if( WIN32 )
		set( VISTAINTERPROCCOMM_ADDITIONAL_DEPENDENCIES Ws2_32 )
	endif( )
endif( )


# preprocessor
if( NOT WIN32 )
	add_definitions( -std=gnu++11 )
endif( )

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66
set( Redstart_Sources
	"src/main.cpp"
	"src/RedstartWindow.cpp"
	"src/RedstartWindow.h"
	"src/RedstartRunSimpleExample.h"
	"src/RedstartUtils.h"
	"src/RedstartSessionBinauralHeadphonesDialog.cpp"
	"src/RedstartSessionBinauralHeadphonesDialog.h"
)

set( Redstart_UIs
	"ui/RedstartWindow.ui"
	"ui/RedstartSessionBinauralHeadphonesDialog.ui" 
)
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
67 68 69

# Qt UI form compiler
qt5_wrap_ui( "ui_RedstartWindow.h" "ui/RedstartWindow.ui" )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
70
qt5_wrap_ui( "ui_RedstartSessionBinauralHeadphonesDialog.h" "ui/RedstartSessionBinauralHeadphonesDialog.ui" )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
71 72
include_directories( "${CMAKE_CURRENT_BINARY_DIR}" ) # Qt UI form compiler generates files into this folder

73 74

# Qt resources
75
#cmake_policy( SET CMP0071 NEW )
76 77 78
qt5_add_resources( VA_REDSTART_RESOURCES "res/QRedstart.qrc" OPTIONS -compress 3 )


Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
79
add_executable( Redstart ${VA_REDSTART_RESOURCES} ${Redstart_Sources} ${Redstart_UIs} )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
target_link_libraries( Redstart ${VISTA_USE_PACKAGE_LIBRARIES} ${VISTAINTERPROCCOMM_ADDITIONAL_DEPENDENCIES} Qt5::Widgets )
install( TARGETS Redstart RUNTIME DESTINATION "bin" )

vista_add_pathscript_dynamic_lib_path( "${_qt5Core_install_prefix}/bin/" )
vista_configure_app( Redstart )
vista_install( Redstart )
vista_create_default_info_file( Redstart )

set_property( TARGET Redstart PROPERTY FOLDER "VA/Apps" )


if( ITA_VA_INSTALL_WITH_DLLS OR ITA_REDSTART_INSTALL_WITH_DLLS )
	vista_install_all_dlls( bin )
endif( )


# dev
if( MSVC )
	set( ITA_REDSTART_INCLUDE_EXTERNAL_MSVC_PROJECTS ON CACHE BOOL "If enabled, msvc projects of external vista packages will be included in the solution" )
	if( ITA_REDSTART_INCLUDE_EXTERNAL_MSVC_PROJECTS AND NOT VA_COMMON_BUILD )
		vista_add_external_msvc_project_of_package( VistaCoreLibs "VistaCoreLibs" DEPENDENT Redstart SILENT )
		vista_add_external_msvc_project_of_package( ITACoreLibs "ITACoreLibs" DEPENDENT Redstart SILENT )
		vista_add_external_msvc_project_of_package( ITAAcousticVisualization "ITAAcousticVisualization" DEPENDENT Redstart SILENT )
		vista_add_external_msvc_project_of_package( VABase "VA" DEPENDENT Redstart SILENT )
		vista_add_external_msvc_project_of_package( VACore "VA" DEPENDENT Redstart SILENT )
		vista_add_external_msvc_project_of_package( VANet "VA" DEPENDENT Redstart SILENT )
	endif( )
endif( )


# deploy
if( WIN32 )
	configure_file( "run_Redstart.bat.proto" "${CMAKE_CURRENT_SOURCE_DIR}/run_Redstart.bat" @ONLY )
	install( FILES "run_Redstart.bat" DESTINATION "." )
else( )
	configure_file( "run_Redstart.sh.proto" "${CMAKE_CURRENT_SOURCE_DIR}/run_Redstart.sh" @ONLY )
	install( FILES "run_Redstart.sh" DESTINATION "." )
endif( )