Skip to content

Commit

Permalink
new example
Browse files Browse the repository at this point in the history
  • Loading branch information
melsman committed Jan 12, 2024
1 parent bfcaf7f commit 9b85db2
Show file tree
Hide file tree
Showing 7 changed files with 391 additions and 18 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,6 @@ jobs:
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt install libgl-dev libglu1-mesa-dev xvfb

- name: Compile
shell: bash
working-directory: ./ci
run: make

- name: Run CI tests (Linux)
if: startsWith(matrix.os, 'ubuntu')
shell: bash
working-directory: ./ci
run: LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH xvfb-run ./ci

- name: Run CI tests (macOS)
if: startsWith(matrix.os, 'macos')
shell: bash
working-directory: ./ci
run: ./ci 1

- name: Setup environment
run: |
echo "OS=$(uname -s | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
Expand All @@ -60,6 +43,23 @@ jobs:
mlkit --version
smlpkg --version
- name: Compile
shell: bash
working-directory: ./ci
run: make

- name: Run CI tests (Linux)
if: startsWith(matrix.os, 'ubuntu')
shell: bash
working-directory: ./ci
run: LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH xvfb-run ./ci

- name: Run CI tests (macOS)
if: startsWith(matrix.os, 'macos')
shell: bash
working-directory: ./ci
run: ./ci 1

- name: Compile SML projects
shell: bash
working-directory: ./sml-examples
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

.PHONY: prepare
prepare:
prepare: lib/github.com/diku-dk/sml-random
$(MAKE) -C src
$(MAKE) -C lib/github.com/diku-dk/sml-tigr/clib lib

Expand All @@ -20,3 +20,6 @@ clean:
$(MAKE) -C sml-examples/hello clean
$(MAKE) -C sml-examples/flags clean
$(MAKE) -C sml-examples/mandel clean

lib/github.com/diku-dk/sml-random:
smlpkg sync
4 changes: 4 additions & 0 deletions sml-examples/nbody/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.exe
*~
MLB
libtigr.so
27 changes: 27 additions & 0 deletions sml-examples/nbody/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
PROGNAME=nbody
MLKIT=mlkit
LIBS=
ifeq ($(OS),Windows_NT)
LDFLAGS += -s -lopengl32 -lgdi32
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LDFLAGS += -arch x86_64 -framework OpenGL -framework Cocoa -L. -ltigr
else ifeq ($(UNAME_S),Linux)
LDFLAGS += -L.
LIBS += -libs 'm,c,dl,GLU,GL,X11,tigr'
endif
endif

.PHONY: all
all: $(PROGNAME).exe

$(PROGNAME).exe: $(PROGNAME).mlb $(PROGNAME).sml libtigr.so
MLCOMP=mlkit $(MLKIT) -ldexe '$(CC) $(LDFLAGS)' $(LIBS) -o $@ $<

libtigr.so: ../../lib/github.com/diku-dk/sml-tigr/clib/libtigr.so
cp $< $@

.PHONY: clean
clean:
rm -rf *~ *.exe MLB libtigr.so
6 changes: 6 additions & 0 deletions sml-examples/nbody/nbody.mlb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
local $(SML_LIB)/basis/basis.mlb
../../lib/github.com/diku-dk/sml-tigr/tigr.mlb
../../lib/github.com/diku-dk/sml-random/random.mlb
in
nbody.sml
end
Loading

0 comments on commit 9b85db2

Please sign in to comment.