diff options
| author | Michael Dusan <michael.dusan@gmail.com> | 2020-01-17 19:39:43 -0500 |
|---|---|---|
| committer | Michael Dusan <michael.dusan@gmail.com> | 2020-01-17 19:39:43 -0500 |
| commit | b9f4ac86efc8bd1e53c75d204aa6f08c2df58be3 (patch) | |
| tree | 98952511a648bf22edddb12e6fe358e99ba606d3 /CONTRIBUTING.md | |
| parent | b5ac079f88e9098ea9c95356518820a5c3fb42a8 (diff) | |
| download | zig-b9f4ac86efc8bd1e53c75d204aa6f08c2df58be3.tar.gz zig-b9f4ac86efc8bd1e53c75d204aa6f08c2df58be3.zip | |
cmake: support `make` and `make install`
(2nd attempt to get this right)
Diffstat (limited to 'CONTRIBUTING.md')
| -rw-r--r-- | CONTRIBUTING.md | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a5aeeb9e21..62b8083222 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,23 +51,28 @@ knowledge of Zig internals.** ### Editing Source Code -First, build the Stage 1 compiler as described in [the Building section](#building). - -One modification you may want to make is adding `-DZIG_SKIP_INSTALL_LIB_FILES=ON` -to the cmake line. If you use the build directory as a working directory to run -tests with, zig will find the lib files in the source directory, and they will not -be "installed" every time you run `make`. This will allow you to make modifications -directly to the standard library, for example, and have them effective immediately. -Note that if you already ran `make` or `make install` with the default cmake -settings, there will already be a `lib/` directory in your build directory. When -executed from the build directory, zig will find this instead of the source lib/ -directory. Remove the unwanted directory so that the desired one can be found. +First, build the Stage 1 compiler as described in [Building from Source](README.md#Building-from-Source). + +Zig locates lib files relative to executable path by searching up the +filesystem tree for a sub-path of `lib/zig/std/std.zig` or `lib/std/std.zig`. +Typically the former is an install and the latter a git working tree which +contains the build directory. + +During development it is not necessary to perform installs when modifying +stage1 or userland sources and in fact it is faster and simpler to run, +test and debug from a git working tree. + +- `make` is typically sufficient to build zig during development iterations. +- `make install` performs a build __and__ install. +- `msbuild -p:Configuration=Release INSTALL.vcxproj` on Windows performs a +build and install. To avoid install, pass cmake option `-DZIG_SKIP_INSTALL_LIB_FILES=ON`. To test changes, do the following from the build directory: -1. Run `make install` (on POSIX) or +1. Run `make` (on POSIX) or `msbuild -p:Configuration=Release INSTALL.vcxproj` (on Windows). -2. `bin/zig build test` (on POSIX) or `bin\zig.exe build test` (on Windows). +2. `$BUILD_DIR/zig build test` (on POSIX) or + `$BUILD_DIR/Release\zig.exe build test` (on Windows). That runs the whole test suite, which does a lot of extra testing that you likely won't always need, and can take upwards of 1 hour. This is what the @@ -85,8 +90,8 @@ Another example is choosing a different set of things to test. For example, not the other ones. Combining this suggestion with the previous one, you could do this: -`bin/zig build test-std -Dskip-release` (on POSIX) or -`bin\zig.exe build test-std -Dskip-release` (on Windows). +`$BUILD_DIR/bin/zig build test-std -Dskip-release` (on POSIX) or +`$BUILD_DIR/Release\zig.exe build test-std -Dskip-release` (on Windows). This will run only the standard library tests, in debug mode only, for all targets (it will cross-compile the tests for non-native targets but not run |
