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

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

include( VistaCommon )

8
if( NOT DEFINED ITA_VANET_VERSION_MAJOR )
9
	set( ITA_VANET_VERSION_MAJOR "v2017" CACHE STRING "VANet version major (usually 'v' and year)" )
10
endif( )
11 12

if( NOT DEFINED ITA_VANET_VERSION_MINOR )
Jonas Stienen's avatar
Jonas Stienen committed
13
	set( ITA_VANET_VERSION_MINOR "c" CACHE STRING "VANet version minor (usually a,b,c ...)" )
14
endif( )
15 16 17

if( NOT DEFINED ITA_VANET_DEFAULT_PORT )
	set( ITA_VANET_DEFAULT_PORT 12340 CACHE INT "VANet default TCP port" )
18 19 20 21 22 23
endif( )

if( NOT DEFINED ITA_VANET_CLIENT_VERBOSE )
	set( ITA_VANET_CLIENT_VERBOSE false CACHE BOOL "VANet client side with verbose output" )
	mark_as_advanced( ITA_VANET_CLIENT_VERBOSE )
endif( )
24

25 26 27 28 29 30 31 32 33 34
if( NOT DEFINED ITA_VANET_CLIENT_SHOW_RAW_TRAFFIC )
	set( ITA_VANET_CLIENT_SHOW_RAW_TRAFFIC false CACHE BOOL "VANet client side print raw network traffic (debugging)" )
	mark_as_advanced( ITA_VANET_CLIENT_SHOW_RAW_TRAFFIC )
endif( )

if( NOT DEFINED ITA_VANET_SERVER_VERBOSE )
	set( ITA_VANET_SERVER_VERBOSE false CACHE BOOL "VANet server side with verbose output" )
	mark_as_advanced( ITA_VANET_SERVER_VERBOSE )
endif( )

35 36 37 38 39
if( NOT DEFINED ITA_VANET_NETAUDIO_VERBOSE )
	set( ITA_VANET_SERVER_VERBOSE false CACHE BOOL "VANet server side with verbose output" )
	mark_as_advanced( ITA_VANET_SERVER_VERBOSE )
endif( )

40 41 42 43 44
if( NOT DEFINED ITA_VANET_SERVER_SHOW_RAW_TRAFFIC )
	set( ITA_VANET_SERVER_SHOW_RAW_TRAFFIC false CACHE BOOL "VANet server side print raw network traffic (debugging)" )
	mark_as_advanced( ITA_VANET_SERVER_SHOW_RAW_TRAFFIC )
endif( )

45 46 47 48 49
if( NOT DEFINED ITA_VANET_WITH_NETAUDIO_STREAM_SERVER_EXTENSION )
	vista_find_package( ITADataSources QUIET )
	set( ITA_VANET_WITH_NETAUDIO_STREAM_SERVER_EXTENSION ${ITADATASOURCES_FOUND} CACHE BOOL "VANet with stream server class extension (requires ITADataSources)" )
endif( )

50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
if( ITA_VANET_CLIENT_VERBOSE )
	add_definitions( -DVANET_CLIENT_VERBOSE )
endif( )

if( ITA_VANET_CLIENT_SHOW_RAW_TRAFFIC )
	add_definitions( -DVANET_CLIENT_SHOW_RAW_TRAFFIC )
endif( )

if( ITA_VANET_SERVER_VERBOSE )
	add_definitions( -DVANET_SERVER_VERBOSE )
endif( )

if( ITA_VANET_SERVER_SHOW_RAW_TRAFFIC )
	add_definitions( -DVANET_SERVER_SHOW_RAW_TRAFFIC )
endif( )
65

66
vista_use_package( VistaCoreLibs REQUIRED COMPONENTS VistaBase VistaInterProcComm FIND_DEPENDENCIES )
67 68
vista_use_package( VABase REQUIRED )

Jonas Stienen's avatar
Jonas Stienen committed
69 70 71 72
# Including the source files of all source subfolders recursively
include( "include/_SourceFiles.cmake" )
include( "src/_SourceFiles.cmake" )

73 74
if( ITA_VANET_WITH_NETAUDIO_STREAM_SERVER_EXTENSION )
	vista_use_package( ITADataSources REQUIRED FIND_DEPENDENCIES )
75
	list( APPEND ProjectSources "src/VANetAudioStreamServer.cpp;src/VANetAudioStreamServerImpl.cpp;src/VANetAudioStreamServerImpl.h" )
76 77
endif( )

Jonas Stienen's avatar
Jonas Stienen committed
78 79
include_directories( "include" )

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
80 81
if( ITA_VISTA_BUILD_STATIC )
	add_definitions( -DVISTABASE_STATIC -DVISTAASPECTS_STATIC -DVISTAINTERPROCCOMM_STATIC )
82
endif( )
83

84
if( BUILD_SHARED_LIBS )
85
	add_definitions( -DVANET_EXPORTS )
86
else( )
87
	add_definitions( -DVABASE_STATIC -DVACORE_STATIC -DVANET_STATIC )
88
endif( )
Jonas Stienen's avatar
Jonas Stienen committed
89

90 91 92 93 94
add_definitions( "-DVANET_VERSION_MAJOR=\"${ITA_VANET_VERSION_MAJOR}\"" )
add_definitions( "-DVANET_VERSION_MINOR=\"${ITA_VANET_VERSION_MINOR}\"" )
add_definitions( "-DVANET_DEFAULT_PORT=${ITA_VANET_DEFAULT_PORT}" )


Jonas Stienen's avatar
Jonas Stienen committed
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
add_library( VANet "${ProjectSources}" )
target_link_libraries( VANet ${VISTA_USE_PACKAGE_LIBRARIES} )


# configure
vista_configure_lib( VANet )
vista_install( VANet )
set( VANET_INCLUDE_OUTDIR "${CMAKE_CURRENT_SOURCE_DIR}/include" )
vista_create_cmake_configs( VANet )
vista_create_default_info_file( VANet )

set_property( TARGET VANet PROPERTY FOLDER "VA" )


# tests
110
if( ITA_VA_WITH_TESTS )
111 112
	set( VANET_COMMON_BUILD TRUE )
	add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/tests" )
113
endif( )