From 3cb8aa05f8cee9e860cf83531682ff0ed4af6a4f Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 4 Mar 2021 23:36:40 +0100 Subject: sync with upstream --- cmake/scripts/common/Platform.cmake | 50 ++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 15 deletions(-) (limited to 'cmake/scripts/common/Platform.cmake') diff --git a/cmake/scripts/common/Platform.cmake b/cmake/scripts/common/Platform.cmake index 5ac233a..397d8d4 100644 --- a/cmake/scripts/common/Platform.cmake +++ b/cmake/scripts/common/Platform.cmake @@ -3,10 +3,13 @@ if(NOT CORE_SYSTEM_NAME) endif() if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd) - # Set default CORE_PLATFORM_NAME to X11 + # Set default CORE_PLATFORM_NAME to X11 WAYLAND GBM # This is overridden by user setting -DCORE_PLATFORM_NAME= - set(_DEFAULT_PLATFORM X11) - option(ENABLE_APP_AUTONAME "Enable renaming the binary according to windowing?" ON) + set(_DEFAULT_PLATFORM X11 WAYLAND GBM) + + if(NOT APP_RENDER_SYSTEM) + message(SEND_ERROR "You need to decide whether you want to use GL- or GLES-based rendering. Please set APP_RENDER_SYSTEM to either \"gl\" or \"gles\". For normal desktop systems, you will usually want to use \"gl\".") + endif() else() string(TOLOWER ${CORE_SYSTEM_NAME} _DEFAULT_PLATFORM) endif() @@ -18,20 +21,37 @@ set(APP_BINARY_SUFFIX ".bin") # use the normalized to lower case CORE_PLATFORM_NAME_LC (see below) instead # if(NOT CORE_PLATFORM_NAME) - set(CORE_PLATFORM_NAME ${_DEFAULT_PLATFORM} CACHE STRING "Platform port to build") + set(CORE_PLATFORM_NAME ${_DEFAULT_PLATFORM}) endif() +set(CORE_PLATFORM_NAME ${CORE_PLATFORM_NAME} CACHE STRING "Platform port to build" FORCE) unset(_DEFAULT_PLATFORM) -string(TOLOWER ${CORE_PLATFORM_NAME} CORE_PLATFORM_NAME_LC) -list(APPEND final_message "Platform: ${CORE_PLATFORM_NAME}") -if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/${CORE_PLATFORM_NAME_LC}.cmake) - include(${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/${CORE_PLATFORM_NAME_LC}.cmake) - if(ENABLE_APP_AUTONAME) - set(APP_BINARY_SUFFIX "-${CORE_PLATFORM_NAME_LC}") +string(REPLACE " " ";" CORE_PLATFORM_NAME "${CORE_PLATFORM_NAME}") +foreach(platform IN LISTS CORE_PLATFORM_NAME) + string(TOLOWER ${platform} platform) + list(APPEND CORE_PLATFORM_NAME_LC ${platform}) +endforeach() + +string(REPLACE ";" " " CORE_PLATFORM_STRING "${CORE_PLATFORM_NAME_LC}") +list(APPEND final_message "Platforms: ${CORE_PLATFORM_STRING}") + +if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd) + list(LENGTH CORE_PLATFORM_NAME_LC PLATFORM_COUNT) + if(PLATFORM_COUNT EQUAL 1) + option(ENABLE_APP_AUTONAME "Enable renaming the binary according to windowing?" ON) + if(ENABLE_APP_AUTONAME) + set(APP_BINARY_SUFFIX "-${CORE_PLATFORM_NAME_LC}") + endif() endif() -else() - file(GLOB _platformnames RELATIVE ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/ - ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/*.cmake) - string(REPLACE ".cmake" " " _platformnames ${_platformnames}) - message(FATAL_ERROR "invalid CORE_PLATFORM_NAME: ${CORE_PLATFORM_NAME_LC}\nValid platforms: ${_platformnames}") endif() + +foreach(CORE_PLATFORM_LC IN LISTS CORE_PLATFORM_NAME_LC) + if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/${CORE_PLATFORM_LC}.cmake) + include(${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/${CORE_PLATFORM_LC}.cmake) + else() + file(GLOB _platformnames RELATIVE ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/ + ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/*.cmake) + string(REPLACE ".cmake" " " _platformnames ${_platformnames}) + message(FATAL_ERROR "invalid CORE_PLATFORM_NAME: ${CORE_PLATFORM_NAME_LC}\nValid platforms: ${_platformnames}") + endif() +endforeach() -- cgit v1.2.3