libFGL Getting Started
This example assumes that you have the CMake build system, the Conan package manager, and a C++20 compiler (preferably GCC 12.1 or higher as it's officially compatible with libFGL). Also see the libFGL Getting Started documentation.
Note: This example tries to follow best practices where possible by using CMake targets and building "out-of-source". If you're unfamiliar with modern build practices, an examination of the
CMakeLists.txt
file may be useful.
-
Set
revisions_enabled=1
under the[general]
section of yourconan.conf
file (~/.conan/conan.conf
on Linux, and%userprofile%/.conan/conan.conf
on Windows). -
Add the libFGL conan remote by running
conan remote add fgl-conan https://fgl.jfrog.io/artifactory/api/conan/fgl-conan
-
git clone
or otherwise obtain a local copy of this example project. -
Open a terminal and navigate to the root project directory (so that the current working directory is where
CMakeLists.txt
is located). -
Run conan to retrieve the project dependencies (which is only
libFGL/latest
in this example). With these arguments, we tell it to generate files forcmake
and output them to thebuild/conan
subdirectory. This subdirectory is referenced in theCMakeLists.txt
file.conan install . -if "build/conan" -g "cmake"
Note: If you add other dependencies, you will probably need add the
--build=missing
option. It isn't required for this example. -
Run CMake to generate build files using the
CMakeLists.txt
in current working directory"."
, and output them to thebuild
subdirectory.cmake -H"." -B"build"
Note: If you're using MinGW on windows, you will probably need to specify the
-G"MinGW Makefiles"
generator option. -
Run CMake to build the project using the generated files in the
build
subdirectory.cmake --build build
-
Finally, assuming everything went well, we can execute the example program.
./build/bin/main.exe
conan remote add fgl-conan https://fgl.jfrog.io/artifactory/api/conan/fgl-conan
conan install . -if "build/conan" -g "cmake"
cmake -H"." -B"build"
cmake --build build
./build/bin/main.exe