Skip to content

Instantly share code, notes, and snippets.

@masonlr
Last active June 23, 2021 13:43
Show Gist options
  • Save masonlr/1c04e3f9fb62b8609a89551522293304 to your computer and use it in GitHub Desktop.
Save masonlr/1c04e3f9fb62b8609a89551522293304 to your computer and use it in GitHub Desktop.
Basilisk macOS

Basilisk installation on macOS

  1. Install XQuartz via its DMG file here https://www.xquartz.org/. Ensure that /opt/X11 exists. Important: Make sure you restart your laptop after installing XQuartz. After restarting, check that the DISPLAY environment variable is set:

    # for example
    
    echo $DISPLAY
    /private/tmp/com.apple.launchd.p9sPN5gJh8/org.macosforge.xquartz:0
    
  2. Install the OpenGL Extension Wrangler Library:

    brew install glew
    
  3. Install bison v3.7.* with

    brew install bison
    
  4. Install ffmpeg:

    brew install ffmpeg
    
  5. Clone the Basilisk source code:

    cd ~ && darcs get --lazy http://basilisk.fr/basilisk
    
  6. Edit src/config and src/gl/Makefile to match the files in this Gist.

  7. Make basilisk:

    cd ~/basilisk/src && make -k && make
    
  8. Make the gl/ libraries:

    cd ~/basilisk/src/gl && make libglutils.a libfb_glx.a
    
  9. Make the basilisk view servers:

    cd ~/basilisk/src && make bview-servers
    
  10. Install pillow into the default python2.7 libaray:

    conda deactivate
    
    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    python2.7 get-pip.py
    python2.7 -m pip install Pillow
    export TK_SILENCE_DEPRECATION=1
    
  11. Update the src/examples/Makefile with the contents of Makefile2

# src/config
# -*-Makefile-*-
# how to launch the C99 compiler
CC99 = gcc -std=c99 -Wno-unused-result -Wno-unused-function
# how to strip unused code
# STRIPFLAGS = -fdata-sections -ffunction-sections -Wl,--gc-sections -w
# other useful (non-standard) flags
CFLAGS += -g -Wall -pipe
# if you have valgrind, otherwise comment this out
# VALGRIND = valgrind -q --tool=memcheck \
# --suppressions=$(BASILISK)/openmpi.supp \
# --leak-check=full
# if gnuplot supports pngcairo, otherwise comment this out
# PNG = pngcairo
# If you have managed to make gdb work (congratulations!), uncomment this
# GDB = gdb
# if you don't have md5sum, replace it with something equivalent
GENSUM = shasum
CHECKSUM = shasum -c --status
# OpenGL libraries
# see bview-server.c#installation for explanations
# OPENGLIBS = -lfb_glx -lGLU -lGLEW -lGL -lX11
# OPENGLIBS = -L/opt/local/lib/ -lfb_osmesa -lGLU -lOSMesa
OPENGLIBS = -I/opt/X11/include -L/opt/X11/lib -framework OpenGL -lfb_glx -lGLU -lGLEW -lGL -lX11
# Compiler and libraries to use with CADNA.
# See [README.cadna]() for more documentation.
CADNACC = clang -D_CADNA=1 -x c++ -m64 \
-Wno-unused-function \
-Wno-unused-result \
-Wno-c++11-compat-deprecated-writable-strings \
-Wno-address-of-array-temporary
CADNALIBS = -lcadnaC -lstdc++
# src/gl/Makefile
-include ../config
CFLAGS += -O2 -I/opt/X11/include -lGLU
all: libglutils.a libfb_osmesa.a libfb_glx.a
libglutils.a: trackball.o gl2ps.o utils.o polygonize.o \
og_font.o og_stroke_mono_roman.o parser.o
ar cr $@ $^
libfb_osmesa.a: fb_osmesa.o
ar cr $@ $^
libfb_glx.a: fb_glx.o OffscreenContextGLX.o fbo.o
ar cr $@ $^
gl2ps.o: gl2ps/gl2ps.c
$(CC) $(CFLAGS) -Igl2ps -c gl2ps/gl2ps.c -o gl2ps.o
utils.o: utils.h
parser.tab.c: parser.y
bison parser.y
parser: parser.tab.c parser.h
$(CC) $(CFLAGS) -DSTANDALONE=1 -o parser parser.tab.c -lm
parser.o: parser.tab.c parser.h
$(CC) $(CFLAGS) -c -o parser.o parser.tab.c
clean:
rm -f *.o *.a
# src/examples/Makefile
# the default CFLAGS are set in $(BASILISK)/config
# CFLAGS += -O2
CFLAGS += -O2 -Xpreprocessor -fopenmp -lomp
all: check
madsen-sv.c: madsen.c
ln -s madsen.c madsen-sv.c
madsen-sv.tst: madsen.s
madsen-sv.tst: CFLAGS += -DSAINT_VENANT=1
madsen.tst: madsen-sv.tst
tohoku-gn.c: tohoku.c
ln -s tohoku.c tohoku-gn.c
tohoku-gn.tst: tohoku.s
tohoku-gn.tst: CFLAGS += -DGN=1
tohoku-hydro.c: tohoku.c
ln -s tohoku.c tohoku-hydro.c
tohoku-hydro.tst: tohoku.s
tohoku-hydro.tst: CFLAGS += -DHYDRO=1
include $(BASILISK)/Makefile.defs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment