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

Use platform preprocessor checks #9

Open
wants to merge 1 commit into
base: main
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
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,3 @@ add_executable (EGAVHIDSample

target_include_directories(EGAVHIDSample PRIVATE ${FRAMEWORK_FOLDER})
target_compile_definitions(EGAVHIDSample PUBLIC EGAV_API)

if(WIN32)
target_compile_definitions(EGAVHIDSample PUBLIC _UP_WINDOWS=1)
elseif(APPLE)
target_compile_definitions(EGAVHIDSample PUBLIC _UP_MAC=1)
endif()
8 changes: 4 additions & 4 deletions Library/EGAVResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ SOFTWARE.
//==============================================================================

#include "EGAVResult.h"
#if _UP_WINDOWS
#if defined(_WIN32)
#include <winerror.h> // for HRESULT
#endif

Expand All @@ -51,7 +51,7 @@ EGAVResult::EGAVResult(EGAVResultCustomType inCustomResultType, int64_t inCustom
mCustomResultCode = inCustomResultCode;
}

#if _UP_WINDOWS
#if defined(_WIN32)
void EGAVResult::InitWithHresult(HRESULT hr)
{
mResultCode = ErrCustom;
Expand All @@ -77,10 +77,10 @@ bool EGAVResult::Succeeded() const
{
switch (mCustomResultType)
{
#if _UP_WINDOWS
#if defined(_WIN32)
case EGAVResultCustomType::Hresult: return SUCCEEDED(mCustomResultCode);
case EGAVResultCustomType::WinError: return (mCustomResultCode == ERROR_SUCCESS) ? true : false;
#elif _UP_MAC
#elif defined(__APPLE__)
case EGAVResultCustomType::Mac: return (mCustomResultCode == 0) ? true : false;
#endif
case EGAVResultCustomType::MainConcept:
Expand Down
6 changes: 3 additions & 3 deletions Library/EGAVResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ SOFTWARE.
//------------------------------------------------------------------------------

#include <string>
#if _UP_WINDOWS
#if defined(_WIN32)
// FMB NOTE: For some strange reason <WinSock2.h> must be before <Windows.h>.
// This is only necessary because contents of <WinSock2.h> are required in other code files.
// However, if <WinSock2.h> is include somewhere it must be guaranteded that <Windows.h> was never include before.
Expand All @@ -50,7 +50,7 @@ SOFTWARE.
//#include "EGAVFeatures.h" // for EGAV_API


#define EVH_AVOID_UNNEEDED_COPY_CONSTRUCTORS (!_UP_WINDOWS) //!< 0 - explicit copy constructors: required for .NET frontends connected via SWIG e.g. 4KCU and EVH Test App
#define EVH_AVOID_UNNEEDED_COPY_CONSTRUCTORS (!defined(_WIN32)) //!< 0 - explicit copy constructors: required for .NET frontends connected via SWIG e.g. 4KCU and EVH Test App
//!< 1 - to avoid "warning: definition of implicit copy constructor for different classes e.g.
//! 'EGAVAudioSampleType' is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy]"

Expand Down Expand Up @@ -141,7 +141,7 @@ class /*EGAV_API*/ EGAVResult
//------------------------------------------------------------------------------
// Initialization
//------------------------------------------------------------------------------
#if _UP_WINDOWS
#if defined(_WIN32)

//! Init with HRESULT (EGAVResultCustomType::Hresult)
void InitWithHresult(HRESULT hr);
Expand Down