Skip to content

Commit 5459400

Browse files
committed
Use separate prim_ops_lib rule
1 parent 3c82cb4 commit 5459400

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -610,13 +610,7 @@ endif()
610610
#
611611
# Provides primitive operators with registration.
612612
#
613-
add_library(prim_ops_lib ${_executorch__srcs})
614-
target_link_libraries(prim_ops_lib PRIVATE executorch_core)
615-
target_include_directories(prim_ops_lib PUBLIC ${_common_include_directories})
616-
target_compile_definitions(prim_ops_lib PUBLIC C10_USING_CUSTOM_GENERATED_MACROS)
617-
target_compile_options(prim_ops_lib PUBLIC ${_common_compile_options})
618-
target_link_options_shared_lib(prim_ops_lib)
619-
613+
add_subdirectory(kernels/prim_ops)
620614
#
621615
# portable_ops_lib: A library to register core ATen ops using portable kernels,
622616
# see kernels/portable/CMakeLists.txt.

kernels/prim_ops/CMakeLists.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# Kernel library for portable kernels. Please this file formatted by running:
8+
# ~~~
9+
# cmake-format -i CMakeLists.txt
10+
# ~~~
11+
12+
cmake_minimum_required(VERSION 3.19)
13+
14+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
15+
if(NOT CMAKE_CXX_STANDARD)
16+
set(CMAKE_CXX_STANDARD 17)
17+
endif()
18+
19+
# Source root directory for executorch.
20+
if(NOT EXECUTORCH_ROOT)
21+
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
22+
endif()
23+
24+
set(_common_compile_options -Wno-deprecated-declarations)
25+
26+
add_library(prim_ops_lib ${_executorch__srcs})
27+
target_link_libraries(prim_ops_lib PRIVATE executorch_core)
28+
target_include_directories(prim_ops_lib PUBLIC ${_common_include_directories})
29+
target_compile_definitions(prim_ops_lib PUBLIC C10_USING_CUSTOM_GENERATED_MACROS)
30+
target_compile_options(prim_ops_lib PUBLIC ${_common_compile_options})
31+
target_link_options_shared_lib(prim_ops_lib)
32+
33+
install(
34+
TARGETS prim_ops_lib
35+
DESTINATION lib
36+
PUBLIC_HEADER DESTINATION include/executorch/kernels/prim_ops/
37+
)

0 commit comments

Comments
 (0)