1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-15 13:33:36 +02:00

VCMIDirs update #6 fix

- Apple compilation fix
- Removed unnecessary macros
- Updated macros indent style
- Fixed 1. warning.
This commit is contained in:
Karol 2014-08-30 15:04:00 +02:00
parent 53ab0593b7
commit 37bd4790f7
6 changed files with 34 additions and 47 deletions

View File

@ -56,49 +56,49 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
// and on: http://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-ios-linux-windows-in-c-preprocessor
// TODO?: Should be moved to vstd\os_detect.h (and then included by Global.h)
#ifdef _WIN16 // Defined for 16-bit environments
#error "16-bit Windows isn't supported"
# error "16-bit Windows isn't supported"
#elif defined(_WIN64) // Defined for 64-bit environments
#define VCMI_WINDOWS
#define VCMI_WINDOWS_64
# define VCMI_WINDOWS
# define VCMI_WINDOWS_64
#elif defined(_WIN32) // Defined for both 32-bit and 64-bit environments
#define VCMI_WINDOWS
#define VCMI_WINDOWS_32
# define VCMI_WINDOWS
# define VCMI_WINDOWS_32
#elif defined(_WIN32_WCE)
#error "Windows CE isn't supported"
# error "Windows CE isn't supported"
#elif defined(__linux__) || defined(__gnu_linux__) || defined(linux) || defined(__linux)
#define VCMI_UNIX
#define VCMI_LINUX
#ifdef __ANDROID__
#define VCMI_ANDROID
#endif
# define VCMI_UNIX
# define VCMI_LINUX
# ifdef __ANDROID__
# define VCMI_ANDROID
# endif
#elif defined(__APPLE__) && defined(__MACH__)
#define VCMI_UNIX
#define VCMI_APPLE
#include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR
#define VCMI_IOS
#define VCMI_IOS_SIM
#elif TARGET_OS_IPHONE
#define VCMI_IOS
#elif TARGET_OS_MAC
#define VCMI_MAC
#else
//#warning "Unknown Apple target."?
#endif
# define VCMI_UNIX
# define VCMI_APPLE
# include "TargetConditionals.h"
# if TARGET_IPHONE_SIMULATOR
# define VCMI_IOS
# define VCMI_IOS_SIM
# elif TARGET_OS_IPHONE
# define VCMI_IOS
# elif TARGET_OS_MAC
# define VCMI_MAC
# else
//# warning "Unknown Apple target."?
# endif
#else
#error "VCMI supports only Windows, OSX, Linux and Android targets"
# error "VCMI supports only Windows, OSX, Linux and Android targets"
#endif
#ifdef VCMI_IOS
#error "iOS system isn't yet supported."
# error "iOS system isn't yet supported."
#endif
/* ---------------------------------------------------------------------------- */
/* Commonly used C++, Boost headers */
/* ---------------------------------------------------------------------------- */
#ifdef VCMI_WINDOWS
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define NOMINMAX // Exclude min/max macros from <Windows.h>
# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - delete this line if something is missing.
# define NOMINMAX // Exclude min/max macros from <Windows.h>. Use std::[min/max] from <algorithm> instead.
#endif
#define _USE_MATH_DEFINES
@ -134,7 +134,7 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
#define BOOST_FILESYSTEM_VERSION 3
#if BOOST_VERSION > 105000
#define BOOST_THREAD_VERSION 3
# define BOOST_THREAD_VERSION 3
#endif
#define BOOST_THREAD_DONT_PROVIDE_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE 1
#define BOOST_BIND_NO_PLACEHOLDERS
@ -199,28 +199,18 @@ typedef boost::lock_guard<boost::recursive_mutex> TLockGuardRec;
// Import + Export macro declarations
#ifdef VCMI_WINDOWS
# ifdef __GNUC__
# define DLL_IMPORT __attribute__((dllimport))
# define DLL_EXPORT __attribute__((dllexport))
# else
# define DLL_IMPORT __declspec(dllimport)
# define DLL_EXPORT __declspec(dllexport)
# endif
# define ELF_VISIBILITY
#else
# ifdef __GNUC__
# define DLL_IMPORT __attribute__ ((visibility("default")))
# define DLL_EXPORT __attribute__ ((visibility("default")))
# define ELF_VISIBILITY __attribute__ ((visibility("default")))
# endif
#endif
#ifdef VCMI_WINDOWS
# ifdef __GNUC__
# define DLL_IMPORT __attribute__((dllimport))
# else
# define DLL_IMPORT __declspec(dllimport)
# endif
# define ELF_VISIBILITY
#else
# ifdef __GNUC__
# define DLL_IMPORT __attribute__ ((visibility("default")))
# define ELF_VISIBILITY __attribute__ ((visibility("default")))
# endif
#endif

View File

@ -203,7 +203,7 @@ int main(int argc, char** argv)
OSX_checkForUpdates();
// Check that game data is prepared. Otherwise run vcmibuilder helper application
FILE* check = fopen((VCMIDirs::get().userDataPath() + "/game_data_prepared").c_str(), "r");
FILE* check = fopen((VCMIDirs::get().userDataPath() / "game_data_prepared").string().c_str(), "r");
if (check == nullptr) {
system("open ./vcmibuilder.app");
return 0;

View File

@ -45,7 +45,6 @@ public:
#if defined(VCMI_WINDOWS) && (_MSC_VER < 1800 || !defined(USE_FFMPEG))
#define WIN32_LEAN_AND_MEAN //excludes rarely used stuff from windows headers - delete this line if something is missing
#include <windows.h>
#pragma pack(push,1)

View File

@ -27,7 +27,6 @@ DLL_LINKAGE CConsoleHandler * console = nullptr;
#define CONSOLE_GRAY "\x1b[1;30m"
#define CONSOLE_TEAL "\x1b[1;36m"
#else
#define WIN32_LEAN_AND_MEAN //excludes rarely used stuff from windows headers - delete this line if something is missing
#include <Windows.h>
#ifndef __MINGW32__
#include <dbghelp.h>

View File

@ -5,7 +5,6 @@
#include "VCMIDirs.h"
#ifdef VCMI_WINDOWS
#define WIN32_LEAN_AND_MEAN //excludes rarely used stuff from windows headers - delete this line if something is missing
#include <windows.h> //for .dll libs
#else
#include <dlfcn.h>

View File

@ -463,7 +463,7 @@ bfs::path VCMIDirsLinux::userDataPath() const
const char* homeDir;
if ((homeDir = getenv("XDG_DATA_HOME")))
return homeDir;
else if (homeDir = getenv("HOME"))
else if ((homeDir = getenv("HOME")))
return bfs::path(homeDir) / ".local" / "share" / "vcmi";
else
return ".";