|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +cmake_minimum_required(VERSION 3.2) |
| 19 | +project(HexagonLauncher C CXX) |
| 20 | + |
| 21 | +include(ExternalProject) |
| 22 | + |
| 23 | +set(LAUNCHER_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") |
| 24 | + |
| 25 | +set(VARS_NEEDED |
| 26 | + ANDROID_ABI |
| 27 | + ANDROID_PLATFORM |
| 28 | + USE_ANDROID_TOOLCHAIN |
| 29 | + USE_HEXAGON_ARCH |
| 30 | + USE_HEXAGON_SDK |
| 31 | + USE_HEXAGON_TOOLCHAIN |
| 32 | +) |
| 33 | +foreach(V IN LISTS VARS_NEEDED) |
| 34 | + if(NOT ${V}) |
| 35 | + message(SEND_ERROR "Please set ${V}") |
| 36 | + endif() |
| 37 | +endforeach() |
| 38 | + |
| 39 | + |
| 40 | +ExternalProject_Add(android_launcher_binaries |
| 41 | + SOURCE_DIR "${LAUNCHER_SOURCE_DIR}/cmake/android" |
| 42 | + BUILD_COMMAND $(MAKE) |
| 43 | + CMAKE_ARGS |
| 44 | + "-DCMAKE_TOOLCHAIN_FILE=${USE_ANDROID_TOOLCHAIN}" |
| 45 | + "-DANDROID_PLATFORM=${ANDROID_PLATFORM}" |
| 46 | + "-DANDROID_ABI=${ANDROID_ABI}" |
| 47 | + "-DUSE_HEXAGON_SDK=${USE_HEXAGON_SDK}" |
| 48 | + "-DUSE_HEXAGON_ARCH=${USE_HEXAGON_ARCH}" |
| 49 | + INSTALL_COMMAND "" |
| 50 | + BUILD_ALWAYS ON |
| 51 | +) |
| 52 | +ExternalProject_Get_Property(android_launcher_binaries BINARY_DIR) |
| 53 | +ExternalProject_Add_Step(android_launcher_binaries copy_binaries |
| 54 | + COMMAND ${CMAKE_COMMAND} -E copy_if_different |
| 55 | + ${BINARY_DIR}/launcher_android |
| 56 | + ${BINARY_DIR}/libtvm_runtime.so |
| 57 | + ${CMAKE_CURRENT_BINARY_DIR} |
| 58 | + DEPENDEES install |
| 59 | +) |
| 60 | + |
| 61 | +ExternalProject_Add(hexagon_launcher_binaries |
| 62 | + SOURCE_DIR "${LAUNCHER_SOURCE_DIR}/cmake/hexagon" |
| 63 | + BUILD_COMMAND $(MAKE) |
| 64 | + CMAKE_ARGS |
| 65 | + "-DCMAKE_C_COMPILER=${USE_HEXAGON_TOOLCHAIN}/bin/hexagon-clang" |
| 66 | + "-DCMAKE_CXX_COMPILER=${USE_HEXAGON_TOOLCHAIN}/bin/hexagon-clang++" |
| 67 | + "-DUSE_HEXAGON_ARCH=${USE_HEXAGON_ARCH}" |
| 68 | + "-DUSE_HEXAGON_SDK=${USE_HEXAGON_SDK}" |
| 69 | + INSTALL_COMMAND "" |
| 70 | + BUILD_ALWAYS ON |
| 71 | +) |
| 72 | +ExternalProject_Get_Property(hexagon_launcher_binaries BINARY_DIR) |
| 73 | +ExternalProject_Add_Step(hexagon_launcher_binaries copy_binaries |
| 74 | + COMMAND ${CMAKE_COMMAND} -E copy_if_different |
| 75 | + ${BINARY_DIR}/liblauncher_rpc_skel.so |
| 76 | + ${CMAKE_CURRENT_BINARY_DIR} |
| 77 | + DEPENDEES install |
| 78 | +) |
0 commit comments