mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-08-17 02:20:25 +03:00
Build kitty against bundled glfw
This commit is contained in:
parent
9307486254
commit
dfd8a69cf2
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -5,5 +5,6 @@ kitty/key_encoding.py linguist-generated=true
|
||||
kitty/rgb.py linguist-generated=true
|
||||
kitty/gl-wrapper.* linguist-generated=true
|
||||
kitty/khrplatform.h linguist-generated=true
|
||||
glfw/*.c linguist-vendored
|
||||
glfw/*.h linguist-vendored
|
||||
kitty/glfw-wrapper.* linguist-generated=true
|
||||
glfw/*.c linguist-vendored=true
|
||||
glfw/*.h linguist-vendored=true
|
||||
|
@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
cloc --exclude-list-file <(echo -e 'kitty/wcwidth9.h\nkitty/glfw.c\nkitty/keys.h\nkitty/charsets.c\nkitty/key_encoding.py\nkitty/rgb.py\nkitty/gl.h\nkitty/gl-wrapper.h\nkitty/gl-wrapper.c\nkitty/khrplatform.h') kitty
|
||||
cloc --exclude-list-file <(echo -e 'kitty/wcwidth9.h\nkitty/glfw.c\nkitty/keys.h\nkitty/charsets.c\nkitty/key_encoding.py\nkitty/rgb.py\nkitty/gl.h\nkitty/gl-wrapper.h\nkitty/gl-wrapper.c\nkitty/khrplatform.h\nkitty/glfw-wrapper.h\nkitty/glfw-wrapper.c') kitty
|
||||
|
114
glfw/glfw.py
114
glfw/glfw.py
@ -15,7 +15,10 @@
|
||||
|
||||
def init_env(env, pkg_config, at_least_version, module='x11'):
|
||||
ans = env.copy()
|
||||
ans.cflags = [x for x in ans.cflags if x not in '-Wpedantic -Wextra -pedantic-errors'.split()]
|
||||
ans.cflags = [
|
||||
x for x in ans.cflags
|
||||
if x not in '-Wpedantic -Wextra -pedantic-errors'.split()
|
||||
]
|
||||
ans.cflags.append('-pthread')
|
||||
ans.cflags.append('-fpic')
|
||||
ans.ldpaths.append('-pthread')
|
||||
@ -75,6 +78,113 @@ def patch_in_file(path, pfunc):
|
||||
f.write(nraw)
|
||||
|
||||
|
||||
class Arg:
|
||||
|
||||
def __init__(self, decl):
|
||||
self.type, self.name = decl.rsplit(' ', 1)
|
||||
self.type = self.type.strip()
|
||||
self.name = self.name.strip()
|
||||
while self.name.startswith('*'):
|
||||
self.name = self.name[1:]
|
||||
self.type = self.type + '*'
|
||||
|
||||
def __repr__(self):
|
||||
return 'Arg({}, {})'.format(self.type, self.name)
|
||||
|
||||
|
||||
class Function:
|
||||
|
||||
def __init__(self, declaration):
|
||||
m = re.match(
|
||||
r'(.+?)\s+(glfw[A-Z][a-zA-Z0-9]+)[(](.+)[)]$', declaration
|
||||
)
|
||||
if m is None:
|
||||
raise SystemExit('Failed to parse ' + declaration)
|
||||
self.restype = m.group(1).strip()
|
||||
self.name = m.group(2)
|
||||
args = m.group(3).strip().split(',')
|
||||
args = [x.strip() for x in args]
|
||||
self.args = []
|
||||
for a in args:
|
||||
if a == 'void':
|
||||
continue
|
||||
self.args.append(Arg(a))
|
||||
|
||||
def declaration(self):
|
||||
return 'typedef {restype} (*{name}_func)({args});\n{name}_func {name}_impl;\n#define {name} {name}_impl'.format(
|
||||
restype=self.restype,
|
||||
name=self.name,
|
||||
args=', '.join(a.type for a in self.args)
|
||||
)
|
||||
|
||||
def load(self):
|
||||
ans = '*(void **) (&{name}_impl) = dlsym(handle, "{name}");'.format(
|
||||
name=self.name
|
||||
)
|
||||
ans += '\n if ({name}_impl == NULL) fail("Failed to load glfw function {name} with error: %s", dlerror());'.format(
|
||||
name=self.name
|
||||
)
|
||||
return ans
|
||||
|
||||
|
||||
def generate_wrappers(glfw_header, glfw_native_header):
|
||||
src = open(glfw_header).read()
|
||||
functions = []
|
||||
first = None
|
||||
for m in re.finditer(r'^GLFWAPI\s+(.+[)]);\s*$', src, flags=re.MULTILINE):
|
||||
if first is None:
|
||||
first = m.start()
|
||||
decl = m.group(1)
|
||||
if 'VkInstance' in decl:
|
||||
continue
|
||||
functions.append(Function(decl))
|
||||
declarations = [f.declaration() for f in functions]
|
||||
p = src.find(' * GLFW API tokens')
|
||||
p = src.find('*/', p)
|
||||
preamble = src[p + 2:first]
|
||||
header = '''\
|
||||
#pragma once
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
{}
|
||||
|
||||
{}
|
||||
|
||||
const char* load_glfw(const char* path);
|
||||
'''.format(preamble, '\n\n'.join(declarations))
|
||||
with open('../kitty/glfw-wrapper.h', 'w') as f:
|
||||
f.write(header)
|
||||
|
||||
code = '''
|
||||
#include <dlfcn.h>
|
||||
#include "data-types.h"
|
||||
#include "glfw-wrapper.h"
|
||||
|
||||
static void* handle = NULL;
|
||||
|
||||
#define fail(msg, ...) { snprintf(buf, sizeof(buf), msg, __VA_ARGS__); return buf; }
|
||||
|
||||
const char*
|
||||
load_glfw(const char* path) {
|
||||
static char buf[2048];
|
||||
handle = dlopen(path, RTLD_LAZY);
|
||||
if (handle == NULL) fail("Failed to dlopen %s with error: %s", path, dlerror());
|
||||
dlerror();
|
||||
|
||||
LOAD
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
unload_glfw() {
|
||||
if (handle) { dlclose(handle); handle = NULL; }
|
||||
}
|
||||
'''.replace('LOAD', '\n\n '.join(f.load() for f in functions))
|
||||
with open('../kitty/glfw-wrapper.c', 'w') as f:
|
||||
f.write(code)
|
||||
|
||||
|
||||
def main():
|
||||
os.chdir(sys.argv[-1])
|
||||
sinfo = collect_source_information()
|
||||
@ -84,6 +194,7 @@ def main():
|
||||
for name in headers + sources:
|
||||
files_to_copy.add(os.path.abspath(os.path.join('src', name)))
|
||||
glfw_header = os.path.abspath('include/GLFW/glfw3.h')
|
||||
glfw_native_header = os.path.abspath('include/GLFW/glfw3native.h')
|
||||
os.chdir(base)
|
||||
for x in os.listdir('.'):
|
||||
if x.rpartition('.') in ('c', 'h'):
|
||||
@ -99,6 +210,7 @@ def main():
|
||||
ensure_ascii=False,
|
||||
sort_keys=True
|
||||
)
|
||||
generate_wrappers(glfw_header, glfw_native_header)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "screen.h"
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "glfw-wrapper.h"
|
||||
|
||||
static char glbuf[4096];
|
||||
|
||||
|
350
kitty/glfw-wrapper.c
generated
Normal file
350
kitty/glfw-wrapper.c
generated
Normal file
@ -0,0 +1,350 @@
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include "data-types.h"
|
||||
#include "glfw-wrapper.h"
|
||||
|
||||
static void* handle = NULL;
|
||||
|
||||
#define fail(msg, ...) { snprintf(buf, sizeof(buf), msg, __VA_ARGS__); return buf; }
|
||||
|
||||
const char*
|
||||
load_glfw(const char* path) {
|
||||
static char buf[2048];
|
||||
handle = dlopen(path, RTLD_LAZY);
|
||||
if (handle == NULL) fail("Failed to dlopen %s with error: %s", path, dlerror());
|
||||
dlerror();
|
||||
|
||||
*(void **) (&glfwInit_impl) = dlsym(handle, "glfwInit");
|
||||
if (glfwInit_impl == NULL) fail("Failed to load glfw function glfwInit with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwTerminate_impl) = dlsym(handle, "glfwTerminate");
|
||||
if (glfwTerminate_impl == NULL) fail("Failed to load glfw function glfwTerminate with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwInitHint_impl) = dlsym(handle, "glfwInitHint");
|
||||
if (glfwInitHint_impl == NULL) fail("Failed to load glfw function glfwInitHint with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwInitHintString_impl) = dlsym(handle, "glfwInitHintString");
|
||||
if (glfwInitHintString_impl == NULL) fail("Failed to load glfw function glfwInitHintString with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetVersion_impl) = dlsym(handle, "glfwGetVersion");
|
||||
if (glfwGetVersion_impl == NULL) fail("Failed to load glfw function glfwGetVersion with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetVersionString_impl) = dlsym(handle, "glfwGetVersionString");
|
||||
if (glfwGetVersionString_impl == NULL) fail("Failed to load glfw function glfwGetVersionString with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetError_impl) = dlsym(handle, "glfwGetError");
|
||||
if (glfwGetError_impl == NULL) fail("Failed to load glfw function glfwGetError with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetErrorCallback_impl) = dlsym(handle, "glfwSetErrorCallback");
|
||||
if (glfwSetErrorCallback_impl == NULL) fail("Failed to load glfw function glfwSetErrorCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetMonitors_impl) = dlsym(handle, "glfwGetMonitors");
|
||||
if (glfwGetMonitors_impl == NULL) fail("Failed to load glfw function glfwGetMonitors with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetPrimaryMonitor_impl) = dlsym(handle, "glfwGetPrimaryMonitor");
|
||||
if (glfwGetPrimaryMonitor_impl == NULL) fail("Failed to load glfw function glfwGetPrimaryMonitor with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetMonitorPos_impl) = dlsym(handle, "glfwGetMonitorPos");
|
||||
if (glfwGetMonitorPos_impl == NULL) fail("Failed to load glfw function glfwGetMonitorPos with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetMonitorPhysicalSize_impl) = dlsym(handle, "glfwGetMonitorPhysicalSize");
|
||||
if (glfwGetMonitorPhysicalSize_impl == NULL) fail("Failed to load glfw function glfwGetMonitorPhysicalSize with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetMonitorContentScale_impl) = dlsym(handle, "glfwGetMonitorContentScale");
|
||||
if (glfwGetMonitorContentScale_impl == NULL) fail("Failed to load glfw function glfwGetMonitorContentScale with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetMonitorName_impl) = dlsym(handle, "glfwGetMonitorName");
|
||||
if (glfwGetMonitorName_impl == NULL) fail("Failed to load glfw function glfwGetMonitorName with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetMonitorCallback_impl) = dlsym(handle, "glfwSetMonitorCallback");
|
||||
if (glfwSetMonitorCallback_impl == NULL) fail("Failed to load glfw function glfwSetMonitorCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetVideoModes_impl) = dlsym(handle, "glfwGetVideoModes");
|
||||
if (glfwGetVideoModes_impl == NULL) fail("Failed to load glfw function glfwGetVideoModes with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetVideoMode_impl) = dlsym(handle, "glfwGetVideoMode");
|
||||
if (glfwGetVideoMode_impl == NULL) fail("Failed to load glfw function glfwGetVideoMode with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetGamma_impl) = dlsym(handle, "glfwSetGamma");
|
||||
if (glfwSetGamma_impl == NULL) fail("Failed to load glfw function glfwSetGamma with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetGammaRamp_impl) = dlsym(handle, "glfwGetGammaRamp");
|
||||
if (glfwGetGammaRamp_impl == NULL) fail("Failed to load glfw function glfwGetGammaRamp with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetGammaRamp_impl) = dlsym(handle, "glfwSetGammaRamp");
|
||||
if (glfwSetGammaRamp_impl == NULL) fail("Failed to load glfw function glfwSetGammaRamp with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwDefaultWindowHints_impl) = dlsym(handle, "glfwDefaultWindowHints");
|
||||
if (glfwDefaultWindowHints_impl == NULL) fail("Failed to load glfw function glfwDefaultWindowHints with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwWindowHint_impl) = dlsym(handle, "glfwWindowHint");
|
||||
if (glfwWindowHint_impl == NULL) fail("Failed to load glfw function glfwWindowHint with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwCreateWindow_impl) = dlsym(handle, "glfwCreateWindow");
|
||||
if (glfwCreateWindow_impl == NULL) fail("Failed to load glfw function glfwCreateWindow with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwDestroyWindow_impl) = dlsym(handle, "glfwDestroyWindow");
|
||||
if (glfwDestroyWindow_impl == NULL) fail("Failed to load glfw function glfwDestroyWindow with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwWindowShouldClose_impl) = dlsym(handle, "glfwWindowShouldClose");
|
||||
if (glfwWindowShouldClose_impl == NULL) fail("Failed to load glfw function glfwWindowShouldClose with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowShouldClose_impl) = dlsym(handle, "glfwSetWindowShouldClose");
|
||||
if (glfwSetWindowShouldClose_impl == NULL) fail("Failed to load glfw function glfwSetWindowShouldClose with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowTitle_impl) = dlsym(handle, "glfwSetWindowTitle");
|
||||
if (glfwSetWindowTitle_impl == NULL) fail("Failed to load glfw function glfwSetWindowTitle with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowIcon_impl) = dlsym(handle, "glfwSetWindowIcon");
|
||||
if (glfwSetWindowIcon_impl == NULL) fail("Failed to load glfw function glfwSetWindowIcon with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetWindowPos_impl) = dlsym(handle, "glfwGetWindowPos");
|
||||
if (glfwGetWindowPos_impl == NULL) fail("Failed to load glfw function glfwGetWindowPos with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowPos_impl) = dlsym(handle, "glfwSetWindowPos");
|
||||
if (glfwSetWindowPos_impl == NULL) fail("Failed to load glfw function glfwSetWindowPos with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetWindowSize_impl) = dlsym(handle, "glfwGetWindowSize");
|
||||
if (glfwGetWindowSize_impl == NULL) fail("Failed to load glfw function glfwGetWindowSize with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowSizeLimits_impl) = dlsym(handle, "glfwSetWindowSizeLimits");
|
||||
if (glfwSetWindowSizeLimits_impl == NULL) fail("Failed to load glfw function glfwSetWindowSizeLimits with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowAspectRatio_impl) = dlsym(handle, "glfwSetWindowAspectRatio");
|
||||
if (glfwSetWindowAspectRatio_impl == NULL) fail("Failed to load glfw function glfwSetWindowAspectRatio with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowSize_impl) = dlsym(handle, "glfwSetWindowSize");
|
||||
if (glfwSetWindowSize_impl == NULL) fail("Failed to load glfw function glfwSetWindowSize with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetFramebufferSize_impl) = dlsym(handle, "glfwGetFramebufferSize");
|
||||
if (glfwGetFramebufferSize_impl == NULL) fail("Failed to load glfw function glfwGetFramebufferSize with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetWindowFrameSize_impl) = dlsym(handle, "glfwGetWindowFrameSize");
|
||||
if (glfwGetWindowFrameSize_impl == NULL) fail("Failed to load glfw function glfwGetWindowFrameSize with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetWindowContentScale_impl) = dlsym(handle, "glfwGetWindowContentScale");
|
||||
if (glfwGetWindowContentScale_impl == NULL) fail("Failed to load glfw function glfwGetWindowContentScale with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetWindowOpacity_impl) = dlsym(handle, "glfwGetWindowOpacity");
|
||||
if (glfwGetWindowOpacity_impl == NULL) fail("Failed to load glfw function glfwGetWindowOpacity with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowOpacity_impl) = dlsym(handle, "glfwSetWindowOpacity");
|
||||
if (glfwSetWindowOpacity_impl == NULL) fail("Failed to load glfw function glfwSetWindowOpacity with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwIconifyWindow_impl) = dlsym(handle, "glfwIconifyWindow");
|
||||
if (glfwIconifyWindow_impl == NULL) fail("Failed to load glfw function glfwIconifyWindow with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwRestoreWindow_impl) = dlsym(handle, "glfwRestoreWindow");
|
||||
if (glfwRestoreWindow_impl == NULL) fail("Failed to load glfw function glfwRestoreWindow with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwMaximizeWindow_impl) = dlsym(handle, "glfwMaximizeWindow");
|
||||
if (glfwMaximizeWindow_impl == NULL) fail("Failed to load glfw function glfwMaximizeWindow with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwShowWindow_impl) = dlsym(handle, "glfwShowWindow");
|
||||
if (glfwShowWindow_impl == NULL) fail("Failed to load glfw function glfwShowWindow with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwHideWindow_impl) = dlsym(handle, "glfwHideWindow");
|
||||
if (glfwHideWindow_impl == NULL) fail("Failed to load glfw function glfwHideWindow with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwFocusWindow_impl) = dlsym(handle, "glfwFocusWindow");
|
||||
if (glfwFocusWindow_impl == NULL) fail("Failed to load glfw function glfwFocusWindow with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwRequestWindowAttention_impl) = dlsym(handle, "glfwRequestWindowAttention");
|
||||
if (glfwRequestWindowAttention_impl == NULL) fail("Failed to load glfw function glfwRequestWindowAttention with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetWindowMonitor_impl) = dlsym(handle, "glfwGetWindowMonitor");
|
||||
if (glfwGetWindowMonitor_impl == NULL) fail("Failed to load glfw function glfwGetWindowMonitor with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowMonitor_impl) = dlsym(handle, "glfwSetWindowMonitor");
|
||||
if (glfwSetWindowMonitor_impl == NULL) fail("Failed to load glfw function glfwSetWindowMonitor with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetWindowAttrib_impl) = dlsym(handle, "glfwGetWindowAttrib");
|
||||
if (glfwGetWindowAttrib_impl == NULL) fail("Failed to load glfw function glfwGetWindowAttrib with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowAttrib_impl) = dlsym(handle, "glfwSetWindowAttrib");
|
||||
if (glfwSetWindowAttrib_impl == NULL) fail("Failed to load glfw function glfwSetWindowAttrib with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowUserPointer_impl) = dlsym(handle, "glfwSetWindowUserPointer");
|
||||
if (glfwSetWindowUserPointer_impl == NULL) fail("Failed to load glfw function glfwSetWindowUserPointer with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetWindowUserPointer_impl) = dlsym(handle, "glfwGetWindowUserPointer");
|
||||
if (glfwGetWindowUserPointer_impl == NULL) fail("Failed to load glfw function glfwGetWindowUserPointer with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowPosCallback_impl) = dlsym(handle, "glfwSetWindowPosCallback");
|
||||
if (glfwSetWindowPosCallback_impl == NULL) fail("Failed to load glfw function glfwSetWindowPosCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowSizeCallback_impl) = dlsym(handle, "glfwSetWindowSizeCallback");
|
||||
if (glfwSetWindowSizeCallback_impl == NULL) fail("Failed to load glfw function glfwSetWindowSizeCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowCloseCallback_impl) = dlsym(handle, "glfwSetWindowCloseCallback");
|
||||
if (glfwSetWindowCloseCallback_impl == NULL) fail("Failed to load glfw function glfwSetWindowCloseCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowRefreshCallback_impl) = dlsym(handle, "glfwSetWindowRefreshCallback");
|
||||
if (glfwSetWindowRefreshCallback_impl == NULL) fail("Failed to load glfw function glfwSetWindowRefreshCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowFocusCallback_impl) = dlsym(handle, "glfwSetWindowFocusCallback");
|
||||
if (glfwSetWindowFocusCallback_impl == NULL) fail("Failed to load glfw function glfwSetWindowFocusCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowIconifyCallback_impl) = dlsym(handle, "glfwSetWindowIconifyCallback");
|
||||
if (glfwSetWindowIconifyCallback_impl == NULL) fail("Failed to load glfw function glfwSetWindowIconifyCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetWindowMaximizeCallback_impl) = dlsym(handle, "glfwSetWindowMaximizeCallback");
|
||||
if (glfwSetWindowMaximizeCallback_impl == NULL) fail("Failed to load glfw function glfwSetWindowMaximizeCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetFramebufferSizeCallback_impl) = dlsym(handle, "glfwSetFramebufferSizeCallback");
|
||||
if (glfwSetFramebufferSizeCallback_impl == NULL) fail("Failed to load glfw function glfwSetFramebufferSizeCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwPollEvents_impl) = dlsym(handle, "glfwPollEvents");
|
||||
if (glfwPollEvents_impl == NULL) fail("Failed to load glfw function glfwPollEvents with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwWaitEvents_impl) = dlsym(handle, "glfwWaitEvents");
|
||||
if (glfwWaitEvents_impl == NULL) fail("Failed to load glfw function glfwWaitEvents with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwWaitEventsTimeout_impl) = dlsym(handle, "glfwWaitEventsTimeout");
|
||||
if (glfwWaitEventsTimeout_impl == NULL) fail("Failed to load glfw function glfwWaitEventsTimeout with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwPostEmptyEvent_impl) = dlsym(handle, "glfwPostEmptyEvent");
|
||||
if (glfwPostEmptyEvent_impl == NULL) fail("Failed to load glfw function glfwPostEmptyEvent with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetInputMode_impl) = dlsym(handle, "glfwGetInputMode");
|
||||
if (glfwGetInputMode_impl == NULL) fail("Failed to load glfw function glfwGetInputMode with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetInputMode_impl) = dlsym(handle, "glfwSetInputMode");
|
||||
if (glfwSetInputMode_impl == NULL) fail("Failed to load glfw function glfwSetInputMode with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetKeyName_impl) = dlsym(handle, "glfwGetKeyName");
|
||||
if (glfwGetKeyName_impl == NULL) fail("Failed to load glfw function glfwGetKeyName with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetKeyScancode_impl) = dlsym(handle, "glfwGetKeyScancode");
|
||||
if (glfwGetKeyScancode_impl == NULL) fail("Failed to load glfw function glfwGetKeyScancode with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetKey_impl) = dlsym(handle, "glfwGetKey");
|
||||
if (glfwGetKey_impl == NULL) fail("Failed to load glfw function glfwGetKey with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetMouseButton_impl) = dlsym(handle, "glfwGetMouseButton");
|
||||
if (glfwGetMouseButton_impl == NULL) fail("Failed to load glfw function glfwGetMouseButton with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetCursorPos_impl) = dlsym(handle, "glfwGetCursorPos");
|
||||
if (glfwGetCursorPos_impl == NULL) fail("Failed to load glfw function glfwGetCursorPos with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetCursorPos_impl) = dlsym(handle, "glfwSetCursorPos");
|
||||
if (glfwSetCursorPos_impl == NULL) fail("Failed to load glfw function glfwSetCursorPos with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwCreateCursor_impl) = dlsym(handle, "glfwCreateCursor");
|
||||
if (glfwCreateCursor_impl == NULL) fail("Failed to load glfw function glfwCreateCursor with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwCreateStandardCursor_impl) = dlsym(handle, "glfwCreateStandardCursor");
|
||||
if (glfwCreateStandardCursor_impl == NULL) fail("Failed to load glfw function glfwCreateStandardCursor with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwDestroyCursor_impl) = dlsym(handle, "glfwDestroyCursor");
|
||||
if (glfwDestroyCursor_impl == NULL) fail("Failed to load glfw function glfwDestroyCursor with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetCursor_impl) = dlsym(handle, "glfwSetCursor");
|
||||
if (glfwSetCursor_impl == NULL) fail("Failed to load glfw function glfwSetCursor with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetKeyCallback_impl) = dlsym(handle, "glfwSetKeyCallback");
|
||||
if (glfwSetKeyCallback_impl == NULL) fail("Failed to load glfw function glfwSetKeyCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetCharCallback_impl) = dlsym(handle, "glfwSetCharCallback");
|
||||
if (glfwSetCharCallback_impl == NULL) fail("Failed to load glfw function glfwSetCharCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetCharModsCallback_impl) = dlsym(handle, "glfwSetCharModsCallback");
|
||||
if (glfwSetCharModsCallback_impl == NULL) fail("Failed to load glfw function glfwSetCharModsCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetMouseButtonCallback_impl) = dlsym(handle, "glfwSetMouseButtonCallback");
|
||||
if (glfwSetMouseButtonCallback_impl == NULL) fail("Failed to load glfw function glfwSetMouseButtonCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetCursorPosCallback_impl) = dlsym(handle, "glfwSetCursorPosCallback");
|
||||
if (glfwSetCursorPosCallback_impl == NULL) fail("Failed to load glfw function glfwSetCursorPosCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetCursorEnterCallback_impl) = dlsym(handle, "glfwSetCursorEnterCallback");
|
||||
if (glfwSetCursorEnterCallback_impl == NULL) fail("Failed to load glfw function glfwSetCursorEnterCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetScrollCallback_impl) = dlsym(handle, "glfwSetScrollCallback");
|
||||
if (glfwSetScrollCallback_impl == NULL) fail("Failed to load glfw function glfwSetScrollCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetDropCallback_impl) = dlsym(handle, "glfwSetDropCallback");
|
||||
if (glfwSetDropCallback_impl == NULL) fail("Failed to load glfw function glfwSetDropCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwJoystickPresent_impl) = dlsym(handle, "glfwJoystickPresent");
|
||||
if (glfwJoystickPresent_impl == NULL) fail("Failed to load glfw function glfwJoystickPresent with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetJoystickAxes_impl) = dlsym(handle, "glfwGetJoystickAxes");
|
||||
if (glfwGetJoystickAxes_impl == NULL) fail("Failed to load glfw function glfwGetJoystickAxes with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetJoystickButtons_impl) = dlsym(handle, "glfwGetJoystickButtons");
|
||||
if (glfwGetJoystickButtons_impl == NULL) fail("Failed to load glfw function glfwGetJoystickButtons with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetJoystickHats_impl) = dlsym(handle, "glfwGetJoystickHats");
|
||||
if (glfwGetJoystickHats_impl == NULL) fail("Failed to load glfw function glfwGetJoystickHats with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetJoystickName_impl) = dlsym(handle, "glfwGetJoystickName");
|
||||
if (glfwGetJoystickName_impl == NULL) fail("Failed to load glfw function glfwGetJoystickName with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetJoystickGUID_impl) = dlsym(handle, "glfwGetJoystickGUID");
|
||||
if (glfwGetJoystickGUID_impl == NULL) fail("Failed to load glfw function glfwGetJoystickGUID with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwJoystickIsGamepad_impl) = dlsym(handle, "glfwJoystickIsGamepad");
|
||||
if (glfwJoystickIsGamepad_impl == NULL) fail("Failed to load glfw function glfwJoystickIsGamepad with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetJoystickCallback_impl) = dlsym(handle, "glfwSetJoystickCallback");
|
||||
if (glfwSetJoystickCallback_impl == NULL) fail("Failed to load glfw function glfwSetJoystickCallback with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwUpdateGamepadMappings_impl) = dlsym(handle, "glfwUpdateGamepadMappings");
|
||||
if (glfwUpdateGamepadMappings_impl == NULL) fail("Failed to load glfw function glfwUpdateGamepadMappings with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetGamepadName_impl) = dlsym(handle, "glfwGetGamepadName");
|
||||
if (glfwGetGamepadName_impl == NULL) fail("Failed to load glfw function glfwGetGamepadName with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetGamepadState_impl) = dlsym(handle, "glfwGetGamepadState");
|
||||
if (glfwGetGamepadState_impl == NULL) fail("Failed to load glfw function glfwGetGamepadState with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetClipboardString_impl) = dlsym(handle, "glfwSetClipboardString");
|
||||
if (glfwSetClipboardString_impl == NULL) fail("Failed to load glfw function glfwSetClipboardString with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetClipboardString_impl) = dlsym(handle, "glfwGetClipboardString");
|
||||
if (glfwGetClipboardString_impl == NULL) fail("Failed to load glfw function glfwGetClipboardString with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetTime_impl) = dlsym(handle, "glfwGetTime");
|
||||
if (glfwGetTime_impl == NULL) fail("Failed to load glfw function glfwGetTime with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSetTime_impl) = dlsym(handle, "glfwSetTime");
|
||||
if (glfwSetTime_impl == NULL) fail("Failed to load glfw function glfwSetTime with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetTimerValue_impl) = dlsym(handle, "glfwGetTimerValue");
|
||||
if (glfwGetTimerValue_impl == NULL) fail("Failed to load glfw function glfwGetTimerValue with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetTimerFrequency_impl) = dlsym(handle, "glfwGetTimerFrequency");
|
||||
if (glfwGetTimerFrequency_impl == NULL) fail("Failed to load glfw function glfwGetTimerFrequency with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwMakeContextCurrent_impl) = dlsym(handle, "glfwMakeContextCurrent");
|
||||
if (glfwMakeContextCurrent_impl == NULL) fail("Failed to load glfw function glfwMakeContextCurrent with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetCurrentContext_impl) = dlsym(handle, "glfwGetCurrentContext");
|
||||
if (glfwGetCurrentContext_impl == NULL) fail("Failed to load glfw function glfwGetCurrentContext with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSwapBuffers_impl) = dlsym(handle, "glfwSwapBuffers");
|
||||
if (glfwSwapBuffers_impl == NULL) fail("Failed to load glfw function glfwSwapBuffers with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwSwapInterval_impl) = dlsym(handle, "glfwSwapInterval");
|
||||
if (glfwSwapInterval_impl == NULL) fail("Failed to load glfw function glfwSwapInterval with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwExtensionSupported_impl) = dlsym(handle, "glfwExtensionSupported");
|
||||
if (glfwExtensionSupported_impl == NULL) fail("Failed to load glfw function glfwExtensionSupported with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetProcAddress_impl) = dlsym(handle, "glfwGetProcAddress");
|
||||
if (glfwGetProcAddress_impl == NULL) fail("Failed to load glfw function glfwGetProcAddress with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwVulkanSupported_impl) = dlsym(handle, "glfwVulkanSupported");
|
||||
if (glfwVulkanSupported_impl == NULL) fail("Failed to load glfw function glfwVulkanSupported with error: %s", dlerror());
|
||||
|
||||
*(void **) (&glfwGetRequiredInstanceExtensions_impl) = dlsym(handle, "glfwGetRequiredInstanceExtensions");
|
||||
if (glfwGetRequiredInstanceExtensions_impl == NULL) fail("Failed to load glfw function glfwGetRequiredInstanceExtensions with error: %s", dlerror());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
unload_glfw() {
|
||||
if (handle) { dlclose(handle); handle = NULL; }
|
||||
}
|
1786
kitty/glfw-wrapper.h
generated
Normal file
1786
kitty/glfw-wrapper.h
generated
Normal file
File diff suppressed because it is too large
Load Diff
41
kitty/glfw.c
41
kitty/glfw.c
@ -6,23 +6,11 @@
|
||||
|
||||
#include "state.h"
|
||||
#include <structmember.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "glfw-wrapper.h"
|
||||
#if defined(__APPLE__)
|
||||
#define GLFW_EXPOSE_NATIVE_COCOA
|
||||
#include <GLFW/glfw3native.h>
|
||||
extern bool cocoa_make_window_resizable(void *w);
|
||||
#endif
|
||||
|
||||
#if GLFW_VERSION_MAJOR < 3 || (GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR < 2)
|
||||
#error "glfw >= 3.2 required"
|
||||
#endif
|
||||
|
||||
#if GLFW_VERSION_MAJOR > 3 || (GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR > 2)
|
||||
#define has_request_attention
|
||||
#define has_init_hint_string
|
||||
#define has_content_scale_query
|
||||
#endif
|
||||
|
||||
#if GLFW_KEY_LAST >= MAX_KEY_COUNT
|
||||
#error "glfw has too many keys, you should increase MAX_KEY_COUNT"
|
||||
#endif
|
||||
@ -316,7 +304,11 @@ error_callback(int error, const char* description) {
|
||||
|
||||
|
||||
PyObject*
|
||||
glfw_init(PyObject UNUSED *self) {
|
||||
glfw_init(PyObject UNUSED *self, PyObject *args) {
|
||||
const char* path;
|
||||
if (!PyArg_ParseTuple(args, "s", &path)) return NULL;
|
||||
const char* err = load_glfw(path);
|
||||
if (err) { PyErr_SetString(PyExc_RuntimeError, err); return NULL; }
|
||||
glfwSetErrorCallback(error_callback);
|
||||
PyObject *ans = glfwInit() ? Py_True: Py_False;
|
||||
Py_INCREF(ans);
|
||||
@ -386,9 +378,7 @@ glfw_init_hint_string(PyObject UNUSED *self, PyObject *args) {
|
||||
int hint_id;
|
||||
char *hint;
|
||||
if (!PyArg_ParseTuple(args, "is", &hint_id, &hint)) return NULL;
|
||||
#ifdef has_init_hint_string
|
||||
glfwInitHintString(hint_id, hint);
|
||||
#endif
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
@ -404,16 +394,10 @@ get_clipboard_string(PyObject UNUSED *self) {
|
||||
|
||||
static PyObject*
|
||||
get_content_scale_for_window(PyObject UNUSED *self) {
|
||||
#ifdef has_content_scale_query
|
||||
OSWindow *w = global_state.callback_os_window ? global_state.callback_os_window : global_state.os_windows;
|
||||
float xscale, yscale;
|
||||
glfwGetWindowContentScale(w->handle, &xscale, &yscale);
|
||||
return Py_BuildValue("ff", xscale, yscale);
|
||||
#else
|
||||
(void)self;
|
||||
PyErr_SetString(PyExc_NotImplementedError, "glfw version is too old");
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
@ -488,9 +472,7 @@ void
|
||||
request_window_attention(id_type kitty_window_id) {
|
||||
OSWindow *w = os_window_for_kitty_window(kitty_window_id);
|
||||
if (w) {
|
||||
#ifdef has_request_attention
|
||||
glfwRequestWindowAttention(w->handle);
|
||||
#endif
|
||||
glfwPostEmptyEvent();
|
||||
}
|
||||
}
|
||||
@ -549,15 +531,10 @@ primary_monitor_size(PyObject UNUSED *self) {
|
||||
|
||||
static PyObject*
|
||||
primary_monitor_content_scale(PyObject UNUSED *self) {
|
||||
#ifdef has_content_scale_query
|
||||
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
|
||||
float xscale, yscale;
|
||||
glfwGetMonitorContentScale(monitor, &xscale, &yscale);
|
||||
return Py_BuildValue("ff", xscale, yscale);
|
||||
#else
|
||||
PyErr_SetString(PyExc_NotImplementedError, "glfw version is too old");
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
@ -572,7 +549,7 @@ os_window_should_close(PyObject UNUSED *self, PyObject *args) {
|
||||
if (should_os_window_close(w)) Py_RETURN_TRUE;
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
glfwSetWindowShouldClose(w->handle, q ? GLFW_TRUE : GL_FALSE);
|
||||
glfwSetWindowShouldClose(w->handle, q ? GLFW_TRUE : GLFW_FALSE);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
}
|
||||
@ -607,7 +584,7 @@ static PyMethodDef module_methods[] = {
|
||||
METHODB(glfw_window_hint, METH_VARARGS),
|
||||
METHODB(os_window_should_close, METH_VARARGS),
|
||||
METHODB(os_window_swap_buffers, METH_VARARGS),
|
||||
{"glfw_init", (PyCFunction)glfw_init, METH_NOARGS, ""},
|
||||
{"glfw_init", (PyCFunction)glfw_init, METH_VARARGS, ""},
|
||||
{"glfw_terminate", (PyCFunction)glfw_terminate, METH_NOARGS, ""},
|
||||
{"glfw_wait_events", (PyCFunction)glfw_wait_events, METH_VARARGS, ""},
|
||||
{"glfw_post_empty_event", (PyCFunction)glfw_post_empty_event, METH_NOARGS, ""},
|
||||
@ -624,10 +601,8 @@ bool
|
||||
init_glfw(PyObject *m) {
|
||||
if (PyModule_AddFunctions(m, module_methods) != 0) return false;
|
||||
#define ADDC(n) if(PyModule_AddIntConstant(m, #n, n) != 0) return false;
|
||||
#ifdef GLFW_X11_WM_CLASS_NAME
|
||||
ADDC(GLFW_X11_WM_CLASS_NAME)
|
||||
ADDC(GLFW_X11_WM_CLASS_CLASS)
|
||||
#endif
|
||||
ADDC(GLFW_RELEASE);
|
||||
ADDC(GLFW_PRESS);
|
||||
ADDC(GLFW_REPEAT);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "keys.h"
|
||||
#include "state.h"
|
||||
#include "screen.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "glfw-wrapper.h"
|
||||
|
||||
const char*
|
||||
key_to_bytes(int glfw_key, bool smkx, bool extended, int mods, int action) {
|
||||
|
@ -16,7 +16,7 @@
|
||||
from .fast_data_types import (
|
||||
change_wcwidth, create_os_window, glfw_init, glfw_init_hint_string,
|
||||
glfw_terminate, install_sigchld_handler, set_default_window_icon,
|
||||
set_logical_dpi, set_options
|
||||
set_logical_dpi, set_options, GLFW_X11_WM_CLASS_NAME, GLFW_X11_WM_CLASS_CLASS
|
||||
)
|
||||
from .fonts.box_drawing import set_scale
|
||||
from .utils import (
|
||||
@ -25,11 +25,6 @@
|
||||
)
|
||||
from .window import load_shader_programs
|
||||
|
||||
try:
|
||||
from .fast_data_types import GLFW_X11_WM_CLASS_NAME, GLFW_X11_WM_CLASS_CLASS
|
||||
except ImportError:
|
||||
GLFW_X11_WM_CLASS_NAME = GLFW_X11_WM_CLASS_CLASS = None
|
||||
|
||||
|
||||
def load_all_shaders():
|
||||
load_shader_programs()
|
||||
@ -99,6 +94,7 @@ def main():
|
||||
sys.setswitchinterval(1000.0) # we have only a single python thread
|
||||
except AttributeError:
|
||||
pass # python compiled without threading
|
||||
base = os.path.dirname(os.path.abspath(__file__))
|
||||
if isosx:
|
||||
ensure_osx_locale()
|
||||
try:
|
||||
@ -137,10 +133,12 @@ def main():
|
||||
return
|
||||
opts = create_opts(args)
|
||||
change_wcwidth(not opts.use_system_wcwidth)
|
||||
if GLFW_X11_WM_CLASS_CLASS is not None:
|
||||
glfw_init_hint_string(GLFW_X11_WM_CLASS_CLASS, args.cls)
|
||||
if not glfw_init():
|
||||
glfw_module = 'cocoa' if isosx else 'x11'
|
||||
if not glfw_init(os.path.join(base, 'glfw-{}.so'.format(glfw_module))):
|
||||
raise SystemExit('GLFW initialization failed')
|
||||
if glfw_module == 'x11':
|
||||
glfw_init_hint_string(GLFW_X11_WM_CLASS_CLASS, args.cls)
|
||||
glfw_init_hint_string(GLFW_X11_WM_CLASS_NAME, args.cls)
|
||||
try:
|
||||
with setup_profiling(args):
|
||||
# Avoid needing to launch threads to reap zombies
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "lineops.h"
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "glfw-wrapper.h"
|
||||
|
||||
static MouseShape mouse_cursor_shape = BEAM;
|
||||
typedef enum MouseActions { PRESS, RELEASE, DRAG, MOVE } MouseAction;
|
||||
|
9
setup.py
9
setup.py
@ -202,15 +202,10 @@ def kitty_env():
|
||||
font_libs = pkg_config('fontconfig', '--libs')
|
||||
cflags.extend(pkg_config('harfbuzz', '--cflags-only-I'))
|
||||
font_libs.extend(pkg_config('harfbuzz', '--libs'))
|
||||
cflags.extend(pkg_config('glfw3', '--cflags-only-I'))
|
||||
pylib = get_python_flags(cflags)
|
||||
if isosx:
|
||||
glfw_ldflags = pkg_config('--libs', '--static', 'glfw3'
|
||||
) + ['-framework', 'OpenGL']
|
||||
else:
|
||||
glfw_ldflags = pkg_config('glfw3', '--libs')
|
||||
gl_libs = ['-framework', 'OpenGL'] if isosx else pkg_config('gl', '--libs')
|
||||
libpng = pkg_config('libpng', '--libs')
|
||||
ans.ldpaths += pylib + font_libs + glfw_ldflags + libpng + [
|
||||
ans.ldpaths += pylib + font_libs + gl_libs + libpng + [
|
||||
'-lunistring'
|
||||
]
|
||||
if not isosx:
|
||||
|
Loading…
Reference in New Issue
Block a user