|
42 | 42 |
|
43 | 43 | cmake_minimum_required(VERSION 3.13)
|
44 | 44 | project(executorch)
|
| 45 | +include(build/Utils.cmake) |
45 | 46 |
|
46 | 47 | # option to register custom operator `my_ops::mul3` in
|
47 | 48 | # `examples/custom_ops/custom_ops_1.py`
|
@@ -260,33 +261,35 @@ target_link_libraries(portable_kernels_bindings INTERFACE portable_kernels)
|
260 | 261 | # would remove them since there are no other references to them.
|
261 | 262 | if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL
|
262 | 263 | "AppleClang")
|
263 |
| - target_link_options( |
264 |
| - portable_kernels_bindings |
265 |
| - INTERFACE |
266 |
| - # TODO(dbort): This will cause the .a to show up on the link line twice for |
267 |
| - # targets that depend on this library; once because CMake will add it, and |
268 |
| - # once because it's in this list of args. See if there's a way to avoid |
269 |
| - # that. |
270 |
| - -Wl,-force_load,libportable_kernels_bindings.a) |
271 |
| -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") |
| 264 | + if(CMAKE_TOOLCHAIN_FILE MATCHES ".*android\.toolchain\.cmake$") |
| 265 | + # For Android tool chain |
| 266 | + gcc_kernel_link_options(portable_kernels_bindings) |
| 267 | + else() |
| 268 | + # For host tool chain |
| 269 | + clang_kernel_link_options(portable_kernels_bindings) |
| 270 | + endif() |
| 271 | +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") |
272 | 272 | # Using gcc
|
273 |
| - target_link_options( |
274 |
| - portable_kernels_bindings INTERFACE |
275 |
| - # TODO(dbort): This will cause the .a to show up on the link line twice |
276 |
| - -Wl,--whole-archive libportable_kernels_bindings.a -Wl,--no-whole-archive) |
| 273 | + gcc_kernel_link_options(portable_kernels_bindings) |
277 | 274 | endif()
|
278 | 275 |
|
279 | 276 | #
|
280 | 277 | # executor_runner: A simple commandline tool that loads and runs a program file.
|
281 | 278 | #
|
282 | 279 |
|
283 |
| -add_executable(executor_runner ${_executor_runner__srcs}) |
284 |
| -target_link_libraries(executor_runner executorch portable_kernels_bindings |
285 |
| - gflags) |
286 |
| -target_compile_options(executor_runner PUBLIC ${_common_compile_options}) |
| 280 | +# ios can only build library but not binary |
| 281 | +if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*ios\.toolchain\.cmake$") |
| 282 | + add_executable(executor_runner ${_executor_runner__srcs}) |
| 283 | + target_link_libraries(executor_runner executorch portable_kernels_bindings |
| 284 | + gflags) |
| 285 | + target_compile_options(executor_runner PUBLIC ${_common_compile_options}) |
| 286 | +endif() |
287 | 287 |
|
288 | 288 | # Generate custom_ops_lib based on REGISTER_EXAMPLE_CUSTOM_OPS
|
289 | 289 | if(REGISTER_EXAMPLE_CUSTOM_OP_1 OR REGISTER_EXAMPLE_CUSTOM_OP_2)
|
290 | 290 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/examples/custom_ops)
|
291 | 291 | target_link_libraries(executor_runner custom_ops_lib)
|
292 | 292 | endif()
|
| 293 | + |
| 294 | +# Print all summary |
| 295 | +executorch_print_configuration_summary() |
0 commit comments