Skip to content

Commit

Permalink
Merge pull request #422 from kubilus1/macos_prmerge
Browse files Browse the repository at this point in the history
Macos prmerge
  • Loading branch information
kubilus1 authored Oct 18, 2023
2 parents 4e71f32 + 8cc56f3 commit ff472eb
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 13 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ bin: autoortho/.version
./autoortho/__main__.py -o autoortho_lin.bin

autoortho_osx.bin: autoortho/.version
python3.10 -m nuitka --verbose --verbose-output=nuitka.log \
#python3.10 -m nuitka --verbose --verbose-output=nuitka.log
python3 -m nuitka --verbose --verbose-output=nuitka.log \
--macos-app-icon=autoortho/imgs/ao-icon.ico \
--enable-plugin=eventlet \
--enable-plugin=tk-inter \
Expand Down
21 changes: 14 additions & 7 deletions autoortho/aoimage/Makefile.osx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

TARGET=main
JPGT=/opt/libjpeg-turbo/lib64/
#JPGT=/opt/homebrew/opt/jpeg-turbo/lib

HEADERS=$(wildcard *.h)
OBJECTS=aoimage.o
Expand All @@ -10,13 +11,20 @@ OBJECTS=aoimage.o
CC=gcc
LD=gcc

CFLAGS+=-O2 -Wall -fPIC -fdiagnostics-color -fvisibility=hidden \
$(DEFINES)
CFLAGS+=-O2 -arch arm64 -arch x86_64 -Wall -fPIC -fdiagnostics-color -fvisibility=hidden -I/opt/libjpeg-turbo/include/ \
$(DEFINES)

LDFLAGS=-shared -rdynamic -nodefaultlibs -lpthread
LDFLAGS=-shared -rdynamic -nodefaultlibs -arch arm64 -arch x86_64 -lpthread
#LIBS=-lturbojpeg
#LIBS=./libturbojpeg.a
LIBS=-L$(JPGT) -lturbojpeg
# Statically linked with libjpeg-turbo-3.0.1
LIBS=$(JPGT)/libturbojpeg.a
#LIBS=-L$(JPGT) -lturbojpeg

#CFLAGS+=-O2 -Wall -fPIC -fdiagnostics-color -fvisibility=hidden \
$(DEFINES)
#
#LDFLAGS=-shared -rdynamic -nodefaultlibs -lpthread
#LIBS=-L$(JPGT) -lturbojpeg

all: $(TARGET)

Expand All @@ -25,11 +33,10 @@ all: $(TARGET)

main: main.c aoimage.dylib $(HEADERS)
$(CC) $(CFLAGS) -o main \
main.c aoimage.c $(LIBS)
main.c aoimage.c $(LIBS)

aoimage.dylib: $(OBJECTS)
$(LD) -o aoimage.dylib $(LDFLAGS) $(OBJECTS) $(LIBS)

clean:
rm -f $(OBJECTS) $(TARGET) aoimage.dylib

Binary file modified autoortho/aoimage/aoimage.dylib
100644 → 100755
Binary file not shown.
8 changes: 8 additions & 0 deletions autoortho/autoortho.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ def diagnose(CFG):
log.warning(f" Maptype: {maptype} FAILED!")
failed = True

log.info(f"Checking DDS file compression:")
dds_compressor = CFG.pydds.compressor.upper()
if dds_compressor != "ISPC" and platform.system().lower() == 'darwin':
log.warning(f" {dds_compressor} FAILED! Not supported on MacOS, use ISPC instead!")
failed = True
else:
log.info(f" {dds_compressor} OK!")

log.info("------------------------------------")
if failed:
log.warning("***************")
Expand Down
12 changes: 9 additions & 3 deletions autoortho/flighttrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import socket
import threading
import platform
from aoconfig import CFG
import logging
log = logging.getLogger(__name__)
Expand All @@ -23,6 +24,11 @@
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)

if platform.system().lower() == 'darwin':
local_host = '127.0.0.1'
else:
local_host = '0.0.0.0'


class FlightTracker(object):

Expand Down Expand Up @@ -192,13 +198,13 @@ def metrics():
def run():
#app.run(host='0.0.0.0', port=CFG.flightdata.webui_port, debug=CFG.general.debug, threaded=True, use_reloader=False)
log.info("Start flighttracker...")
socketio.run(app, host='0.0.0.0', port=int(CFG.flightdata.webui_port))
log.info("Exiting flighttracker ...")
socketio.run(app, host=local_host, port=int(CFG.flightdata.webui_port))
log.info("Exiting flighttracker ...")

def main():
ft.start()
try:
app.run(host='0.0.0.0', debug=False, threaded=True, use_reloader=False)
app.run(host=local_host, debug=False, threaded=True, use_reloader=False)
except KeyboardInterrupt:
print("Shutdown requested.")
finally:
Expand Down
9 changes: 7 additions & 2 deletions autoortho/pydds.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,18 @@
_stb_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),'lib','windows','stb_dxt.dll')
_ispc_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),'lib','windows','ispc_texcomp.dll')
elif platform.system().lower() == 'darwin':
#_stb_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),'lib','darwin_arm','libstbdxt.dylib')
# Note, issues with STB so disabled for macos
# _stb_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),'lib','darwin_arm','libstbdxt.dylib')
_ispc_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),'lib','darwin_arm','libispc_texcomp.dylib')
else:
print("System is not supported")
exit()

#_stb = CDLL(_stb_path)
if platform.system().lower() == 'darwin':
_stb = None
else:
_stb = CDLL(_stb_path)

_ispc = CDLL(_ispc_path)

DDSD_CAPS = 0x00000001 # dwCaps/dwCaps2 is enabled.
Expand Down

0 comments on commit ff472eb

Please sign in to comment.