Commit 81291af9 authored by Ilya Prokhorov's avatar Ilya Prokhorov

Mingw32 build

parent a6a707ba
......@@ -6,6 +6,14 @@ set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (MINGW32)
set(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
set(CMAKE_RANLIB i686-w64-mingw32-ranlib)
endif()
if (EMSCRIPTEN)
set(CMAKE_CXX_FLAGS "-s USE_SDL=2 -s USE_SDL_TTF=2 -s USE_SDL_IMAGE=2 -s USE_LIBPNG=1 -s ASSERTIONS=1 -s SDL2_IMAGE_FORMATS='[\"png\"]' -s DISABLE_EXCEPTION_CATCHING=0 -O3 --no-heap-copy")
endif()
......@@ -18,10 +26,29 @@ file(GLOB_RECURSE SOURCE_FILES
if (EMSCRIPTEN)
add_library(FlameSteelCommonTraits STATIC ${SOURCE_FILES})
elseif (MINGW32)
add_library(FlameSteelCommonTraits.dll SHARED ${SOURCE_FILES})
else()
add_library(FlameSteelCommonTraits SHARED ${SOURCE_FILES})
endif()
if (MINGW32)
target_link_libraries(
FlameSteelCommonTraits.dll
-static-libgcc
-static-libstdc++
SDL2
SDL2_mixer
/home/demensdeum/Sources/cube-art-project-bootstrap/FlameSteelFramework/FlameSteelCore/FlameSteelCore.dll )
set_target_properties(FlameSteelCommonTraits.dll PROPERTIES
PREFIX ""
SUFFIX ""
LINK_FLAGS "-Wl,--add-stdcall-alias"
POSITION_INDEPENDENT_CODE 0 # this is to avoid MinGW warning;
# MinGW generates position-independent-code for DLL by default
)
else()
install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/FlameSteelCommonTraits"
DESTINATION include/FlameSteelFramework
......@@ -30,3 +57,4 @@ install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/FlameSteelCommonTraits"
)
install(TARGETS FlameSteelCommonTraits DESTINATION lib)
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment