Skip to content

Fix installation inside virtual env #14

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
25 changes: 11 additions & 14 deletions FaCT++.Python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
set(CMAKE_VERBOSE_MAKEFILE ON)
cmake_minimum_required(VERSION 3.13.0)
set(CMAKE_CXX_STANDARD 11)
find_program(PYTHON "python")
set(PYTHON "python")

if (PYTHON)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be fine; however, what if a user does not have Python installed on the system? Previously the build system worked in such a way that factpp was able to be built from the root directory even if Python bindings were not needed. However, this PR makes it impossible. If you are OK with that, feel free to merge

file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/pyfactxx/__init__.py")
set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")

set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/pyfactxx/__init__.py")
set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")
add_custom_command(OUTPUT ${OUTPUT}
COMMAND ${PYTHON} ${SETUP_PY} build
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
DEPENDS ${DEPS})

add_custom_command(OUTPUT ${OUTPUT}
COMMAND ${PYTHON} ${SETUP_PY} build
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
DEPENDS ${DEPS})
add_custom_target(pyfactxx-build ALL DEPENDS ${OUTPUT})

add_custom_target(pyfactxx-build ALL DEPENDS ${OUTPUT})

install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install)")
endif()
install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install)")