name: physics
gpid: malunal
semv: 1.0.0

options:
  level: 2

requires:
- https://git.malunal.studio/sakura/std@v1.0.0

targets:
- name: malunal.linear
  type: library
  root: ./linear
  deps:
  - std.math
  - std.serial

# The shapes of space, made of `malunal::linear`'s vectors, and the tests
# between them.
- name: malunal.geometry
  type: library
  root: ./geometry
  deps:
  - malunal.linear
  - std.math
  - std.serial

# Light in the units it's measured in, lumens, candela, lux, and nits, and
# converted between them; exposure values; and the colors of temperatures.
- name: malunal.photometry
  type: library
  root: ./photometry
  deps:
  - malunal.linear
  - std.math

# What collides in a plane: shapes, where and how deep two meet, rays, a tree
# of boxes, and a grid of solid cells, as a tilemap's walls are.
- name: malunal.physics2d
  type: library
  root: ./physics2d
  deps:
  - malunal.linear
  - std.containers
  - std.math
  - std.serial

# Times what `malunal::linear` does against the same written a number at a
# time; see its header.
- name:  malunal.linear.bench
  type:  program
  level: ${level}
  deps:
  - malunal.linear
  - std.containers
  - std.io
  - std.math
  - std.time
  srcs:
  - tools/bench.sakura

# Times what `malunal::geometry` does against the same written a number at a
# time; see its header.
- name:  malunal.geometry.bench
  type:  program
  level: ${level}
  deps:
  - malunal.geometry
  - malunal.linear
  - std.containers
  - std.io
  - std.math
  - std.time
  srcs:
  - tools/geometry_bench.sakura

tests:
# On the machine, which works each number at a time.
- name: malunal.linear.tests
  type: program
  deps: [malunal.linear, std.json, std.math, std.serial, std.testing]
  srcs: [tests/main.sakura, tests/linear.sakura]

# The same tests built with `-O2`, which works vectors as lanes, and gives the
# same bits.
- name: malunal.linear.lanes.tests
  type: program
  runs: native
  level: 2
  deps: [malunal.linear, std.json, std.math, std.serial, std.testing]
  srcs: [tests/main.sakura, tests/linear.sakura]

# `malunal::geometry`'s, the same two ways.
- name: malunal.geometry.tests
  type: program
  deps: [malunal.geometry, malunal.linear, std.json, std.math, std.serial, std.testing]
  srcs: [tests/main.sakura, tests/geometry.sakura]

- name: malunal.geometry.lanes.tests
  type: program
  runs: native
  level: 2
  deps: [malunal.geometry, malunal.linear, std.json, std.math, std.serial, std.testing]
  srcs: [tests/main.sakura, tests/geometry.sakura]

- name: malunal.photometry.tests
  type: program
  deps: [malunal.linear, malunal.photometry, std.math, std.testing]
  srcs: [tests/main.sakura, tests/photometry.sakura]

- name: malunal.physics2d.tests
  type: program
  deps: [malunal.linear, malunal.physics2d, std.containers, std.math, std.testing]
  srcs: [tests/main.sakura, tests/physics2d.sakura]

exports:
- malunal.linear
- malunal.geometry
- malunal.photometry
- malunal.physics2d

package:
  desc: The numbers of physical space and what's in it. Vectors, quaternions, and matrices of f32, and the shapes of space made of them, worked as SIMD lanes where an executable holds them; light in the units it's measured in; and what collides in a plane.
  auth: John Christman <sorakatadzuma@gmail.com>
