-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
48 lines (39 loc) · 1.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
cmake_minimum_required(VERSION 3.14)
project(IsingModelBindings LANGUAGES CXX)
#Find python :)
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
set(PYTHON_INCLUDE_DIR ${Python3_INCLUDE_DIRS})
set(PYTHON_LIBRARY ${Python3_LIBRARIES})
# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Find Python interpreter and development components
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
# Debug output to verify Python paths
message(STATUS "Python3_EXECUTABLE: ${Python3_EXECUTABLE}")
message(STATUS "Python3_INCLUDE_DIRS: ${Python3_INCLUDE_DIRS}")
message(STATUS "Python3_LIBRARIES: ${Python3_LIBRARIES}")
# Add pybind11 using pip-installed version
execute_process(
COMMAND ${Python3_EXECUTABLE} -m pybind11 --cmakedir
OUTPUT_VARIABLE PYBIND11_CMAKE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "pybind11 CMake directory: ${PYBIND11_CMAKE_DIR}")
find_package(pybind11 REQUIRED PATHS ${PYBIND11_CMAKE_DIR})
# Add your bindings
pybind11_add_module(montecarlo
src/cpp/bindings/montecarlo_bindings.cpp
src/cpp/model/IsingModel.cpp
src/cpp/model/Lattice.cpp
src/cpp/model/MonteCarlo.cpp
)
# Include directories for the project
target_include_directories(montecarlo PRIVATE
${PROJECT_SOURCE_DIR}/src/
${PROJECT_SOURCE_DIR}/src/cpp/model
)
add_custom_command(TARGET montecarlo POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:montecarlo> ${PROJECT_SOURCE_DIR}/lib/
)