add mingw-w64 support

This commit is contained in:
Green Sky 2021-11-30 19:50:40 +01:00
parent dc37ad54ec
commit ec98df52d7
8 changed files with 28 additions and 9 deletions

2
.gitignore vendored
View File

@ -10,7 +10,7 @@ cmake-build-release/
*.stackdump *.stackdump
*.coredump *.coredump
compile_commands.json compile_commands.json
/build /build*
.clangd .clangd
.cache .cache

View File

@ -26,7 +26,11 @@ add_subdirectory("physfs")
if(NOT MM_HEADLESS) if(NOT MM_HEADLESS)
if(NOT EMSCRIPTEN) if(NOT EMSCRIPTEN)
find_package(SDL2 REQUIRED) if(VCPKG_TARGET_TRIPLET)
find_package(SDL2 CONFIG REQUIRED)
else() # HACK: fix sdl find module
find_package(SDL2 REQUIRED)
endif()
endif() endif()
if(NOT MM_OPENGL_3_GLES) if(NOT MM_OPENGL_3_GLES)

View File

@ -58,7 +58,9 @@ if(EMSCRIPTEN)
set_target_properties(imgui PROPERTIES LINK_FLAGS "-s USE_SDL=2 -s USE_WEBGL2=1 -s FULL_ES2=1 -s FULL_ES3=1") set_target_properties(imgui PROPERTIES LINK_FLAGS "-s USE_SDL=2 -s USE_WEBGL2=1 -s FULL_ES2=1 -s FULL_ES3=1")
elseif(ANDROID) elseif(ANDROID)
target_link_libraries(imgui SDL) target_link_libraries(imgui SDL)
else() # if not android or emscripten elseif(VCPKG_TARGET_TRIPLET)
target_link_libraries(imgui SDL2::SDL2 SDL2::SDL2main SDL2::SDL2-static)
else()
target_include_directories(imgui PUBLIC "${SDL2_INCLUDE_DIR}") target_include_directories(imgui PUBLIC "${SDL2_INCLUDE_DIR}")
target_link_libraries(imgui ${SDL2_LIBRARY}) target_link_libraries(imgui ${SDL2_LIBRARY})
endif() endif()

View File

@ -163,9 +163,12 @@ target_include_directories(soloud SYSTEM PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/sol
#target_include_directories(soloud PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/imgui") #target_include_directories(soloud PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/imgui")
#if not android or emscripten #if not android or emscripten
target_include_directories(soloud PUBLIC "${SDL2_INCLUDE_DIR}") if(VCPKG_TARGET_TRIPLET)
target_link_libraries(soloud ${SDL2_LIBRARY}) target_link_libraries(soloud SDL2::SDL2 SDL2::SDL2main SDL2::SDL2-static)
#endif else()
target_include_directories(soloud PUBLIC "${SDL2_INCLUDE_DIR}")
target_link_libraries(soloud ${SDL2_LIBRARY})
endif()
#if android #if android
#target_link_libraries(soloud SDL) #target_link_libraries(soloud SDL)

View File

@ -19,10 +19,11 @@ endif()
target_include_directories(tracy_client PUBLIC "${CMAKE_CURRENT_LIST_DIR}") target_include_directories(tracy_client PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
#target_link_libraries(tracy_client
#)
if(UNIX) if(UNIX)
target_link_libraries(tracy_client dl) target_link_libraries(tracy_client dl)
endif() endif()
if(WIN32)
target_link_libraries(tracy_client ws2_32 dbghelp)
endif()

View File

@ -31,6 +31,8 @@ if(NOT MM_HEADLESS)
if(EMSCRIPTEN) if(EMSCRIPTEN)
set_target_properties(filesystem_service PROPERTIES COMPILE_FLAGS "-s USE_SDL=2") set_target_properties(filesystem_service PROPERTIES COMPILE_FLAGS "-s USE_SDL=2")
set_target_properties(filesystem_service PROPERTIES LINK_FLAGS "-s USE_SDL=2") set_target_properties(filesystem_service PROPERTIES LINK_FLAGS "-s USE_SDL=2")
elseif(VCPKG_TARGET_TRIPLET)
target_link_libraries(filesystem_service SDL2::SDL2 SDL2::SDL2main SDL2::SDL2-static)
else() else()
#if not android or emscripten #if not android or emscripten
target_include_directories(filesystem_service PUBLIC "${SDL2_INCLUDE_DIR}") target_include_directories(filesystem_service PUBLIC "${SDL2_INCLUDE_DIR}")

View File

@ -39,6 +39,10 @@ else()
target_link_libraries(sdl_service glad) target_link_libraries(sdl_service glad)
endif() endif()
if(VCPKG_TARGET_TRIPLET)
target_link_libraries(sdl_service SDL2::SDL2 SDL2::SDL2main SDL2::SDL2-static)
endif()
if(BUILD_TESTING) if(BUILD_TESTING)
add_subdirectory(test) add_subdirectory(test)
endif() endif()

View File

@ -34,6 +34,9 @@ SDLService::SDLService(uint32_t _sdl_init_flags) {
//#ifdef __EMSCRIPTEN__ //#ifdef __EMSCRIPTEN__
//_sdl_init_flags &= ~SDL_INIT_HAPTIC; //_sdl_init_flags &= ~SDL_INIT_HAPTIC;
//#endif //#endif
#if 1 // hack for mingw + wine
_sdl_init_flags &= ~SDL_INIT_SENSOR;
#endif
sdl_init_flags = _sdl_init_flags; sdl_init_flags = _sdl_init_flags;
} }