Skip to content

Commit

Permalink
update build commands to use cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
goatshriek committed Sep 26, 2024
1 parent c4ab2a1 commit b14e670
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
36 changes: 18 additions & 18 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ cd build
cmake ../stumpless

# building the library itself
make all
cmake --build .
```

Other environments should be built according to their normal style. For example
Expand Down Expand Up @@ -268,7 +268,7 @@ configuration of the system.
```sh
# the resulting documentation will appear in a folder named docs in the build
# directory
make docs
cmake --build . --target docs
```


Expand All @@ -279,7 +279,7 @@ tests and display the results. If you're concerned that the build may not work
on your architecture, then this is the best way to verify.

```sh
make check
cmake --build . --target check
```

The `check` target will download and build the Google Test library in the build
Expand All @@ -290,20 +290,22 @@ If you're curious about how the library will perform on your system, use the
will download and build the Google Benchmark library in order to run.

```sh
make bench
cmake --build . --target bench
```


## Installing your Build
You can use the install target to install the library on your machine after the
build.
build. This example uses the cmake `--install` command, but you could also use
the `install` build target for your specific build system, for example
`make install` in a GNU make build.

```sh
make install
cmake --install .

# if the above doesn't work, you might need sudo to install files into the
# correct system folders
sudo make install
sudo cmake --install .
```

A simple way to make sure that your install is working as you expected is to
Expand All @@ -313,7 +315,7 @@ your install.

```sh
# first we use the build target to make sure it works
make example-entry && ./example-entry
cmake --build . --target run-example-entry

# next, we compile the same example manually
gcc docs/examples/entry/entry_example.c -lstumpless -omanual_entry_example
Expand All @@ -333,7 +335,8 @@ the environment variable `LIBRARY_PATH` in Cygwin.
If you find that stumpless has installed to unexpected locations and you want
to modify this, use the `CMAKE_INSTALL_PREFIX` definition during the
configuration step of the build. You can always re-run cmake to update this in
an existing build tree if you need to change it.
an existing build tree if you need to change it, or supply the `--prefix` option
to `cmake --install` to change it at install time.

```sh
# our initial build installed to /usr/local locations, which we didn't want
Expand All @@ -345,11 +348,8 @@ cat install_manifest.txt
# /usr/local/include/stumpless.h
# <output truncated>

# re-run the configuration
cmake -DCMAKE_INSTALL_PREFIX=/usr ../stumpless

# re-do the install
sudo make install
# re-do the install with a different prefix
sudo cmake --install . --prefix /usr

# now we see things in the right place!
cat install_manifest.txt
Expand Down Expand Up @@ -401,14 +401,14 @@ testing the C++ library can be done like this:
# this will emit a warning and leave c++ disabled if wrapture cannot be found
cmake -DENABLE_CPP=ON ../stumpless

# the all target will now include the stumpless c++ library
make all
# the default target will now include the stumpless c++ library
cmake --build .

# to test the library, use the `check-cpp` target
make check-cpp
cmake --build . --target check-cpp

# when enabled, the C++ bindings are installed along with the library itself
# so the following command will install the c++ headers and library in addition
# to the c headers and library
make install
cmake --install .
```
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ with your request and we'll work it into our

## Quick Build and Install
Stumpless only requires cmake and a cmake-supported build toolchain (like GCC
or Visual Studio) to build. For a system using the standard GNU make toolchain,
you can simply do:
or Visual Studio) to build.

```sh
# cloning the latest version of the source tree
Expand All @@ -75,10 +74,10 @@ cd build
cmake ../stumpless

# building stumpless (with 4 threads - adjust as desired)
make -j 4 all
cmake --build . --parallel 4

# install the library (you probably need sudo to do this)
sudo make install
sudo cmake --install .
```

Check out the [Installation Instructions](INSTALL.md) for more detail on
Expand Down

0 comments on commit b14e670

Please sign in to comment.