Skip to content

Commit b0c0282

Browse files
committed
Rename tool script to tool.bash and update readme
1 parent b6f0578 commit b0c0282

File tree

2 files changed

+91
-76
lines changed

2 files changed

+91
-76
lines changed

readme.md

+90-75
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,6 @@ project does not or cannot use these, you can easily exchange them for
3636
something else by using preprocessor definitions. See the section below about
3737
the available [customizations](#customizations).
3838

39-
*Layout* comes with a small set of tests as a build target, along with a
40-
primitive benchmark and example usage of the library as a Lua .dll module.
41-
However, you don't need any of this to use *Layout* in your own project.
42-
43-
Building the tests, benchmarks and Lua module are handled by
44-
[GENie](https://github.com/bkaradzic/GENie), but no executable binaries for
45-
GENie are included in this source repository. [Download links for binary builds
46-
of GENie are listed below](#download-genie). You will need to download (or
47-
build yourself) a GENie executable and place it in your path or at the root of
48-
this repository tree. If you want to build on a platform other than Windows,
49-
you'll likely need to modify [genie.lua](genie.lua) for compatibility. Feel
50-
free to open issues or pull requests.
51-
5239
*Layout* can be built as C99 or C++ if you are using GCC or Clang, but must be
5340
built as C++ if you are using MSVC. This requirement exists because the
5441
*Layout* implementation code uses the `vector_size` extension in GCC and Clang,
@@ -62,51 +49,12 @@ implementation easier to read.
6249
[duangle](https://twitter.com/duangle). Unlike *oui*, *Layout* does not handle
6350
anything related to user input, focus, or UI state.
6451

65-
Building the Tests and Benchmarks
66-
=================================
67-
68-
If you want to build *Layout*'s tests, benchmarks, or example Lua module, you
69-
will first need to get (or make) a GENie binary and place it in your path or at
70-
the root of this repository.
71-
72-
Download GENie
73-
--------------
74-
75-
Linux:
76-
https://github.com/bkaradzic/bx/raw/master/tools/bin/linux/genie
77-
78-
OSX:
79-
https://github.com/bkaradzic/bx/raw/master/tools/bin/darwin/genie
80-
81-
Windows:
82-
https://github.com/bkaradzic/bx/raw/master/tools/bin/windows/genie.exe
83-
84-
Visual Studio 2015/2017
85-
------------------
86-
87-
```
88-
genie.exe vs2015
89-
start build/vs2015/layout.sln
90-
```
91-
92-
Replace vs2015 with vs2017 if you want to use Visual Studio 2017.
93-
94-
GCC/MinGW/Clang
95-
---------------
96-
97-
```
98-
./genie gmake
99-
```
100-
101-
and then run your `make` in the directory `build/gmake`. You will need to
102-
specify a target and config. Here is an example for building the `tests` target
103-
in Windows with the 64-bit release configuration using mingw64 in a bash-like
104-
shell (for example, git bash):
105-
106-
107-
```
108-
./genie.exe gmake && mingw32-make.exe -C build/gmake tests config=release64
109-
```
52+
Building the tests and benchmarks is handled by the [tool.bash](tool.bash)
53+
script, or by [GENie](https://github.com/bkaradzic/GENie). See the section
54+
below about [building the tests and
55+
benchmarks](#building-the-tests-and-benchmarks). There's also an example of
56+
using *Layout* as a Lua `.dll` module. However, you don't need any of that to
57+
use *Layout* in your own project.
11058

11159
Options
11260
-------
@@ -115,31 +63,20 @@ You can choose to build *Layout* to use either integer (int16) or floating
11563
point (float) coordinates. Integer is the default, because UI and other 2D
11664
layouts do not often use units smaller than a single point when aligning and
11765
positioning elements. You can choose to use floating point instead of integer
118-
by defining `LAY_FLOAT`. If you are building the tests, benchmarks, or Lua
119-
module for *Layout*, you can configure this when you invoke GENie:
120-
121-
```
122-
./genie gmake --coords=float
123-
```
124-
125-
or if you want to specify integer (the default):
126-
127-
```
128-
./genie gmake --coords=integer
129-
```
66+
by defining `LAY_FLOAT`.
13067

131-
Customizations
132-
--------------
68+
* `LAY_FLOAT`, when defined, will use `float` instead of `int16` for
69+
coordinates.
13370

13471
In addition to the `LAY_FLOAT` preprocessor option, other behavior in *Layout*
13572
can be customized by setting preprocessor definitions. Default behavior will be
13673
used for undefined customizations.
13774

138-
* `LAY_ASSERT`, if defined, will replace the use of `assert.h`'s `assert`
75+
* `LAY_ASSERT` will replace the use of `assert.h`'s `assert`
13976

140-
* `LAY_REALLOC`, if defined, will replace the use of `stdlib.h`'s `realloc`
77+
* `LAY_REALLOC` will replace the use of `stdlib.h`'s `realloc`
14178

142-
* `LAY_MEMSET`, if defined, will replace the use of `string.h`'s `memset`
79+
* `LAY_MEMSET` will replace the use of `string.h`'s `memset`
14380

14481
If you define `LAY_REALLOC`, you will also need to define `LAY_FREE`.
14582

@@ -255,3 +192,81 @@ lay_destroy_context(&ctx);
255192
// The heap-allocated buffer is now freed. The context is now invalid for use
256193
// until lay_init_context is called on it again.
257194
```
195+
196+
Building the Tests and Benchmarks
197+
=================================
198+
199+
ⓘ | None of this is necessary to use in your own project. These directions are only for building the tests and benchmarks programs, which you probably don't care about.
200+
:---: | :---
201+
202+
If you have bash and are on a POSIX system, you can use the `tool.bash`
203+
script to build *Layout*'s standalone tests and benchmarks programs. Run
204+
`tool.bash` to see the options.
205+
206+
<h3>Using GENie</h3>
207+
208+
Instead of using the `tool.bash` script, you can use GENie to generate a Visual
209+
Studio project file, or any of the other project and build system output types
210+
it supports. The GENie generator also lets you build the example Lua module.
211+
212+
<details>
213+
<summary>Directions for acquiring and using GENie</summary>
214+
215+
The [genie.lua](genie.lua) script is mostly tested on Windows, so if you use it
216+
on another platform, you might need to tweak it.
217+
218+
You will first need to get (or make) a GENie binary and place it in your path
219+
or at the root of this repository.
220+
221+
Download GENie
222+
--------------
223+
224+
Linux:
225+
https://github.com/bkaradzic/bx/raw/master/tools/bin/linux/genie
226+
227+
OSX:
228+
https://github.com/bkaradzic/bx/raw/master/tools/bin/darwin/genie
229+
230+
Windows:
231+
https://github.com/bkaradzic/bx/raw/master/tools/bin/windows/genie.exe
232+
233+
Visual Studio 2015/2017
234+
-----------------------
235+
236+
```
237+
genie.exe vs2015
238+
start build/vs2015/layout.sln
239+
```
240+
241+
Replace vs2015 with vs2017 if you want to use Visual Studio 2017.
242+
243+
GCC/MinGW/Clang
244+
---------------
245+
246+
```
247+
./genie gmake
248+
```
249+
250+
and then run your `make` in the directory `build/gmake`. You will need to
251+
specify a target and config. Here is an example for building the `tests` target
252+
in Windows with the 64-bit release configuration using mingw64 in a bash-like
253+
shell (for example, git bash):
254+
255+
256+
```
257+
./genie.exe gmake && mingw32-make.exe -C build/gmake tests config=release64
258+
```
259+
260+
If you want to use float coordinates instead of integer, you can use an option in the build script which will define `LAY_FLOAT` for you:
261+
262+
```
263+
./genie gmake --coords=float
264+
```
265+
266+
or if you want to specify integer (the default):
267+
268+
```
269+
./genie gmake --coords=integer
270+
```
271+
272+
</details>

tool renamed to tool.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -eu -o pipefail
33

44
print_usage() {
55
cat <<EOF
6-
Usage: tool [options] command [args]
6+
Usage: tool.bash [options] command [args]
77
Commands:
88
build <config> <target>
99
Configs: debug, release

0 commit comments

Comments
 (0)