Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to Release mode, if conda env present install bindings and libraries in it #7

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ project(phase_manager LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
endif()

if(DEFINED ENV{CONDA_PREFIX})

set(CMAKE_INSTALL_PREFIX $ENV{CONDA_PREFIX}/ CACHE PATH "bindings install prefix" FORCE)

endif()

find_package(Eigen3 3.3 REQUIRED)

#list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
Expand Down
24 changes: 17 additions & 7 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.5)
find_package(pybind11 QUIET)
add_compile_options(-std=c++14)


message(STATUS "check for pybind11")

if(${pybind11_FOUND})

message(STATUS "compiling python bindings")
Expand All @@ -19,17 +19,27 @@ if(${pybind11_FOUND})
pybind11_add_module(pyphase pyPhase.cpp)
target_link_libraries(pyphase PUBLIC phase_manager)

install(TARGETS pyphase
DESTINATION ${PYTHON_SITE}/${PROJECT_NAME})

# include_directories(${CMAKE_CURRENT_SOURCE_DIR})
pybind11_add_module(pymanager pyPhaseManager.cpp)
target_link_libraries(pymanager PUBLIC phase_manager)

if(DEFINED ENV{CONDA_PREFIX})

set(PYBIND_INSTALL_DIR $ENV{CONDA_PREFIX}/${PYTHON_SITE}/${PROJECT_NAME} CACHE PATH "bindings install prefix" FORCE)

else()

set(PYBIND_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITE}/${PROJECT_NAME} CACHE PATH "bindings install prefix" FORCE)

endif()

install(TARGETS pymanager
DESTINATION ${PYTHON_SITE}/${PROJECT_NAME})
DESTINATION ${PYBIND_INSTALL_DIR})

install(TARGETS pyphase
DESTINATION ${PYBIND_INSTALL_DIR})

install(FILES __init__.py DESTINATION ${PYTHON_SITE}/${PROJECT_NAME})
install(FILES __init__.py DESTINATION ${PYBIND_INSTALL_DIR})

# include_directories(${CMAKE_CURRENT_SOURCE_DIR})
# pybind11_add_module(pyphase_manager pyPhaseManager.cpp)
# target_link_libraries(pyci PRIVATE phase_manager)
Expand Down