Skip to content

Commit

Permalink
Fix MinGW build
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed Aug 29, 2022
1 parent 12dd7bb commit 197bab2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Windows_MinGW_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
working-directory: ${{github.workspace}}
env:
CMAKE_BUILD_TYPE: ${{github.event_name == 'release' && 'Release' || 'Debug'}}
run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{env.CMAKE_BUILD_TYPE}} -DBUILD_SHARED_LIBS=OFF
run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{env.CMAKE_BUILD_TYPE}} -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=../CMake/mingwcc64.toolchain.cmake

- name: Build
working-directory: ${{github.workspace}}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/output/
/build/
/build-rel/
/build-*/
/.vscode/
22 changes: 22 additions & 0 deletions CMake/mingwcc64.toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
SET(MINGW_CROSS TRUE)

SET(CROSS_PREFIX "/usr" CACHE STRING "crosstool-NG prefix")

SET(CMAKE_SYSTEM_NAME Windows)

# workaround
list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "${CROSS_PREFIX}/x86_64-w64-mingw32/include")

SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc")
SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++")
set(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres")
set(PKG_CONFIG_EXECUTABLE "${CROSS_PREFIX}/bin/x86_64-w64-mingw32-pkg-config")

SET(CMAKE_FIND_ROOT_PATH "${CROSS_PREFIX}/x86_64-w64-mingw32" "${CROSS_PREFIX}/x86_64-w64-mingw32/x86_64-w64-mingw32")

SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(SYSTEM_BITS x64)
SET(DISABLE_LTO ON)
4 changes: 2 additions & 2 deletions src/unpack_and_minify_mpq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void PrintHelp()

std::string SrcName(const std::filesystem::path &mpq)
{
std::string result = mpq.stem();
std::string result = mpq.stem().string();
if (result == "DIABDAT")
result = "diabdat";
return result;
Expand Down Expand Up @@ -310,7 +310,7 @@ class MpqArchive {
public:
explicit MpqArchive(const std::filesystem::path &path)
{
const int32_t error = libmpq__archive_open(&archive_, path.c_str(), 0);
const int32_t error = libmpq__archive_open(&archive_, path.string().c_str(), 0);
if (error != 0) {
std::cerr << "Failed to open MPQ at " << path << ": "
<< libmpq__strerror(error) << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions third_party/dvl_gfx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include(functions/FetchContent_MakeAvailableExcludeFromAll)
set(ENABLE_INSTALL OFF)
FetchContent_Declare(
dvl_gfx
URL https://github.com/diasurgical/devilutionx-graphics-tools/archive/95c3b4174b1c5e83bfb7f8681b663cb77ec9bcaa.tar.gz
URL_HASH MD5=8d9124f114a0b9a0bfdb1b9a9b7518dd
URL https://github.com/diasurgical/devilutionx-graphics-tools/archive/6f7e8c73df255d15617e5cb6ae088667b387207b.tar.gz
URL_HASH MD5=47717c8d6d4bab5c19b44717fc40f798
)
FetchContent_MakeAvailableExcludeFromAll(dvl_gfx)

0 comments on commit 197bab2

Please sign in to comment.