|
| 1 | +# |
| 2 | +# Copyright (C) 2019 The Android Open Source Project |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# |
| 16 | + |
| 17 | +# Generates rules to install the dynamic OpenMP runtime libraries to the out |
| 18 | +# directory if the runtime is requested by the app's ldflags. |
| 19 | + |
| 20 | +NDK_APP_NEEDS_DYNAMIC_OMP := false |
| 21 | +$(foreach __module,$(__ndk_modules),\ |
| 22 | + $(eval __module_ldflags := \ |
| 23 | + $(NDK_APP_LDFLAGS) $(__ndk_modules.$(__module).LDFLAGS))\ |
| 24 | + $(if $(filter -fopenmp,$(__module_ldflags)),\ |
| 25 | + $(if $(filter -static-openmp,$(__module_ldflags)),,\ |
| 26 | + $(eval NDK_APP_NEEDS_DYNAMIC_OMP := true)\ |
| 27 | + )\ |
| 28 | + )\ |
| 29 | +) |
| 30 | + |
| 31 | +ifeq ($(NDK_APP_NEEDS_DYNAMIC_OMP),true) |
| 32 | +NDK_APP_OMP := $(NDK_APP_DST_DIR)/libomp.so |
| 33 | +installed_modules: $(NDK_APP_OMP) |
| 34 | + |
| 35 | +NDK_OMP_LIB_PATH := \ |
| 36 | + $(NDK_TOOLCHAIN_LIB_DIR)/$(TARGET_TOOLCHAIN_ARCH_LIB_DIR)/libomp.so |
| 37 | + |
| 38 | +$(NDK_APP_OMP): PRIVATE_ABI := $(TARGET_ARCH_ABI) |
| 39 | +$(NDK_APP_OMP): PRIVATE_SRC := $(NDK_OMP_LIB_PATH) |
| 40 | +$(NDK_APP_OMP): PRIVATE_DST := $(NDK_APP_OMP) |
| 41 | + |
| 42 | +$(call generate-file-dir,$(NDK_APP_$(NDK_SANITIZER_NAME))) |
| 43 | + |
| 44 | +$(NDK_APP_OMP): clean-installed-binaries |
| 45 | + $(call host-echo-build-step,$(PRIVATE_ABI),OpenMP "$(call pretty-dir,$(PRIVATE_DST))") |
| 46 | + $(hide) $(call host-install,$(PRIVATE_SRC),$(PRIVATE_DST)) |
| 47 | +endif |
0 commit comments