Skip to content
This repository was archived by the owner on May 29, 2023. It is now read-only.

Latest commit

 

History

History
347 lines (304 loc) · 9.27 KB

File metadata and controls

347 lines (304 loc) · 9.27 KB

Linux

Setting up

meson setup build

Necessary symlinks

ln -s `readlink -f src/scheme` build/scheme

Optional: using existing repositories for subprojects

ln -s `readlink -f ../SDL` subprojects/sdl2
ls -alh subprojects/sdl2 # subprojects/sdl2 -> xxxx/SDL
ln -s `readlink -f ../s7` subprojects/s7
ls -alh subprojects/s7
ln -s `readlink -f ../SDL_net` subprojects/sdl_net
ls -alh subprojects/sdl_net # subprojects/sdl_net -> xxxx/SDL_net

# file dialog: needed for some examples
ln -s `readlink -f ../nativefiledialog` subprojects/nfd

Building

Build

ninja -C build

Clean

ninja -C build -t clean

Rebuilding (only our things, not the subprojects) Useful to check for warnings etc

rm -rf build/src
rm -rf build/test
ninja -C build

Helpful commands

# for the scheme sources
ln -s `readlink -f src/scheme` build/scheme
# eclipse debug build
ln -s `readlink -f src/scheme` build/meson.debug.linux.x86_64/scheme

meson setup --reconfigure build
meson setup --wipe build
rm -rf build

Building for release

Setting up

meson setup build/release -Dbuildtype=release
meson configure build/release # validating the buildtype
ninja -C build/release
  • debug build weights ~7mb
  • release build ~4mb zipped ~1.3mb

release

  • do not build tests.. duh

Running the tests

#ninja -C build
#./build/test/gtest-all
ninja -C build test

TCP repl

You can just connect from your terminal to the running instance

netcat localhost 12345

However, using emacs is the way to go

(save-selected-window
  (run-scheme "netcat localhost 1234")
  ;; sending something to see if the repl process is alive
  (scheme-send-string "\n"))

Windows

Necessary symlinks

cmd
mklink /J build\scheme src\scheme
exit

Optional: using existing repositories for subprojects

cmd
mklink /J subprojects\sdl2 ..\SDL
# etc..
exit

Building

Preparting the project, building & some notes

cmd //k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64

meson setup build --backend vs
meson compile -C build

# useful commands
meson setup build --reconfigure --backend vs
meson setup build --wipe --backend vs
rm -rf build

# scheme scripts
mklink /J build\scheme src\scheme

Testing

Note: has to be ran in the build/test dir. Cause of some paths.. ugh..

cd build/test
./gtest-all

Bundled examples

imgui demo

ninja -C build

./build/examples/example_imgui

Testing

C++ (gtest)

Have to be ran under the build/test directory (assuming you ran meson setup build)

./gtest-all

To run specific tests:

./gtest-all --gtest_filter=c_primitives.float_arr

Scheme

build/repl test/scheme/test-all.scm
build/repl test/scheme/test-core.scm

Repl

Normal Repl

(run-scheme (concat (projectile-project-root) "build/repl " file))   

“GUI” Repl. The C++ code will call setup and draw functions

(run-scheme (concat (projectile-project-root) "build/gui_repl " file))   

Benchmark

Components

Generating documentation for the scheme namespaces

Generating an org-mode file from the generated ns-doc.el

First, we have to run the test/scheme/gen-doc.scm (this produces the docs/ns-doc.el )

Generating the ns-doc.el from scheme

./build/repl test/scheme/gen-doc.scm

Generating the markdown document

Generating a markdown document

(with-temp-buffer
  ;; (org-mode)
  (let ((ns-doc (read (get-file-contents
		       (expand-file-name "docs/ns-doc.el" )))))
    (mapcar (lambda (ns)
	      (beginning-of-line)
	      (insert (format "# `%s`" (car ns)))
	      (newline)
	      ;; the ns documentation
	      (insert (format "%s" (cadr ns)))
	      (newline)
	      ;; going through the functions
	      (mapcar (lambda (fun)
			(print fun)
			;; fun is usually (name . docstring)
			;; but in some weird case it's (name [] docstring)
			;; eg when the name is "new-char[]" what emacs reads is
			;; (new-char [] "the docstring..")
			;; 
			;; could actually solve this also by exporting a string instead of symbol
			;; for the function name
			(let ((fun-name (if (stringp (cdr fun))
					    (car fun)
					  (format "%s%s" (car fun) (cadr fun))
					  ))
			      (fun-docstring (if (stringp (cdr fun))
						 (cdr fun)
					       (cddr fun))))
			  (insert (format "## %s" fun-name))
			  (newline)
			  (insert (format "%s" fun-docstring))
			  (newline)))
		      (cddr ns)))
	    ns-doc)
    (if (string-empty-p out)
	(buffer-string)
      (write-file (expand-file-name out) nil))))