| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
bi is an arbitrary precision integer library for C++.
For detailed documentation, including this document and an API reference, visit the bi Documentation.
Clone the repository:
git clone <repository-url-or-ssh>
cd biCreate a build directory:
mkdir build && cd buildConfigure the build:
For the default configuration:
cmake ..For custom configurations, refer to the Options section below.
Note: The bi library targets C++20. Sometimes, the default compiler found by CMake might lack support for some C++20 features used in the library. CMake allows you to specify the compiler manually. For instance:
cmake .. -DCMAKE_CXX_COMPILER=clang++More generally:
cmake .. -DCMAKE_CXX_COMPILER=/path/to/your/compilerBuild the library
cmake --build .Run Tests (if applicable):
If BUILD_TESTS is enabled (default is ON), run the tests using:
ctestInstall the Library:
cmake --install . --prefix /path/to/installReplace /path/to/install with the desired installation directory.
Configure the build by appending these options to the cmake command in step 3:
Release-Optimized or Debug Build
Single-configuration generators. Set CMAKE_BUILD_TYPE to Release at configuration time:
cmake .. -DCMAKE_BUILD_TYPE=ReleaseFor single-configuration generators, if CMAKE_BUILD_TYPE is not specified, this library will set CMAKE_BUILD_TYPE to Release by default. For a debug build, use -DCMAKE_BUILD_TYPE=Debug.
Multi-configuration generators (e.g. Visual Studio). The build type for these generators is selected at build time, not at configuration time. Use the --config Release option with the cmake --build command to specify a release build:
cmake --build . --config ReleaseFor a debug build, use the --config Debug option.
Development
Enabling the export of compile commands is useful for tools like linters or editors. To do this, set CMAKE_EXPORT_COMPILE_COMMANDS to ON. For example:
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ONTo integrate the bi library into a CMake project, locate and link against it using CMake's find_package() command.
Install the bi Library
Ensure that bi is installed on your system. If you haven't already installed it, or if you're unsure how to do so, refer to the Building From Source section for steps on creating a build directory, configuring, building, and installing the library.
Use a Packaged Version of the Library:
Alternatively, if you have a CPack-generated package of the bi library, extract it to a preferred location. This option is useful if you prefer not to build from source or are distributing the library to others.
Important Note: If you install the library or extract a packaged version of it to a non-standard location (i.e., not in the default system paths), note the path (e.g., /path/to/install). You may need this information for setting the CMAKE_PREFIX_PATH in your project, enabling CMake to find and link the library.
Configure Your Project to Find the bi Library
In your project's CMakeLists.txt file, use the find_package() command to locate the bi library:
find_package(bi REQUIRED)Link Against the bi Library
After finding the bi library with find_package(), link it to your target:
add_executable(sample sample.cpp)
target_link_libraries(sample PRIVATE bi::bi)Setting the CMAKE_PREFIX_PATH (if necessary)
This step is only necessary if you installed or extracted bi to a non-standard location, say, /path/to/install.
Option 1: Using Command Line
Set CMAKE_PREFIX_PATH to /path/to/install when configuring your project.
For example:
cmake .. -DCMAKE_PREFIX_PATH=/path/to/installOption 2: Modifying CMakeLists.txt
Alternatively, append the path to CMAKE_PREFIX_PATH in your project's CMakeLists.txt:
list(APPEND CMAKE_PREFIX_PATH /path/to/install)Add this before the find_package() call.
After building the bi library, one can create a distributable package using CPack, containing the compiled binaries and necessary headers.
Complete the build process as described in Building from Source.
In the build directory, run:
cpack
Refer to the cpack documentation for additional options and details.
Users with compatible platforms can integrate the packaged bi library into their projects.
For example, for CMake-based projects:
This approach allows users to integrate the library into their CMake-based projects, bypassing the need to build the library from source.
| Back | FazBrowse Home | New Git URL |