diff options
Diffstat (limited to 'cmake/scripts/common/Platform.cmake')
| -rw-r--r-- | cmake/scripts/common/Platform.cmake | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cmake/scripts/common/Platform.cmake b/cmake/scripts/common/Platform.cmake new file mode 100644 index 0000000..b19b7e5 --- /dev/null +++ b/cmake/scripts/common/Platform.cmake | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | if(NOT CORE_SYSTEM_NAME) | ||
| 2 | string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) | ||
| 3 | endif() | ||
| 4 | |||
| 5 | if(CORE_SYSTEM_NAME STREQUAL linux) | ||
| 6 | # Set default CORE_PLATFORM_NAME to X11 | ||
| 7 | # This is overridden by user setting -DCORE_PLATFORM_NAME=<platform> | ||
| 8 | set(_DEFAULT_PLATFORM X11) | ||
| 9 | else() | ||
| 10 | string(TOLOWER ${CORE_SYSTEM_NAME} _DEFAULT_PLATFORM) | ||
| 11 | endif() | ||
| 12 | |||
| 13 | # | ||
| 14 | # Note: please do not use CORE_PLATFORM_NAME in any checks, | ||
| 15 | # use the normalized to lower case CORE_PLATFORM_NAME_LC (see below) instead | ||
| 16 | # | ||
| 17 | if(NOT CORE_PLATFORM_NAME) | ||
| 18 | set(CORE_PLATFORM_NAME ${_DEFAULT_PLATFORM} CACHE STRING "Platform port to build") | ||
| 19 | endif() | ||
| 20 | unset(_DEFAULT_PLATFORM) | ||
| 21 | string(TOLOWER ${CORE_PLATFORM_NAME} CORE_PLATFORM_NAME_LC) | ||
| 22 | |||
| 23 | list(APPEND final_message "Platform: ${CORE_PLATFORM_NAME}") | ||
| 24 | if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/${CORE_PLATFORM_NAME_LC}.cmake) | ||
| 25 | include(${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/${CORE_PLATFORM_NAME_LC}.cmake) | ||
| 26 | else() | ||
| 27 | file(GLOB _platformnames RELATIVE ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/ | ||
| 28 | ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/*.cmake) | ||
| 29 | string(REPLACE ".cmake" " " _platformnames ${_platformnames}) | ||
| 30 | message(FATAL_ERROR "invalid CORE_PLATFORM_NAME: ${CORE_PLATFORM_NAME_LC}\nValid platforms: ${_platformnames}") | ||
| 31 | endif() | ||
| 32 | |||
