Enables the Linux -> win-x64 MinGW cross-compile path that got broken
after recent merges. Still INCOMPLETE — build fails later at missing
DirectX IME headers (DIMM.h) and likely more vendor SDK compat issues.
Commit captures the mechanical fixes so Jakub can adopt/iterate.
Changes:
1. toolchains/linux-mingw64.cmake — MinGW cross-compile toolchain
(Windows x86_64 target, mingw-w64 gcc/g++/windres, lld linker).
2. CMakeLists.txt:
- MSVC-only flags (/MP, /Zi, /DEBUG linker flag) gated behind
if(MSVC) — they break MinGW gcc which treats /MP as filename.
- UNICODE / _UNICODE defined globally (was inside if(MSVC), but
WIN32_FIND_DATA etc. need it everywhere).
- __int64 -> long long compile definition for non-MSVC compilers
so the Granny SDK header parses.
- -mssse3 compile option for non-MSVC so _mm_shuffle_epi8 in
EterLib/GrpImageTexture.cpp inlines correctly.
3. Include fixes for Linux case-sensitive filesystem and stricter
GCC standard library:
- Poly/StdAfx.h: backslash in include path -> forward slash.
- EterBase/Stl.h: <SSTREAM> -> <sstream>.
- EterBase/Utils.h: add <cmath> so cos() in templates resolves.
- AudioLib/MaSoundInstance.h: add <cstdint> so uint8_t vector
template argument is valid.
- AudioLib/Type.h: add <cstdint> for uint32_t.
- extern/include/utf8.h: add <cstdint> for uint8_t/uint16_t.
- EffectLib/Type.h: typedef typename std::vector<...>::iterator
(dependent-name C++11+ compliance).
Not committed (needs manual recreation per checkout, or git-tracking
them needs buy-in):
- 60+ stdafx case-variant symlinks (stdafx.h, StdAfx.h, Stdafx.h)
- 7 directory case symlinks (Eterlib, eterLib, eterBase, Gamelib,
gamelib, Eterbase, eterbase)
- header case-variant symlinks in individual dirs
Still failing at:
- src/EterLib/IME.h:7 wanting DIMM.h (DirectX IME, not in extern/
and not shipped with mingw-w64). Needs either a shim header, a
#ifdef _MSC_VER guard, or vendoring the Microsoft DirectX IME SDK.
Work done over ~2h trying to get a fresh release cycle through from
Linux. Stopping here because each fix exposes another vendor/compat
issue that benefits from Jakub's context of the build history.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
93 lines
2.9 KiB
CMake
93 lines
2.9 KiB
CMake
cmake_minimum_required(VERSION 3.19)
|
|
|
|
project(m2dev-client-src)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# ASan support
|
|
option(ENABLE_ASAN "Enable AddressSanitizer" OFF)
|
|
|
|
set(CMAKE_MODULE_PATH
|
|
${CMAKE_MODULE_PATH}
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/buildtool"
|
|
)
|
|
|
|
include(Utils)
|
|
|
|
set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo;Release" CACHE STRING "Configurations" FORCE)
|
|
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo,Release>:ProgramDatabase>")
|
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
|
add_compile_definitions(UNICODE _UNICODE)
|
|
add_compile_definitions("$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:__int64=long long>")
|
|
add_compile_options("$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-mssse3>")
|
|
if(MSVC)
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
|
endif()
|
|
add_compile_definitions(UNICODE _UNICODE)
|
|
add_compile_definitions("$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:__int64=long long>")
|
|
add_compile_options("$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-mssse3>")
|
|
if(MSVC)
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG")
|
|
endif()
|
|
|
|
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
|
add_compile_definitions(UNICODE _UNICODE)
|
|
add_compile_definitions("$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:__int64=long long>")
|
|
add_compile_options("$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-mssse3>")
|
|
if(MSVC)
|
|
add_compile_options(/MP)
|
|
endif()
|
|
|
|
add_compile_definitions(UNICODE _UNICODE)
|
|
add_compile_definitions("$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:__int64=long long>")
|
|
add_compile_options("$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-mssse3>")
|
|
if(MSVC)
|
|
add_compile_definitions(UNICODE _UNICODE)
|
|
endif()
|
|
|
|
add_compile_options(
|
|
$<$<CXX_COMPILER_ID:MSVC>:/wd4828>
|
|
$<$<CXX_COMPILER_ID:MSVC>:/wd4996>
|
|
$<$<CXX_COMPILER_ID:MSVC>:/wd5033>
|
|
)
|
|
|
|
# ASan flags
|
|
if(ENABLE_ASAN)
|
|
if(MSVC)
|
|
add_compile_options(/fsanitize=address)
|
|
add_link_options(/fsanitize=address)
|
|
add_definitions(-D_DISABLE_VECTOR_ANNOTATION)
|
|
add_definitions(-D_DISABLE_STRING_ANNOTATION)
|
|
else()
|
|
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
|
add_link_options(-fsanitize=address)
|
|
endif()
|
|
endif()
|
|
|
|
add_definitions(-DNOMINMAX)
|
|
add_definitions(-DWIN32_LEAN_AND_MEAN)
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
add_definitions(-DWINDOWS_IGNORE_PACKING_MISMATCH)
|
|
|
|
add_definitions(-DUSE_LOD)
|
|
add_definitions(-DDUNGEON_WORK)
|
|
add_definitions(-DBUILDING_GRANNY_STATIC)
|
|
add_definitions(-DGRANNY_THREADED)
|
|
add_definitions(-DPy_NO_ENABLE_SHARED)
|
|
|
|
add_compile_definitions("$<$<CONFIG:Debug>:DEBUG>")
|
|
add_compile_definitions("$<$<CONFIG:RelWithDebInfo>:_DISTRIBUTE>")
|
|
add_compile_definitions("$<$<CONFIG:Release>:_DISTRIBUTE>")
|
|
|
|
include_directories("src")
|
|
include_directories("extern/include")
|
|
include_directories("vendor/libsodium/src/libsodium/include")
|
|
include_directories("vendor/freetype-2.13.3/include")
|
|
|
|
# Add subdirectories for libraries and executables
|
|
add_subdirectory(vendor)
|
|
add_subdirectory(src)
|
|
add_subdirectory(extern) |