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 7cmake_minimum_required(VERSION 3.19) 8project(nanogpt_runner) 9 10set(CMAKE_CXX_STANDARD 17) 11set(CMAKE_CXX_STANDARD_REQUIRED True) 12 13# Set options for executorch build. 14option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER "" ON) 15option(EXECUTORCH_BUILD_EXTENSION_MODULE "" ON) 16option(EXECUTORCH_BUILD_EXTENSION_TENSOR "" ON) 17option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED "" ON) 18option(EXECUTORCH_BUILD_XNNPACK "" ON) # Build with Xnnpack backend 19 20# Include the executorch subdirectory. 21add_subdirectory( 22 ${CMAKE_CURRENT_SOURCE_DIR}/third-party/executorch 23 ${CMAKE_BINARY_DIR}/executorch 24) 25 26add_executable(nanogpt_runner main.cpp) 27target_link_libraries( 28 nanogpt_runner 29 PRIVATE executorch 30 extension_module_static # Provides the Module class 31 extension_tensor # Provides the TensorPtr class 32 optimized_native_cpu_ops_lib # Provides baseline cross-platform 33 # kernels 34 xnnpack_backend # Provides the XNNPACK CPU acceleration backend 35) 36