Skip to content

Commit ebfd1f1

Browse files
committed
install flatc
1 parent 518324f commit ebfd1f1

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

third-party/CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,32 @@
1212
ExternalProject_Add(
1313
flatbuffers_external_project
1414
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/flatbuffers_external_project
15-
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/flatbuffers_external_project
1615
SOURCE_DIR ${PROJECT_SOURCE_DIR}/third-party/flatbuffers
1716
# Always use Make to avoid needing to codesign flatc if the project is using Xcode.
1817
CMAKE_GENERATOR "Unix Makefiles"
1918
CMAKE_ARGS -DFLATBUFFERS_BUILD_FLATC=ON
20-
-DFLATBUFFERS_INSTALL=OFF
19+
-DFLATBUFFERS_INSTALL=ON
2120
-DFLATBUFFERS_BUILD_FLATHASH=OFF
2221
-DFLATBUFFERS_BUILD_FLATLIB=OFF
2322
-DFLATBUFFERS_BUILD_TESTS=OFF
23+
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
2424
-DCMAKE_CXX_FLAGS="-DFLATBUFFERS_MAX_ALIGNMENT=${EXECUTORCH_FLATBUFFERS_MAX_ALIGNMENT}"
2525
# Unset the toolchain to build for the host instead of the toolchain set for the project.
2626
-DCMAKE_TOOLCHAIN_FILE=
2727
# If building for iOS, "unset" these variables to rely on the host (macOS) defaults.
2828
$<$<AND:$<BOOL:${APPLE}>,$<BOOL:$<FILTER:${PLATFORM},EXCLUDE,^MAC>>>:-DCMAKE_OSX_SYSROOT=>
2929
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}
30-
INSTALL_COMMAND ""
31-
BUILD_BYPRODUCTS <BINARY_DIR>/flatc
30+
BUILD_BYPRODUCTS <INSTALL_DIR>/bin/flatc
3231
)
33-
ExternalProject_Get_Property(flatbuffers_external_project BINARY_DIR)
32+
ExternalProject_Get_Property(flatbuffers_external_project INSTALL_DIR)
3433
add_executable(flatc IMPORTED GLOBAL)
3534
add_dependencies(flatc flatbuffers_external_project)
3635
if(WIN32)
3736
# flatbuffers does not use CMAKE_BUILD_TYPE. Internally, the build forces Release
3837
# config, but from CMake's perspective the build type is always Debug.
39-
set_target_properties(flatc PROPERTIES IMPORTED_LOCATION ${BINARY_DIR}/$<CONFIG>/flatc.exe)
38+
set_target_properties(flatc PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/$<CONFIG>/bin/flatc.exe)
4039
else()
41-
set_target_properties(flatc PROPERTIES IMPORTED_LOCATION ${BINARY_DIR}/flatc)
40+
set_target_properties(flatc PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/bin/flatc)
4241
endif()
4342

4443
# TODO: re-enable once flatbuffers is added as a subdirectory.

0 commit comments

Comments
 (0)