1cmake_minimum_required(VERSION 3.15)
2project(markov_cpp)
4set(CMAKE_CXX_STANDARD 14)
5set(CMAKE_CXX_STANDARD_REQUIRED ON)
6set(CMAKE_POSITION_INDEPENDENT_CODE ON)
8find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
10# Fetch and include pybind11
11include(FetchContent)
12FetchContent_Declare(
13 pybind11
14 GIT_REPOSITORY https://github.com/pybind/pybind11.git
15 GIT_TAG v2.11.1
16)
18# Fetch and include Eigen
19FetchContent_Declare(
20 eigen
21 GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
22 GIT_TAG 3.4.0
23)
25FetchContent_MakeAvailable(pybind11 eigen)
27# Build markov_reconstruct module
28pybind11_add_module(markov_reconstruct_cpp_ext markov_reconstruct.cpp)
30# Build markov_predict module
31pybind11_add_module(markov_predict_cpp_ext markov_predict.cpp)
32target_link_libraries(markov_predict_cpp_ext PRIVATE Eigen3::Eigen)
34# Build get_run_lengths module
35pybind11_add_module(get_run_lengths_cpp_ext get_run_lengths.cpp)
37# Install all modules
38install(TARGETS markov_reconstruct_cpp_ext markov_predict_cpp_ext get_run_lengths_cpp_ext
39 DESTINATION benchcompress/algorithms/ans)