@@ -460,7 +460,7 @@ endif()
460
460
# tools like `flatc`, along with example executables like `executor_runner` and
461
461
# libraries that it uses, like `gflags`. Disabling this can be helpful when
462
462
# cross-compiling, but some required tools that would have been built need to be
463
- # provided directly (via, for example, FLATC_EXECUTABLE) .
463
+ # provided directly.
464
464
cmake_dependent_option(
465
465
EXECUTORCH_BUILD_HOST_TARGETS "Build host-only targets." ON
466
466
"NOT CMAKE_TOOLCHAIN_IOS" OFF
@@ -471,10 +471,9 @@ cmake_dependent_option(
471
471
#
472
472
cmake_dependent_option(
473
473
EXECUTORCH_BUILD_FLATC "Build the flatc executable." ON
474
- "NOT FLATC_EXECUTABLE;EXECUTORCH_BUILD_HOST_TARGETS " OFF
474
+ "NOT FLATC_EXECUTABLE" OFF
475
475
)
476
476
477
-
478
477
set (FLATBUFFERS_BUILD_FLATC OFF CACHE BOOL "" )
479
478
set (FLATBUFFERS_BUILD_FLATHASH OFF CACHE BOOL "" )
480
479
set (FLATBUFFERS_BUILD_FLATLIB OFF CACHE BOOL "" )
@@ -507,6 +506,8 @@ if(EXECUTORCH_BUILD_FLATC)
507
506
-DFLATBUFFERS_BUILD_TESTS=${FLATBUFFERS_BUILD_TESTS}
508
507
-DFLATBUFFERS_INSTALL=${FLATBUFFERS_INSTALL}
509
508
-DCMAKE_CXX_FLAGS="-DFLATBUFFERS_MAX_ALIGNMENT=${FLATBUFFERS_MAX_ALIGNMENT} "
509
+ # If building for iOS, "unset" these variables to rely on the host (macOS) defaults.
510
+ $<$<AND :$<BOOL :${CMAKE_TOOLCHAIN_IOS} >,$<BOOL :$<FILTER :${PLATFORM} ,EXCLUDE ,^MAC>>>:-DCMAKE_OSX_SYSROOT=>
510
511
INSTALL_COMMAND ""
511
512
BUILD_BYPRODUCTS <BINARY_DIR>/flatc
512
513
)
@@ -515,6 +516,8 @@ if(EXECUTORCH_BUILD_FLATC)
515
516
# flatbuffers does not use CMAKE_BUILD_TYPE. Internally, the build forces Release
516
517
# config, but from CMake's perspective the build type is always Debug.
517
518
set (FLATC_EXECUTABLE ${BINARY_DIR} /$<CONFIG>/flatc.exe)
519
+ elseif (CMAKE_GENERATOR STREQUAL "Xcode" )
520
+ set (FLATC_EXECUTABLE ${BINARY_DIR} /$<CONFIG>/flatc)
518
521
else ()
519
522
set (FLATC_EXECUTABLE ${BINARY_DIR} /flatc)
520
523
endif ()
@@ -528,12 +531,7 @@ if(NOT FLATC_EXECUTABLE)
528
531
find_program (FLATC_EXECUTABLE flatc)
529
532
530
533
if (NOT FLATC_EXECUTABLE)
531
- message (
532
- FATAL_ERROR
533
- "FLATC_EXECUTABLE must be set when EXECUTORCH_BUILD_FLATC is disabled. "
534
- "Note that EXECUTORCH_BUILD_FLATC may be disabled implicitly when "
535
- "cross-compiling or when EXECUTORCH_BUILD_HOST_TARGETS is disabled."
536
- )
534
+ message (FATAL_ERROR "FLATC_EXECUTABLE must be set when EXECUTORCH_BUILD_FLATC is disabled." )
537
535
endif ()
538
536
endif ()
539
537
0 commit comments