aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-11-07 20:36:41 +0800
committerYuqian Yang <crupest@crupest.life>2025-11-07 21:00:23 +0800
commit4ffff6a8a2f964919ad86d0f2a85e4761323f8b7 (patch)
tree5d81f67af9cb1684d17137ad49a7dd10a0e2d4d5 /src
parentccf48eb93a101ba2412497ad5f3966e4f31d2178 (diff)
downloadcru-4ffff6a8a2f964919ad86d0f2a85e4761323f8b7.tar.gz
cru-4ffff6a8a2f964919ad86d0f2a85e4761323f8b7.tar.bz2
cru-4ffff6a8a2f964919ad86d0f2a85e4761323f8b7.zip
Remove CRU_PLATFORM_* macros.
Diffstat (limited to 'src')
-rw-r--r--src/base/CMakeLists.txt18
-rw-r--r--src/base/SubProcess.cpp4
-rw-r--r--src/base/io/Resource.cpp6
-rw-r--r--src/base/log/Logger.cpp4
-rw-r--r--src/base/log/StdioLogTarget.cpp2
5 files changed, 8 insertions, 26 deletions
diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt
index 5892c136..d8830714 100644
--- a/src/base/CMakeLists.txt
+++ b/src/base/CMakeLists.txt
@@ -69,21 +69,3 @@ endif()
if (MSVC)
target_compile_options(CruBase PUBLIC /wd4250 /wd4251)
endif()
-
-if (WIN32)
- target_compile_definitions(CruBase PUBLIC
- CRU_PLATFORM_WINDOWS
- )
-elseif(APPLE)
- target_compile_definitions(CruBase PUBLIC
- CRU_PLATFORM_OSX
- CRU_PLATFORM_UNIX
- )
-elseif(EMSCRIPTEN)
- target_compile_definitions(CruBase PUBLIC CRU_PLATFORM_EMSCRIPTEN)
-else()
- target_compile_definitions(CruBase PUBLIC
- CRU_PLATFORM_LINUX
- CRU_PLATFORM_UNIX
- )
-endif()
diff --git a/src/base/SubProcess.cpp b/src/base/SubProcess.cpp
index 964ae478..bad5c20f 100644
--- a/src/base/SubProcess.cpp
+++ b/src/base/SubProcess.cpp
@@ -2,7 +2,7 @@
#include <thread>
-#ifdef CRU_PLATFORM_UNIX
+#if defined(__APPLE__) || defined(__unix)
#include "cru/base/platform/unix/PosixSpawnSubProcess.h"
#endif
@@ -150,7 +150,7 @@ SubProcessExitResult SubProcess::Call(
}
SubProcess::SubProcess(SubProcessStartInfo start_info) {
-#ifdef CRU_PLATFORM_UNIX
+#if defined(__APPLE__) || defined(__unix)
platform_process_.reset(new PlatformSubProcess(
std::move(start_info),
std::make_shared<platform::unix::PosixSpawnSubProcessImpl>()));
diff --git a/src/base/io/Resource.cpp b/src/base/io/Resource.cpp
index df7277b6..0eddf6c2 100644
--- a/src/base/io/Resource.cpp
+++ b/src/base/io/Resource.cpp
@@ -1,9 +1,9 @@
#include "cru/base/io/Resource.h"
#include "cru/base/Base.h"
-#if defined(CRU_PLATFORM_OSX)
+#if defined(__APPLE__)
#include <CoreFoundation/CoreFoundation.h>
-#elif defined(CRU_PLATFORM_WINDOWS)
+#elif defined(_WIN32)
#include <Windows.h>
#elif defined(__linux)
#include <fstream>
@@ -14,7 +14,7 @@
namespace cru::io {
std::filesystem::path GetResourceDir() {
-#if defined(CRU_PLATFORM_OSX)
+#if defined(__APPLE__)
CFBundleRef main_bundle = CFBundleGetMainBundle();
CFURLRef bundle_url = CFBundleCopyBundleURL(main_bundle);
CFStringRef cf_string_ref =
diff --git a/src/base/log/Logger.cpp b/src/base/log/Logger.cpp
index 2c0f3f07..c5d8b0b5 100644
--- a/src/base/log/Logger.cpp
+++ b/src/base/log/Logger.cpp
@@ -10,7 +10,7 @@
#include <memory>
#include <mutex>
-#ifdef CRU_PLATFORM_WINDOWS
+#ifdef _WIN32
#include "cru/base/platform/win/DebugLogTarget.h"
#endif
@@ -20,7 +20,7 @@ Logger *Logger::GetInstance() {
logger.AddLogTarget(std::make_unique<StdioLogTarget>());
-#ifdef CRU_PLATFORM_WINDOWS
+#ifdef _WIN32
logger.AddLogTarget(std::make_unique<platform::win::WinDebugLogTarget>());
#endif
diff --git a/src/base/log/StdioLogTarget.cpp b/src/base/log/StdioLogTarget.cpp
index 34813426..bdcdd783 100644
--- a/src/base/log/StdioLogTarget.cpp
+++ b/src/base/log/StdioLogTarget.cpp
@@ -9,7 +9,7 @@ StdioLogTarget::StdioLogTarget() {}
StdioLogTarget::~StdioLogTarget() {}
void StdioLogTarget::Write(log::LogLevel level, std::string message) {
-#ifdef CRU_PLATFORM_WINDOWS
+#ifdef _WIN32
auto s = string::ToUtf16(message);
if (level == log::LogLevel::Error) {
std::wcerr << s << std::endl;