Skip to content

Commit

Permalink
make optional arguments to cmake explicit (p4lang#1536)
Browse files Browse the repository at this point in the history
make optional arguments to cmake explicit
  • Loading branch information
Calin Cascaval authored Oct 1, 2018
1 parent 123a1fc commit 59d920c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ OPTION (ENABLE_P4C_GRAPHS "Build the p4c-graphs backend" ON)
OPTION (ENABLE_PROTOBUF_STATIC "Link against Protobuf statically" ON)
OPTION (ENABLE_GC "Use libgc" ON)

if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "RELEASE")
endif()

if (NOT $ENV{P4C_VERSION} STREQUAL "")
# Allow the version to be set from outside
set (P4C_VERSION $ENV{P4C_VERSION})
Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,31 @@ dot -Tpdf ParserImpl.dot > ParserImpl.pdf
```
mkdir build
cd build
cmake .. [-DCMAKE_BUILD_TYPE=RELEASE|DEBUG] [-DCMAKE_INSTALL_PREFIX=<path>] [-DENABLE_DOCS=ON (default off)] [-DENABLE_P4RUNTIME_TO_PD=OFF (default on)] [-DENABLE_PROTOBUF_STATIC=OFF (default on)] [-DENABLE_GC=OFF (default on)]
cmake .. <optional arguments>
make -j4
make -j4 check
```
If adding new targets to this build system, please see [instructions](#defining-new-cmake-targets).
The cmake command takes the following optional arguments to
further customize the build:
- `-DCMAKE_BUILD_TYPE=RELEASE|DEBUG` -- set CMAKE_BUILD_TYPE to
RELEASE or DEBUG to build with optimizations or with debug
symbols to run in gdb. Default is RELEASE.
- `-DCMAKE_INSTALL_PREFIX=<path>` -- set the directory where
`make install` installs the compiler. Defaults to /usr/local.
- `-DENABLE_BMV2=ON|OFF`. Enable the bmv2 backend. Default ON.
- `-DENABLE_EBPF=ON|OFF`. Enable the ebpf backend. Default ON.
- `-DENABLE_P4C_GRAPHS=ON|OFF`. Enable the p4c-graphs backend. Default ON.
- `-DENABLE_P4TEST=ON|OFF`. Enable the p4test backend. Default ON.
- `-DENABLE_DOCS=ON|OFF`. Build documentation. Default is OFF.
- `-DENABLE_GC=ON|OFF`. Enable the use of the garbage collection
library. Default is ON.
- `-DENABLE_GTESTS=ON|OFF`. Enable building and running GTest unit tests.
Default is ON.
- `-DENABLE_PROTOBUF_STATIC=ON|OFF`. Enable the use of static
protobuf libraries. Default is ON.
If adding new targets to this build system, please see
[instructions](#defining-new-cmake-targets).
4. (Optional) Install the compiler and the P4 shared headers globally.
```
Expand Down

0 comments on commit 59d920c

Please sign in to comment.