CMakeLists.txt 5.07 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
set( Redstart_Sources
	"src/main.cpp"
	"src/RedstartWindow.cpp"
	"src/RedstartWindow.h"
	"src/RedstartRunSimpleExample.h"
	"src/RedstartUtils.h"
	"src/RedstartSessionBinauralHeadphonesDialog.cpp"
	"src/RedstartSessionBinauralHeadphonesDialog.h"
61 62
	"src/RedstartSessionExperimentalTalkthroughDialog.cpp"
	"src/RedstartSessionExperimentalTalkthroughDialog.h"
63 64
	"src/RedstartSessionImportDialog.cpp"
	"src/RedstartSessionImportDialog.h"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
65
	"src/RedstartSessionList.h"
Dipl.-Ing. Jonas Stienen's avatar
Mooore  
Dipl.-Ing. Jonas Stienen committed
66
	"src/RedstartSessionDetailsTreeView.h"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
67 68 69 70
)

set( Redstart_UIs
	"ui/RedstartWindow.ui"
71 72
	"ui/RedstartSessionBinauralHeadphonesDialog.ui"
	"ui/RedstartSessionExperimentalTalkthroughDialog.ui"
73
	"ui/RedstartSessionImportDialog.ui"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
74
)
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
75 76 77

# Qt UI form compiler
qt5_wrap_ui( "ui_RedstartWindow.h" "ui/RedstartWindow.ui" )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
78
qt5_wrap_ui( "ui_RedstartSessionBinauralHeadphonesDialog.h" "ui/RedstartSessionBinauralHeadphonesDialog.ui" )
79
qt5_wrap_ui( "ui_RedstartSessionExperimentalTalkthroughDialog.h" "ui/RedstartSessionExperimentalTalkthroughDialog.ui" )
80
qt5_wrap_ui( "ui_RedstartSessionImportDialog.h" "ui/RedstartSessionImportDialog.ui" )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
81 82
include_directories( "${CMAKE_CURRENT_BINARY_DIR}" ) # Qt UI form compiler generates files into this folder

83 84

# Qt resources
85
#cmake_policy( SET CMP0071 NEW )
86 87
qt5_add_resources( VA_REDSTART_RESOURCES "res/QRedstart.qrc" OPTIONS -compress 3 )

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
88
include_directories( "src" )
89

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
90
add_executable( Redstart ${VA_REDSTART_RESOURCES} ${Redstart_Sources} ${Redstart_UIs} )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
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 118 119 120 121 122 123 124
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 "." )
125 126 127 128 129 130
	
	# Qt specialty: copy Qt and plugin platform dlls that are loaded during execution from a fixed relative path
	install( FILES "${_qt5Core_install_prefix}/bin/Qt5Core.dll" DESTINATION "bin" )
	install( FILES "${_qt5Core_install_prefix}/bin/Qt5Gui.dll" DESTINATION "bin" )
	install( FILES "${_qt5Core_install_prefix}/bin/Qt5Widgets.dll" DESTINATION "bin" )
	install( DIRECTORY "${_qt5Core_install_prefix}/plugins/platforms" DESTINATION "bin" FILES_MATCHING PATTERN "*.dll" )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
131 132 133 134
else( )
	configure_file( "run_Redstart.sh.proto" "${CMAKE_CURRENT_SOURCE_DIR}/run_Redstart.sh" @ONLY )
	install( FILES "run_Redstart.sh" DESTINATION "." )
endif( )