Skip to content

Commit

Permalink
cmake version update, macos config ready, custom godot-cpp target
Browse files Browse the repository at this point in the history
properties
  • Loading branch information
Vano committed May 3, 2024
1 parent ccd918a commit c8fb210
Show file tree
Hide file tree
Showing 6 changed files with 1,148 additions and 45 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# TODO:
# Test builds for MacOS/IOS

cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.13)
project(godot-cpp LANGUAGES CXX)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
Expand Down Expand Up @@ -124,6 +124,11 @@ set_target_properties(${PROJECT_NAME}
PROPERTIES
CXX_EXTENSIONS OFF
POSITION_INDEPENDENT_CODE ON
GODOT_CC_FLAGS "${GODOT_CC_FLAGS}"
GODOT_CXX_FLAGS "${GODOT_CXX_FLAGS}"
GODOT_COMPILE_WARNING_FLAGS "${GODOT_COMPILE_WARNING_FLAGS}"
GODOT_LINK_FLAGS "${GODOT_LINK_FLAGS}"
LIBRARY_SUFFIX "${LIBRARY_SUFFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
Expand Down
26 changes: 0 additions & 26 deletions cmake/Info.plist.in

This file was deleted.

10 changes: 6 additions & 4 deletions cmake/godotcpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "")
endif()

set(TARGET "TEMPLATE_DEBUG" CACHE STRING "Target platform (EDITOR, TEMPLATE_DEBUG, TEMPLATE_RELEASE)")

# Auto-detect platform
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(DEFAULT_GODOT_PLATFORM "LINUX")
Expand All @@ -22,7 +23,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # Set by providing Emscripten toolchain
set(DEFAULT_GODOT_PLATFORM "WEB")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") # Set by providing Android toolchain
set(DEFAULT_GODOT_PLATFORM "NOTFOUND")
set(DEFAULT_GODOT_PLATFORM "ANDROID")
else()
set(DEFAULT_GODOT_PLATFORM "NOTFOUND")
endif()

set(GODOT_PLATFORM "${DEFAULT_GODOT_PLATFORM}" CACHE STRING "[Auto-detected] Target platform (LINUX, MACOS, WINDOWS, ANDROID, IOS, WEB)")
Expand All @@ -31,9 +34,8 @@ if("${GODOT_PLATFORM}" STREQUAL "NOTFOUND")
message(FATAL_ERROR "Could not auto-detect platform for \"${CMAKE_SYSTEM_NAME}\" automatically, please specify with -DGODOT_PLATFORM=<platform>")
endif()

set(GODOT_PLATFORM "${DEFAULT_GODOT_PLATFORM}" CACHE STRING "[Auto-detected] Target platform (LINUX, MACOS, WINDOWS, ANDROID, IOS, WEB)")

message(STATUS "Platform detected: ${GODOT_PLATFORM}")

set(GDEXTENSION_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gdextension" CACHE FILEPATH "Path to a directory containing GDExtension interface header")

set(GDEXTENSION_API_FILE "${CMAKE_CURRENT_SOURCE_DIR}/gdextension/extension_api.json" CACHE FILEPATH "Path to GDExtension API JSON file")
Expand Down Expand Up @@ -98,7 +100,7 @@ set(DEFAULT_OPTIMIZATION "$<NOT:${DEFAULT_OPTIMIZATION_DEBUG_FEATURES}>")

set(DEBUG_SYMBOLS_ENABLED "$<OR:$<BOOL:${DEBUG_SYMBOLS}>,$<IN_LIST:${CONFIG},${CONFIGS_WITH_DEBUG}>>")

# Clean default options
# Clear default options
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
Expand Down
Loading

0 comments on commit c8fb210

Please sign in to comment.