docs: where a source's object goes, and what a link reads
The README's "Writing a project.cpp" says that a .cpp, .c or .cu of a configuration is compiled into an object named from its path, under objects/ in the build directory at the source's path from cfg.path, or under objects-outside/ at its whole path for a source outside cfg.path; that two sources may therefore have the same file name in different directories, and a .c lie beside a .cpp or a .cu of its name; that the progress line of such a source's compile names it by that path; and that the link and a static library's archive step read their objects from <outputName>.objects in the build directory. The contributor guide gains two rules beside the one on output paths. ObjectPath() names an object, which is not to be named from its source's file name, and a step that takes every object of a configuration reads them from a response file. And a static library's archive and the list of a step's objects are written under another name beside them and renamed into place, as anything else that a link or archive step of another crafter-build may be reading is to be: two crafter-builds can build a project loaded with GitProject at once, in the clone the cache keeps for its source.
This commit is contained in:
parent
f9bd5333da
commit
9df82bc272
2 changed files with 4 additions and 0 deletions
|
|
@ -43,6 +43,8 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
|
|||
|
||||
Run `crafter-build` in that directory, outputs land at `bin/myapp-<target>-<march>-<mtune>-<hash>/myapp` and intermediates at `build/myapp-<target>-<march>-<mtune>-<hash>/`. The hash covers everything that changes what is compiled (build type, defines, flags, sysroot, the compiler itself), so two such builds never share a directory. After a compiler update, a new crafter-build release included, the first build starts a fresh directory and recompiles. `crafter-build clean` removes the ones left behind. Add `-r` to run the produced executable straight after a successful build, in its own directory, where its shaders, `cfg.files` and assets are; a wasm32 one runs under wasmtime, or wasmer where there is no wasmtime, with no directory given to it, and one built for the browser (`EnableWasiBrowserRuntime`) is served over HTTP from that directory instead.
|
||||
|
||||
A `.cpp`, `.c` or `.cu` of a configuration is compiled into an object named from its path: `a/Thing.cpp` into `objects/a/Thing_impl.o` in that `build/` directory, at the source's path from `cfg.path`, and a source outside `cfg.path` into `objects-outside/` there, at its whole path. Two sources may therefore have the same file name in different directories, and a `.c` may lie beside a `.cpp` or a `.cu` of its name. The progress line of such a source's compile names it by the same path, `Compiling a/Thing.cpp`. The link, and the archive step of a static library, read their objects from a file in that directory, `<outputName>.objects`, so the command is no longer for many sources than for one.
|
||||
|
||||
crafter-build orders a configuration's units by the `import` lines of its sources: a unit is built after the modules and partitions it imports, and a module's primary interface after all of its partitions. Interface units of one configuration that import each other cannot be built in any order: two partitions, a partition and its own module, or two modules. Such a configuration is refused before anything of it is built, with an error that names the units in the order they wait. The imports are read from the source text without compiling it, so one in a string literal, in a comment that spans lines or under `#if 0` counts too, and such text can make a round in a project the compiler accepts.
|
||||
|
||||
A build runs at most as many of its steps at once as the machine has hardware threads, however many sources are stale: the compiles of its sources, its shaders and assets, and its links and archives, counted together for the project and the dependencies it is built on. An `ExternalDependency`'s CMake build is not among them and is given that many jobs of its own, and the tests `crafter-build test` runs are counted by `--jobs=`. A step counts as one whatever threads it starts for itself: a link runs on lld's, and an asset is compressed on threads its compressor starts.
|
||||
|
|
|
|||
Loading…
Reference in a new issue