Skip to content

urban233/rdkit-cpp-example-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rdkit-cpp-example-template

License Conan

This repository is based on the blog post Using the RDKit in a C++ program as a ready-to-use GitHub template.

NOTE: This branch contains a new variant that uses Conan to build the library. To get the Conda version, please check the conda branch.

Contents of this document

Prerequisite

Build

From source

  1. Create a new Python virutal environment:
    python -m venv .venv
  2. Activate the new Python virtual environment (for Windows):
    .\.venv\Scripts\activate
  3. Install the Conan Python package:
    pip install conan
  4. Run Conan configuration step
    IMPORTANT: You must have a Conan package of RDKit in your local Conan cache!
    You can get the Conan RDKit package by following the guide Building the RDKit Conan package.
    Once you've built the Conan RDKit package, adjust line 45 of the conanfile.py so that it contains the correct channel. Most common is rdkit/2025.09.3.
    conan install .
  5. Run CMake build step using the appropriate Conan profile (e.g. Windows):
    conan build . --profile .\profiles\windows\release
    or for Linux use:
    conan build . --profile ./profiles/linux/release
    or for macOS use:
    conan build . --profile ./profiles/macos/release

IMPORTANT: Be aware that the profiles for Linux and macOS are only tested via the GitHub action workflow.

Package as standalone folder

NOTE: This procedure has been only tested on Windows yet. For macOS and Linux proceed with caution.

The default profiles located under the profiles folder can be used to package the library as a standalone folder. To change the output folder, modify the local_package_dir property in the conanfile.py file.

Building the Conan RDKit package

In order to build this example using Conan, you'll need to build the RDKit Conan package first, so that it's available via the local Conan cache. To do this, clone the RDKit conan package repo:

git clone https://github.com/urban233/rdkit-conan-package.git
cd rdkit-conan-package

After that, proceed with creating the package:

conan create . rdkit/2025.09.03

This will build the RDKit library and create a local Conan package.


Now you can proceed with step 4 of the From source section.

Working with CLion

To build this example in IDE's such as CLion, you can use CMake profiles. Start with cloning the repository:

git clone https://github.com/urban233/rdkit-cpp-example-template.git
cd rdkit-cpp-example-template

After that, install the Conan dependencies by running:

conan install .

Be aware that for this, the Conan RDKit package must be present in the local Conan cache. Then, create the CMake profile by running:

cmake . --preset=conan-default

After that you could also build the Conan RDKit package with the command:

cmake --build --preset=conan-release

or activate the new CMake profile within CLion and then use the GUI to build the project.

Using Conda

This repository also contains a Conda variant that can be used for dependency management. To use it, please first clone the repo:

git clone https://github.com/urban233/rdkit-cpp-example-template.git

and then switch to the conda branch:

cd rdkit-cpp-example-template
git checkout conda

This branch contains a README.md file with instructions on how to use Conda to build the library.

License

This project is licensed under the BSD License – see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published