From 638cf9feb4849bee6fa613f1c0e7545fa899322f Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 16 Aug 2013 19:08:39 +0100 Subject: [PATCH] Separated out catch_platform.h --- include/internal/catch_debugger.hpp | 8 +------- include/internal/catch_platform.h | 20 +++++++++++++++++++ include/internal/catch_timer.h | 4 +++- include/internal/catch_timer.hpp | 5 +++-- .../CatchSelfTest.xcodeproj/project.pbxproj | 2 ++ 5 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 include/internal/catch_platform.h diff --git a/include/internal/catch_debugger.hpp b/include/internal/catch_debugger.hpp index 976d14a..9979dff 100644 --- a/include/internal/catch_debugger.hpp +++ b/include/internal/catch_debugger.hpp @@ -12,13 +12,7 @@ #include -#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -#define CATCH_PLATFORM_MAC -#elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -#define CATCH_PLATFORM_IPHONE -#elif defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) -#define CATCH_PLATFORM_WINDOWS -#endif +#include "catch_platform.h" #ifdef CATCH_PLATFORM_MAC diff --git a/include/internal/catch_platform.h b/include/internal/catch_platform.h new file mode 100644 index 0000000..0142dc1 --- /dev/null +++ b/include/internal/catch_platform.h @@ -0,0 +1,20 @@ +/* + * Created by Phil on 16/8/2013. + * Copyright 2013 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + * + */ +#ifndef TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED +#define TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED + +#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +#define CATCH_PLATFORM_MAC +#elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED) +#define CATCH_PLATFORM_IPHONE +#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) +#define CATCH_PLATFORM_WINDOWS +#endif + +#endif // TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED diff --git a/include/internal/catch_timer.h b/include/internal/catch_timer.h index ad24883..015f88b 100644 --- a/include/internal/catch_timer.h +++ b/include/internal/catch_timer.h @@ -8,7 +8,9 @@ #ifndef TWOBLUECUBES_CATCH_TIMER_H_INCLUDED #define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED -#ifdef WIN32 +#include "catch_platform.h" + +#ifdef CATCH_PLATFORM_WINDOWS typedef unsigned long long uint64_t; #else #include diff --git a/include/internal/catch_timer.hpp b/include/internal/catch_timer.hpp index 6abbf3a..6f716b1 100644 --- a/include/internal/catch_timer.hpp +++ b/include/internal/catch_timer.hpp @@ -7,13 +7,14 @@ */ #include "catch_timer.h" +#include "catch_platform.h" #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++11-long-long" #endif -#ifdef WIN32 +#ifdef CATCH_PLATFORM_WINDOWS #include #else #include @@ -22,7 +23,7 @@ namespace Catch { namespace { -#ifdef WIN32 +#ifdef CATCH_PLATFORM_WINDOWS uint64_t getCurrentTicks() { static uint64_t hz=0, hzo=0; if (!hz) { diff --git a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj index c189a78..c640304 100644 --- a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj +++ b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj @@ -73,6 +73,7 @@ 26948284179A9AB900ED166E /* SectionTrackerTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SectionTrackerTests.cpp; path = ../../../SelfTest/SectionTrackerTests.cpp; sourceTree = ""; }; 26948287179EF7F900ED166E /* catch_test_case_tracker.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_test_case_tracker.hpp; sourceTree = ""; }; 2694A1FB16A0000E004816E3 /* catch_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = catch_text.cpp; sourceTree = ""; }; + 26AEAF1617BEA18E009E32C9 /* catch_platform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_platform.h; sourceTree = ""; }; 26C5F3EC17514B970056FB3C /* clara.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = clara.h; path = ../../../../include/internal/clara.h; sourceTree = ""; }; 26DACF2F17206D3400A21326 /* catch_text.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_text.h; sourceTree = ""; }; 4A084F1C15DACEEA0027E631 /* catch_test_case_info.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_test_case_info.hpp; sourceTree = ""; }; @@ -425,6 +426,7 @@ 26759473171C74C200A84BD1 /* catch_compiler_capabilities.h */, 26DACF2F17206D3400A21326 /* catch_text.h */, 263FD06117AF8DF200988A20 /* catch_timer.h */, + 26AEAF1617BEA18E009E32C9 /* catch_platform.h */, ); name = Infrastructure; sourceTree = "";