Skip to content

Commit

Permalink
Add HERMES_IS_MOBILE_BUILD flag.
Browse files Browse the repository at this point in the history
Summary:
Add a `HERMES_IS_MOBILE_BUILD` flag which allows us to exclude
features by default on phones while keeping them around on non-mobile
builds.

This is useful for sections of code in the compiler which increase code
size and are only used on the compiling server, such as the ability to
parse Flow types.

These new features can be gated by default under `HERMES_IS_MOBILE_BUILD`,
allowing simple defaults.

Reviewed By: tmikov

Differential Revision: D20290497

fbshipit-source-id: 1d310bf86e26076e481353a9fd148af89b20cbc4
  • Loading branch information
avp authored and facebook-github-bot committed Mar 6, 2020
1 parent 02ecd03 commit bc0390a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ set(HERMESVM_JIT_DISASSEMBLER OFF CACHE BOOL
set(HERMES_USE_FLOWPARSER OFF CACHE BOOL
"Use libflowparser for parsing es6")

set(HERMES_IS_MOBILE_BUILD OFF CACHE BOOL
"Building for a mobile device")

set(HERMES_IS_ANDROID OFF CACHE BOOL
"Building for Android")

Expand All @@ -167,6 +170,8 @@ set(EMSCRIPTEN_FASTCOMP ON CACHE BOOL
"Emscripten is using the fastcomp backend instead of the LLVM one")

if (HERMES_IS_ANDROID)
set(HERMES_IS_MOBILE_BUILD TRUE)

add_definitions(-DHERMES_PLATFORM_UNICODE=HERMES_PLATFORM_UNICODE_JAVA)

# The toolchain passes -Wa,--noexecstack which is valid for compiling
Expand All @@ -187,6 +192,10 @@ if (HERMES_IS_ANDROID)
endif()
endif()

if (HERMES_IS_MOBILE_BUILD)
add_definitions(-DHERMES_IS_MOBILE_BUILD)
endif()

# Enable debug mode by default
if ((NOT GENERATOR_IS_MULTI_CONFIG) AND CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE Debug)
Expand Down

0 comments on commit bc0390a

Please sign in to comment.