diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-08-12 15:49:36 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-08-12 15:49:36 +0200 |
| commit | 2a38070d44ed01753c51067bbd7f007e4b74bd6b (patch) | |
| tree | 56c0e3251801345eed11de8657438d3bad1eb4d6 | |
| parent | de9b93c702e771d4b8ca8c6dae6f33e25f383741 (diff) | |
| download | nissy-core-2a38070d44ed01753c51067bbd7f007e4b74bd6b.tar.gz nissy-core-2a38070d44ed01753c51067bbd7f007e4b74bd6b.zip | |
Renamed UNIX build script to build.sh, added info to README.md related to windows build
| -rw-r--r-- | README.md | 54 | ||||
| -rw-r--r-- | benchmarks/benchmarks.md | 2 | ||||
| -rwxr-xr-x | build.sh (renamed from build) | 12 | ||||
| -rw-r--r-- | python/examples/solve.py | 2 | ||||
| -rwxr-xr-x | utils/container-run.sh | 6 | ||||
| -rw-r--r-- | web/http/nissyapp.mjs | 4 |
6 files changed, 46 insertions, 34 deletions
| @@ -13,43 +13,55 @@ of pruning tables that were developed independently. | |||
| 13 | 13 | ||
| 14 | ## Building | 14 | ## Building |
| 15 | 15 | ||
| 16 | This project currently supports only POSIX systems (Linux, MacOS, BSD...). | 16 | This project is mainly developed on UNIX systems (Linux, MacOS, BSD...), |
| 17 | If you want to build on Windows you can do so via | 17 | but it is also possible to build it on Windows, with some limitations. |
| 18 | [WSL](https://learn.microsoft.com/en-us/windows/wsl/install). Note that | 18 | |
| 19 | the resulting executable will not be a native Windows executable. | 19 | ### UNIX (Linux, MaxOS, BSD...) |
| 20 | Windows as a build target will be available in the future. | ||
| 21 | 20 | ||
| 22 | To build nissy simply run | 21 | To build nissy simply run |
| 23 | 22 | ||
| 24 | ``` | 23 | ``` |
| 25 | $ ./build | 24 | $ ./build.sh |
| 26 | ``` | 25 | ``` |
| 27 | 26 | ||
| 28 | For a list of options and targets for the build system run `./build help`. | 27 | For a list of options and targets for the build system run `./build.sh help`. |
| 29 | Some compiler settings can be overridden using environment variables, | 28 | Some compiler settings can be overridden using environment variables, |
| 30 | as explained in the comments at the beginning of the build script. For | 29 | as explained in the comments at the beginning of the build script. For |
| 31 | example, the command: | 30 | example, the command: |
| 32 | 31 | ||
| 33 | ``` | 32 | ``` |
| 34 | $ export NISSY_BUILD_THREADS=3 | 33 | $ export NISSY_BUILD_THREADS=3 |
| 35 | $ CC=gcc ./build | 34 | $ CC=gcc ./build.sh |
| 36 | ``` | 35 | ``` |
| 37 | 36 | ||
| 38 | is going to configure `nissy` to use at most 3 threads, and build it with | 37 | is going to configure `nissy` to use at most 3 threads, and build it with |
| 39 | `gcc`. Se the comments in `./build` for more details. | 38 | `gcc`. Se the comments in `./build.sh` for more details. |
| 39 | |||
| 40 | ### Windows | ||
| 41 | |||
| 42 | It is possible to build this project on Windows using `build.bat`. This script | ||
| 43 | is going to build: | ||
| 44 | |||
| 45 | * The core nissy library | ||
| 46 | * The shell `run.exe` (see below) | ||
| 47 | * The Python module (see below) | ||
| 48 | |||
| 49 | All other options are unavailable. Moreover, Windows build will not | ||
| 50 | enable certain optimizations, such as multithreading and advanced CPU | ||
| 51 | instructions. Work is ongoing to improve Windows support. | ||
| 40 | 52 | ||
| 41 | ## Running tests | 53 | ## Running tests |
| 42 | 54 | ||
| 43 | This project includes a suite of "unit" test. You can run them with: | 55 | This project includes a suite of "unit" test. You can run them with: |
| 44 | 56 | ||
| 45 | ``` | 57 | ``` |
| 46 | $ ./build test | 58 | $ ./build.sh test |
| 47 | ``` | 59 | ``` |
| 48 | 60 | ||
| 49 | For running the tests for the WebAssembly build with nodejs you can use: | 61 | For running the tests for the WebAssembly build with nodejs you can use: |
| 50 | 62 | ||
| 51 | ``` | 63 | ``` |
| 52 | $ ./build webtest | 64 | $ ./build.sh webtest |
| 53 | ``` | 65 | ``` |
| 54 | 66 | ||
| 55 | To run only a subset of the tests, you can pass as argument a regular | 67 | To run only a subset of the tests, you can pass as argument a regular |
| @@ -84,7 +96,7 @@ are not run in debug mode by default. | |||
| 84 | To run a tool you can use: | 96 | To run a tool you can use: |
| 85 | 97 | ||
| 86 | ``` | 98 | ``` |
| 87 | $ ./build tool TOOLNAME PARAMETERS... | 99 | $ ./build.sh tool TOOLNAME PARAMETERS... |
| 88 | ``` | 100 | ``` |
| 89 | 101 | ||
| 90 | Where `TOOLNAME` is the name of one of the tools, or a regular expression | 102 | Where `TOOLNAME` is the name of one of the tools, or a regular expression |
| @@ -94,7 +106,7 @@ parameters. | |||
| 94 | For example: | 106 | For example: |
| 95 | 107 | ||
| 96 | ``` | 108 | ``` |
| 97 | $ :./build tool gendata h48h2k2 | 109 | $ :./build.sh tool gendata h48h2k2 |
| 98 | ``` | 110 | ``` |
| 99 | 111 | ||
| 100 | Will run a tool that generates the data table for the H48 solver with | 112 | Will run a tool that generates the data table for the H48 solver with |
| @@ -104,7 +116,7 @@ Each tool run is automatically timed, so these tools can be used as | |||
| 104 | benchmark. The output as well as the time of the run are saved to a | 116 | benchmark. The output as well as the time of the run are saved to a |
| 105 | file in the tools/results folder. | 117 | file in the tools/results folder. |
| 106 | 118 | ||
| 107 | To build and run a tool in debug mode, use `./build -d tool`. | 119 | To build and run a tool in debug mode, use `./build.sh -d tool`. |
| 108 | 120 | ||
| 109 | ### The `solvetest` tools | 121 | ### The `solvetest` tools |
| 110 | 122 | ||
| @@ -113,7 +125,7 @@ solvers produce the correct solutions. They can be run individually as | |||
| 113 | all other tools, or all together with | 125 | all other tools, or all together with |
| 114 | 126 | ||
| 115 | ``` | 127 | ``` |
| 116 | $ ./build solvetest # Use -d for debug mode (very slow for some solvers) | 128 | $ ./build.sh solvetest # Use -d for debug mode (very slow for some solvers) |
| 117 | ``` | 129 | ``` |
| 118 | 130 | ||
| 119 | If one of the solvetests fails, subsequent tests are going to be skipped. | 131 | If one of the solvetests fails, subsequent tests are going to be skipped. |
| @@ -127,7 +139,7 @@ as the commands require quite verbose options. | |||
| 127 | To build the shell run: | 139 | To build the shell run: |
| 128 | 140 | ||
| 129 | ``` | 141 | ``` |
| 130 | $ ./build shell | 142 | $ ./build.sh shell |
| 131 | ``` | 143 | ``` |
| 132 | 144 | ||
| 133 | This will create an executable called `run`. Then you can for example | 145 | This will create an executable called `run`. Then you can for example |
| @@ -192,7 +204,7 @@ interface. You can build them and run them with the build tool, for | |||
| 192 | example: | 204 | example: |
| 193 | 205 | ||
| 194 | ``` | 206 | ``` |
| 195 | ./build cpp cpp/examples/solve_h48h3k2.cpp | 207 | ./build.sh cpp cpp/examples/solve_h48h3k2.cpp |
| 196 | ``` | 208 | ``` |
| 197 | 209 | ||
| 198 | NOTE: If you prefer to use a C-style API, you'll have to write | 210 | NOTE: If you prefer to use a C-style API, you'll have to write |
| @@ -207,10 +219,10 @@ this module follows the C API quite closely, except its functions | |||
| 207 | sometimes return strings instead of writing to `char *` buffers. | 219 | sometimes return strings instead of writing to `char *` buffers. |
| 208 | 220 | ||
| 209 | To build the Python module you need the Python development headers | 221 | To build the Python module you need the Python development headers |
| 210 | installed. You can check this from the output of `./build config`: | 222 | installed. You can check this from the output of `./build.sh config`: |
| 211 | 223 | ||
| 212 | ``` | 224 | ``` |
| 213 | $ ./build config | 225 | $ ./build.sh config |
| 214 | ... | 226 | ... |
| 215 | Python bindings: version 3.13 | 227 | Python bindings: version 3.13 |
| 216 | ``` | 228 | ``` |
| @@ -218,7 +230,7 @@ Python bindings: version 3.13 | |||
| 218 | Then to build the module: | 230 | Then to build the module: |
| 219 | 231 | ||
| 220 | ``` | 232 | ``` |
| 221 | $ ./build python | 233 | $ ./build.sh python |
| 222 | ``` | 234 | ``` |
| 223 | 235 | ||
| 224 | And to import it | 236 | And to import it |
| @@ -255,7 +267,7 @@ Bindings for JavaScript via a WebAssembly build (using | |||
| 255 | The JavaScript module can be built with | 267 | The JavaScript module can be built with |
| 256 | 268 | ||
| 257 | ``` | 269 | ``` |
| 258 | $ ./build web | 270 | $ ./build.sh web |
| 259 | ``` | 271 | ``` |
| 260 | 272 | ||
| 261 | An example web app running nissy can be found in the `web/http` folder. | 273 | An example web app running nissy can be found in the `web/http` folder. |
diff --git a/benchmarks/benchmarks.md b/benchmarks/benchmarks.md index 805408d..f84ddb3 100644 --- a/benchmarks/benchmarks.md +++ b/benchmarks/benchmarks.md | |||
| @@ -234,7 +234,7 @@ Time per cube adjusted for tables size (in seconds \* GiB, lower is better). | |||
| 234 | example: | 234 | example: |
| 235 | 235 | ||
| 236 | ``` | 236 | ``` |
| 237 | ./build tool solve_file h48h7k2 ./benchmarks/scrambles/scrambles-16.txt | 237 | ./build.sh tool solve_file h48h7k2 ./benchmarks/scrambles/scrambles-16.txt |
| 238 | ``` | 238 | ``` |
| 239 | 239 | ||
| 240 | To find all solutions, add something like `99999 0` at the end of the | 240 | To find all solutions, add something like `99999 0` at the end of the |
| @@ -1,11 +1,11 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # Build system for nissy, run './build help' for info on how to use this. | 3 | # Build system for nissy, run './build.sh help' for info on how to use this. |
| 4 | 4 | ||
| 5 | # The variables below can be used to personalize the build system. For example, | 5 | # The variables below can be used to personalize the build system. For example, |
| 6 | # to compile with clang instead of the default cc one can use: | 6 | # to compile with clang instead of the default cc one can use: |
| 7 | # | 7 | # |
| 8 | # CC=clang ./build | 8 | # CC=clang ./build.sh |
| 9 | # | 9 | # |
| 10 | # Each variable also has a counterpart that starts with NISSY_BUILD_*. These | 10 | # Each variable also has a counterpart that starts with NISSY_BUILD_*. These |
| 11 | # other variables can be set, for example, in your shell configuration file | 11 | # other variables can be set, for example, in your shell configuration file |
| @@ -20,7 +20,7 @@ | |||
| 20 | # If later the same user wants to build a debug version without sanitizers, | 20 | # If later the same user wants to build a debug version without sanitizers, |
| 21 | # they may use | 21 | # they may use |
| 22 | # | 22 | # |
| 23 | # SANITIZE="" ./build debug | 23 | # SANITIZE="" ./build.sh debug |
| 24 | # | 24 | # |
| 25 | # And the empty string value will take precedence. | 25 | # And the empty string value will take precedence. |
| 26 | 26 | ||
| @@ -193,7 +193,7 @@ build_help() { | |||
| 193 | echo "" | 193 | echo "" |
| 194 | echo "The -d option activates debug mode (slower, used for testing)." | 194 | echo "The -d option activates debug mode (slower, used for testing)." |
| 195 | echo "Tests are automatically built in debug mode even without -d." | 195 | echo "Tests are automatically built in debug mode even without -d." |
| 196 | echo "For more on build configurations, see the comments in ./build" | 196 | echo "For more on build configurations, see the comments in ./build.sh" |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | build_config() { | 199 | build_config() { |
| @@ -287,7 +287,7 @@ build_cpp() { | |||
| 287 | validate_command "$CXX" | 287 | validate_command "$CXX" |
| 288 | if [ -z "$@" ]; then | 288 | if [ -z "$@" ]; then |
| 289 | echo "Please provide one or more valid C++ source files" | 289 | echo "Please provide one or more valid C++ source files" |
| 290 | echo "usage: ./build cpp FILES" | 290 | echo "usage: ./build.sh cpp FILES" |
| 291 | fi | 291 | fi |
| 292 | 292 | ||
| 293 | build_nissy || exit 1 | 293 | build_nissy || exit 1 |
| @@ -418,7 +418,7 @@ build_tool() { | |||
| 418 | 418 | ||
| 419 | if [ -z "$pattern" ]; then | 419 | if [ -z "$pattern" ]; then |
| 420 | echo "Please provide a valid PATTERN to select a tool" | 420 | echo "Please provide a valid PATTERN to select a tool" |
| 421 | echo "usage: ./build tool PATTERN" | 421 | echo "usage: ./build.sh tool PATTERN" |
| 422 | exit 1 | 422 | exit 1 |
| 423 | fi | 423 | fi |
| 424 | shift | 424 | shift |
diff --git a/python/examples/solve.py b/python/examples/solve.py index 725c704..75e7914 100644 --- a/python/examples/solve.py +++ b/python/examples/solve.py | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # Small example of nissy Python module usage | 1 | # Small example of nissy Python module usage |
| 2 | 2 | ||
| 3 | # Run "./build python", then run this from either the top-level directory | 3 | # Run "./build.sh python", then run this from either the top-level directory |
| 4 | # of the nissy-core repo or from the python subdirectory. | 4 | # of the nissy-core repo or from the python subdirectory. |
| 5 | 5 | ||
| 6 | # Append the directories to the python path so we can load the module | 6 | # Append the directories to the python path so we can load the module |
diff --git a/utils/container-run.sh b/utils/container-run.sh index ba8deae..6090e1c 100755 --- a/utils/container-run.sh +++ b/utils/container-run.sh | |||
| @@ -4,14 +4,14 @@ | |||
| 4 | # It can be used for testing on platforms different from the host. For example, | 4 | # It can be used for testing on platforms different from the host. For example, |
| 5 | # the command | 5 | # the command |
| 6 | # | 6 | # |
| 7 | # ./container-run.sh arm ./build test | 7 | # ./container-run.sh arm ./build.sh test |
| 8 | # | 8 | # |
| 9 | # builds nissy and runs the unit tests in an ARM container. | 9 | # builds nissy and runs the unit tests in an ARM container. |
| 10 | # | 10 | # |
| 11 | # The containers are based on Alpine Linux and the contain the necessary tools | 11 | # The containers are based on Alpine Linux and the contain the necessary tools |
| 12 | # to build the main library and the C++ and Python examples. They DO NOT | 12 | # to build the main library and the C++ and Python examples. They DO NOT |
| 13 | # contain the emscripten compiler, so they cannot be used to build the web | 13 | # contain the emscripten compiler, so they cannot be used to build the web |
| 14 | # version (e.g. ./build web or ./buidl webtest). | 14 | # version (e.g. ./build.sh web or ./build.sh webtest). |
| 15 | # The images are given a tag starting with 'localhost/nissy/'. | 15 | # The images are given a tag starting with 'localhost/nissy/'. |
| 16 | # | 16 | # |
| 17 | # See below for a list of options. | 17 | # See below for a list of options. |
| @@ -28,7 +28,7 @@ usage() { | |||
| 28 | echo "arm (equivalent to: arm64)" | 28 | echo "arm (equivalent to: arm64)" |
| 29 | echo "" | 29 | echo "" |
| 30 | echo "Examples:" | 30 | echo "Examples:" |
| 31 | echo "$0 ram ./build test # Run unit tests in arm container" | 31 | echo "$0 ram ./build.sh test # Run unit tests in arm container" |
| 32 | exit 1 | 32 | exit 1 |
| 33 | } | 33 | } |
| 34 | 34 | ||
diff --git a/web/http/nissyapp.mjs b/web/http/nissyapp.mjs index b056b5f..a653db6 100644 --- a/web/http/nissyapp.mjs +++ b/web/http/nissyapp.mjs | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | // Run ./build web from the main folder before running this example. | 1 | // Run ./build.sh web from the main folder before running this example. |
| 2 | // The necessary modules (including worker.mjs) will be built and / or moved | 2 | // The necessary modules (including worker.mjs) will be built and / or moved |
| 3 | // to this folder when running ./build web. | 3 | // to this folder when running ./build.sh web. |
| 4 | 4 | ||
| 5 | var solveButton = document.getElementById("solveButton"); | 5 | var solveButton = document.getElementById("solveButton"); |
| 6 | var pauseResumeButton = document.getElementById("pauseResumeButton"); | 6 | var pauseResumeButton = document.getElementById("pauseResumeButton"); |
