Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ ethos-u-scratch/
executorch.egg-info
pip-out/

# Third-party libraries, symlink'ed to FetchContent source directories
third-party/gflags

# Any exported models and profiling outputs
*.bin
*.model
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
[submodule "third-party/flatcc"]
path = third-party/flatcc
url = https://github.com/dvidelabs/flatcc.git
[submodule "third-party/gflags"]
path = third-party/gflags
url = https://github.com/gflags/gflags.git
[submodule "third-party/googletest"]
path = third-party/googletest
url = https://github.com/google/googletest.git
Expand Down
10 changes: 2 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ project(executorch)

include(${PROJECT_SOURCE_DIR}/tools/cmake/common/preset.cmake)
include(${PROJECT_SOURCE_DIR}/tools/cmake/Utils.cmake)
include(${PROJECT_SOURCE_DIR}/tools/cmake/FetchContent.cmake)
include(CMakeDependentOption)
include(ExternalProject)
include(FetchContent)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
Expand Down Expand Up @@ -456,14 +458,6 @@ endif()

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/configurations)

#
# gflags: Commandline flag host library.
#

if(EXECUTORCH_BUILD_GFLAGS)
add_subdirectory(third-party/gflags)
endif()

# Install `executorch` library as well as `executorch-config.cmake` under
# ${CMAKE_INSTALL_PREFIX}/
install(
Expand Down
3 changes: 1 addition & 2 deletions backends/apple/coreml/scripts/build_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ cmake "$EXECUTORCH_ROOT_PATH" -B"$CMAKE_EXECUTORCH_BUILD_DIR_PATH" \
-DPLATFORM=MAC_UNIVERSAL \
-DDEPLOYMENT_TARGET=13.0 \
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
-DEXECUTORCH_BUILD_XNNPACK=OFF \
-DEXECUTORCH_BUILD_GFLAGS=OFF
-DEXECUTORCH_BUILD_XNNPACK=OFF

cmake --build "$CMAKE_EXECUTORCH_BUILD_DIR_PATH" -j9 -t executorch

Expand Down
1 change: 0 additions & 1 deletion backends/cadence/build_cadence_fusionG3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ if $STEPWISE_BUILD; then
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF \
-DPYTHON_EXECUTABLE=python3 \
-DEXECUTORCH_FUSION_G3_OPT=ON \
-DEXECUTORCH_BUILD_GFLAGS=ON \
-DHAVE_FNMATCH_H=OFF \
-Bcmake-out/backends/cadence \
backends/cadence
Expand Down
1 change: 0 additions & 1 deletion backends/cadence/build_cadence_hifi4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ if $STEPWISE_BUILD; then
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF \
-DPYTHON_EXECUTABLE=python3 \
-DEXECUTORCH_NNLIB_OPT=ON \
-DEXECUTORCH_BUILD_GFLAGS=ON \
-DHAVE_FNMATCH_H=OFF \
-Bcmake-out/backends/cadence \
backends/cadence
Expand Down
7 changes: 3 additions & 4 deletions examples/models/llama/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
set(TORCH_ROOT ${EXECUTORCH_ROOT}/third-party/pytorch)

include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
include(${EXECUTORCH_ROOT}/tools/cmake/FetchContent.cmake)

if(NOT PYTHON_EXECUTABLE)
resolve_python_executable()
Expand All @@ -68,10 +69,8 @@ set(_common_compile_options -Wno-deprecated-declarations -fPIC)
# Let files say "include <executorch/path/to/header.h>".
set(_common_include_directories ${EXECUTORCH_ROOT}/..)

# For some reason android build is not able to find where gflags is and hence
# cannot find corresponding .cmake file
set(gflags_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party/gflags)
find_package(gflags REQUIRED)
# Fetch gflags
FetchContent_gflags()

#
# llama_main: test binary to run llama, with tokenizer and sampler integrated
Expand Down
7 changes: 3 additions & 4 deletions examples/models/llava/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ endif()
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../..)

include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
include(${EXECUTORCH_ROOT}/tools/cmake/FetchContent.cmake)

if(NOT PYTHON_EXECUTABLE)
resolve_python_executable()
Expand All @@ -66,10 +67,8 @@ set(_common_compile_options -Wno-deprecated-declarations -fPIC)
# Let files say "include <executorch/path/to/header.h>".
set(_common_include_directories ${EXECUTORCH_ROOT}/..)

# For some reason android build is not able to find where gflags is and hence
# cannot find corresponding .cmake file
set(gflags_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party/gflags)
find_package(gflags REQUIRED)
# Fetch gflags
FetchContent_gflags()

#
# llava_main: test binary to run llava, with tokenizer and sampler integrated
Expand Down
5 changes: 2 additions & 3 deletions examples/portable/custom_ops/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ endif()

include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake)
include(${EXECUTORCH_ROOT}/tools/cmake/FetchContent.cmake)

if(NOT PYTHON_EXECUTABLE)
resolve_python_executable()
Expand All @@ -40,9 +41,7 @@ set(_common_compile_options -Wno-deprecated-declarations -fPIC)
set(_common_include_directories ${EXECUTORCH_ROOT}/..)

find_package(executorch CONFIG REQUIRED)
find_package(
gflags REQUIRED PATHS ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party
)
FetchContent_gflags()

target_include_directories(executorch INTERFACE ${_common_include_directories})

Expand Down
1 change: 0 additions & 1 deletion examples/qualcomm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ endif()
# etdump, bundled_program.
find_package(executorch CONFIG REQUIRED)
target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED)
find_package(gflags REQUIRED)

set(_common_compile_options -Wno-deprecated-declarations -fPIC)

Expand Down
5 changes: 2 additions & 3 deletions examples/selective_build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set(TORCH_ROOT ${EXECUTORCH_ROOT}/third-party/pytorch)

include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake)
include(${EXECUTORCH_ROOT}/tools/cmake/FetchContent.cmake)

if(NOT PYTHON_EXECUTABLE)
resolve_python_executable()
Expand All @@ -39,9 +40,7 @@ set(_common_compile_options -Wno-deprecated-declarations -fPIC)
set(_common_include_directories ${EXECUTORCH_ROOT}/..)

find_package(executorch CONFIG REQUIRED)
find_package(
gflags REQUIRED PATHS ${CMAKE_CURRENT_BINARY_DIR}/../../third-party
)
FetchContent_gflags()

target_include_directories(executorch_core INTERFACE ${_common_include_directories})

Expand Down
1 change: 1 addition & 0 deletions extension/training/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ target_link_libraries(extension_training executorch_core kernels_util_all_deps

list(TRANSFORM _train_xor__srcs PREPEND "${EXECUTORCH_ROOT}/")
add_executable(train_xor ${_train_xor__srcs})

target_include_directories(
train_xor PUBLIC ${_common_include_directories}
)
Expand Down
7 changes: 7 additions & 0 deletions third-party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ if(BUILD_TESTING)
add_subdirectory(googletest)
endif()

FetchContent_gflags()
# Create a symlink from the gflags source directory to third-party/gflags
message(STATUS "gflags source dir: ${gflags_SOURCE_DIR}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: lets not log, it's too noisy — do we really need to tell them every time?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is very helpful for debugging

execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink "${gflags_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/gflags"
)

# MARK: - flatbuffers

if(WIN32)
Expand Down
1 change: 0 additions & 1 deletion third-party/gflags
Submodule gflags deleted from a738fd
19 changes: 19 additions & 0 deletions tools/cmake/FetchContent.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# FetchContent gflags and make available at CMake configure time.
# Make the content available at configure time so that BUCK can use it.
include(FetchContent)

function(FetchContent_gflags)
FetchContent_Declare(
gflags
GIT_REPOSITORY https://github.com/gflags/gflags.git
GIT_TAG v2.2.2
)
set(GFLAGS_INTTYPES_FORMAT C99)
FetchContent_MakeAvailable(gflags)
endfunction()
5 changes: 0 additions & 5 deletions tools/cmake/preset/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,6 @@ define_overridable_option(
"Build the Cortex-M backend"
BOOL OFF
)
define_overridable_option(
EXECUTORCH_BUILD_GFLAGS
"Build the gflags library."
BOOL ON
)
define_overridable_option(
EXECUTORCH_COREML_BUILD_EXECUTOR_RUNNER
"Build CoreML executor runner."
Expand Down
Loading