2024-11-21 00:30:48 +00:00
|
|
|
#[=======================================================================[.rst:
|
|
|
|
Windows
|
|
|
|
-------
|
|
|
|
|
|
|
|
This file contains functions for options and configuration for targeting the
|
|
|
|
Windows platform
|
|
|
|
|
|
|
|
]=======================================================================]
|
|
|
|
|
|
|
|
function( windows_options )
|
|
|
|
|
|
|
|
option( GODOT_USE_STATIC_CPP "Link MinGW/MSVC C++ runtime libraries statically" ON )
|
|
|
|
|
2024-11-27 22:25:00 +00:00
|
|
|
option( GODOT_DEBUG_CRT "Compile with MSVC's debug CRT (/MDd)" OFF )
|
|
|
|
|
2024-11-21 00:30:48 +00:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function( windows_generate TARGET_NAME )
|
|
|
|
set( IS_MSVC "$<CXX_COMPILER_ID:MSVC>" )
|
|
|
|
set( IS_CLANG "$<OR:$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:Clang>>" )
|
|
|
|
set( NOT_MSVC "$<NOT:${IS_MSVC}>" )
|
|
|
|
set( STATIC_CPP "$<BOOL:${GODOT_USE_STATIC_CPP}>")
|
|
|
|
set( DISABLE_EXCEPTIONS "$<BOOL:${GODOT_DISABLE_EXCEPTIONS}>")
|
2024-11-27 22:25:00 +00:00
|
|
|
set( DEBUG_CRT "$<BOOL:${GODOT_DEBUG_CRT}>" )
|
2024-11-21 00:30:48 +00:00
|
|
|
|
|
|
|
set_target_properties( ${TARGET_NAME}
|
|
|
|
PROPERTIES
|
|
|
|
PDB_OUTPUT_DIRECTORY "$<1:${CMAKE_SOURCE_DIR}/bin>"
|
2024-11-27 22:25:00 +00:00
|
|
|
INTERFACE_MSVC_RUNTIME_LIBRARY
|
|
|
|
"$<IF:${DEBUG_CRT},MultiThreadedDebugDLL,$<IF:${STATIC_CPP},MultiThreaded,MultiThreadedDLL>>"
|
2024-11-21 00:30:48 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_definitions( ${TARGET_NAME}
|
|
|
|
PUBLIC
|
|
|
|
WINDOWS_ENABLED
|
|
|
|
$<${IS_MSVC}:
|
|
|
|
TYPED_METHOD_BIND
|
|
|
|
NOMINMAX
|
|
|
|
>
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_options( ${TARGET_NAME}
|
|
|
|
PUBLIC
|
|
|
|
|
|
|
|
$<${NOT_MSVC}:
|
|
|
|
-Wl,--no-undefined
|
|
|
|
$<${STATIC_CPP}:
|
|
|
|
-static
|
|
|
|
-static-libgcc
|
|
|
|
-static-libstdc++
|
|
|
|
>
|
|
|
|
>
|
|
|
|
|
|
|
|
$<${IS_CLANG}:-lstdc++>
|
|
|
|
)
|
|
|
|
|
|
|
|
common_compiler_flags( ${TARGET_NAME} )
|
|
|
|
endfunction()
|