Skip to content

Commit c5e68a2

Browse files
revert xnnpack cmakelist and fix file_data_loader
1 parent 038fa53 commit c5e68a2

File tree

2 files changed

+15
-28
lines changed

2 files changed

+15
-28
lines changed

backends/xnnpack/CMakeLists.txt

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -73,33 +73,17 @@ foreach(fbs_file ${_xnnpack_schema__srcs})
7373
endforeach()
7474

7575
# Generate the headers from the .fbs files.
76-
if(WIN32)
77-
add_custom_command(
78-
OUTPUT ${_xnnpack_schema__outputs}
79-
COMMAND
80-
${FLATC_EXECUTABLE} --cpp --cpp-std c++11 --scoped-enums -o
81-
"${_xnnpack_schema__include_dir}/executorch/backends/xnnpack/serialization"
82-
${_xnnpack_schema__srcs}
83-
COMMAND
84-
powershell -Command
85-
"Move-Item -Path ${_xnnpack_flatbuffer__outputs} -Destination ${_xnnpack_schema__outputs}"
86-
WORKING_DIRECTORY ${EXECUTORCH_ROOT}
87-
COMMENT "Generating xnnpack_schema headers"
88-
VERBATIM
89-
)
90-
else()
91-
add_custom_command(
92-
OUTPUT ${_xnnpack_schema__outputs}
93-
COMMAND
94-
${FLATC_EXECUTABLE} --cpp --cpp-std c++11 --scoped-enums -o
95-
"${_xnnpack_schema__include_dir}/executorch/backends/xnnpack/serialization"
96-
${_xnnpack_schema__srcs}
97-
COMMAND mv ${_xnnpack_flatbuffer__outputs} ${_xnnpack_schema__outputs}
98-
WORKING_DIRECTORY ${EXECUTORCH_ROOT}
99-
COMMENT "Generating xnnpack_schema headers"
100-
VERBATIM
101-
)
102-
endif()
76+
add_custom_command(
77+
OUTPUT ${_xnnpack_schema__outputs}
78+
COMMAND
79+
${FLATC_EXECUTABLE} --cpp --cpp-std c++11 --scoped-enums -o
80+
"${_xnnpack_schema__include_dir}/executorch/backends/xnnpack/serialization"
81+
${_xnnpack_schema__srcs}
82+
COMMAND mv ${_xnnpack_flatbuffer__outputs} ${_xnnpack_schema__outputs}
83+
WORKING_DIRECTORY ${EXECUTORCH_ROOT}
84+
COMMENT "Generating xnnpack_schema headers"
85+
VERBATIM
86+
)
10387

10488
add_library(xnnpack_schema INTERFACE ${_xnnpack_schema__outputs})
10589
set_target_properties(xnnpack_schema PROPERTIES LINKER_LANGUAGE CXX)

extension/data_loader/file_data_loader.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <fcntl.h>
1818
#include <sys/stat.h>
1919
#include <sys/types.h>
20-
#include <unistd.h>
20+
#include <executorch/runtime/platform/compat_unistd.h>
2121

2222
#include <executorch/runtime/core/error.h>
2323
#include <executorch/runtime/core/result.h>
@@ -71,6 +71,9 @@ FileDataLoader::~FileDataLoader() {
7171
std::free(const_cast<char*>(file_name_));
7272
// fd_ can be -1 if this instance was moved from, but closing a negative fd is
7373
// safe (though it will return an error).
74+
if (fd_ == -1) {
75+
return;
76+
}
7477
::close(fd_);
7578
}
7679

0 commit comments

Comments
 (0)