2024-03-15 16:19:01 +00:00
|
|
|
if (NOT MINGW)
|
|
|
|
return()
|
2024-03-13 18:13:55 +00:00
|
|
|
endif()
|
|
|
|
|
2024-03-15 16:19:01 +00:00
|
|
|
# this has to run after the toolchain is initialized.
|
|
|
|
include_directories("${CMAKE_SOURCE_DIR}/dependencies/mingw-include")
|
|
|
|
include_directories("${CMAKE_SOURCE_DIR}/dependencies/mingw-xaudio/include")
|
2024-03-13 18:13:55 +00:00
|
|
|
|
2024-03-15 16:19:01 +00:00
|
|
|
# link libgcc/libstdc++ statically on GCC/mingw
|
2024-03-13 18:13:55 +00:00
|
|
|
# and adjust link command when making a static binary
|
2024-03-15 16:19:01 +00:00
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND VBAM_STATIC)
|
2024-03-13 18:13:55 +00:00
|
|
|
# some dists don't have a static libpthread
|
|
|
|
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread ")
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET visualboyadvance-m PRE_LINK
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/msys-link-static.cmake
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
add_custom_command(
|
|
|
|
TARGET visualboyadvance-m PRE_LINK
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/link-static.cmake
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
)
|
|
|
|
endif()
|
2024-03-15 16:19:01 +00:00
|
|
|
endif()
|