Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cmake/godotcpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,12 @@ function( godotcpp_generate )
CXX_VISIBILITY_PRESET ${GODOT_SYMBOL_VISIBILITY}

COMPILE_WARNING_AS_ERROR ${GODOT_WARNING_AS_ERROR}

POSITION_INDEPENDENT_CODE ON
BUILD_RPATH_USE_ORIGIN ON
INTERFACE_POSITION_INDEPENDENT_CODE ON

# Tell the linker to add the $ORIGIN relative location at build time
INTERFACE_BUILD_RPATH_USE_ORIGIN ON

PREFIX lib
OUTPUT_NAME "${PROJECT_NAME}.${SYSTEM_NAME}.${TARGET_NAME}.${SYSTEM_ARCH}"
Expand Down
5 changes: 5 additions & 0 deletions cmake/macos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ function( macos_generate TARGET_NAME )

set_target_properties( ${TARGET_NAME}
PROPERTIES
# enable RPATH on MACOS, with the BUILD_RPATH_USE_ORIGIN
# this should allow loading libraries from relative paths on macos.
INTERFACE_MACOSX_RPATH ON

# Specify multiple architectures for universal builds
OSX_ARCHITECTURES "${OSX_ARCH}"
INTERFACE_OSX_ARCHITECTURES "${OSX_ARCH}"
)

target_compile_definitions(${TARGET_NAME}
Expand Down
7 changes: 5 additions & 2 deletions cmake/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ function( windows_generate TARGET_NAME )
set( STATIC_CPP "$<BOOL:${GODOT_USE_STATIC_CPP}>")
set( DISABLE_EXCEPTIONS "$<BOOL:${GODOT_DISABLE_EXCEPTIONS}>")
set( DEBUG_CRT "$<BOOL:${GODOT_DEBUG_CRT}>" )
set( MSVC_RUNTIME "$<IF:${DEBUG_CRT},MultiThreadedDebugDLL,$<IF:${STATIC_CPP},MultiThreaded,MultiThreadedDLL>>" )

set_target_properties( ${TARGET_NAME}
PROPERTIES
PDB_OUTPUT_DIRECTORY "$<1:${CMAKE_SOURCE_DIR}/bin>"
INTERFACE_MSVC_RUNTIME_LIBRARY
"$<IF:${DEBUG_CRT},MultiThreadedDebugDLL,$<IF:${STATIC_CPP},MultiThreaded,MultiThreadedDLL>>"

# set msvc runtime to link against and for our consumers
MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME}"
INTERFACE_MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME}"
)

target_compile_definitions( ${TARGET_NAME}
Expand Down
7 changes: 0 additions & 7 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ set_target_properties( godot-cpp-test
CXX_EXTENSIONS OFF
CXX_VISIBILITY_PRESET ${GODOT_SYMBOL_VISIBILITY}

POSITION_INDEPENDENT_CODE ON
BUILD_RPATH_USE_ORIGIN ON
LINK_SEARCH_START_STATIC ON
LINK_SEARCH_END_STATIC ON

Expand All @@ -49,8 +47,6 @@ set_target_properties( godot-cpp-test
)

if( CMAKE_SYSTEM_NAME STREQUAL Darwin )
get_target_property( OSX_ARCH godot-cpp::${TEST_TARGET} OSX_ARCHITECTURES )

set( OUTPUT_DIR "${OUTPUT_DIR}/libgdexample.macos.${TEST_TARGET}.framework")

set_target_properties( godot-cpp-test
Expand All @@ -60,8 +56,5 @@ if( CMAKE_SYSTEM_NAME STREQUAL Darwin )

OUTPUT_NAME "gdexample.macos.${TEST_TARGET}"
SUFFIX ""

#macos options
OSX_ARCHITECTURES "${OSX_ARCH}"
)
endif ()
Loading