forked from speed-dreams/speed-dreams-code
Xavier Del Campo Romero
022b19a141
As opposed to simu >= 3.0, simu 2.1 did not consider air or wheel temperatures. This would have several consequences: - Some drivers such as shadow rely on these parameters to calculate tire grip. If temperature air is zero (i.e., 0K), no grip is assumed and therefore speeds are also assigned to zero, making the driver not to move at all. - Invalid temperature values (i.e., 0K) would be shown on the UI, both in ssg and OSG. Unfortunately, simuv2.1 bundled the SOLID-2.0 library (aka FreeSOLID) because the library is not available from most GNU/Linux distributions yet. In order to solve this situation, the FreeSOLID library was migrated from CVS to Git [1] so it could be used as a submodule, and therefore let the build system decide whether to optionally use the in-tree copy. That said, packaging/3rdParty-devel has dropped FreeSOLID in favour of the submodule, since it must always be built from source anyway. [1]: https://forge.a-lec.org/speed-dreams/freesolid
225 lines
8.6 KiB
CMake
225 lines
8.6 KiB
CMake
############################################################################
|
|
#
|
|
# file : options.cmake
|
|
# copyright : (C) 2008 by Mart Kelder, 2010 by J.-P. Meuret
|
|
# web : www.speed-dreams.org
|
|
#
|
|
############################################################################
|
|
|
|
############################################################################
|
|
# #
|
|
# This program is free software; you can redistribute it and/or modify #
|
|
# it under the terms of the GNU General Public License as published by #
|
|
# the Free Software Foundation; either version 2 of the License, or #
|
|
# (at your option) any later version. #
|
|
# #
|
|
############################################################################
|
|
|
|
# @file CMake configuration options
|
|
# @author Mart Kelder, J.-P. Meuret
|
|
|
|
INCLUDE(CMakeDependentOption)
|
|
|
|
MACRO(ADD_SD_COMPILE_OPTIONS)
|
|
|
|
# Build options (do it only once).
|
|
IF(NOT _ALREADY_DONE)
|
|
|
|
# Default build configuration.
|
|
IF(NOT MSVC)
|
|
IF(NOT CMAKE_BUILD_TYPE)
|
|
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING
|
|
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
|
|
FORCE)
|
|
ENDIF()
|
|
MESSAGE(STATUS "Build configuration : ${CMAKE_BUILD_TYPE}")
|
|
ENDIF(NOT MSVC)
|
|
|
|
# CMake options.
|
|
SET(OPTION_CHECK_CONTENTS false CACHE BOOL "Set to off if you don't want the build to be stopped by missing optional contents folders")
|
|
MARK_AS_ADVANCED(OPTION_CHECK_CONTENTS)
|
|
|
|
SET(OPTION_OFFICIAL_ONLY false CACHE BOOL "Build / install only officially released contents")
|
|
|
|
SET(OPTION_FORCE_DEBUG false CACHE BOOL "Force debug symbols even in Release build (Automatic in Debug builds)")
|
|
|
|
SET(OPTION_TRACE true CACHE BOOL "Enable traces into the console or log file")
|
|
|
|
SET(OPTION_TRACE_LEVEL "5" CACHE STRING "Trace level integer threshold, only if OPTION_TRACE (traces with higher level are not logged ; 0=Fatal, 1=Error, 2=Warning, 3=Info, 4=Trace, 5=Debug, ...)")
|
|
|
|
SET(OPTION_PROFILER false CACHE BOOL "Enable profiler")
|
|
|
|
SET(OPTION_SCHEDULE_SPY false CACHE BOOL "Enable fine grained scheduling spy")
|
|
|
|
SET(OPTION_3RDPARTY_EXPAT true CACHE BOOL "Use 3rd party Expat library rather than bundled TXML")
|
|
|
|
SET(OPTION_3RDPARTY_SQLITE3 false CACHE BOOL "Use SQLite3 as database for record/replay")
|
|
|
|
SET(OPTION_OSGGRAPH true CACHE BOOL "Build OpenScenGraph-based WIP osggraph graphics module")
|
|
|
|
SET(OPTION_TINYGLTF false CACHE BOOL "Use tinygltf library")
|
|
|
|
SET(OPTION_WEBSERVER true CACHE BOOL "Build with WebServer functionality")
|
|
|
|
SET(OPTION_CLIENT_SERVER true CACHE BOOL "Build with Client/Server network architecture")
|
|
|
|
SET(OPTION_PARAM_OPTIMIZER false CACHE BOOL "Build with Parameter Optimizer for Robot development")
|
|
|
|
SET(OPTION_TRACKEDITOR true CACHE BOOL "Build the TrackEditor (Requires Java)")
|
|
|
|
IF(APPLE)
|
|
# Automatically set OPTION_USE_MACPORTS (at least until someone fixes the regular APPLE build)
|
|
MESSAGE(STATUS "Automatically set OPTION_USE_MACPORTS (at least until someone fixes the regular APPLE build)")
|
|
SET(OPTION_USE_MACPORTS true CACHE BOOL "Use the MacPorts dependencies")
|
|
ENDIF(APPLE)
|
|
|
|
IF(UNIX)
|
|
SET(OPTION_XRANDR true CACHE BOOL "XrandR")
|
|
SET(OPTION_GLEXTPROTOTYPES true CACHE BOOL "Enable prototypes in glext.h")
|
|
#SET(OPTION_UNLOAD_SSGGRAPH true CACHE BOOL "If false, never unload ssggraph module (useful on some Linuxes to avoid XOrg crashes)")
|
|
ENDIF(UNIX)
|
|
|
|
SET(OPTION_UNLOAD_SSGGRAPH true CACHE BOOL "If false, never unload ssggraph module (useful on some Linuxes to avoid XOrg crashes)")
|
|
|
|
|
|
IF(OPTION_USE_MACPORTS)
|
|
SET(CMAKE_MACOSX_RPATH TRUE)
|
|
#SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
SET(CMAKE_PREFIX_PATH "/opt/local" CACHE PATH "Prepended to search path")
|
|
#SET(CMAKE_FIND_ROOT_PATH "/opt/local" CACHE PATH "Prepended to search path")
|
|
SET(CMAKE_FIND_FRAMEWORK LAST)
|
|
MESSAGE(STATUS "Remove the line below to true when OSG works on MacPorts")
|
|
SET(OPTION_OSGGRAPH false CACHE BOOL "Build OpenScenGraph-based WIP osggraph graphics module")
|
|
ENDIF(OPTION_USE_MACPORTS)
|
|
|
|
# Custom 3rdParty location for some Windows builds (standard CMake Find<package> macros
|
|
# can't find it, so we needed another solution : see FindCustom3rdParty.cmake).
|
|
IF(MSVC)
|
|
SET(_OPTION_CUSTOM_3RDPARTY true) # Always needed for MSVC compilers.
|
|
ELSEIF(MINGW)
|
|
IF(CMAKE_GENERATOR STREQUAL "MSYS Makefiles")
|
|
# Not needed with "MSYS Makefiles" generator when using MinGW
|
|
# (3rd party libs assumed to be installed in standard location /usr/local).
|
|
SET(_OPTION_CUSTOM_3RDPARTY false)
|
|
ELSE(CMAKE_GENERATOR STREQUAL "MSYS Makefiles")
|
|
# Just as for MSVC builds : special location.
|
|
SET(_OPTION_CUSTOM_3RDPARTY true)
|
|
ENDIF(CMAKE_GENERATOR STREQUAL "MSYS Makefiles")
|
|
ENDIF(MSVC)
|
|
|
|
SET(OPTION_CUSTOM_3RDPARTY ${_OPTION_CUSTOM_3RDPARTY} CACHE BOOL "Set to ON to use 3rdParty prebuilt API located in <PROJECT_SOURCE_DIR>/../3rdparty")
|
|
MARK_AS_ADVANCED(OPTION_CUSTOM_3RDPARTY)
|
|
|
|
# Compiler definitions (needs more comments. Is it needed under Windows ?).
|
|
ADD_DEFINITIONS(-D_DEFAULT_SOURCE -DSHM)
|
|
|
|
IF(MSVC)
|
|
|
|
# Inhibit definition of Macros min(a,b) and max(a,b) for Windows MSVC builds,
|
|
# as the names conflict with the template functions from standard template library
|
|
ADD_DEFINITIONS(-DNOMINMAX)
|
|
|
|
ENDIF(MSVC)
|
|
|
|
IF(OPTION_FORCE_DEBUG)
|
|
ADD_DEFINITIONS(-DSD_DEBUG)
|
|
ENDIF(OPTION_FORCE_DEBUG)
|
|
|
|
IF(OPTION_TRACE)
|
|
ADD_DEFINITIONS(-DTRACE_OUT)
|
|
ENDIF(OPTION_TRACE)
|
|
|
|
IF(OPTION_TRACE_LEVEL)
|
|
ADD_DEFINITIONS(-DTRACE_LEVEL=${OPTION_TRACE_LEVEL})
|
|
ENDIF(OPTION_TRACE_LEVEL)
|
|
|
|
IF(OPTION_XRANDR)
|
|
ADD_DEFINITIONS(-DUSE_RANDR_EXT)
|
|
ENDIF(OPTION_XRANDR)
|
|
|
|
IF(OPTION_PROFILER)
|
|
ADD_DEFINITIONS(-DPROFILER)
|
|
ENDIF(OPTION_PROFILER)
|
|
|
|
IF(OPTION_SCHEDULE_SPY)
|
|
ADD_DEFINITIONS(-DSCHEDULE_SPY)
|
|
ENDIF(OPTION_SCHEDULE_SPY)
|
|
|
|
IF(OPTION_3RDPARTY_EXPAT)
|
|
ADD_DEFINITIONS(-DTHIRD_PARTY_EXPAT)
|
|
ENDIF(OPTION_3RDPARTY_EXPAT)
|
|
|
|
IF(OPTION_3RDPARTY_SQLITE3)
|
|
ADD_DEFINITIONS(-DTHIRD_PARTY_SQLITE3)
|
|
ENDIF(OPTION_3RDPARTY_SQLITE3)
|
|
|
|
IF(OPTION_GLEXTPROTOTYPES)
|
|
ADD_DEFINITIONS(-DGL_GLEXT_PROTOTYPES)
|
|
ENDIF(OPTION_GLEXTPROTOTYPES)
|
|
|
|
IF(OPTION_UNLOAD_SSGGRAPH)
|
|
ADD_DEFINITIONS(-DUNLOAD_SSGGRAPH)
|
|
ENDIF(OPTION_UNLOAD_SSGGRAPH)
|
|
|
|
IF(OPTION_TINYGLTF)
|
|
ADD_DEFINITIONS(-DTINYGLTF)
|
|
ENDIF(OPTION_TINYGLTF)
|
|
|
|
IF(OPTION_WEBSERVER)
|
|
ADD_DEFINITIONS(-DWEBSERVER)
|
|
ENDIF(OPTION_WEBSERVER)
|
|
|
|
IF(OPTION_CLIENT_SERVER)
|
|
ADD_DEFINITIONS(-DCLIENT_SERVER)
|
|
ENDIF(OPTION_CLIENT_SERVER)
|
|
|
|
IF(OPTION_USE_MACPORTS)
|
|
ADD_DEFINITIONS(-DUSE_MACPORTS)
|
|
ENDIF(OPTION_USE_MACPORTS)
|
|
|
|
# Define for code that needs Torcs backward compatibility
|
|
ADD_DEFINITIONS(-DSPEED_DREAMS)
|
|
|
|
ENDIF(NOT _ALREADY_DONE)
|
|
|
|
# Compile options
|
|
IF(NOT _ALREADY_DONE)
|
|
|
|
# GCC warnings (at least for the 4.x series, there are none by default).
|
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
# Add useful warnings / checks.
|
|
SET(_SD_WOPTS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_SD_WOPTS}")
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_SD_WOPTS}")
|
|
|
|
# MSVC warnings (default warning level 3 is not exactly what we want).
|
|
ELSEIF(MSVC)
|
|
|
|
# Suppress bothering MSVC warnings and add useful warnings / checks.
|
|
SET(_SD_WOPTS "/W4") # Better warning level (default seems to be 3).
|
|
|
|
# Level 3 useless/boring warnings.
|
|
SET(_SD_WOPTS "${_SD_WOPTS} /wd4251") # class XXX needs a DLL interface
|
|
SET(_SD_WOPTS "${_SD_WOPTS} /wd4996") # std::_Copy_opt disaproved because unsafe
|
|
|
|
# Level 4 useless/boring warnings.
|
|
SET(_SD_WOPTS "${_SD_WOPTS} /wd4100") # unreferenced formal parameter
|
|
SET(_SD_WOPTS "${_SD_WOPTS} /wd4127") # conditional expression is constant
|
|
SET(_SD_WOPTS "${_SD_WOPTS} /wd4201") # nonstandard extension used : nameless struct/union
|
|
SET(_SD_WOPTS "${_SD_WOPTS} /wd4706") # assignment within conditional expression
|
|
|
|
# Other useless warnings.
|
|
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE
|
|
-D_CRT_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
|
|
|
|
# That's all.
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_SD_WOPTS}")
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_SD_WOPTS}")
|
|
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
ENDIF(NOT _ALREADY_DONE)
|
|
|
|
ENDMACRO(ADD_SD_COMPILE_OPTIONS)
|