mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-10-23 10:15:53 +00:00
GN recently added support for Apple frameworks to link, rather than overloading the libs lists. This pulls .frameworks out of the libs lists, so that GN can stop supporting .frameworks in libs in the future. Bug: chromium:1052560 Change-Id: I0b57a3c4c995887a57937317db30b67cf7a7f0f7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24281 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
150 lines
4.0 KiB
Plaintext
150 lines
4.0 KiB
Plaintext
# Copyright 2020 The Dawn Authors
|
|
#
|
|
# 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.
|
|
|
|
import("../../../scripts/dawn_overrides_with_defaults.gni")
|
|
|
|
import("${dawn_root}/scripts/dawn_features.gni")
|
|
|
|
# Only expose GLFW targets on platforms where GLFW is supported: otherwise they
|
|
# might get discovered by GN when another target in this file is referenced,
|
|
# and GLFW will be built as part of "all" builds, causing compilation failures.
|
|
|
|
assert(dawn_supports_glfw_for_windowing)
|
|
glfw_dir = dawn_glfw_dir
|
|
|
|
config("glfw_public") {
|
|
include_dirs = [ "${glfw_dir}/include" ]
|
|
|
|
if (is_win) {
|
|
defines = [ "_GLFW_WIN32" ]
|
|
}
|
|
|
|
if (is_mac) {
|
|
defines = [ "_GLFW_COCOA" ]
|
|
}
|
|
|
|
if (is_linux) {
|
|
defines = [ "_GLFW_X11" ]
|
|
}
|
|
}
|
|
|
|
static_library("glfw") {
|
|
public_configs = [ ":glfw_public" ]
|
|
|
|
if (dawn_has_build) {
|
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
}
|
|
|
|
if (is_win && !is_clang) {
|
|
# nonstandard extension, function/data pointer conversion in expression
|
|
cflags_c = [ "/wd4152" ]
|
|
} else {
|
|
cflags_c = [
|
|
"-Wno-sign-compare",
|
|
"-Wno-missing-field-initializers",
|
|
]
|
|
}
|
|
|
|
sources = [
|
|
"${glfw_dir}/include/GLFW/glfw3.h",
|
|
"${glfw_dir}/include/GLFW/glfw3native.h",
|
|
"${glfw_dir}/src/context.c",
|
|
"${glfw_dir}/src/egl_context.c",
|
|
"${glfw_dir}/src/egl_context.h",
|
|
"${glfw_dir}/src/init.c",
|
|
"${glfw_dir}/src/input.c",
|
|
"${glfw_dir}/src/internal.h",
|
|
"${glfw_dir}/src/monitor.c",
|
|
"${glfw_dir}/src/osmesa_context.c",
|
|
"${glfw_dir}/src/osmesa_context.h",
|
|
"${glfw_dir}/src/vulkan.c",
|
|
"${glfw_dir}/src/window.c",
|
|
]
|
|
libs = []
|
|
|
|
if (is_win) {
|
|
sources += [
|
|
"${glfw_dir}/src/wgl_context.c",
|
|
"${glfw_dir}/src/wgl_context.h",
|
|
"${glfw_dir}/src/win32_init.c",
|
|
"${glfw_dir}/src/win32_joystick.c",
|
|
"${glfw_dir}/src/win32_joystick.h",
|
|
"${glfw_dir}/src/win32_monitor.c",
|
|
"${glfw_dir}/src/win32_platform.h",
|
|
"${glfw_dir}/src/win32_thread.c",
|
|
"${glfw_dir}/src/win32_time.c",
|
|
"${glfw_dir}/src/win32_window.c",
|
|
]
|
|
}
|
|
|
|
if (is_linux || is_mac) {
|
|
sources += [
|
|
"${glfw_dir}/src/posix_thread.c",
|
|
"${glfw_dir}/src/posix_thread.h",
|
|
]
|
|
}
|
|
|
|
if (is_linux) {
|
|
sources += [
|
|
"${glfw_dir}/src/glx_context.c",
|
|
"${glfw_dir}/src/glx_context.h",
|
|
"${glfw_dir}/src/linux_joystick.c",
|
|
"${glfw_dir}/src/linux_joystick.h",
|
|
"${glfw_dir}/src/posix_time.c",
|
|
"${glfw_dir}/src/posix_time.h",
|
|
"${glfw_dir}/src/x11_init.c",
|
|
"${glfw_dir}/src/x11_monitor.c",
|
|
"${glfw_dir}/src/x11_platform.h",
|
|
"${glfw_dir}/src/x11_window.c",
|
|
"${glfw_dir}/src/xkb_unicode.c",
|
|
"${glfw_dir}/src/xkb_unicode.h",
|
|
]
|
|
|
|
libs += [
|
|
"rt",
|
|
"dl",
|
|
"X11",
|
|
"Xcursor",
|
|
"Xinerama",
|
|
"Xrandr",
|
|
]
|
|
}
|
|
|
|
if (is_mac) {
|
|
sources += [
|
|
"${glfw_dir}/src/cocoa_init.m",
|
|
"${glfw_dir}/src/cocoa_joystick.h",
|
|
"${glfw_dir}/src/cocoa_joystick.m",
|
|
"${glfw_dir}/src/cocoa_monitor.m",
|
|
"${glfw_dir}/src/cocoa_platform.h",
|
|
"${glfw_dir}/src/cocoa_time.c",
|
|
"${glfw_dir}/src/cocoa_window.m",
|
|
"${glfw_dir}/src/nsgl_context.h",
|
|
"${glfw_dir}/src/nsgl_context.m",
|
|
]
|
|
frameworks = [
|
|
"Cocoa.framework",
|
|
"IOKit.framework",
|
|
"CoreFoundation.framework",
|
|
"CoreVideo.framework",
|
|
]
|
|
cflags_objc = [
|
|
"-Wno-sign-compare",
|
|
"-Wno-unguarded-availability",
|
|
"-Wno-objc-multiple-method-names",
|
|
]
|
|
}
|
|
}
|