| # Copyright 2017 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| config("glfw_config") { |
| include_dirs = [ |
| "include", |
| "deps", |
| ] |
| cflags = [ |
| "-Wall", |
| "-Wno-deprecated", |
| ] |
| |
| # add flags to avoid compiler warnings |
| cflags += [ |
| "-Wno-int-conversion", |
| "-Wno-implicit-function-declaration", |
| "-Wno-missing-field-initializers", |
| "-Wno-sign-compare", |
| ] |
| } |
| static_library("glfw") { |
| defines = [ |
| "_GLFW_BUILD_DLL", |
| "__GLFW_USE_HYBRID_HPG", |
| ] |
| sources = [ |
| "deps/getopt.c", |
| "deps/glad_vulkan.c", |
| "src/context.c", |
| "src/egl_context.c", |
| "src/init.c", |
| "src/input.c", |
| "src/monitor.c", |
| "src/osmesa_context.c", |
| "src/vulkan.c", |
| "src/window.c", |
| ] |
| if (is_mac) { |
| defines += [ |
| "_GLFW_COCOA", |
| "_GLFW_USE_RETINA", |
| ] |
| frameworks = [ |
| "Cocoa.framework", |
| "CoreFoundation.framework", |
| "CoreGraphics.framework", |
| "CoreVideo.framework", |
| "IOKit.framework", |
| "OpenGL.framework", |
| ] |
| sources += [ |
| "src/cocoa_init.m", |
| "src/cocoa_joystick.m", |
| "src/cocoa_monitor.m", |
| "src/cocoa_time.c", |
| "src/cocoa_window.m", |
| "src/nsgl_context.m", |
| "src/posix_thread.c", |
| ] |
| } else if (is_linux) { |
| defines += [ "_GLFW_X11" ] |
| sources += [ |
| "src/glx_context.c", |
| "src/linux_joystick.c", |
| "src/posix_thread.c", |
| "src/posix_time.c", |
| "src/x11_init.c", |
| "src/x11_monitor.c", |
| "src/x11_window.c", |
| "src/xkb_unicode.c", |
| ] |
| libs = [ |
| "X11", |
| "Xinerama", |
| "Xcursor", |
| "Xrandr", |
| ] |
| } |
| public_configs = [ ":glfw_config" ] |
| configs += [ "//build/config:Wno-conversion" ] |
| } |