Skip to content
Closed
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
11 changes: 5 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,11 @@ if(EXECUTORCH_BUILD_FLATC)
)
endif()
set(FLATC_EXECUTABLE flatc)
option(FLATBUFFERS_BUILD_FLATC "" ON)
option(FLATBUFFERS_BUILD_FLATHASH "" OFF)
option(FLATBUFFERS_BUILD_FLATLIB "" OFF)
option(FLATBUFFERS_BUILD_TESTS "" OFF)
option(FLATBUFFERS_INSTALL "" OFF)
set(FLATBUFFERS_BUILD_FLATC ON CACHE BOOL "")
set(FLATBUFFERS_BUILD_FLATHASH OFF CACHE BOOL "")
set(FLATBUFFERS_BUILD_FLATLIB OFF CACHE BOOL "")
set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "")
set(FLATBUFFERS_INSTALL OFF CACHE BOOL "")
add_subdirectory(third-party/flatbuffers)
endif()
if(NOT FLATC_EXECUTABLE)
Expand Down Expand Up @@ -453,7 +453,6 @@ if(EXECUTORCH_BUILD_PYBIND)
etdump
executorch
extension_data_loader
flatcc
portable_ops_lib
util
torch
Expand Down
12 changes: 10 additions & 2 deletions sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,16 @@ foreach(schema_file ${_bundled_input_schema_names})
"${CMAKE_CURRENT_SOURCE_DIR}/bundled_program/schema/${schema_file}")
endforeach()

set(FLATCC_TEST OFF CACHE BOOL "")
set(FLATCC_REFLECTION OFF CACHE BOOL "")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party/flatcc
${CMAKE_BINARY_DIR}/third-party/flatcc)

# Fix for "relocation R_X86_64_32 against `.rodata' can not be used when making
# a shared object; recompile with -fPIC" when building on some x86 linux
# systems.
set_property(TARGET flatccrt PROPERTY POSITION_INDEPENDENT_CODE ON)

# Assume we are cross-compiling and the CMAKE_TOOLCHAIN_FILE is set
include(ExternalProject)

Expand All @@ -67,6 +74,7 @@ ExternalProject_Add(
PREFIX ${CMAKE_BINARY_DIR}/_host_build
SOURCE_DIR ${CMAKE_SOURCE_DIR}/third-party/flatcc
BINARY_DIR ${CMAKE_BINARY_DIR}/_host_build
CMAKE_CACHE_ARGS -DFLATCC_TEST:BOOL=OFF -DFLATCC_REFLECTION:BOOL=OFF
INSTALL_COMMAND "" # Prevent the install step, modify as needed
)

Expand Down Expand Up @@ -118,7 +126,7 @@ add_library(etdump ${CMAKE_CURRENT_SOURCE_DIR}/etdump/etdump_flatcc.cpp

target_link_libraries(
etdump
PUBLIC etdump_schema flatcc
PUBLIC etdump_schema flatccrt
PRIVATE executorch)

add_custom_command(
Expand Down Expand Up @@ -148,7 +156,7 @@ target_include_directories(

# Install libraries
install(
TARGETS bundled_program etdump flatcc
TARGETS bundled_program etdump flatccrt
DESTINATION ${CMAKE_BINARY_DIR}/lib
INCLUDES
DESTINATION ${_common_include_directories})