Get it building on macOS
This commit is contained in:
parent
cfc99baac4
commit
3773aaa8a1
14
.travis.yml
14
.travis.yml
@ -75,8 +75,8 @@ matrix:
|
||||
env:
|
||||
global:
|
||||
- PYTHON=python3
|
||||
- PKG_CONFIG_PATH=$HOME/glfw/lib/pkgconfig:$HOME/harfbuzz/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||
- LD_LIBRARY_PATH=$HOME/glfw/lib:$HOME/harfbuzz/lib:$LD_LIBRARY_PATH
|
||||
- PKG_CONFIG_PATH=$HOME/harfbuzz/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||
- LD_LIBRARY_PATH=$HOME/harfbuzz/lib:$LD_LIBRARY_PATH
|
||||
- ASAN_OPTIONS=leak_check_at_exit=0
|
||||
|
||||
install: |
|
||||
@ -86,7 +86,7 @@ install: |
|
||||
if [[ "$USE_BREW" == "1" ]]; then
|
||||
brew update;
|
||||
brew install python3;
|
||||
brew install glfw;
|
||||
brew install libunistring;
|
||||
brew install freetype;
|
||||
brew install harfbuzz --without-glib --without-gobject-introspection --without-graphite2 --without-icu4c;
|
||||
else
|
||||
@ -95,13 +95,6 @@ install: |
|
||||
fi
|
||||
else
|
||||
pushd /tmp
|
||||
wget -O glfw-3.2.1.zip https://github.com/glfw/glfw/archive/3.2.1.zip
|
||||
unzip -q glfw-3.2.1.zip
|
||||
cd glfw-3.2.1
|
||||
cmake -DBUILD_SHARED_LIBS=ON -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF -DCMAKE_INSTALL_PREFIX=$HOME/glfw
|
||||
make
|
||||
make install
|
||||
|
||||
wget https://github.com/behdad/harfbuzz/releases/download/1.6.3/harfbuzz-1.6.3.tar.bz2
|
||||
tar xf harfbuzz-1.6.3.tar.bz2
|
||||
cd harfbuzz-1.6.3
|
||||
@ -111,7 +104,6 @@ install: |
|
||||
cd ..
|
||||
popd
|
||||
fi
|
||||
pkg-config --cflags glfw3
|
||||
pkg-config --cflags harfbuzz
|
||||
if [[ "$TRAVIS_OS_NAME" != 'osx' ]]; then
|
||||
PLIB=$(ldd `which python` | grep libpython | cut -d ' ' -f 3)
|
||||
|
||||
@ -89,14 +89,12 @@ the following dependencies are installed first.
|
||||
=== Dependencies
|
||||
|
||||
* python >= 3.5
|
||||
* glfw >= 3.2
|
||||
* harfbuzz >= 1.5.0
|
||||
* libunistring
|
||||
* zlib
|
||||
* libpng
|
||||
* freetype
|
||||
* fontconfig (not needed on macOS)
|
||||
* harfbuzz >= 1.5.0
|
||||
* xsel (only on X11 systems with glfw < 3.3)
|
||||
* ImageMagick (optional, needed to use the `kitty icat` tool to display images in the terminal)
|
||||
* gcc or clang (required only for building)
|
||||
* pkg-config (required only for building)
|
||||
@ -131,8 +129,7 @@ python3 /path/to/kitty/folder
|
||||
kitty is available as a macOS `dmg` file for easy installation from the
|
||||
link:../../releases[releases page]. You can also run kitty directly from
|
||||
source using the above install from source instructions, after installing its
|
||||
two dependencies (`python >= 3.5` and `glfw >= 3.2` using http://brew.sh/[brew]
|
||||
or a similar package manager)
|
||||
dependencies using http://brew.sh/[brew] or a similar package manager.
|
||||
|
||||
|
||||
== Design philosophy
|
||||
|
||||
@ -859,15 +859,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
||||
}
|
||||
|
||||
- (void)loadMainMenu
|
||||
{
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 100800
|
||||
[[NSBundle mainBundle] loadNibNamed:@"MainMenu"
|
||||
owner:NSApp
|
||||
topLevelObjects:&nibObjects];
|
||||
#else
|
||||
[[NSBundle mainBundle] loadNibNamed:@"MainMenu" owner:NSApp];
|
||||
#endif
|
||||
{ // removed by Kovid as it generated compiler warnings
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// Set up the menu bar (manually)
|
||||
|
||||
14
glfw/glfw.py
14
glfw/glfw.py
@ -19,13 +19,19 @@ def init_env(env, pkg_config, at_least_version, module='x11'):
|
||||
x for x in ans.cflags
|
||||
if x not in '-Wpedantic -Wextra -pedantic-errors'.split()
|
||||
]
|
||||
ans.cflags.append('-pthread')
|
||||
if not isosx:
|
||||
ans.cflags.append('-pthread')
|
||||
ans.ldpaths.append('-pthread')
|
||||
ans.cflags.append('-fpic')
|
||||
ans.ldpaths.append('-pthread')
|
||||
ans.cflags.append('-D_GLFW_' + module.upper())
|
||||
ans.cflags.append('-D_GLFW_BUILD_DLL')
|
||||
|
||||
if not isosx:
|
||||
if isosx:
|
||||
ans.ldpaths.extend(
|
||||
"-framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo".
|
||||
split()
|
||||
)
|
||||
else:
|
||||
ans.ldpaths.extend('-lrt -lm -ldl'.split())
|
||||
|
||||
if module == 'x11':
|
||||
@ -216,6 +222,8 @@ def main():
|
||||
shutil.copy2(src, '.')
|
||||
shutil.copy2(glfw_header, '.')
|
||||
patch_in_file('internal.h', lambda x: x.replace('../include/GLFW/', ''))
|
||||
patch_in_file('cocoa_window.m', lambda x: re.sub(
|
||||
r'[(]void[)]loadMainMenu.+?}', '(void)loadMainMenu\n{ // removed by Kovid as it generated compiler warnings \n}\n', x, flags=re.DOTALL))
|
||||
json.dump(
|
||||
sinfo,
|
||||
open('source-info.json', 'w'),
|
||||
|
||||
@ -7,9 +7,7 @@
|
||||
#include "state.h"
|
||||
#include <structmember.h>
|
||||
#include "glfw-wrapper.h"
|
||||
#if defined(__APPLE__)
|
||||
extern bool cocoa_make_window_resizable(void *w);
|
||||
#endif
|
||||
|
||||
#if GLFW_KEY_LAST >= MAX_KEY_COUNT
|
||||
#error "glfw has too many keys, you should increase MAX_KEY_COUNT"
|
||||
@ -262,7 +260,8 @@ create_os_window(PyObject UNUSED *self, PyObject *args) {
|
||||
glfwSetWindowFocusCallback(glfw_window, window_focus_callback);
|
||||
#ifdef __APPLE__
|
||||
if (OPT(macos_hide_titlebar)) {
|
||||
if (!cocoa_make_window_resizable(glfwGetCocoaWindow(glfw_window))) { PyErr_Print(); }
|
||||
if (glfwGetCocoaWindow) { if (!cocoa_make_window_resizable(glfwGetCocoaWindow(glfw_window))) { PyErr_Print(); } }
|
||||
else fprintf(stderr, "Failed to load glfwGetCocoaWindow\n");
|
||||
}
|
||||
#endif
|
||||
double now = monotonic();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user