Fixed compilation with SDL/mingw
This commit is contained in:
@@ -93,13 +93,14 @@ if(NOT backend_sdl AND UNIX AND NOT ANDROID AND NOT IOS)
|
||||
endif()
|
||||
|
||||
#third party build options
|
||||
WAGIC_OPTION(BUILD_ZLIB "build zlib from source" WIN32 OR APPLE)
|
||||
WAGIC_OPTION(BUILD_ZLIB "build zlib from source" ((NOT MINGW) AND (WIN32 OR APPLE)))
|
||||
WAGIC_OPTION(BUILD_JPEG "build jpeg from source" (WIN32 OR APPLE OR PSP OR ANDROID OR EMSCRIPTEN))
|
||||
WAGIC_OPTION(BUILD_PNG "build png from source" (WIN32 OR APPLE OR PSP OR ANDROID OR EMSCRIPTEN))
|
||||
WAGIC_OPTION(BUILD_UNZIP "build unzip from source" ON)
|
||||
WAGIC_OPTION(BUILD_TINYXML "build tinyxml from source" (WIN32 OR APPLE OR PSP OR ANDROID OR EMSCRIPTEN OR IOS))
|
||||
WAGIC_OPTION(BUILD_ZIPFS "build zipfs from source" ON)
|
||||
WAGIC_OPTION(BUILD_SDL2 "build SDL2 from source" (backend_sdl AND (UNIX OR WIN32 OR ANDROID) AND (NOT EMSCRIPTEN AND NOT IOS)))
|
||||
#WAGIC_OPTION(BUILD_CURL "build curl from source" (backend_sdl AND WIN32))
|
||||
|
||||
#project options
|
||||
if(ANDROID)
|
||||
@@ -170,6 +171,8 @@ FindOrBuildUNZIP()
|
||||
FindOrBuildPNG()
|
||||
FindOrBuildJPEG()
|
||||
FindOrBuildBoost()
|
||||
#FindOrBuildCurl()
|
||||
|
||||
if(PSP)
|
||||
FindOrBuildGIF()
|
||||
endif()
|
||||
|
||||
@@ -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)
|
||||
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)
|
||||
|
||||
@@ -198,7 +198,17 @@ elseif(backend_sdl)
|
||||
${Boost_INCLUDE_DIRS} ${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
|
||||
add_executable(wagic ${MTG_generic_src} ${MTG_sdl_src} src/TestSuiteAI.cpp src/AIPlayerBakaB.cpp)
|
||||
link_directories(${Boost_LIBRARY_DIR} ${SDL2_LIBRARY_DIR})
|
||||
target_link_libraries(wagic ${JGE_LIBRARY} ${SDL2_LIBRARY} ${OPENGL_LIBRARIES} ${TINYXML_LIBRARIES} ${BOOST_date_time} ${HGE_LIBRARY} ${ZLIB_LIBRARIES})
|
||||
target_link_libraries(wagic PRIVATE
|
||||
${JGE_LIBRARY}
|
||||
${PNG_LIBRARIES} # Explicitly link libpng
|
||||
${ZIPFS_LIBRARY} # Explicitly link libzipFS
|
||||
${SDL2_LIBRARY}
|
||||
${OPENGL_LIBRARIES}
|
||||
${TINYXML_LIBRARIES}
|
||||
${HGE_LIBRARY}
|
||||
${BOOST_date_time}
|
||||
${ZLIB_LIBRARIES} # Ensure zlib is linked
|
||||
)
|
||||
endif()
|
||||
elseif(backend_psp)
|
||||
if(PSP)
|
||||
|
||||
@@ -804,7 +804,7 @@ bool SdlApp::OnInit()
|
||||
return true;
|
||||
};
|
||||
|
||||
#if (defined ANDROID)
|
||||
#if (defined ANDROID) || (defined WIN32)
|
||||
int SDL_main(int argc, char * argv[])
|
||||
#else
|
||||
int main(int argc, char* argv[])
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Translate.h"
|
||||
#include "PriceList.h"
|
||||
#include "Subtypes.h"
|
||||
#include <random>
|
||||
|
||||
//WSyncable
|
||||
bool WSyncable::Hook(WSyncable* s)
|
||||
@@ -285,7 +286,10 @@ bool WSrcCards::setOffset(int pos)
|
||||
|
||||
void WSrcCards::Shuffle()
|
||||
{
|
||||
std::random_shuffle(cards.begin(), cards.end());
|
||||
std::random_device rd;
|
||||
std::mt19937 g(rd());
|
||||
|
||||
std::shuffle (cards.begin(), cards.end(), g);
|
||||
validate();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user