Skip to content

Commit 0ee4319

Browse files
authored
Merge pull request #4 from kadir014/rewrite
Rewrite
2 parents 4b1726c + 4264110 commit 0ee4319

File tree

169 files changed

+48989
-15856
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+48989
-15856
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
.vscode/
33
nova-physics-ws.code-workspace
44

5+
# Meson
6+
subprojects/
7+
reconfigure/
8+
59
# Project testing & debugging
610
cache/
11+
.cache/
712
test.c
813
pytest/
914
SDL2/
@@ -70,6 +75,7 @@ lib
7075
*.so
7176
*.so.*
7277
*.dylib
78+
.DS_Store
7379

7480
# Executables
7581
*.exe

BUILDING.md

Lines changed: 30 additions & 203 deletions
Original file line numberDiff line numberDiff line change
@@ -1,218 +1,45 @@
1-
# Nova Physics Build System Guidance
2-
Welcome to the Nova Physics building guide.
1+
# Building Nova Physics
2+
Nova Physics uses [Meson](https://mesonbuild.com/) as its build system.
33

4-
Nova Physics uses a dependency-free Python script to simplify and organize building.
5-
6-
You can use `python nova_builder.py --help` to see the usage manual. Only requirement is to have Python 3.9 or higher installed on the system.
7-
8-
9-
**What you can do with the build system:**
10-
- [Build Nova Physics library](#building-nova-physics-static-libraries)
11-
- [Build & run example demos](#running-nova-physics-example-demos)
12-
- [Build & run benchmarks](#running-nova-physics-benchmarks)
13-
- [Build & run the test suite](#running-nova-physics-test-suite)
14-
15-
16-
<br><br><br>
17-
18-
19-
# Building Nova Physics Static Libraries
20-
This section covers building and generating static libraries yourself (in case you don't use the already-built archives from the [latest release.](https://github.com/kadir014/nova-physics/releases/latest))
21-
22-
## <img src="https://i.imgur.com/lyTfWAN.png" width=20> Windows
23-
**Prerequisite**: Make sure you have either MinGW (GCC) or Visual Studio build tools installed.
24-
25-
Download or clone the repository.
26-
```
27-
git clone https://github.com/kadir014/nova-physics.git
28-
```
29-
30-
Set working directory as Nova Physics directory.
31-
```
32-
cd "C:\...\nova-physics"
33-
```
34-
35-
Run Nova Physics's build system with `build` command to start building. To see options and arguments you can utilize for building use `--help`.
36-
```
37-
python nova_builder.py build
38-
```
39-
40-
If successful, you should see the generated static libraries in the `nova-physics\build` sub-directory.
41-
42-
43-
## <img src="https://i.imgur.com/J3TG2gm.png" width=20> Linux
44-
45-
**Prerequisite**: Make sure you have GCC installed
46-
47-
<br>
48-
49-
Download or clone the repository.
50-
```
51-
$ git clone https://github.com/kadir014/nova-physics.git
52-
```
53-
54-
Set working directory as Nova Physics directory.
55-
```
56-
$ cd ./.../nova-physics
57-
```
58-
59-
Run Nova Physics's build system with `build` command to start building. (Can also be `py` or `python3` depending on the platform) To see options and arguments you can utilize for building use `--help`.
60-
```
61-
$ python nova_builder.py build
62-
```
63-
64-
If successful, you should see the generated static libraries in `nova-physics/build` sub-directory.
65-
66-
67-
<br><br><br>
68-
69-
70-
# Running Nova Physics Example Demos
71-
This section covers building & running examples.
72-
73-
## <img src="https://i.imgur.com/lyTfWAN.png" width=20> Windows
74-
**Prerequisite**: Make sure you have MinGW (GCC) or Visual Studio build tools installed. Dependencies like SDL2 will be installed automatically by the script.
75-
76-
Download or clone the repository.
77-
```
78-
git clone https://github.com/kadir014/nova-physics.git
4+
If you're on macOS, install HomeBrew and Nova Physics's developer dependencies.
5+
```sh
6+
$ brew install glfw mesa sdl2 meson
797
```
808

81-
Set working directory as the Nova Physics directory.
82-
```
83-
cd "C:\...\nova-physics"
9+
Install meson. (if you have any issues refer to [meson's installation guide](https://mesonbuild.com/Getting-meson.html))
10+
```sh
11+
$ pip install meson
8412
```
8513

86-
Run Nova Physics's build system with `examples` command, it will detect the missing dependencies and download them on the fly. To see options and arguments you can utilize for building use `--help`.
87-
```
88-
python nova_builder.py examples
14+
Change working dir to repository root.
15+
```sh
16+
$ cd path/to/nova-physics
8917
```
9018

91-
If successful, the example demos will be ran and you will see an SDL2 window open.
92-
93-
## <img src="https://i.imgur.com/J3TG2gm.png" width=20> Linux
94-
**Prerequisite**: Make sure you have GCC, SDL2 and SDL2-ttf development libraries installed via your package manager.
95-
Here are two sources explaining how to install SDL2 and the extensions on Linux:
96-
- https://wiki.libsdl.org/SDL2/Installation
97-
- https://lazyfoo.net/tutorials/SDL/01_hello_SDL/linux/index.php
98-
99-
<br>
100-
101-
After installing the dependencies, download or clone the repository.
102-
```
103-
$ git clone https://github.com/kadir014/nova-physics.git
19+
Create a `build` directory for meson.
20+
```sh
21+
$ mkdir build
10422
```
10523

106-
Set working directory as Nova Physics directory
107-
```
108-
$ cd ./.../nova-physics
24+
Setup meson configuration. For the other type of build types (optimization levels) see [here.](https://mesonbuild.com/Builtin-options.html#details-for-buildtype)
25+
```sh
26+
$ meson setup build --buildtype=debug
10927
```
11028

111-
Then run the build system with the `examples` command. (Can also be `py` or `python3` depending on the platform) To see options and arguments you can utilize for building use `--help`.
29+
We can finally start compiling. If successful you should see the built targets in `build` directory.
30+
```sh
31+
$ meson compile -C build
11232
```
113-
$ python nova_builder.py examples
114-
```
115-
116-
If successful, the example demos will be ran and you will see an SDL2 window open.
117-
118-
119-
<br><br><br>
120-
121-
122-
# Running Nova Physics Benchmarks
123-
This section covers building & running benchmarks.
12433

125-
## <img src="https://i.imgur.com/lyTfWAN.png" width=20> Windows
126-
**Prerequisite**: Make sure you have either MinGW (GCC) or Visual Studio build tools installed.
34+
# Building Options
35+
While in the `build` dir (not root dir) you can use `$ meson configure` to see all building options and change them with `$ meson configure -Doption=nv_bool`
12736

128-
Download or clone the repository.
129-
```
130-
git clone https://github.com/kadir014/nova-physics.git
131-
```
132-
133-
Set working directory as Nova Physics directory.
134-
```
135-
cd "C:\...\nova-physics"
136-
```
137-
138-
Run Nova Physics's build system with `bench` command with a benchmark argument (e.g `boxes.c`) to start benchmarking. To see options and arguments you can utilize for building use `--help`.
139-
```
140-
python nova_builder.py bench <benchmark_source>
141-
```
142-
143-
If successful, the benchmark will start running, you can see the progress and remaining time on terminal.
144-
145-
146-
## <img src="https://i.imgur.com/J3TG2gm.png" width=20> Linux
147-
148-
**Prerequisite**: Make sure you have GCC installed
149-
150-
<br>
151-
152-
Download or clone the repository.
153-
```
154-
$ git clone https://github.com/kadir014/nova-physics.git
155-
```
156-
157-
Set working directory as Nova Physics directory.
158-
```
159-
$ cd ./.../nova-physics
160-
```
161-
162-
Run Nova Physics's build system with `bench` command with a benchmark argument (e.g `boxes.c`) to start benchmarking. (Can also be `py` or `python3` depending on the platform) To see options and arguments you can utilize for building use `--help`.
163-
```
164-
$ python nova_builder.py bench <benchmark_source>
165-
```
166-
167-
If successful, the benchmark will start running, you can see the progress and remaining time on terminal.
168-
169-
170-
<br><br><br>
171-
172-
173-
# Running Nova Physics Test Suite
174-
This section covers building & running unit tests.
175-
176-
## <img src="https://i.imgur.com/lyTfWAN.png" width=20> Windows
177-
**Prerequisite**: Make sure you have either MinGW (GCC) or Visual Studio build tools installed.
178-
179-
Download or clone the repository.
180-
```
181-
git clone https://github.com/kadir014/nova-physics.git
182-
```
183-
184-
Set working directory as Nova Physics directory.
185-
```
186-
cd "C:\...\nova-physics"
187-
```
188-
189-
Run Nova Physics's build system with `tests` command to start running the test suite. To see options and arguments you can utilize for building use `--help`.
190-
```
191-
python nova_builder.py tests
192-
```
193-
194-
If successful, the unit tests will be run and results will be shown on the terminal.
195-
196-
197-
## <img src="https://i.imgur.com/J3TG2gm.png" width=20> Linux
198-
199-
**Prerequisite**: Make sure you have GCC installed
200-
201-
<br>
202-
203-
Download or clone the repository.
204-
```
205-
$ git clone https://github.com/kadir014/nova-physics.git
206-
```
207-
208-
Set working directory as Nova Physics directory.
209-
```
210-
$ cd ./.../nova-physics
211-
```
212-
213-
Run Nova Physics's build system with `tests` command to start running the test suite. (Can also be `py` or `python3` depending on the platform) To see options and arguments you can utilize for building use `--help`.
214-
```
215-
$ python nova_builder.py tests
216-
```
37+
Here's a list of our custom build options (You can also check `meson.options` file):
38+
- `build_examples`: Build example demos, installs SDL2. On by default.
39+
- `build_benchmarks`: Build bechmarks. Off by default.
40+
- `build_tests`: Build unit tests. On by default.
41+
- `enable_profiler`: Enable built-in profiler. If enabled, `<windows.h>` can be included. (Defines NV_ENABLE_PROFILER, on by default)
42+
- `enable_simd`: Enable usage of any SIMD extension. (Defines NV_ENABLE_SIMD, on by default)
43+
- `use_doubles`: Use double-precision floats. (Defines NV_USE_DOUBLE_PRECISION, off by default)
21744

218-
If successful, the unit tests will be run and results will be shown on the terminal.
45+
For instance, if you didn't want to build example demos and just the static library, you could do `$ meson configure -Dbuild_examples=false`.

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ void nv_some_function(...);
8282
8383
// Enums are in PascalCase, with their fields being the enum name + field name in full caps
8484
typedef enum {
85-
nv_SomeEnum_FIELD1,
86-
nv_SomeEnum_FIELD2,
85+
nvSomeEnum_FIELD1,
86+
nvSomeEnum_FIELD2,
8787
...
88-
} nv_SomeEnum;
88+
} nvSomeEnum;
8989
```

0 commit comments

Comments
 (0)