Janet 1.41.2-0fea20c Documentation
(Other Versions:
1.41.1
1.40.1
1.40.0
1.39.1
1.38.0
1.37.1
1.36.0
1.35.0
1.34.0
1.31.0
1.29.1
1.28.0
1.27.0
1.26.0
1.25.1
1.24.0
1.23.0
1.22.0
1.21.0
1.20.0
1.19.0
1.18.1
1.17.1
1.16.1
1.15.0
1.13.1
1.12.2
1.11.1
1.10.1
1.9.1
1.8.1
1.7.0
1.6.0
1.5.1
1.5.0
1.4.0
1.3.1
)
declare-cc
The declare-cc module provides a DSL to the cc module for compiling C and C++ projects that
eliminates boilerplate, provides incremental builds, and re-implements support for building project.janet projects outside of JPM.
Reference
declare-cc/*build-root* declare-cc/*install-manifest* declare-cc/*toolchain* declare-cc/create-buffer-c declare-cc/declare-archive declare-cc/declare-bin declare-cc/declare-binscript declare-cc/declare-documentation declare-cc/declare-executable declare-cc/declare-headers declare-cc/declare-manpage declare-cc/declare-native declare-cc/declare-project declare-cc/declare-source declare-cc/install-file-rule declare-cc/jpm-shim-env declare-cc/modpath-to-meta declare-cc/modpath-to-static declare-cc/phony declare-cc/post-deps declare-cc/quickbin declare-cc/rule declare-cc/run-tests declare-cc/sh-phony declare-cc/sh-rule declare-cc/sh-task declare-cc/task
(create-buffer-c bytes dest name) Inline raw byte file as a c file. The header file will contain two exported symbols, `(string name "_emded")`, a pointer of an array of unsigned char, and `(string name "_embed_size")`, a size_t of the number bytes.
(declare-archive &named entry name deps) Build a janet archive. This is a file that bundles together many janet scripts into a janet image. This file can the be moved to any machine with a janet vm and the required dependencies and run there.
(declare-bin &named main) Declare a generic file to be installed as an executable.
(declare-binscript &named main hardcode-syspath is-janet) Declare a janet file to be installed as an executable script. Creates a shim on windows. If hardcode is true, will insert code into the script such that it will run correctly even when JANET_PATH is changed. if auto-shebang is truthy, will also automatically insert a correct shebang line.
(declare-documentation &named source prefix) Mark a file as general documentation to be installed. Documentation will be installed to $SYSYPATH/man/`prefix`/`(basename source)`
(declare-executable &named name entry install headers no-compile no-core defines pkg-config-flags target-os deps static pkg-config-libs smart-libs c-std c++-std msvc-libs ldflags cflags c++flags lflags libs static-libs dynamic-libs use-rpath use-rdynamic) Declare a janet file to be the entry of a standalone executable program. The entry file is evaluated and a main function is looked for in the entry file. This function is marshalled into bytecode which is then embedded in a final executable for distribution.
(declare-headers &named headers prefix) Declare headers for a library installation. Installed headers can be used by other native libraries.
(declare-manpage page) Mark a manpage for installation. Manpages will be installed to $SYSPATH/man/man1/`(basename page)`
(declare-native &named name source embedded lflags libs cflags c++flags defines nostatic static-libs deps headers use-rpath use-rdynamic pkg-config-flags dynamic-libs msvc-libs ldflags pkg-config-libs smart-libs c-std c++-std target-os) Declare a native module. This is a shared library that can be loaded dynamically by a janet runtime. This also builds a static libary that can be used to bundle janet code and native into a single executable.
(declare-project &named name description url version repo tag dependencies author license) Define your project metadata. This should be the first declaration in a project.janet file. Sets up the JPM-style build rule system as well as creates a number of default bundle hooks including: - build - clean - check - install - list-rules - rule-tree
(declare-source &named source prefix) Create Janet modules. This does not actually build the module(s), but registers them for packaging and installation. :source should be an array of files and directores to copy into JANET_MODPATH or JANET_PATH. :prefix can optionally be given to modify the destination path to be (string JANET_PATH prefix source).
(install-file-rule src dest &opt chmod-mode thunk is-exe) Add install and uninstall rule for moving file from src into destdir.
(jpm-shim-env &opt e) Create an environment table that can evaluate project.janet files
(modpath-to-meta toolchain path) Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static toolchain path) Get the static library (.a) path corresponding to a native module path (.so).
(post-deps & body) Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(quickbin entry output) Create an executable file from a script with a main function.
(run-tests &opt root-directory) Run tests on a project in the current directory. The tests will be run in the environment dictated by (dyn :modpath).
(sh-rule target deps & body) Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).