This guide explains how to install and build LazyOrm-CPP in your project.
- CMake: Version 3.15 or higher
- C++ Compiler: C++20 standard support required
- GCC 9.0+
- Clang 10.0+
- MSVC 19.28+
- Clone the repository:
git clone https://github.com/your-repo/lazy-orm-cpp.git
cd lazy-orm-cpp- Create a build directory:
mkdir build
cd build- Configure with CMake:
cmake ..- Build the library:
cmake --build .- Install (optional):
cmake --install .Add LazyOrm-CPP to your CMake project using add_subdirectory:
cmake_minimum_required(VERSION 3.15)
project(MyProject)
# Add LazyOrm-CPP
add_subdirectory(path/to/lazy-orm-cpp)
# Link to your target
add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE lazyorm)Or use CMake's find_package after installation:
find_package(lazyorm REQUIRED)
add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE lazyorm)The following CMake options are available:
| Option | Default | Description |
|---|---|---|
tests |
OFF |
Build test suite |
To build tests:
cmake -Dtests=ON ..
cmake --build .After installation, include LazyOrm-CPP headers in your code:
#include "LazyOrm.h"
#include "MariadbLazy.h"
#include "PostgreLazy.h"
#include "SqliteLazy.h"LazyOrm-CPP is a query builder and does not include database drivers. Query builder of LazyOrm-CPP supprots:
- MariaDB/MySQL`
- PostgreSQL
- SQLite
By default, LazyOrm-CPP installs to:
- Headers:
/usr/local/include/LazyOrm/ - Library:
/usr/local/lib/ - CMake config:
/usr/local/lib/cmake/lazyorm/
To customize installation paths:
cmake -DCMAKE_INSTALL_PREFIX=/custom/path ..To verify your installation, compile a simple test program:
#include <iostream>
#include "LazyOrm.h"
int main() {
LazyOrm::LazyOrm lazyOrm;
std::cout << "LazyOrm-CPP installed successfully!" << std::endl;
return 0;
}Compile:
g++ -std=c++20 test.cpp -o test -I/usr/local/include -L/usr/local/lib -llazyormIf you encounter a CMake version error, upgrade your CMake:
# Ubuntu/Debian
sudo apt-get install --only-upgrade cmake
# macOS with Homebrew
brew upgrade cmakeEnsure your compiler supports C++20:
g++ --version # Should be 9.0+
clang++ --version # Should be 10.0+If you encounter linking errors, verify the library path is in your linker search path:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATHOr add the path to /etc/ld.so.conf.d/ and run sudo ldconfig.