Advanced: Directly Building the Software Framework Using Conan
Advanced: Directly Building the Software Framework Using Conan
Warning
This method of compiling Basilisk is not typically required and should only
be attempted by advanced users familiar with both conan and cmake.
See Building the Software Framework for documentation on the regular build process.
Configuring and Building with conan Commands
Calling conanfile.py with Python dispatches one Conan command that installs missing dependencies, generates
the build files, and calls the Basilisk recipe’s build() method. This section outlines the equivalent direct
Conan command for advanced users.
Note
All commands are called from the Basilisk root directory.
Installing Dependencies and Building Basilisk
The command, in its minimal form, is:
conan build . --build=missing -s compiler.cppstd=17 -s:b compiler.cppstd=17This command creates the dist3 distribution folder when needed, resolves the required third-party resources,
compiles dependencies whose binaries are missing, generates the CMake files, and builds Basilisk. All build files
are stored in dist3. It does not install or modify packages in the active Python environment. Install the
requirements and create the editable Basilisk installation separately, as described in the platform-specific
installation instructions. Applying C++17 to both the host and build profiles lets Conan match cached build tools
directly instead of searching compatible configurations or querying a remote for an avoidable profile mismatch.
For the direct equivalent of Preparing for Offline Builds, replace --build=missing with --build=never, disable remotes,
and enable Basilisk’s offline CMake and Cargo behavior through its Conan configuration value:
conan build . --build=never --no-remote \
-c user.basilisk:offline=True \
-s compiler.cppstd=17 -s:b compiler.cppstd=17The matching configuration must first have been built online so its Conan packages, GoogleTest or Corrosion sources, and Rust crates are already cached.
There are several options that can be provided to this conan build command as shown in the following table.
Note that the option names for groupings of Basilisk modules are the same as with the one-step build above. The
&: prefix scopes each option to the Basilisk consumer recipe. Keep the option expression in double quotes because
& is a shell control character.
Options for conan build
| Option | Values | Default | Description |
|---|---|---|---|
-o "&:vizInterface=<value>" | Boolean | True | Include C++ Module: vizInterface in the configuration and build |
-o "&:opNav=<value>" | Boolean | False | Include the OpenCV library dependent Basilisk modules. |
-o "&:clean=<value>" | Boolean | False | Delete the configured build folder and Basilisk Numba cache artifacts before configuring to yield a fresh build. The build folder must either be empty or contain Basilisk ownership metadata, and its resolved path cannot traverse a symbolic link or junction. Existing CMake builds are accepted only when their cache identifies the selected Basilisk source tree. |
-o "&:buildFolder=<path>" | Directory path | dist3 | Select the build folder. Relative paths are resolved from the Basilisk source directory. |
-o "&:buildProject=<value>" | Boolean | True | Will build the project executable after the configuration step |
-o "&:buildTesting=<value>" | Boolean | True | Builds the native GoogleTest executables and registers them with CTest |
-s build_type | Release, Debug | Release | Specifies the build type |
-o "&:strictWarnings=<value>" | Boolean | False | Enables the additional Basilisk compiler diagnostics described in Strict Compiler Warnings |
-o "&:generator=<value>" | see here | Automatically selected | Used to specify a specific cmake generator. See discussion in Table Options for One-Step Configure/Build Process. |
Thus, using the same build example as in the one-step section, to create a build with opNav modes enabled,
but no C++ Module: vizInterface, and using a clean distribution folder, and that is built right away, you could use:
conan build . --build=missing -s compiler.cppstd=17 -s:b compiler.cppstd=17 \
-o "&:clean=True" -o "&:buildProject=True" -o "&:opNav=True" -o "&:vizInterface=False"Note how much more verbose this is, but it gives you full control if you want to store the compiled binaries and
cmake files in directories other than dist3/conan.
Running cmake Directly
Advanced users can still run conan install . --build=missing separately when they intentionally want to
prepare dependencies and toolchain files without calling the recipe’s build() method. They must then configure
CMake with the generated Conan toolchain before running CMake directly from the dist3 distribution folder.
This optional split workflow is not used by python conanfile.py.
The following table summarizes the optional Basilisk related flags that can be provided to cmake. If
they are not used, then the shown default behaviors are used.
cmake Basilisk Build Flags
| cmake Flag | Default | Description |
|---|---|---|
BUILD_VIZINTERFACE | ON | will create C++ Module: vizInterface |
BUILD_OPNAV | OFF | will create the OpenCL dependent optical navigation related modules |
BUILD_TESTING | ON | fetches GoogleTest and builds the native C++ test executables |
BSK_STRICT_WARNINGS | OFF | enables additional compiler diagnostics for Basilisk C and C++ sources |
BSK_OFFLINE_BUILD | OFF | prevents GoogleTest, Corrosion, and Cargo dependency resolution from accessing the network; the required sources and crates must already be cached |
BSK_FETCHCONTENT_CACHE_DIR | <Basilisk root>/.bsk-cache/fetchcontent | selects the persistent GoogleTest and Corrosion source cache used by online and offline builds |
macOS Example
$ cmake ../src -G Xcode -DBUILD_OPNAV=ONLinux Example
$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../srcWindows Examples
Example direct build on Windows:
default
cmake -G "Visual Studio Win" ../src -DCMAKE_BUILD_TYPE=Release cmake --build . --target ALL_BUILD --config Release
- Example `cmake` commands using x86:
```default
cmake -G "Visual Studio <MSVC Version> <MSVC Product Year> Win32" ../src -DCMAKE_BUILD_TYPE=ReleaseMSVC Mapping
| MSVC Product Year | MSVC Version |
|---|---|
| 2022 | 17 |
| 2019 | 16 |
| 2017 | 15.9 |
| 15.8 | |
| 15.7 | |
| 15.6 | |
| 15.5 | |
| 15.4 - 15.3 | |
| 15.2 - 15.0 | |
| 2015 | 14 |
| 2013 | 12 |
| 2012 | 11 |
Example build commands for Arch x86, MSVC Year 2017, MSVC Version 15:
cmake -G “Visual Studio 15 2017 Win32” ../srcExample build commands forArch x64, MSVC Year 2019, MSVC Version 16:
cmake -G “Visual Studio 16 2019” -A x64 ../src -DCMAKE_BUILD_TYPE=Release
cmake -G “Visual Studio 15 2017 Win64” ../src -DCMAKE_BUILD_TYPE=Release