[osx build/linking]
- Remove the need for client apps to explicitly link with all dependent libs and frameworks - Don't require redistributing libEGL/libGLES if not used, by linking them with '-weak-l' option - Change examples build scripts accordingly
This commit is contained in:
parent
94373d12ae
commit
3b26c92c85
11
build.sh
11
build.sh
|
@ -63,8 +63,15 @@ if [ $target = 'lib' ] ; then
|
|||
$CC $DEBUG_FLAGS -c -o $BINDIR/milepost_c.o $CFLAGS $FLAGS $INCLUDES $SRCDIR/milepost.c
|
||||
$CC $DEBUG_FLAGS -c -o $BINDIR/milepost_objc.o $FLAGS $INCLUDES $SRCDIR/milepost.m
|
||||
|
||||
# build the static library
|
||||
libtool -static -o $BINDIR/libmilepost.a $BINDIR/milepost_c.o $BINDIR/milepost_objc.o
|
||||
# build dynamic library
|
||||
ld -dylib -o $BINDIR/libmilepost.dylib $BINDIR/milepost_c.o $BINDIR/milepost_objc.o -lc -framework Carbon -framework Cocoa -framework Metal -framework QuartzCore -L$BINDIR -weak-lEGL -weak-lGLESv2
|
||||
|
||||
# change dependent libs path to @rpath.
|
||||
install_name_tool -change "./libEGL.dylib" '@rpath/libEGL.dylib' $BINDIR/libmilepost.dylib
|
||||
install_name_tool -change "./libGLESv2.dylib" '@rpath/libGLESv2.dylib' $BINDIR/libmilepost.dylib
|
||||
|
||||
# add executable path to rpath. Client executable can still add its own rpaths if needed, e.g. @executable_path/libs/ etc.
|
||||
install_name_tool -add_rpath "@executable_path" $BINDIR/libmilepost.dylib
|
||||
|
||||
else
|
||||
# additional targets
|
||||
|
|
|
@ -5,12 +5,7 @@ RESDIR=../../resources
|
|||
SRCDIR=../../src
|
||||
|
||||
INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app"
|
||||
LIBS="-L$BINDIR -lmilepost -framework Carbon -framework Cocoa -framework Metal -framework QuartzCore -L$BINDIR -lEGL -lGLESv2"
|
||||
FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG -Wl,-dead_strip"
|
||||
LIBS="-L$BINDIR -lmilepost"
|
||||
FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG"
|
||||
|
||||
clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_canvas main.c
|
||||
|
||||
# change dynamic libraries install name
|
||||
#TODO: this shouldn't be needed for apps using only metal backend...
|
||||
install_name_tool -change "./libEGL.dylib" "@loader_path/libEGL.dylib" $BINDIR/example_canvas
|
||||
install_name_tool -change "./libGLESv2.dylib" "@loader_path/libGLESv2.dylib" $BINDIR/example_canvas
|
||||
|
|
|
@ -5,7 +5,7 @@ RESDIR=../../resources
|
|||
SRCDIR=../../src
|
||||
|
||||
INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app -I$SRCDIR/graphics"
|
||||
LIBS="-L$BINDIR -lmilepost -framework Cocoa -framework Carbon -framework Metal -framework QuartzCore"
|
||||
LIBS="-L$BINDIR -lmilepost"
|
||||
FLAGS="-O2 -mmacos-version-min=10.15.4"
|
||||
|
||||
clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/perf_text main.c
|
||||
|
|
|
@ -3,13 +3,10 @@
|
|||
BINDIR=../../bin
|
||||
RESDIR=../../resources
|
||||
SRCDIR=../../src
|
||||
EXTDIR=../../ext
|
||||
|
||||
INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app -I$SRCDIR/../ext/angle_headers"
|
||||
LIBS="-L$BINDIR -lmilepost -framework Carbon -framework Cocoa -framework Metal -framework QuartzCore -lGLESv2 -lEGL"
|
||||
INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app -I$EXTDIR"
|
||||
LIBS="-L$BINDIR -lmilepost"
|
||||
FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG"
|
||||
|
||||
clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_gles_triangle main.c
|
||||
|
||||
# change dynamic libraries install name
|
||||
install_name_tool -change "./libEGL.dylib" "@loader_path/libEGL.dylib" $BINDIR/example_gles_triangle
|
||||
install_name_tool -change "./libGLESv2.dylib" "@loader_path/libGLESv2.dylib" $BINDIR/example_gles_triangle
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
#define _USE_MATH_DEFINES //NOTE: necessary for MSVC
|
||||
#include<math.h>
|
||||
|
||||
#include<GLES3/gl32.h>
|
||||
|
||||
#define MG_INCLUDE_GL_API 1
|
||||
#include"milepost.h"
|
||||
|
||||
#define LOG_SUBSYSTEM "Main"
|
||||
|
@ -70,6 +69,7 @@ int main()
|
|||
|
||||
//NOTE: create surface
|
||||
mg_surface surface = mg_surface_create_for_window(window, MG_BACKEND_GLES);
|
||||
mg_surface_prepare(surface);
|
||||
|
||||
//NOTE: init shader and gl state
|
||||
GLuint vao;
|
||||
|
|
|
@ -5,16 +5,11 @@ RESDIR=../../resources
|
|||
SRCDIR=../../src
|
||||
|
||||
INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app"
|
||||
LIBS="-L$BINDIR -lmilepost -framework Carbon -framework Cocoa -framework Metal -framework QuartzCore -L$BINDIR -lEGL -lGLESv2"
|
||||
FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG -Wl,-dead_strip"
|
||||
LIBS="-L$BINDIR -lmilepost -framework Foundation -framework Metal"
|
||||
FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG"
|
||||
|
||||
xcrun -sdk macosx metal -c -o shader.air shader.metal
|
||||
xcrun -sdk macosx metallib -o shader.metallib shader.air
|
||||
cp shader.metallib $BINDIR/triangle_shader.metallib
|
||||
|
||||
clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_metal_triangle main.m
|
||||
|
||||
# change dynamic libraries install name
|
||||
#TODO: this shouldn't be needed for apps using only metal backend...
|
||||
install_name_tool -change "./libEGL.dylib" "@loader_path/libEGL.dylib" $BINDIR/example_metal_triangle
|
||||
install_name_tool -change "./libGLESv2.dylib" "@loader_path/libGLESv2.dylib" $BINDIR/example_metal_triangle
|
||||
|
|
12
todo.txt
12
todo.txt
|
@ -7,24 +7,20 @@ Overview
|
|||
[/] error on bad option macro combinations
|
||||
[/] write doc about backend option macros
|
||||
|
||||
[?] could have an internal, per-platform mp_layer struct that handles resizing/hiding etc...
|
||||
-> avoid duplication of frame/hiding and duplication of egl code.
|
||||
[/] EGL surfaces: See how we can isolate platform-specific stuff and just deal with one egl impl...
|
||||
|
||||
[ ] Check that we can make GLES and GL surfaces co-exist in the app
|
||||
[ ] Allow controlling surface overlaying
|
||||
|
||||
[/] Allow selecting version of GL/GLES context when creating surface
|
||||
- pass/set attributes when creating surface?
|
||||
[/] Automatic surface resizing
|
||||
|
||||
[!] Make linking with libEGL optional, even if EGL backend is compiled in milepost?
|
||||
- use dead_strip_dylib on osx?
|
||||
[.] Make linking with libEGL optional, even if EGL backend is compiled in milepost?
|
||||
- use /DELAYLOAD:lib on windows?
|
||||
[.] Remove the need for client apps to link with all dependent libs explicitly
|
||||
|
||||
[!] Bundle examples with their own resources?? (e.g. avoiding clashes in metal libs files in bin directory)
|
||||
|
||||
[!] Sort out gles contents scaling for high dpi on osx
|
||||
[!] Allow controlling surface overlaying
|
||||
[!] Sort out contents scaling for high dpi on osx
|
||||
[!] win32 surfaces: only register surface child window once?
|
||||
[!] Fix canvas shader precision issue on OSX
|
||||
[!] Fix canvas perf issue on OSX
|
||||
|
|
Loading…
Reference in New Issue