mirror of
https://github.com/godotengine/godot-cpp.git
synced 2026-01-03 18:09:13 +03:00
Simplify <platform>_generate cmake function signature, as TARGET_ALIAS and TARGET_NAME are still in scope and do not need to be passed. Add USE_FOLDERS, and FOLDER properties to group targets in VS and XCode Guard test target with GODOT_ENABLE_TESTING Generate all three variants in the form godot-cpp.test.<target> to remove the -DTEST_TARGET option clutter. Update the docs/cmake.rst with information about the testing target Update the Github CI
60 lines
1.3 KiB
CMake
60 lines
1.3 KiB
CMake
#[=======================================================================[.rst:
|
|
MacOS
|
|
-----
|
|
|
|
This file contains functions for options and configuration for targeting the
|
|
MacOS platform
|
|
|
|
]=======================================================================]
|
|
|
|
# Find Requirements
|
|
IF(APPLE)
|
|
set( CMAKE_OSX_SYSROOT $ENV{SDKROOT} )
|
|
find_library( COCOA_LIBRARY REQUIRED
|
|
NAMES Cocoa
|
|
PATHS ${CMAKE_OSX_SYSROOT}/System/Library
|
|
PATH_SUFFIXES Frameworks
|
|
NO_DEFAULT_PATH)
|
|
ENDIF (APPLE)
|
|
|
|
|
|
function( macos_options )
|
|
# macos options here
|
|
endfunction()
|
|
|
|
|
|
function( macos_generate )
|
|
|
|
# OSX_ARCHITECTURES does not support generator expressions.
|
|
if( NOT GODOT_ARCH OR GODOT_ARCH STREQUAL universal )
|
|
set( OSX_ARCH "x86_64;arm64" )
|
|
set( SYSTEM_ARCH universal )
|
|
else()
|
|
set( OSX_ARCH ${GODOT_ARCH} )
|
|
endif()
|
|
|
|
set_target_properties( ${TARGET_NAME}
|
|
PROPERTIES
|
|
|
|
OSX_ARCHITECTURES "${OSX_ARCH}"
|
|
)
|
|
|
|
target_compile_definitions(${TARGET_NAME}
|
|
PUBLIC
|
|
MACOS_ENABLED
|
|
UNIX_ENABLED
|
|
)
|
|
|
|
target_link_options( ${TARGET_NAME}
|
|
PUBLIC
|
|
-Wl,-undefined,dynamic_lookup
|
|
)
|
|
|
|
target_link_libraries( ${TARGET_NAME}
|
|
INTERFACE
|
|
${COCOA_LIBRARY}
|
|
)
|
|
|
|
common_compiler_flags()
|
|
endfunction()
|