Skip to content

Commit 5cb2e4b

Browse files
jathularryliu0820
authored andcommitted
Fetch gflags dynamically
1 parent 09a4b9d commit 5cb2e4b

File tree

14 files changed

+65
-34
lines changed

14 files changed

+65
-34
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ ethos-u-scratch/
2121
executorch.egg-info
2222
pip-out/
2323

24+
# Dynamically fetched third-party libraries
25+
third-party/gflags
26+
2427
# Any exported models and profiling outputs
2528
*.bin
2629
*.model

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
[submodule "third-party/flatcc"]
4141
path = third-party/flatcc
4242
url = https://github.com/dvidelabs/flatcc.git
43-
[submodule "third-party/gflags"]
44-
path = third-party/gflags
45-
url = https://github.com/gflags/gflags.git
4643
[submodule "third-party/googletest"]
4744
path = third-party/googletest
4845
url = https://github.com/google/googletest.git

CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ project(executorch)
5252

5353
include(${PROJECT_SOURCE_DIR}/tools/cmake/common/preset.cmake)
5454
include(${PROJECT_SOURCE_DIR}/tools/cmake/Utils.cmake)
55+
include(${PROJECT_SOURCE_DIR}/tools/cmake/EXECUTORCH_FetchContent_Destination.cmake)
5556
include(CMakeDependentOption)
5657
include(ExternalProject)
58+
include(FetchContent)
5759

5860
if(NOT CMAKE_CXX_STANDARD)
5961
set(CMAKE_CXX_STANDARD 17)
@@ -456,14 +458,6 @@ endif()
456458

457459
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/configurations)
458460

459-
#
460-
# gflags: Commandline flag host library.
461-
#
462-
463-
if(EXECUTORCH_BUILD_GFLAGS)
464-
add_subdirectory(third-party/gflags)
465-
endif()
466-
467461
# Install `executorch` library as well as `executorch-config.cmake` under
468462
# ${CMAKE_INSTALL_PREFIX}/
469463
install(

backends/apple/coreml/scripts/build_tests.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ cmake "$EXECUTORCH_ROOT_PATH" -B"$CMAKE_EXECUTORCH_BUILD_DIR_PATH" \
3333
-DPLATFORM=MAC_UNIVERSAL \
3434
-DDEPLOYMENT_TARGET=13.0 \
3535
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
36-
-DEXECUTORCH_BUILD_XNNPACK=OFF \
37-
-DEXECUTORCH_BUILD_GFLAGS=OFF
36+
-DEXECUTORCH_BUILD_XNNPACK=OFF
3837

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

backends/cadence/build_cadence_fusionG3.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ if $STEPWISE_BUILD; then
5050
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF \
5151
-DPYTHON_EXECUTABLE=python3 \
5252
-DEXECUTORCH_FUSION_G3_OPT=ON \
53-
-DEXECUTORCH_BUILD_GFLAGS=ON \
5453
-DHAVE_FNMATCH_H=OFF \
5554
-Bcmake-out/backends/cadence \
5655
backends/cadence

backends/cadence/build_cadence_hifi4.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ if $STEPWISE_BUILD; then
4949
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF \
5050
-DPYTHON_EXECUTABLE=python3 \
5151
-DEXECUTORCH_NNLIB_OPT=ON \
52-
-DEXECUTORCH_BUILD_GFLAGS=ON \
5352
-DHAVE_FNMATCH_H=OFF \
5453
-Bcmake-out/backends/cadence \
5554
backends/cadence

examples/models/llama/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ set(_common_include_directories ${EXECUTORCH_ROOT}/..)
7070

7171
# For some reason android build is not able to find where gflags is and hence
7272
# cannot find corresponding .cmake file
73-
set(gflags_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party/gflags)
73+
set(gflags_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../third-party/gflags/gflags-build)
7474
find_package(gflags REQUIRED)
7575

7676
#

examples/models/llava/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ set(_common_include_directories ${EXECUTORCH_ROOT}/..)
6868

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

7474
#

examples/qualcomm/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ endif()
3030
# etdump, bundled_program.
3131
find_package(executorch CONFIG REQUIRED)
3232
target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED)
33+
34+
set(gflags_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../third-party/gflags/gflags-build)
3335
find_package(gflags REQUIRED)
3436

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

third-party/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ if(BUILD_TESTING)
1414
add_subdirectory(googletest)
1515
endif()
1616

17+
EXECUTORCH_FetchContent_Destination("${CMAKE_CURRENT_SOURCE_DIR}/gflags")
18+
FetchContent_Declare(
19+
gflags
20+
GIT_REPOSITORY https://github.com/gflags/gflags.git
21+
GIT_TAG v2.2.2
22+
)
23+
set(GFLAGS_INTTYPES_FORMAT C99)
24+
FetchContent_MakeAvailable(gflags)
25+
1726
# MARK: - flatbuffers
1827

1928
if(WIN32)

0 commit comments

Comments
 (0)