From 2ca07e9b11f65e43545457e3fb6345f6175cb4f2 Mon Sep 17 00:00:00 2001 From: lzwdgc Date: Mon, 15 Feb 2021 15:56:24 +0300 Subject: [PATCH] Fix linux build. --- src/common/buffer.cpp | 1 + src/common/common.cpp | 12 ++++++++++++ src/common/mat.h | 4 +++- src/common/tga.h | 5 +++-- src/common/types.cpp | 2 ++ src/mmo_extractor/other.h | 17 +++++++++-------- src/mpj_loader/mpj.cpp | 4 +++- sw.cpp | 7 ++++--- 8 files changed, 37 insertions(+), 15 deletions(-) diff --git a/src/common/buffer.cpp b/src/common/buffer.cpp index 749e2c9..8e7308c 100644 --- a/src/common/buffer.cpp +++ b/src/common/buffer.cpp @@ -21,6 +21,7 @@ #include #include +#include const int build_version = 0 //#include diff --git a/src/common/common.cpp b/src/common/common.cpp index 36aef04..f8e7d52 100644 --- a/src/common/common.cpp +++ b/src/common/common.cpp @@ -18,10 +18,15 @@ #include "common.h" +#include + +#ifdef _WIN32 #include +#endif std::string str2utf8(const std::string &codepage_str, int cp) { +#ifdef _WIN32 auto utf16_str = str2utf16(codepage_str, cp); int utf8_size = WideCharToMultiByte(CP_UTF8, 0, utf16_str.c_str(), utf16_str.length(), nullptr, 0, @@ -31,10 +36,14 @@ std::string str2utf8(const std::string &codepage_str, int cp) utf16_str.length(), &utf8_str[0], utf8_size, nullptr, nullptr); return utf8_str; +#else + SW_UNIMPLEMENTED; +#endif } std::wstring str2utf16(const std::string &codepage_str, int cp) { +#ifdef _WIN32 int size; std::wstring utf16_str; @@ -45,4 +54,7 @@ std::wstring str2utf16(const std::string &codepage_str, int cp) codepage_str.length(), &utf16_str[0], size); return utf16_str; +#else + SW_UNIMPLEMENTED; +#endif } diff --git a/src/common/mat.h b/src/common/mat.h index 2821865..e252fb3 100644 --- a/src/common/mat.h +++ b/src/common/mat.h @@ -23,10 +23,12 @@ #include -#include #include #include +#include +#include + template class mat { diff --git a/src/common/tga.h b/src/common/tga.h index 29d765e..9b645df 100644 --- a/src/common/tga.h +++ b/src/common/tga.h @@ -1,9 +1,10 @@ #pragma once -#include - #include "buffer.h" +#include +#include + #pragma pack(push, 1) // http://paulbourke.net/dataformats/tga/ diff --git a/src/common/types.cpp b/src/common/types.cpp index 7cf27e9..81d3b92 100644 --- a/src/common/types.cpp +++ b/src/common/types.cpp @@ -18,6 +18,8 @@ #include "types.h" +#include + void weather::load(const buffer &b) { READ_STRING(b, name); diff --git a/src/mmo_extractor/other.h b/src/mmo_extractor/other.h index 0fcac33..21f0437 100644 --- a/src/mmo_extractor/other.h +++ b/src/mmo_extractor/other.h @@ -29,6 +29,13 @@ #include +// if we move this inside MechGroup, compilation error - default ctor is deleted +struct MechGroup_unk_type01 +{ + uint32_t unk0 = 0; + float unk1 = 0; +}; + struct MechGroup { std::string name; @@ -39,13 +46,7 @@ struct MechGroup // probably an old field std::string org_ru; - struct unk_type01 - { - uint32_t unk0 = 0; - float unk1 = 0; - }; - - std::variant, uint32_t> type_data; + std::variant, uint32_t> type_data; bool hidden; @@ -64,7 +65,7 @@ struct MechGroup case 0: case 1: { - unk_type01 t; + MechGroup_unk_type01 t; READ(b, t.unk0); READ(b, t.unk1); type_data = t; diff --git a/src/mpj_loader/mpj.cpp b/src/mpj_loader/mpj.cpp index 409cab1..045a090 100644 --- a/src/mpj_loader/mpj.cpp +++ b/src/mpj_loader/mpj.cpp @@ -18,12 +18,14 @@ #include "mpj.h" +#include + #include #include #include #include -#include +#include segment *segment::create_segment(const buffer &b) { diff --git a/sw.cpp b/sw.cpp index 83d4597..771674a 100644 --- a/sw.cpp +++ b/sw.cpp @@ -50,8 +50,9 @@ void build(Solution &s) script2txt += cpp20; script2txt.setRootDirectory("src/script2txt"); script2txt += "pub.lzwdgc.Polygon4.DataManager.schema-master"_dep; - gen_flex_bison_pair("org.sw.demo.lexxmark.winflexbison"_dep, script2txt, "LALR1_CPP_VARIANT_PARSER", "script2txt"); - script2txt.CompileOptions.push_back("/Zc:__cplusplus"); + gen_flex_bison_pair("org.sw.demo.lexxmark.winflexbison"_dep, script2txt, "LALR1_CPP_VARIANT_PARSER", "script2txt"); + if (script2txt.getCompilerType() == CompilerType::MSVC) + script2txt.CompileOptions.push_back("/Zc:__cplusplus"); auto &model = tools.addStaticLibrary("model"); model += cpp20; @@ -67,7 +68,7 @@ void build(Solution &s) auto &mod_converter = add_exe("mod_converter"); mod_converter += model; - path sdk = "d:/arh/apps/Autodesk/FBX/FBX SDK/2019.0"; + path sdk = "d:/arh/apps/Autodesk/FBX/FBX SDK/2020.2"; mod_converter += IncludeDirectory(sdk / "include"); String cfg = "release"; if (mod_converter.getBuildSettings().Native.ConfigurationType == ConfigurationType::Debug)