Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler detection being used as platform detection. #189

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 31 additions & 16 deletions src/optick.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,50 @@
#include <stdint.h>
#include <stddef.h>

#if defined(_MSC_VER)
# define OPTICK_MSVC (1)
# define OPTICK_64BIT (1)
////////////////////////////////////////////////////////////////////////
// Platform Detection
////////////////////////////////////////////////////////////////////////

#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# define OPTICK_WINDOWS (1)
# if defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
# define OPTICK_64BIT (1)
# else
# define OPTICK_32BIT (1)
# endif
# if defined(_DURANGO)
# define OPTICK_PC (0)
# else
# define OPTICK_PC (1)
# endif
#elif defined(__clang__) || defined(__GNUC__)
# define OPTICK_GCC (1)
# if defined(__APPLE_CC__)
# define OPTICK_OSX (1)
# define OPTICK_64BIT (1)
# elif defined(__linux__)
# endif
#elif defined(__APPLE_CC__) || defined(__APPLE__)
# define OPTICK_OSX (1)
# define OPTICK_64BIT (1)
#elif defined(__linux__)
# define OPTICK_LINUX (1)
# define OPTICK_64BIT (1)
# elif defined(__FreeBSD__)
#elif defined(__FreeBSD__)
# define OPTICK_FREEBSD (1)
# define OPTICK_64BIT (1)
# endif
# if defined(__aarch64__) || defined(_M_ARM64)
#elif defined(__aarch64__) || defined(_M_ARM64)
# define OPTICK_ARM (1)
# define OPTICK_64BIT (1)
# elif defined(__arm__) || defined(_M_ARM)
#elif defined(__arm__) || defined(_M_ARM)
# define OPTICK_ARM (1)
# define OPTICK_32BIT (1)
# endif
#else
#error Compiler not supported
# error Platform not supported
#endif

////////////////////////////////////////////////////////////////////////
// Compiler Detection
////////////////////////////////////////////////////////////////////////
#if defined(_MSC_VER)
# define OPTICK_MSVC (1)
#elif defined(__clang__) || defined(__GNUC__)
# define OPTICK_GCC (1)
#else
# error Compiler not supported
#endif

////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/optick_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <stdint.h>
#include <stdlib.h>

#if defined(OPTICK_MSVC)
#if defined(OPTICK_WINDOWS)

#ifdef OPTICK_UE4
#include "Core/Public/Windows/AllowWindowsPlatformTypes.h"
Expand Down
2 changes: 1 addition & 1 deletion src/optick_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
//////////////////////////////////////////////////////////////////////////
// Start of the Platform-specific stuff
//////////////////////////////////////////////////////////////////////////
#if defined(OPTICK_MSVC)
#if defined(OPTICK_WINDOWS)
#include "optick_core.win.h"
#elif defined(OPTICK_LINUX)
#include "optick_core.linux.h"
Expand Down
4 changes: 2 additions & 2 deletions src/optick_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "optick_common.h"
#include "optick_miniz.h"

#if defined(OPTICK_MSVC)
#if defined(OPTICK_WINDOWS)
#define USE_WINDOWS_SOCKETS (1)
#else
#define USE_BERKELEY_SOCKETS (1)
Expand All @@ -49,7 +49,7 @@ typedef UINT_PTR TcpSocket;
#endif


#if defined(OPTICK_MSVC)
#if defined(OPTICK_WINDOWS)
#pragma comment( lib, "ws2_32.lib" )
#endif

Expand Down