|
| 1 | +# Copyright 2013 The Flutter Authors. All rights reserved. |
| 2 | +# Use of this source code is governed by a BSD-style license that can be |
| 3 | +# found in the LICENSE file. |
| 4 | + |
| 5 | +import("glfw_args.gni") |
| 6 | + |
| 7 | +_checkout_dir = "//flutter/third_party/glfw" |
| 8 | + |
| 9 | +config("relative_glfw_headers") { |
| 10 | + include_dirs = [ |
| 11 | + "$_checkout_dir/include", |
| 12 | + "$_checkout_dir/include/GLFW", |
| 13 | + ] |
| 14 | +} |
| 15 | + |
| 16 | +source_set("glfw") { |
| 17 | + public = [ |
| 18 | + "$_checkout_dir/include/GLFW/glfw3.h", |
| 19 | + "$_checkout_dir/include/GLFW/glfw3native.h", |
| 20 | + ] |
| 21 | + |
| 22 | + sources = [ |
| 23 | + "$_checkout_dir/src/context.c", |
| 24 | + "$_checkout_dir/src/egl_context.c", |
| 25 | + "$_checkout_dir/src/init.c", |
| 26 | + "$_checkout_dir/src/input.c", |
| 27 | + "$_checkout_dir/src/monitor.c", |
| 28 | + "$_checkout_dir/src/null_init.c", |
| 29 | + "$_checkout_dir/src/null_joystick.c", |
| 30 | + "$_checkout_dir/src/null_joystick.h", |
| 31 | + "$_checkout_dir/src/null_monitor.c", |
| 32 | + "$_checkout_dir/src/null_platform.h", |
| 33 | + "$_checkout_dir/src/null_window.c", |
| 34 | + "$_checkout_dir/src/osmesa_context.c", |
| 35 | + "$_checkout_dir/src/platform.c", |
| 36 | + "$_checkout_dir/src/vulkan.c", |
| 37 | + "$_checkout_dir/src/window.c", |
| 38 | + ] |
| 39 | + |
| 40 | + include_dirs = [ "$_checkout_dir/src" ] |
| 41 | + |
| 42 | + public_configs = [ ":relative_glfw_headers" ] |
| 43 | + |
| 44 | + if (is_win) { |
| 45 | + sources += [ |
| 46 | + "$_checkout_dir/src/wgl_context.c", |
| 47 | + "$_checkout_dir/src/win32_init.c", |
| 48 | + "$_checkout_dir/src/win32_joystick.c", |
| 49 | + "$_checkout_dir/src/win32_joystick.h", |
| 50 | + "$_checkout_dir/src/win32_module.c", |
| 51 | + "$_checkout_dir/src/win32_monitor.c", |
| 52 | + "$_checkout_dir/src/win32_platform.h", |
| 53 | + "$_checkout_dir/src/win32_thread.c", |
| 54 | + "$_checkout_dir/src/win32_time.c", |
| 55 | + "$_checkout_dir/src/win32_window.c", |
| 56 | + ] |
| 57 | + |
| 58 | + defines = [ "_GLFW_WIN32" ] |
| 59 | + } else if (is_linux) { |
| 60 | + sources += [ |
| 61 | + "$_checkout_dir/src/glx_context.c", |
| 62 | + "$_checkout_dir/src/linux_joystick.c", |
| 63 | + "$_checkout_dir/src/linux_joystick.h", |
| 64 | + "$_checkout_dir/src/posix_module.c", |
| 65 | + "$_checkout_dir/src/posix_poll.c", |
| 66 | + "$_checkout_dir/src/posix_poll.h", |
| 67 | + "$_checkout_dir/src/posix_thread.c", |
| 68 | + "$_checkout_dir/src/posix_thread.h", |
| 69 | + "$_checkout_dir/src/posix_time.c", |
| 70 | + "$_checkout_dir/src/posix_time.h", |
| 71 | + "$_checkout_dir/src/x11_init.c", |
| 72 | + "$_checkout_dir/src/x11_monitor.c", |
| 73 | + "$_checkout_dir/src/x11_platform.h", |
| 74 | + "$_checkout_dir/src/x11_window.c", |
| 75 | + "$_checkout_dir/src/xkb_unicode.c", |
| 76 | + "$_checkout_dir/src/xkb_unicode.h", |
| 77 | + ] |
| 78 | + |
| 79 | + defines = [ |
| 80 | + "_GLFW_X11", |
| 81 | + "_GLFW_HAS_XF86VM", |
| 82 | + ] |
| 83 | + |
| 84 | + libs = [ |
| 85 | + "X11", |
| 86 | + "Xcursor", |
| 87 | + "Xinerama", |
| 88 | + "Xrandr", |
| 89 | + "Xxf86vm", |
| 90 | + ] |
| 91 | + } else if (is_mac) { |
| 92 | + sources += [ |
| 93 | + "$_checkout_dir/src/cocoa_init.m", |
| 94 | + "$_checkout_dir/src/cocoa_joystick.h", |
| 95 | + "$_checkout_dir/src/cocoa_joystick.m", |
| 96 | + "$_checkout_dir/src/cocoa_monitor.m", |
| 97 | + "$_checkout_dir/src/cocoa_platform.h", |
| 98 | + "$_checkout_dir/src/cocoa_time.c", |
| 99 | + "$_checkout_dir/src/cocoa_window.m", |
| 100 | + "$_checkout_dir/src/nsgl_context.m", |
| 101 | + "$_checkout_dir/src/posix_module.c", |
| 102 | + "$_checkout_dir/src/posix_thread.c", |
| 103 | + "$_checkout_dir/src/posix_thread.h", |
| 104 | + ] |
| 105 | + |
| 106 | + defines = [ "_GLFW_COCOA" ] |
| 107 | + |
| 108 | + cflags = [ |
| 109 | + "-Wno-deprecated-declarations", |
| 110 | + "-Wno-objc-multiple-method-names", |
| 111 | + ] |
| 112 | + |
| 113 | + frameworks = [ |
| 114 | + "CoreVideo.framework", |
| 115 | + "IOKit.framework", |
| 116 | + ] |
| 117 | + } |
| 118 | + |
| 119 | + if (glfw_vulkan_library != "") { |
| 120 | + defines += [ "_GLFW_VULKAN_LIBRARY=" + glfw_vulkan_library ] |
| 121 | + } |
| 122 | + |
| 123 | + configs -= [ "//build/config/compiler:chromium_code" ] |
| 124 | + configs += [ "//build/config/compiler:no_chromium_code" ] |
| 125 | +} |
0 commit comments