Skip to content

Fix flatcc path for Windows #8970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2025
Merged
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
16 changes: 14 additions & 2 deletions devtools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ if(NOT CMAKE_CXX_STANDARD)
endif()

if(NOT FLATCC_EXECUTABLE)
set(FLATCC_EXECUTABLE ${_flatcc_source_dir}/bin/flatcc)
if(WIN32)
set(FLATCC_EXECUTABLE ${_flatcc_source_dir}/bin/${CMAKE_BUILD_TYPE}/flatcc)
else()
set(FLATCC_EXECUTABLE ${_flatcc_source_dir}/bin/flatcc)
endif()
endif()

# Source root directory for executorch.
Expand Down Expand Up @@ -159,6 +163,12 @@ file(MAKE_DIRECTORY
${_program_schema__include_dir}/executorch/devtools/bundled_program
)

if(WIN32)
set(RM_COMMAND rmdir /s /q)
else()
set(RM_COMMAND rm -rf)
Copy link
Contributor

Choose a reason for hiding this comment

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

rm -rf in a cmakefile makes me a little uneasy, why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know; rm -rf was being used before my changes. Here I'm simply switching it to use a cmd.exe equivalent for Windows. I can change it to rm -r if that's more reasonable.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah ok looks like it was there before, so hopefully should be fine i guess

endif()

add_custom_command(
OUTPUT ${_etdump_schema__outputs}
COMMAND
Expand All @@ -168,11 +178,13 @@ add_custom_command(
${FLATCC_EXECUTABLE} -cwr -o
${_program_schema__include_dir}/executorch/devtools/etdump
${_etdump_schema__srcs}
COMMAND rm -rf ${_etdump_schema_cleanup_paths}
COMMAND ${RM_COMMAND} ${_etdump_schema_cleanup_paths}
DEPENDS ${_etdump_schema_gen_dep}
COMMENT "Generating etdump headers"
)

unset(RM_COMMAND)

add_library(
etdump ${CMAKE_CURRENT_SOURCE_DIR}/etdump/etdump_flatcc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/etdump/emitter.cpp
Expand Down
Loading