Building requires access to an installation of Geode. There are two ways to achieve this:
GEODE_HOMEthat points to your Geode installation path.
GEODE_ROOTduring the CMake configuration step.
-DGEODE_ROOT=/path/to/geodeto the initial
$ cd <clone> $ mkdir build $ cd build # configuration step $ cmake .. <platform-specific generator parameters (see below)> # build step $ cmake --build . -- <platform-specific parallelism parameters (see below)>
If OpenSSL is installed in a custom location, then you must pass
OPENSSL_ROOT_DIR during the CMake configuration step. For example,
To explicitly specify the location in which the Native Client will be installed, add
-DCMAKE_INSTALL_PREFIX=/path/to/installation/destination to this initial
cmake execution command.
To set the version header on the API docs, specify PRODUCT_VERSION on the configuration command line. For example,
CMake uses a “generator” to produce configuration files for use by a variety of build tools, e.g., UNIX makefiles, Visual Studio projects. By default a system-specific generator is used by CMake during configuration. (Please see the CMake documentation for further information.) However, in many cases there is a better choice.
The recommended generator for most unix platforms is ‘Makefiles’ (default):
$ cmake ..
Install XCode from the App Store
xcode-select --installfrom terminal
Install the required dependencies through homebrew. If you use another package manager for your mac feel free to use that.
$ brew install geode $ brew install openssl $ brew install doxygen $ brew install cmake
You will need to provide the path to the brew installed OpenSSL headers since macOS already has a system installed version but without the required headers.
$ cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl
For Visual Studio 2017 and newer you only need to specify the correct architecture, toolset and SDK for Windows. To build a 64-bit library using the 64 bit toolset version 14.1 with minimum ABI compatibility of 14.16 for minimum Windows version 10.0.16299.0 use the following options.
$ cmake .. -A x64 -Tv141,version=14.16,host=x64 -DCMAKE_SYSTEM_VERSION=10.0.16299.0
At a bare minimum you will likely need to specify the architecture, since MSVC still defaults to 32 bit, and the 64 bit version of the toolset, because of large object files. The latest toolset version and Windows SDK will likely get picked up.
$ cmake .. -A x64 -Thost=x64
For faster builds, use optional parallelism parameters in the last build step:
$ cmake --build . -- -j <# of jobs>
$ cmake --build . -- /m
IPv6 support can be enabled by adding
-DWITH_IPV6=ON to the CMake Generator command.
$ cmake … -DWITH_IPV6=ON …
If building with GCC or Clang you can enable C++ code coverage by adding
-DUSE_CPP_COVERAGE=ON to the CMake Generator command.
$ cmake … -DUSE_CPP_COVERAGE=ON …
You can then generate a C++ code coverage report by downloading lcov. After acquiring lcov, finish the Steps to build section above. Then, run the tests as described in the CONTRIBUTING.md. Finally, run the following commands from the
$ lcov --capture --directory . --output-file coverage.info $ genhtml coverage.info --output-directory coverage_report
You can then open the
index.html file in the
coverage_report directory using any browser.
$ cmake … -DCMAKE_CXX_CLANG_TIDY=clang-tidy …
To use specific
$ cmake … -DCMAKE_CXX_CLANG_TIDY=/path/to/clang-tidy …
clang-tidy uses the configuration found in
.clang-tidy To override
$ cmake … -DCMAKE_CXX_CLANG_TIDY=clang-tidy;<options> …
Individual targets in the build tree have their own dependency of the form
<<targetName>>-clangformat, which uses the
clang-format executable, wherever it is found, to format and modified files according to the rules specfied in the .clang-format file. This is helpful when submitting changes to geode-native, because an improperly formatted file will fail Travis-CI and have to be fixed prior to merging any pull request. If clang-format is not installed on your system, clangformat targets will not be added to your project files, and geode-native should build normally. Under some circumstances, however, it may become necessary to disable
clang-format on a system where it is installed.
clang-format in the build:
$ cmake … -DClangFormat_EXECUTABLE='' …
On the other hand, it may also be desirable to run clang-format on the entire source tree. This is also easily done via the
all-clangformat in a build with clang-format enabled. If clang-format has been disabled in the cmake configuration step, as above, the
all-clangformat target will not exist, and the cmake configuration step will have to be re-run with clang-format enabled.
To run clang-format on the entire source tree:
$ cmake --build . --target all-clangformat
By default a system-specific location is used by CMake as the destination of the
install target, e.g.,
/usr/local on UNIX system. To explicitly specify the location in which the Native Client will be installed, add
-DCMAKE_INSTALL_PREFIX=/path/to/installation/destination to the initial
cmake execution command.
Note: For consistent results, avoid using the “~” (tilde) abbreviation when specifying paths on the CMake command line. Interpretation of the symbol varies depending on the option being specified, and on the system or command shell in use.
Due to limitations in CMake, the documentation must be built as a separate step before installation:
$ cd <clone> $ cd build $ cmake --build . --target docs $ cmake --build . --target install
$ xcode-select --install