From 03302a8f5bf23c46c1d1d4c14636f539814f3b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <3397065-ZehMatt@users.noreply.gitlab.com> Date: Sun, 17 Jul 2022 18:40:27 +0300 Subject: [PATCH] Conditionally build cpp for platform, remove obsolete header --- components/CMakeLists.txt | 17 ++++++++++++++--- components/platform/file.posix.cpp | 5 ----- components/platform/file.stdio.cpp | 5 ----- components/platform/file.win32.cpp | 5 ----- components/platform/platform.internal.hpp | 19 ------------------- 5 files changed, 14 insertions(+), 37 deletions(-) delete mode 100644 components/platform/platform.internal.hpp diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 39c20ab127..e67ae36a32 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -337,12 +337,23 @@ add_component_dir(navmeshtool add_component_dir(platform platform - file.posix - file.win32 - file.stdio file ) +if (WIN32) + add_component_dir(platform + file.win32 + ) +elseif (UNIX) + add_component_dir(platform + file.posix + ) +else () + add_component_dir(platform + file.stdio + ) +endif() + set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui ) diff --git a/components/platform/file.posix.cpp b/components/platform/file.posix.cpp index dd50083e7a..efffa0fd76 100644 --- a/components/platform/file.posix.cpp +++ b/components/platform/file.posix.cpp @@ -1,8 +1,5 @@ -#include "platform.internal.hpp" #include "file.hpp" -#if PLATFORM_TYPE == PLATFORM_TYPE_POSIX - #include #include #include @@ -100,5 +97,3 @@ namespace Platform::File { } } - -#endif diff --git a/components/platform/file.stdio.cpp b/components/platform/file.stdio.cpp index ed17bd2040..26c2480902 100644 --- a/components/platform/file.stdio.cpp +++ b/components/platform/file.stdio.cpp @@ -1,8 +1,5 @@ -#include "platform.internal.hpp" #include "file.hpp" -#if PLATFORM_TYPE == PLATFORM_TYPE_STDIO - #include #include #include @@ -89,5 +86,3 @@ namespace Platform::File { } } - -#endif diff --git a/components/platform/file.win32.cpp b/components/platform/file.win32.cpp index 31fe67ecba..ad7e11213d 100644 --- a/components/platform/file.win32.cpp +++ b/components/platform/file.win32.cpp @@ -1,8 +1,5 @@ -#include "platform.internal.hpp" #include "file.hpp" -#if PLATFORM_TYPE == PLATFORM_TYPE_WIN32 - #include #include #include @@ -97,5 +94,3 @@ namespace Platform::File { return bytesRead; } } - -#endif diff --git a/components/platform/platform.internal.hpp b/components/platform/platform.internal.hpp deleted file mode 100644 index 255fe7cb7a..0000000000 --- a/components/platform/platform.internal.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef COMPONENT_PLATFORM_FILE_HPP -#define COMPONENT_PLATFORM_FILE_HPP - -namespace Platform -{ -#define PLATFORM_TYPE_STDIO 0 -#define PLATFORM_TYPE_WIN32 1 -#define PLATFORM_TYPE_POSIX 2 - -#if defined(__linux) || defined(__unix) || defined(__posix) -#define PLATFORM_TYPE PLATFORM_TYPE_POSIX -#elif defined(_WIN32) -#define PLATFORM_TYPE PLATFORM_TYPE_WIN32 -#else -#define PLATFORM_TYPE PLATFORM_TYPE_STDIO -#endif -} - -#endif