@@ -12,20 +12,28 @@ endif()
12
12
set (TARGET "TEMPLATE_DEBUG" CACHE STRING "Target platform (EDITOR, TEMPLATE_DEBUG, TEMPLATE_RELEASE)" )
13
13
# Auto-detect platform
14
14
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
15
- set (DEFAULT_PLATFORM "LINUX" )
15
+ set (DEFAULT_GODOT_PLATFORM "LINUX" )
16
16
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
17
- set (DEFAULT_PLATFORM "WINDOWS" )
17
+ set (DEFAULT_GODOT_PLATFORM "WINDOWS" )
18
18
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
19
- set (DEFAULT_PLATFORM "MACOS" )
19
+ set (DEFAULT_GODOT_PLATFORM "MACOS" )
20
+ elseif (CMAKE_SYSTEM_NAME STREQUAL "iOS" )
21
+ set (DEFAULT_GODOT_PLATFORM "IOS" )
20
22
elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten" ) # Set by providing Emscripten toolchain
21
- set (DEFAULT_PLATFORM "WEB" )
23
+ set (DEFAULT_GODOT_PLATFORM "WEB" )
22
24
elseif (CMAKE_SYSTEM_NAME STREQUAL "Android" ) # Set by providing Android toolchain
23
- set (DEFAULT_PLATFORM "ANDROID" )
24
- else ()
25
- message (FATAL_ERROR "Could not auto-detect platform for \" ${CMAKE_SYSTEM_NAME} \" automatically, please specify with -DPLATFORM=<platform>" )
25
+ set (DEFAULT_GODOT_PLATFORM "NOTFOUND" )
26
26
endif ()
27
- set (PLATFORM "${DEFAULT_PLATFORM} " CACHE STRING "[Auto-detected] Target platform (LINUX, MACOS, WINDOWS, ANDROID, IOS, WEB)" )
28
27
28
+ set (GODOT_PLATFORM "${DEFAULT_GODOT_PLATFORM} " CACHE STRING "[Auto-detected] Target platform (LINUX, MACOS, WINDOWS, ANDROID, IOS, WEB)" )
29
+
30
+ if ("${GODOT_PLATFORM} " STREQUAL "NOTFOUND" )
31
+ message (FATAL_ERROR "Could not auto-detect platform for \" ${CMAKE_SYSTEM_NAME} \" automatically, please specify with -DGODOT_PLATFORM=<platform>" )
32
+ endif ()
33
+
34
+ set (GODOT_PLATFORM "${DEFAULT_GODOT_PLATFORM} " CACHE STRING "[Auto-detected] Target platform (LINUX, MACOS, WINDOWS, ANDROID, IOS, WEB)" )
35
+
36
+ message (STATUS "Platform detected: ${GODOT_PLATFORM} " )
29
37
set (GDEXTENSION_DIR "${CMAKE_CURRENT_SOURCE_DIR} /gdextension" CACHE FILEPATH "Path to a directory containing GDExtension interface header" )
30
38
31
39
set (GDEXTENSION_API_FILE "${CMAKE_CURRENT_SOURCE_DIR} /gdextension/extension_api.json" CACHE FILEPATH "Path to GDExtension API JSON file" )
@@ -81,7 +89,7 @@ endif()
81
89
# Workaround of $<CONFIG> expanding to "" when default build set
82
90
set (CONFIG "$<IF:$<STREQUAL:,$<CONFIG>>,${CMAKE_BUILD_TYPE} ,$<CONFIG>>" )
83
91
84
- string (TOLOWER ".${PLATFORM } .${TARGET} " platform_target )
92
+ string (TOLOWER ".${GODOT_PLATFORM } .${TARGET} " platform_target )
85
93
string (PREPEND LIBRARY_SUFFIX ${platform_target} )
86
94
87
95
# Default optimization levels if OPTIMIZE=AUTO, for multi-config support
@@ -266,24 +274,24 @@ list(APPEND GODOT_LINK_FLAGS
266
274
)
267
275
268
276
# Platform-specific options
269
- if ("${PLATFORM } " STREQUAL "LINUX" )
277
+ if ("${GODOT_PLATFORM } " STREQUAL "LINUX" )
270
278
include (linux )
271
- elseif ("${PLATFORM } " STREQUAL "MACOS" )
279
+ elseif ("${GODOT_PLATFORM } " STREQUAL "MACOS" )
272
280
include (macos )
273
- elseif ("${PLATFORM } " STREQUAL "WINDOWS" )
281
+ elseif ("${GODOT_PLATFORM } " STREQUAL "WINDOWS" )
274
282
include (windows )
275
- elseif ("${PLATFORM } " STREQUAL "ANDROID" )
283
+ elseif ("${GODOT_PLATFORM } " STREQUAL "ANDROID" )
276
284
include (android )
277
- elseif ("${PLATFORM } " STREQUAL "IOS" )
285
+ elseif ("${GODOT_PLATFORM } " STREQUAL "IOS" )
278
286
include (ios )
279
- elseif ("${PLATFORM } " STREQUAL "WEB" )
287
+ elseif ("${GODOT_PLATFORM } " STREQUAL "WEB" )
280
288
include (web )
281
289
else ()
282
- message (FATAL_ERROR "Platform not supported: ${PLATFORM } " )
290
+ message (FATAL_ERROR "Platform not supported: ${GODOT_PLATFORM } " )
283
291
endif ()
284
292
285
293
# Mac/IOS use framework directory structure and don't need arch suffix
286
- if ((NOT "${PLATFORM } " STREQUAL "MACOS" ) AND (NOT "${PLATFORM } " STREQUAL "IOS" ))
294
+ if ((NOT "${GODOT_PLATFORM } " STREQUAL "MACOS" ) AND (NOT "${GODOT_PLATFORM } " STREQUAL "IOS" ))
287
295
string (APPEND LIBRARY_SUFFIX ".${ARCH} " )
288
296
endif ()
289
297
0 commit comments