Fixed compilation with SDL/mingw

This commit is contained in:
xawotihs
2025-05-11 17:08:37 +02:00
parent 0023c4a086
commit 00e076fca4
5 changed files with 57 additions and 12 deletions
+36 -8
View File
@@ -107,18 +107,23 @@ endmacro()
macro(FindOrBuildZLIB)
if(BUILD_ZLIB)
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/zlib)
set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/zlib ${CMAKE_BINARY_DIR}/thirdparty/zlib)
set(ZLIB_LIBRARIES zlib)
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/zlib ${CMAKE_BINARY_DIR}/thirdparty/zlib)
set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/zlib)
set(ZLIB_LIBRARIES ZLIB::ZLIBSTATIC)
else()
if(WIN32)
if(WIN32 AND NOT MINGW)
set(ZLIB_ROOT ${CMAKE_SOURCE_DIR}/thirdparty/binary/win)
find_package(ZLIB)
else()
if(backend_qt_console OR backend_qt_widget OR EMSCRIPTEN)
set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/zlib)
else()
if(MINGW)
set(ZLIB_USE_STATIC_LIBS TRUE)
find_package(ZLIB REQUIRED)
else()
find_package(ZLIB)
if(backend_qt_console OR backend_qt_widget OR EMSCRIPTEN)
set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/zlib)
else()
find_package(ZLIB)
endif()
endif()
endif()
endif()
@@ -181,6 +186,29 @@ macro(FindOrBuildPNG)
endif()
endmacro()
macro(FindOrBuildCurl)
if(BUILD_CURL)
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/curl ${CMAKE_BINARY_DIR}/thirdparty/curl)
set(CURL curl_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/curl)
set(CURL_LIBRARIES curl)
else()
if(WIN32)
#findPNG does currently not provide prefix vars. so we find
find_path(CURL CURL_INCLUDE_DIRS curl.h HINTS ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/include)
find_library(CURL_LIBRARIES libcurl HINTS ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/lib)
if (CURL_LIBRARIES AND CURL_INCLUDE_DIRS)
set(CURL_FOUND ON)
mark_as_advanced(CURL_INCLUDE_DIRS CURL_LIBRARIES)
else()
message(FATAL_ERROR "Could not find CURL on windows")
endif()
else()
find_package(CURL)
endif()
endif()
endmacro()
macro(FindOrBuildFreetype)
if(PSP)
set(ENV{FREETYPE_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/thirdparty/binary/psp/include)