wip: compilation on windows

This commit is contained in:
Tim Felgentreff 2020-05-02 07:24:10 +02:00
parent 31254eb339
commit 8382f38aef
4 changed files with 45 additions and 27 deletions
CMakeLists.txt
cmake/modules
src
third_party/hqx/src
video

View file

@ -711,6 +711,11 @@ else()
set(PIXMAPSDIRABS "${PIXMAPSDIR}")
endif()
if (WIN32)
set(SDL2_LIBRARY ${SDL2_LIBRARY} ${SDL2main_LIBRARY})
message(${SDL2_LIBRARY})
endif()
# Stratagus definitions
add_definitions(-DUSE_ZLIB -DPIXMAPS=\"${PIXMAPSDIRABS}\")
@ -807,6 +812,9 @@ endif()
if(CMAKE_COMPILER_IS_GNUC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsigned-char")
endif()
if(WIN32 AND MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Profile")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
@ -1063,7 +1071,7 @@ if(WIN32 AND MINGW AND ENABLE_STATIC)
set_target_properties(stratagus PROPERTIES LINK_FLAGS "${LINK_FLAGS} -static-libgcc -static-libstdc++ -Wl,--stack,10485760")
endif()
if(APPLE)
if(APPLE OR WIN32)
set_target_properties(stratagus PROPERTIES LINK_FLAGS "${LINK_FLAGS} -lSDL2main")
endif()

View file

@ -13,6 +13,13 @@ find_library(SDL2_LIBRARY_TEMP
PATH_SUFFIXES lib
)
find_library(SDL2main_LIBRARY
NAMES SDL2main
HINTS
ENV SDLDIR
PATH_SUFFIXES lib
)
# SDL may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
@ -84,4 +91,4 @@ else (THEORA_FOUND)
endif (SDL2_FIND_REQUIRED)
endif (SDL2_FOUND)
MARK_AS_ADVANCED(SDL2_INCLUDE_DIR SDL2_LIBRARY)
MARK_AS_ADVANCED(SDL2_INCLUDE_DIR SDL2_LIBRARY SDL2main_LIBRARY)

View file

@ -34,12 +34,14 @@
#endif
#if defined(_WIN32)
#ifdef DLL_EXPORT
#define HQX_API __declspec(dllexport)
#else
#define HQX_API __declspec(dllimport)
#endif
#else
/*
* #ifdef DLL_EXPORT
* #define HQX_API __declspec(dllexport)
* #else
* #define HQX_API __declspec(dllimport)
* #endif
* #else
*/
#define HQX_API
#endif

View file

@ -282,25 +282,6 @@ void InitVideoSdl()
#if defined(DEBUG) && !defined(USE_WIN32)
signal(SIGSEGV, CleanExit);
signal(SIGABRT, CleanExit);
#endif
#ifdef USE_WIN32
HWND hwnd = NULL;
HICON hicon = NULL;
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info)) {
hwnd = info.window;
}
if (hwnd) {
hicon = ExtractIcon(GetModuleHandle(NULL), Parameters::Instance.applicationName.c_str(), 0);
}
if (hicon) {
SendMessage(hwnd, (UINT)WM_SETICON, ICON_SMALL, (LPARAM)hicon);
SendMessage(hwnd, (UINT)WM_SETICON, ICON_BIG, (LPARAM)hicon);
}
#endif
}
@ -352,6 +333,26 @@ void InitVideoSdl()
}
Video.ResizeScreen(Video.Width, Video.Height);
// #ifdef USE_WIN32
// HWND hwnd = NULL;
// HICON hicon = NULL;
// SDL_SysWMinfo info;
// SDL_VERSION(&info.version);
// if (SDL_GetWindowWMInfo(TheWindow, &info)) {
// hwnd = info.win.window;
// }
// if (hwnd) {
// hicon = ExtractIcon(GetModuleHandle(NULL), Parameters::Instance.applicationName.c_str(), 0);
// }
// if (hicon) {
// SendMessage(hwnd, (UINT)WM_SETICON, ICON_SMALL, (LPARAM)hicon);
// SendMessage(hwnd, (UINT)WM_SETICON, ICON_BIG, (LPARAM)hicon);
// }
// #endif
#if ! defined(USE_WIN32) && ! defined(USE_MAEMO)
SDL_Surface *icon = NULL;