onnxruntime/cmake/onnxruntime_flatbuffers.cmake
Tiago Koji Castro Shibata 62c0d24340
Fix Windows Store build (#8753)
* Remove APIs unavailable in Store in #8349, #8178, #8065

* Add UWP stubs of C runtime functions

* Remove UWP incompatible tests from UWP build

* Remove incompatible tests from Store

* Use UWP stubs in store only

* Skip partition check outside of Windows

* Remove unused WRL include

* Workaround Windows header not including what it uses

* Fix precompiled header name clash

* Workaround SDK bugs

* DXCore workaround in Win7

* Fix warning

* Fix more warnings

* Bump WinML to target Windows 8

* Fix more warnings

* Remove unnecessary workarounds

* Remove Desktop only APIs from DML adapter
2021-08-23 11:19:03 -07:00

36 lines
1.4 KiB
CMake

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
file(GLOB onnxruntime_flatbuffers_srcs CONFIGURE_DEPENDS
"${ONNXRUNTIME_ROOT}/core/flatbuffers/*.h"
"${ONNXRUNTIME_ROOT}/core/flatbuffers/*.cc"
)
source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_flatbuffers_srcs})
onnxruntime_add_static_library(onnxruntime_flatbuffers ${onnxruntime_flatbuffers_srcs})
onnxruntime_add_include_to_target(onnxruntime_flatbuffers onnx flatbuffers)
if(onnxruntime_ENABLE_INSTRUMENT)
target_compile_definitions(onnxruntime_flatbuffers PUBLIC ONNXRUNTIME_ENABLE_INSTRUMENT)
endif()
target_include_directories(onnxruntime_flatbuffers PRIVATE ${ONNXRUNTIME_ROOT})
add_dependencies(onnxruntime_flatbuffers ${onnxruntime_EXTERNAL_DEPENDENCIES})
set_target_properties(onnxruntime_flatbuffers PROPERTIES FOLDER "ONNXRuntime")
# Add dependency so the flatbuffers compiler is built if enabled
if (FLATBUFFERS_BUILD_FLATC)
add_dependencies(onnxruntime_flatbuffers flatc)
endif()
if (WINDOWS_STORE)
function(target_force_include target scope file)
if (MSVC)
target_compile_options(${target} ${scope} "/FI${file}")
else()
target_compile_options(${target} ${scope} -include "${file}")
endif()
endfunction()
target_force_include(flatbuffers PRIVATE uwp_stubs.h)
target_force_include(flatc PRIVATE uwp_stubs.h)
endif()