Skip to content

Commit f25f7fe

Browse files
committed
updates
1 parent f777de7 commit f25f7fe

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

examples/models/llama2/CMakeLists.txt

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,36 @@ if(EXECUTORCH_BUILD_KERNELS_CUSTOM)
121121
list(APPEND link_libraries custom_ops)
122122
endif()
123123

124-
if (EXECUTORCH_BUILD_TORCHAO)
125-
set(torchao_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party/torchao)
126-
find_package(torchao CONFIG REQUIRED)
127-
list(APPEND link_libraries ${TORCHAO_LIBRARIES})
124+
if(EXECUTORCH_BUILD_TORCHAO)
125+
include(ExternalProject)
126+
# set(TORCHAO_BUILD_EXECUTORCH_OPS ON)
127+
128+
ExternalProject_Add(
129+
torchao
130+
PREFIX ${CMAKE_BINARY_DIR}/../../../third-party/ao/torchao/experimental
131+
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../third-party/ao/torchao/experimental
132+
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=cmake-out
133+
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
134+
-DTORCHAO_BUILD_EXECUTORCH_OPS=ON
135+
-DEXECUTORCH_INCLUDE_DIRS=$HOME/repos
136+
-DEXECUTORCH_LIBRARIES=${CMAKE_BINARY_DIR}/lib/libexecutorch.a;$HOME/repos/executorch/cmake-out/lib/libextension_threadpool.a;$HOME/repos/executorch/cmake-out/lib/libcpuinfo.a;$HOME/repos/executorch/cmake-out/lib/libpthreadpool.a
137+
)
138+
set(TORCHAO_BUILD_EXECUTORCH_OPS ON)
139+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../third-party/ao/torchao/experimental ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party/ao/torchao/experimental)
140+
141+
set(torchao_DIR /Users/scroy/repos/executorch/cmake-out/lib/cmake/torchao)
142+
find_package(torchao REQUIRED)
143+
144+
# set(torchao_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party/ao/torchao/experimental)
145+
# find_package(torchao CONFIG REQUIRED)
146+
147+
# find_package(Torch CONFIG REQUIRED HINT ${CMAKE_PREFIX_PATH}/torch/share/cmake/Torch)
148+
# add_compile_options("-frtti")
149+
# set(Torch_DIR /opt/miniconda3/envs/et_env/lib/python3.10/site-packages/torch/share/cmake/Torch)
150+
151+
# add_subdirectory(third-party/ao/torchao/experimental)
152+
target_link_options_shared_lib(torchao::torchao_ops_executorch)
153+
list(APPEND link_libraries torchao::torchao_ops_executorch)
128154
endif()
129155

130156
set(XNNPACK_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../backends/xnnpack)

0 commit comments

Comments
 (0)