Skip to content

Commit

Permalink
Use TARGET_OS_TV definition from TargetConditionals.h
Browse files Browse the repository at this point in the history
Summary:
Instead of defining the OS preprocessor flags ourselves in CMake,
import TargetConditionals.h which will define them.

Reviewed By: tmikov

Differential Revision: D64090935

fbshipit-source-id: 8f0bc4f1947a400b657caca10ac3cc81bf839c6e
  • Loading branch information
neildhar authored and facebook-github-bot committed Oct 10, 2024
1 parent 924f1d1 commit aa2da3d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ if(HERMES_APPLE_TARGET_PLATFORM MATCHES "catalyst")
set(THREADS_PREFER_PTHREAD_FLAG ON)
endif()

if(HERMES_APPLE_TARGET_PLATFORM MATCHES "appletv")
add_definitions(-DTARGET_OS_IPHONE=1)
add_definitions(-DTARGET_OS_TV=1)
endif()

# This must be consistent with the release_version in:
# - android/build.gradle
# - npm/package.json
Expand Down
3 changes: 3 additions & 0 deletions external/llvh/lib/Support/Unix/Process.inc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
#ifdef HAVE_TERMIOS_H
# include <termios.h>
#endif
#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif

//===----------------------------------------------------------------------===//
//=== WARNING: Implementation here must contain only generic UNIX code that
Expand Down
5 changes: 2 additions & 3 deletions external/llvh/lib/Support/Unix/Program.inc
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_POSIX_SPAWN
#include <spawn.h>

#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif
#ifdef HAVE_POSIX_SPAWN
#include <spawn.h>

#if defined(__APPLE__) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
#define USE_NSGETENVIRON 1
Expand Down
4 changes: 4 additions & 0 deletions lib/Support/OSCompatPosix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
#endif
#endif // __ANDROID__

#ifdef __APPLE__
#include <TargetConditionals.h>
#endif

#include "llvh/Support/raw_ostream.h"

namespace hermes {
Expand Down

0 comments on commit aa2da3d

Please sign in to comment.