Skip to content

Commit aa1f7a5

Browse files
VanoVano
authored andcommitted
PLATFORM rename (conflicts with osxcross)
1 parent 590f2db commit aa1f7a5

File tree

5 files changed

+28
-72
lines changed

5 files changed

+28
-72
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# TARGET Godot build target (EDITOR, TEMPLATE_DEBUG, TEMPLATE_RELEASE)
1212
#
13-
# PLATFORM: Platform type (LINUX, MACOS, WINDOWS, ANDROID, IOS, WEB)
13+
# GODOT_PLATFORM: Platform type (LINUX, MACOS, WINDOWS, ANDROID, IOS, WEB)
1414
# Auto-detected by default depending on current OS or chosen toolchain
1515
#
1616
# other global and chosen platform-specific options:

cmake/godotcpp.cmake

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,28 @@ endif()
1212
set(TARGET "TEMPLATE_DEBUG" CACHE STRING "Target platform (EDITOR, TEMPLATE_DEBUG, TEMPLATE_RELEASE)")
1313
# Auto-detect platform
1414
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
15-
set(DEFAULT_PLATFORM "LINUX")
15+
set(DEFAULT_GODOT_PLATFORM "LINUX")
1616
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
17-
set(DEFAULT_PLATFORM "WINDOWS")
17+
set(DEFAULT_GODOT_PLATFORM "WINDOWS")
1818
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")
2022
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # Set by providing Emscripten toolchain
21-
set(DEFAULT_PLATFORM "WEB")
23+
set(DEFAULT_GODOT_PLATFORM "WEB")
2224
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")
2626
endif()
27-
set(PLATFORM "${DEFAULT_PLATFORM}" CACHE STRING "[Auto-detected] Target platform (LINUX, MACOS, WINDOWS, ANDROID, IOS, WEB)")
2827

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}")
2937
set(GDEXTENSION_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gdextension" CACHE FILEPATH "Path to a directory containing GDExtension interface header")
3038

3139
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()
8189
# Workaround of $<CONFIG> expanding to "" when default build set
8290
set(CONFIG "$<IF:$<STREQUAL:,$<CONFIG>>,${CMAKE_BUILD_TYPE},$<CONFIG>>")
8391

84-
string(TOLOWER ".${PLATFORM}.${TARGET}" platform_target)
92+
string(TOLOWER ".${GODOT_PLATFORM}.${TARGET}" platform_target)
8593
string(PREPEND LIBRARY_SUFFIX ${platform_target})
8694

8795
# Default optimization levels if OPTIMIZE=AUTO, for multi-config support
@@ -266,24 +274,24 @@ list(APPEND GODOT_LINK_FLAGS
266274
)
267275

268276
# Platform-specific options
269-
if("${PLATFORM}" STREQUAL "LINUX")
277+
if("${GODOT_PLATFORM}" STREQUAL "LINUX")
270278
include(linux)
271-
elseif("${PLATFORM}" STREQUAL "MACOS")
279+
elseif("${GODOT_PLATFORM}" STREQUAL "MACOS")
272280
include(macos)
273-
elseif("${PLATFORM}" STREQUAL "WINDOWS")
281+
elseif("${GODOT_PLATFORM}" STREQUAL "WINDOWS")
274282
include(windows)
275-
elseif("${PLATFORM}" STREQUAL "ANDROID")
283+
elseif("${GODOT_PLATFORM}" STREQUAL "ANDROID")
276284
include(android)
277-
elseif("${PLATFORM}" STREQUAL "IOS")
285+
elseif("${GODOT_PLATFORM}" STREQUAL "IOS")
278286
include(ios)
279-
elseif("${PLATFORM}" STREQUAL "WEB")
287+
elseif("${GODOT_PLATFORM}" STREQUAL "WEB")
280288
include(web)
281289
else()
282-
message(FATAL_ERROR "Platform not supported: ${PLATFORM}")
290+
message(FATAL_ERROR "Platform not supported: ${GODOT_PLATFORM}")
283291
endif()
284292

285293
# 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"))
287295
string(APPEND LIBRARY_SUFFIX ".${ARCH}")
288296
endif()
289297

test/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ file(GLOB_RECURSE HEADERS src/*.h**)
1717
get_directory_property(LIBRARY_SUFFIX DIRECTORY ${GODOT_CPP_PATH} DEFINITION LIBRARY_SUFFIX)
1818

1919
# Define our godot-cpp library
20-
if(${PLATFORM} STREQUAL "WEB")
20+
if(${GODOT_PLATFORM} STREQUAL "WEB")
2121
# wasm libraries loaded with dlopen() are created like this in cmake
2222
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
2323
set_target_properties(${PROJECT_NAME}
2424
PROPERTIES
2525
SUFFIX ".wasm"
2626
OUTPUT_NAME "${PROJECT_NAME}${LIBRARY_SUFFIX}"
2727
)
28-
elseif(${PLATFORM} STREQUAL "MACOS")
28+
elseif(${GODOT_PLATFORM} STREQUAL "MACOS")
2929
# TODO: create framework with cmake FRAMEWORK property
3030
# or with template file
3131
message(WARNING "Mac/IOS framework configuration is not tested and may not work.")

test/project/bin/libgdexample.macos.template_debug.framework/Resources/Info.plist

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/project/bin/libgdexample.macos.template_release.framework/Resources/Info.plist

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)