CMakeLists.txt 5.81 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
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( )

40 41 42 43 44
if( ITA_CORE_LIBS_BUILD_STATIC )
	add_definitions( -DITA_BASE_STATIC -DITA_DATA_SOURCES_STATIC )
endif( )


Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
45 46 47 48 49 50 51 52 53 54 55 56 57
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
58 59 60 61 62 63 64 65
set( Redstart_Sources
	"src/main.cpp"
	"src/RedstartWindow.cpp"
	"src/RedstartWindow.h"
	"src/RedstartRunSimpleExample.h"
	"src/RedstartUtils.h"
	"src/RedstartSessionBinauralHeadphonesDialog.cpp"
	"src/RedstartSessionBinauralHeadphonesDialog.h"
66 67
	"src/RedstartSessionExperimentalTalkthroughDialog.cpp"
	"src/RedstartSessionExperimentalTalkthroughDialog.h"
68 69
	"src/RedstartSessionImportDialog.cpp"
	"src/RedstartSessionImportDialog.h"
70 71
	"src/RedstartSessionWizardDialog.cpp"
	"src/RedstartSessionWizardDialog.h"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
72
	"src/RedstartSessionList.h"
Dipl.-Ing. Jonas Stienen's avatar
Mooore  
Dipl.-Ing. Jonas Stienen committed
73
	"src/RedstartSessionDetailsTreeView.h"
Dipl.-Ing. Jonas Stienen's avatar
WIP  
Dipl.-Ing. Jonas Stienen committed
74
	"src/RedstartCoreOutputPlainTextEdit.h"
75 76
	"src/RedstartRunCirculatingSourceDialog.h"
	"src/RedstartRunCirculatingSourceDialog.cpp"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
77 78 79 80
)

set( Redstart_UIs
	"ui/RedstartWindow.ui"
81 82
	"ui/RedstartSessionBinauralHeadphonesDialog.ui"
	"ui/RedstartSessionExperimentalTalkthroughDialog.ui"
83
	"ui/RedstartSessionImportDialog.ui"
84
	"ui/RedstartSessionWizardDialog.ui"
85
	"ui/RedstartRunCirculatingSourceDialog.ui"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
86
)
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
87 88 89

# Qt UI form compiler
qt5_wrap_ui( "ui_RedstartWindow.h" "ui/RedstartWindow.ui" )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
90
qt5_wrap_ui( "ui_RedstartSessionBinauralHeadphonesDialog.h" "ui/RedstartSessionBinauralHeadphonesDialog.ui" )
91
qt5_wrap_ui( "ui_RedstartSessionExperimentalTalkthroughDialog.h" "ui/RedstartSessionExperimentalTalkthroughDialog.ui" )
92
qt5_wrap_ui( "ui_RedstartSessionImportDialog.h" "ui/RedstartSessionImportDialog.ui" )
93
qt5_wrap_ui( "ui_RedstartSessionWizardDialog.h" "ui/RedstartSessionWizardDialog.ui" )
94
qt5_wrap_ui( "ui_RedstartRunCirculatingSourceDialog.h" "ui/RedstartRunCirculatingSourceDialog.ui" )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
95 96
include_directories( "${CMAKE_CURRENT_BINARY_DIR}" ) # Qt UI form compiler generates files into this folder

97 98

# Qt resources
99
#cmake_policy( SET CMP0071 NEW )
100 101
qt5_add_resources( VA_REDSTART_RESOURCES "res/QRedstart.qrc" OPTIONS -compress 3 )

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
102
include_directories( "src" )
103

104 105 106 107 108 109 110
if( WIN32 )
	# Hide console by using WIN32 application flag
	add_executable( Redstart WIN32 ${VA_REDSTART_RESOURCES} ${Redstart_Sources} ${Redstart_UIs} )
else( )
	add_executable( Redstart ${VA_REDSTART_RESOURCES} ${Redstart_Sources} ${Redstart_UIs} )
endif( )

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
111 112 113 114 115 116 117 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 143 144
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 "." )
145 146 147 148 149 150
	
	# 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
151 152 153 154
else( )
	configure_file( "run_Redstart.sh.proto" "${CMAKE_CURRENT_SOURCE_DIR}/run_Redstart.sh" @ONLY )
	install( FILES "run_Redstart.sh" DESTINATION "." )
endif( )