From 1fba251baf6bc940429cbb1f91743460297bb96e Mon Sep 17 00:00:00 2001 From: milek7 Date: Mon, 25 Mar 2019 20:54:17 +0100 Subject: [PATCH] change __linux__ to __unix__ --- Driver.cpp | 2 +- Logs.cpp | 2 +- PyInt.cpp | 5 +++++ Timer.cpp | 4 ++-- application.cpp | 4 ++-- screenshot.cpp | 2 +- stdafx.h | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Driver.cpp b/Driver.cpp index 315d08b7..d4c53a9c 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -1638,7 +1638,7 @@ TController::TController(bool AI, TDynamicObject *NewControll, bool InitPsyche, if( WriteLogFlag ) { #ifdef _WIN32 CreateDirectory( "physicslog", NULL ); -#elif __linux__ +#elif __unix__ mkdir( "physicslog", 0644 ); #endif LogFile.open( std::string( "physicslog/" + VehicleName + ".dat" ), diff --git a/Logs.cpp b/Logs.cpp index e7dc68dc..b0f92e24 100644 --- a/Logs.cpp +++ b/Logs.cpp @@ -25,7 +25,7 @@ char endstring[10] = "\n"; std::string filename_date() { ::SYSTEMTIME st; -#ifdef __linux__ +#ifdef __unix__ timespec ts; clock_gettime(CLOCK_REALTIME, &ts); tm *tms = localtime(&ts.tv_sec); diff --git a/PyInt.cpp b/PyInt.cpp index fe4ceaa1..f4f2ae4b 100644 --- a/PyInt.cpp +++ b/PyInt.cpp @@ -88,6 +88,11 @@ auto python_taskqueue::init() -> bool { Py_SetPythonHome("linuxpython64"); else Py_SetPythonHome("linuxpython"); +#elif __APPLE__ + if (sizeof(void*) == 8) + Py_SetPythonHome("macpython64"); + else + Py_SetPythonHome("macpython"); #endif Py_Initialize(); PyEval_InitThreads(); diff --git a/Timer.cpp b/Timer.cpp index 91c48329..c8eaee50 100644 --- a/Timer.cpp +++ b/Timer.cpp @@ -69,7 +69,7 @@ void UpdateTimers(bool pause) #ifdef _WIN32 QueryPerformanceFrequency((LARGE_INTEGER *)&fr); QueryPerformanceCounter((LARGE_INTEGER *)&count); -#elif __linux__ +#elif __unix__ timespec ts; clock_gettime(CLOCK_MONOTONIC_RAW, &ts); count = (uint64_t)ts.tv_sec * 1000000000 + (uint64_t)ts.tv_nsec; @@ -91,7 +91,7 @@ void UpdateTimers(bool pause) oldCount = count; // Keep track of the time lapse and frame count -#if __linux__ +#if __unix__ double fTime = (double)(count / 1000000000); #elif _WIN32_WINNT >= _WIN32_WINNT_VISTA double fTime = ::GetTickCount64() * 0.001f; // Get current time in seconds diff --git a/application.cpp b/application.cpp index 39d0bf68..10b2ff9c 100644 --- a/application.cpp +++ b/application.cpp @@ -30,7 +30,7 @@ http://mozilla.org/MPL/2.0/. #pragma comment (lib, "dbghelp.lib") #pragma comment (lib, "version.lib") -#ifdef __linux__ +#ifdef __unix__ #include #include #endif @@ -361,7 +361,7 @@ eu07_application::init_files() { DeleteFile( "log.txt" ); DeleteFile( "errors.txt" ); CreateDirectory( "logs", NULL ); -#elif __linux__ +#elif __unix__ unlink("log.txt"); unlink("errors.txt"); mkdir("logs", 0664); diff --git a/screenshot.cpp b/screenshot.cpp index 9751a08e..a4d2bd4e 100644 --- a/screenshot.cpp +++ b/screenshot.cpp @@ -23,7 +23,7 @@ void screenshot_manager::screenshot_save_thread( char *img ) uint64_t perf; #ifdef _WIN32 QueryPerformanceCounter((LARGE_INTEGER*)&perf); -#elif __linux__ +#elif __unix__ timespec ts; clock_gettime(CLOCK_REALTIME, &ts); perf = ts.tv_nsec; diff --git a/stdafx.h b/stdafx.h index 690f03d6..06095c1f 100644 --- a/stdafx.h +++ b/stdafx.h @@ -29,7 +29,7 @@ #include #undef NOMINMAX #endif -#ifdef __linux__ +#ifdef __unix__ #include #endif // stl