# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. config("executable_config") { configs = [] if (!is_mac) { if (!is_mingw) { cflags = [ "-fPIE" ] asmflags = [ "-fPIE" ] ldflags = [ "-Wl,-rpath=\$ORIGIN/", "-Wl,-rpath-link=", ] if (current_os == "linux") { ldflags += [ "-lpthread" ] } } if (is_ohos) { ldflags += [ "-lpthread" ] configs += [ "$build_root/config/ohos:executable_config" ] } else if (is_android) { configs += [ "$build_root/config/aosp:executable_config" ] } } } config("default_libs") { if (is_win) { libs = [ "advapi32.lib", "comdlg32.lib", "dbghelp.lib", "dnsapi.lib", "gdi32.lib", "msimg32.lib", "odbc32.lib", "odbccp32.lib", "oleaut32.lib", "psapi.lib", "shell32.lib", "shlwapi.lib", "user32.lib", "usp10.lib", "uuid.lib", "version.lib", "wininet.lib", "winmm.lib", "winspool.lib", "ws2_32.lib", # Please don't add more stuff here. We should actually be making this # list smaller, since all common things should be covered. If you need # some extra libraries, please just add a libs = [ "foo.lib" ] to your # target that needs it. ] if (current_os == "winuwp") { # These libraries are needed for Windows UWP (i.e. store apps). libs += [ "dloadhelper.lib", "WindowsApp.lib", ] } else { # These libraries are not compatible with Windows UWP (i.e. store apps.) libs += [ "delayimp.lib", "kernel32.lib", "ole32.lib", ] } } else if (is_ohos || is_android) { libs = [ "dl", "m", ] } else if (is_mac) { # Targets should choose to explicitly link frameworks they require. Since # linking can have run-time side effects, nothing should be listed here. libs = [] } else if (is_linux) { libs = [ "dl", "pthread", "rt", ] } } group("common_deps") { public_deps = [] if (use_musl && is_ohos) { public_deps += [ "$build_root/third_party_gn/musl:soft_shared_libs" ] } } group("executable_deps") { public_deps = [ ":common_deps" ] } group("shared_library_deps") { public_deps = [ ":common_deps" ] } group("static_library_deps") { public_deps = [ ":common_deps" ] } group("source_set_deps") { public_deps = [ ":common_deps" ] }