Unified OS and arch checking defines
This commit is contained in:
parent
7f5a32a83b
commit
2c1759ce0a
@ -41,11 +41,24 @@ list(JOIN PYTHON_VERSION_MAJOR_MINOR "." PYTHON_VERSION_MAJOR_MINOR)
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -DIMGUI_IMPL_OPENGL_LOADER_GLAD -DPYTHON_VERSION_MAJOR_MINOR=\"\\\"${PYTHON_VERSION_MAJOR_MINOR}\"\\\"")
|
||||
|
||||
if (WIN32)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc -static")
|
||||
# Detect current OS / System
|
||||
if (MSYS OR MINGW)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOS_WINDOWS -static-libstdc++ -static-libgcc -static")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wl,-subsystem,windows")
|
||||
endif (WIN32)
|
||||
elseif(APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOS_MACOS")
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOS_LINUX")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown / unsupported system!")
|
||||
endif()
|
||||
|
||||
# Detect 32 vs. 64 bit system
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DARCH_64_BIT")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DARCH_32_BIT")
|
||||
endif()
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DRELEASE -DIMHEX_VERSION=\"\\\"${PROJECT_VERSION}\"\\\"")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DIMHEX_VERSION=\"\\\"${PROJECT_VERSION}-Debug\"\\\"")
|
||||
|
||||
|
@ -21,7 +21,7 @@ using s128 = __int128_t;
|
||||
extern int mainArgc;
|
||||
extern char **mainArgv;
|
||||
|
||||
#if defined(__EMX__) || defined (WIN32)
|
||||
#ifdef OS_WINDOWS
|
||||
#define MAGIC_PATH_SEPARATOR ";"
|
||||
#else
|
||||
#define MAGIC_PATH_SEPARATOR ":"
|
||||
|
@ -32,7 +32,7 @@ namespace hex {
|
||||
u8 utf8Char[4];
|
||||
float float32;
|
||||
double float64;
|
||||
#if defined(_WIN64)
|
||||
#if defined(OS_WINDOWS) && defined(ARCH_64_BIT)
|
||||
__time32_t time32;
|
||||
__time64_t time64;
|
||||
#else
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "helpers/project_file_handler.hpp"
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifdef OS_MACOS
|
||||
#define off64_t off_t
|
||||
#define fopen64 fopen
|
||||
#define fseeko64 fseek
|
||||
|
@ -74,7 +74,7 @@ namespace hex {
|
||||
this->m_cachedData.emplace_back("float (32 bit)", hex::format("%e", hex::changeEndianess(this->m_previewData.float32, this->m_endianess)), sizeof(float));
|
||||
this->m_cachedData.emplace_back("double (64 bit)", hex::format("%e", hex::changeEndianess(this->m_previewData.float64, this->m_endianess)), sizeof(double));
|
||||
|
||||
#if defined(_WIN64)
|
||||
#if defined(OS_WINDOWS) && defined(ARCH_64_BIT)
|
||||
{
|
||||
auto endianAdjustedTime = hex::changeEndianess(this->m_previewData.time32, this->m_endianess);
|
||||
std::tm * ptm = _localtime32(&endianAdjustedTime);
|
||||
@ -107,7 +107,7 @@ namespace hex {
|
||||
#endif
|
||||
|
||||
this->m_cachedData.emplace_back("GUID", hex::format("%s{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}",
|
||||
(this->m_previewData.guid.data3 >> 12) <= 5 && ((this->m_previewData.guid.data4[0] >> 4) >= 8 || (this->m_previewData.guid.data4[0] >> 4) == 0) ? "" : "[INVALID] ",
|
||||
(this->m_previewData.guid.data3 >> 12) <= 5 && ((this->m_previewData.guid.data4[0] >> 4) >= 8 || (this->m_previewData.guid.data4[0] >> 4) == 0) ? "" : "Invalid ",
|
||||
hex::changeEndianess(this->m_previewData.guid.data1, this->m_endianess),
|
||||
hex::changeEndianess(this->m_previewData.guid.data2, this->m_endianess),
|
||||
hex::changeEndianess(this->m_previewData.guid.data3, this->m_endianess),
|
||||
|
Loading…
x
Reference in New Issue
Block a user