summaryrefslogtreecommitdiffstats
path: root/cmake/scripts/common/Platform.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/scripts/common/Platform.cmake')
-rw-r--r--cmake/scripts/common/Platform.cmake50
1 files changed, 35 insertions, 15 deletions
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)
3endif() 3endif()
4 4
5if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd) 5if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd)
6 # Set default CORE_PLATFORM_NAME to X11 6 # Set default CORE_PLATFORM_NAME to X11 WAYLAND GBM
7 # This is overridden by user setting -DCORE_PLATFORM_NAME=<platform> 7 # This is overridden by user setting -DCORE_PLATFORM_NAME=<platform>
8 set(_DEFAULT_PLATFORM X11) 8 set(_DEFAULT_PLATFORM X11 WAYLAND GBM)
9 option(ENABLE_APP_AUTONAME "Enable renaming the binary according to windowing?" ON) 9
10 if(NOT APP_RENDER_SYSTEM)
11 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\".")
12 endif()
10else() 13else()
11 string(TOLOWER ${CORE_SYSTEM_NAME} _DEFAULT_PLATFORM) 14 string(TOLOWER ${CORE_SYSTEM_NAME} _DEFAULT_PLATFORM)
12endif() 15endif()
@@ -18,20 +21,37 @@ set(APP_BINARY_SUFFIX ".bin")
18# use the normalized to lower case CORE_PLATFORM_NAME_LC (see below) instead 21# use the normalized to lower case CORE_PLATFORM_NAME_LC (see below) instead
19# 22#
20if(NOT CORE_PLATFORM_NAME) 23if(NOT CORE_PLATFORM_NAME)
21 set(CORE_PLATFORM_NAME ${_DEFAULT_PLATFORM} CACHE STRING "Platform port to build") 24 set(CORE_PLATFORM_NAME ${_DEFAULT_PLATFORM})
22endif() 25endif()
26set(CORE_PLATFORM_NAME ${CORE_PLATFORM_NAME} CACHE STRING "Platform port to build" FORCE)
23unset(_DEFAULT_PLATFORM) 27unset(_DEFAULT_PLATFORM)
24string(TOLOWER ${CORE_PLATFORM_NAME} CORE_PLATFORM_NAME_LC)
25 28
26list(APPEND final_message "Platform: ${CORE_PLATFORM_NAME}") 29string(REPLACE " " ";" CORE_PLATFORM_NAME "${CORE_PLATFORM_NAME}")
27if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/${CORE_PLATFORM_NAME_LC}.cmake) 30foreach(platform IN LISTS CORE_PLATFORM_NAME)
28 include(${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/${CORE_PLATFORM_NAME_LC}.cmake) 31 string(TOLOWER ${platform} platform)
29 if(ENABLE_APP_AUTONAME) 32 list(APPEND CORE_PLATFORM_NAME_LC ${platform})
30 set(APP_BINARY_SUFFIX "-${CORE_PLATFORM_NAME_LC}") 33endforeach()
34
35string(REPLACE ";" " " CORE_PLATFORM_STRING "${CORE_PLATFORM_NAME_LC}")
36list(APPEND final_message "Platforms: ${CORE_PLATFORM_STRING}")
37
38if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd)
39 list(LENGTH CORE_PLATFORM_NAME_LC PLATFORM_COUNT)
40 if(PLATFORM_COUNT EQUAL 1)
41 option(ENABLE_APP_AUTONAME "Enable renaming the binary according to windowing?" ON)
42 if(ENABLE_APP_AUTONAME)
43 set(APP_BINARY_SUFFIX "-${CORE_PLATFORM_NAME_LC}")
44 endif()
31 endif() 45 endif()
32else()
33 file(GLOB _platformnames RELATIVE ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/
34 ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/*.cmake)
35 string(REPLACE ".cmake" " " _platformnames ${_platformnames})
36 message(FATAL_ERROR "invalid CORE_PLATFORM_NAME: ${CORE_PLATFORM_NAME_LC}\nValid platforms: ${_platformnames}")
37endif() 46endif()
47
48foreach(CORE_PLATFORM_LC IN LISTS CORE_PLATFORM_NAME_LC)
49 if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/${CORE_PLATFORM_LC}.cmake)
50 include(${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/${CORE_PLATFORM_LC}.cmake)
51 else()
52 file(GLOB _platformnames RELATIVE ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/
53 ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/*.cmake)
54 string(REPLACE ".cmake" " " _platformnames ${_platformnames})
55 message(FATAL_ERROR "invalid CORE_PLATFORM_NAME: ${CORE_PLATFORM_NAME_LC}\nValid platforms: ${_platformnames}")
56 endif()
57endforeach()