Some fixups, mainly to support MinGW builds
This commit is contained in:
16
SConstruct
16
SConstruct
@@ -4,6 +4,9 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
platform = ARGUMENTS.get('OS', Platform())
|
platform = ARGUMENTS.get('OS', Platform())
|
||||||
|
toolset = ARGUMENTS.get('toolset', 'default')
|
||||||
|
sixty_four = ARGUMENTS.get('64bit', false)
|
||||||
|
arch = 'x86_64' if sixty_four else 'x86'
|
||||||
|
|
||||||
if str(platform) not in ("darwin", "win32"):
|
if str(platform) not in ("darwin", "win32"):
|
||||||
print "Sorry, your platform is not supported."
|
print "Sorry, your platform is not supported."
|
||||||
@@ -14,7 +17,10 @@ if str(platform) not in ("darwin", "win32"):
|
|||||||
|
|
||||||
print 'Building for:', platform
|
print 'Building for:', platform
|
||||||
|
|
||||||
env = Environment(TARGET_ARCH='x86',ENV=os.environ)
|
if toolset != 'default':
|
||||||
|
env = Environment(TARGET_ARCH=arch,ENV=os.environ, tools = [toolset])
|
||||||
|
else:
|
||||||
|
env = Environment(TARGET_ARCH=arch,ENV=os.environ)
|
||||||
env.VariantDir('#build/obj', 'src')
|
env.VariantDir('#build/obj', 'src')
|
||||||
env.VariantDir('#build/obj/test', 'test')
|
env.VariantDir('#build/obj/test', 'test')
|
||||||
|
|
||||||
@@ -38,7 +44,8 @@ if path.exists(".git"):
|
|||||||
env.Command('src/tools/gitrev.hpp', git_refs, gen_gitrev)
|
env.Command('src/tools/gitrev.hpp', git_refs, gen_gitrev)
|
||||||
else:
|
else:
|
||||||
# Zipped source downloads from github do not include the repo (probably a good thing)
|
# Zipped source downloads from github do not include the repo (probably a good thing)
|
||||||
env.Command('src/tools/gitrev.hpp', '', """
|
# TODO: This does not work on Windows
|
||||||
|
env.Command('src/tools/gitrev.hpp', '', r"""
|
||||||
echo -e "\n#define GIT_REVISION \"\"\n#define GIT_TAG \"\"\n#define GIT_TAG_REVISION \"\"\n" > #TARGET
|
echo -e "\n#define GIT_REVISION \"\"\n#define GIT_TAG \"\"\n#define GIT_TAG_REVISION \"\"\n" > #TARGET
|
||||||
""")
|
""")
|
||||||
|
|
||||||
@@ -196,13 +203,15 @@ if not env.GetOption('clean'):
|
|||||||
print "There's a problem with your compiler!"
|
print "There's a problem with your compiler!"
|
||||||
Exit(1)
|
Exit(1)
|
||||||
|
|
||||||
if not conf.CheckLib('zlib' if str(platform) == "win32" else 'z'):
|
if not conf.CheckLib('zlib' if (str(platform) == "win32" and 'mingw' not in env["TOOLS"]) else 'z'):
|
||||||
print 'zlib must be installed!'
|
print 'zlib must be installed!'
|
||||||
Exit(1)
|
Exit(1)
|
||||||
|
|
||||||
def check_lib(lib, disp, suffixes=[], versions=[]):
|
def check_lib(lib, disp, suffixes=[], versions=[]):
|
||||||
if str(platform) == "win32" and lib.startswith("boost"):
|
if str(platform) == "win32" and lib.startswith("boost"):
|
||||||
lib = "lib" + lib
|
lib = "lib" + lib
|
||||||
|
if "mingw" in env["TOOLS"] and lib.startswith("sfml"):
|
||||||
|
lib = "lib" + lib
|
||||||
possible_names = [lib]
|
possible_names = [lib]
|
||||||
if str(platform) == "win32":
|
if str(platform) == "win32":
|
||||||
if 'msvc' in env['TOOLS']:
|
if 'msvc' in env['TOOLS']:
|
||||||
@@ -367,3 +376,4 @@ SConscript("build/pkg/SConscript")
|
|||||||
# Cleanup
|
# Cleanup
|
||||||
|
|
||||||
env.Clean('.', 'build')
|
env.Clean('.', 'build')
|
||||||
|
env.Clean('.', '.sconsign.dblite')
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ elif str(platform) == "win32":
|
|||||||
game_sources.extend(Split("""
|
game_sources.extend(Split("""
|
||||||
boe.menus.win.cpp
|
boe.menus.win.cpp
|
||||||
"""))
|
"""))
|
||||||
game_sources.append(env.RES('#build/obj/BladesOfExile.res', '#rsrc/menus/BladesOfExile.rc'))
|
game_sources.append(env.RES('#rsrc/menus/BladesOfExile.rc'))
|
||||||
|
|
||||||
boe = env.Program("#build/bin/Blades of Exile", common_sources + party_classes + game_sources)
|
boe = env.Program("#build/bin/Blades of Exile", common_sources + party_classes + game_sources)
|
||||||
|
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ void add_outdoor_maps() {
|
|||||||
|
|
||||||
void start_data_dump() {
|
void start_data_dump() {
|
||||||
fs::path path = progDir/"Data Dump.txt";
|
fs::path path = progDir/"Data Dump.txt";
|
||||||
std::ofstream fout(path.c_str());
|
std::ofstream fout(path.string().c_str());
|
||||||
|
|
||||||
fout << "Begin data dump:\n";
|
fout << "Begin data dump:\n";
|
||||||
fout << " Overall mode " << overall_mode << "\n";
|
fout << " Overall mode " << overall_mode << "\n";
|
||||||
|
|||||||
@@ -9,6 +9,11 @@
|
|||||||
#ifndef BoE_boe_menus_h
|
#ifndef BoE_boe_menus_h
|
||||||
#define BoE_boe_menus_h
|
#define BoE_boe_menus_h
|
||||||
|
|
||||||
|
// Needed for MinGW builds for some reason
|
||||||
|
#ifdef FILE_OPEN
|
||||||
|
#undef FILE_OPEN
|
||||||
|
#endif
|
||||||
|
|
||||||
void init_menubar();
|
void init_menubar();
|
||||||
void adjust_monst_menu();
|
void adjust_monst_menu();
|
||||||
void init_spell_menus();
|
void init_spell_menus();
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <gl/GL.h>
|
#include <gl/GL.h>
|
||||||
#undef HELP_INDEX // Except this one
|
#undef HELP_INDEX // Except this one
|
||||||
|
#undef FILE_OPEN
|
||||||
|
|
||||||
// This is the index of each menu on the menubar
|
// This is the index of each menu on the menubar
|
||||||
enum {
|
enum {
|
||||||
|
|||||||
@@ -423,7 +423,9 @@ void cPlayer::sort_items() {
|
|||||||
item_priority[items[i].variety]) {
|
item_priority[items[i].variety]) {
|
||||||
no_swaps = false;
|
no_swaps = false;
|
||||||
std::swap(items[i + 1], items[i]);
|
std::swap(items[i + 1], items[i]);
|
||||||
std::swap(equip[i + 1], equip[i]);
|
auto temp_equip = equip[i];
|
||||||
|
equip[i] = equip[i + 1];
|
||||||
|
equip[i + 1] = temp_equip;
|
||||||
if(weap_poisoned.slot == i + 1)
|
if(weap_poisoned.slot == i + 1)
|
||||||
weap_poisoned.slot--;
|
weap_poisoned.slot--;
|
||||||
else if(weap_poisoned.slot == i)
|
else if(weap_poisoned.slot == i)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
|
env = env.Clone()
|
||||||
|
env.Append(CXXFLAGS="-fpermissive")
|
||||||
dlog_util = env.StaticLibrary("#build/lib/dlogutil", Glob("*.cpp") + Glob("xml-parser/*.cpp"))
|
dlog_util = env.StaticLibrary("#build/lib/dlogutil", Glob("*.cpp") + Glob("xml-parser/*.cpp"))
|
||||||
|
|
||||||
Return("dlog_util")
|
Return("dlog_util")
|
||||||
@@ -51,7 +51,7 @@ Cursor::Cursor(fs::path imgPath, float hotSpotX, float hotSpotY) {
|
|||||||
sf::Image gif;
|
sf::Image gif;
|
||||||
if(!gif.loadFromFile(imgPath.string())) {
|
if(!gif.loadFromFile(imgPath.string())) {
|
||||||
std::string error = "Error loading cursor from " + imgPath.string();
|
std::string error = "Error loading cursor from " + imgPath.string();
|
||||||
throw std::exception(error.c_str());
|
throw error;
|
||||||
}
|
}
|
||||||
// Calculate the AND and XOR masks
|
// Calculate the AND and XOR masks
|
||||||
HBITMAP cursorAnd = CreateCompatibleBitmap(GetDC(NULL), gif.getSize().x, gif.getSize().y);
|
HBITMAP cursorAnd = CreateCompatibleBitmap(GetDC(NULL), gif.getSize().x, gif.getSize().y);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(NDEBUG)
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -36,3 +38,5 @@ void set_debug_buffers() {
|
|||||||
std::cout.rdbuf(&dbg_buf);
|
std::cout.rdbuf(&dbg_buf);
|
||||||
std::cerr.rdbuf(&dbg_err_buf);
|
std::cerr.rdbuf(&dbg_err_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ bool load_party(fs::path file_to_load, cUniverse& univ){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool load_party_v1(fs::path file_to_load, cUniverse& real_univ, bool town_restore, bool in_scen, bool maps_there, bool must_port){
|
bool load_party_v1(fs::path file_to_load, cUniverse& real_univ, bool town_restore, bool in_scen, bool maps_there, bool must_port){
|
||||||
std::ifstream fin(file_to_load.c_str(), std::ios_base::binary);
|
std::ifstream fin(file_to_load.string().c_str(), std::ios_base::binary);
|
||||||
fin.seekg(3*sizeof(short),std::ios_base::beg); // skip the header, which is 6 bytes in the old format
|
fin.seekg(3*sizeof(short),std::ios_base::beg); // skip the header, which is 6 bytes in the old format
|
||||||
|
|
||||||
legacy::party_record_type store_party;
|
legacy::party_record_type store_party;
|
||||||
|
|||||||
@@ -968,11 +968,13 @@ bool operator==(const tessel_ref_t& a, const tessel_ref_t& b) {
|
|||||||
return a.key == b.key;
|
return a.key == b.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> struct std::hash<tessel_ref_t> {
|
namespace std {
|
||||||
|
template<> struct hash<tessel_ref_t> {
|
||||||
size_t operator()(tessel_ref_t key) const {
|
size_t operator()(tessel_ref_t key) const {
|
||||||
return key.key;
|
return key.key;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
std::unordered_map<tessel_ref_t, tessel_t> tiling_reservoir;
|
std::unordered_map<tessel_ref_t, tessel_t> tiling_reservoir;
|
||||||
static int tessel_index = 0;
|
static int tessel_index = 0;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <cstring>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ void erase_if(ContainerT& items, const PredicateT& predicate) {
|
|||||||
// Case-insensitive string comparison seems to be semi-standard, but with different names.
|
// Case-insensitive string comparison seems to be semi-standard, but with different names.
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#define strnicmp strncasecmp
|
#define strnicmp strncasecmp
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_WIN32)
|
||||||
#define strnicmp _strnicmp
|
#define strnicmp _strnicmp
|
||||||
#else
|
#else
|
||||||
#error Missing strnicmp / strncasecmp
|
#error Missing strnicmp / strncasecmp
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
struct accel_table_t {
|
struct accel_table_t {
|
||||||
std::vector<ACCEL> table;
|
std::vector<ACCEL> table;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
void set_pref(std::string keypath, bool value);
|
void set_pref(std::string keypath, bool value);
|
||||||
bool get_bool_pref(std::string keypath, bool fallback = false);
|
bool get_bool_pref(std::string keypath, bool fallback = false);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ void append_iarray_pref(std::string keypath, int value) {
|
|||||||
if(prefs.find(keypath) == prefs.end() || prefs[keypath].type() != typeid(iarray))
|
if(prefs.find(keypath) == prefs.end() || prefs[keypath].type() != typeid(iarray))
|
||||||
prefs[keypath] = iarray{value};
|
prefs[keypath] = iarray{value};
|
||||||
else {
|
else {
|
||||||
iarray& arr = boost::any_cast<iarray>(prefs[keypath]);
|
iarray& arr = boost::any_cast<iarray&>(prefs[keypath]);
|
||||||
arr.push_back(value);
|
arr.push_back(value);
|
||||||
prefs[keypath] = arr;
|
prefs[keypath] = arr;
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ void append_iarray_pref(std::string keypath, int value) {
|
|||||||
|
|
||||||
std::vector<int> get_iarray_pref(std::string keypath) {
|
std::vector<int> get_iarray_pref(std::string keypath) {
|
||||||
if(prefs.find(keypath) == prefs.end()) return {};
|
if(prefs.find(keypath) == prefs.end()) return {};
|
||||||
if(prefs[keypath].type() == typeid(iarray)) return boost::any_cast<iarray>(prefs[keypath]);
|
if(prefs[keypath].type() == typeid(iarray)) return boost::any_cast<iarray&>(prefs[keypath]);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ static bool save_prefs(fs::path fpath) {
|
|||||||
std::ofstream fout(fpath.string().c_str());
|
std::ofstream fout(fpath.string().c_str());
|
||||||
for(auto& kv : prefs) {
|
for(auto& kv : prefs) {
|
||||||
if(kv.second.type() == typeid(iarray)) {
|
if(kv.second.type() == typeid(iarray)) {
|
||||||
iarray& arr = boost::any_cast<iarray>(kv.second);
|
const iarray& arr = boost::any_cast<iarray&>(kv.second);
|
||||||
fout << kv.first << " = [";
|
fout << kv.first << " = [";
|
||||||
for(int i : arr) fout << i << ' ';
|
for(int i : arr) fout << i << ' ';
|
||||||
fout.seekp(-1,std::ios::cur); // To overwrite the final space written in the loop
|
fout.seekp(-1,std::ios::cur); // To overwrite the final space written in the loop
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace ResMgr {
|
|||||||
if(!fs::exists(fpath))
|
if(!fs::exists(fpath))
|
||||||
throw xResMgrErr("Failed to load GIF cursor: " + fpath.string());
|
throw xResMgrErr("Failed to load GIF cursor: " + fpath.string());
|
||||||
int x = 0, y = 0, f_sz;
|
int x = 0, y = 0, f_sz;
|
||||||
std::ifstream fin(fpath.c_str(), std::ios::binary);
|
std::ifstream fin(fpath.string().c_str(), std::ios::binary);
|
||||||
fin.seekg(0, std::ios::end);
|
fin.seekg(0, std::ios::end);
|
||||||
f_sz = fin.tellg();
|
f_sz = fin.tellg();
|
||||||
fin.clear();
|
fin.clear();
|
||||||
@@ -99,7 +99,7 @@ namespace ResMgr {
|
|||||||
/// Each line in the file becomes one string in the resulting list.
|
/// Each line in the file becomes one string in the resulting list.
|
||||||
/// (Empty lines are included too.)
|
/// (Empty lines are included too.)
|
||||||
template<> inline StringRsrc* resLoader<StringRsrc>::operator() (fs::path fpath) {
|
template<> inline StringRsrc* resLoader<StringRsrc>::operator() (fs::path fpath) {
|
||||||
std::ifstream fin(fpath.c_str());
|
std::ifstream fin(fpath.string().c_str());
|
||||||
if(fin.fail()) {
|
if(fin.fail()) {
|
||||||
std::cerr << std_fmterr << ": Error opening file";
|
std::cerr << std_fmterr << ": Error opening file";
|
||||||
throw xResMgrErr("Failed to load string list: " + fpath.string());
|
throw xResMgrErr("Failed to load string list: " + fpath.string());
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// For some bizarre reason, Visual Studio doesn't declare snprintf in <cstdio>
|
// For some bizarre reason, Visual Studio doesn't declare snprintf in <cstdio>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <SFML/Graphics/RenderWindow.hpp>
|
#include <SFML/Graphics/RenderWindow.hpp>
|
||||||
#include <SFML/Graphics/Image.hpp>
|
#include <SFML/Graphics/Image.hpp>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
extern sf::RenderWindow mainPtr;
|
extern sf::RenderWindow mainPtr;
|
||||||
OPENFILENAMEA getParty, getScen, getRsrc, putParty, putScen, putRsrc;
|
OPENFILENAMEA getParty, getScen, getRsrc, putParty, putScen, putRsrc;
|
||||||
|
|||||||
Reference in New Issue
Block a user