Skip to content

Commit

Permalink
Use CMake Python Functions (#188)
Browse files Browse the repository at this point in the history
* Use cmake python functions defined in everest-cmake

Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de>

* fix python venv setup

Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de>

* Fix add_subdirectory

Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de>

* bump version

Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de>

---------

Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de>
  • Loading branch information
andistorm authored Jun 14, 2024
1 parent 5836534 commit 34d0b10
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 31 deletions.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.14)

project(everest-framework
VERSION 0.15.0
VERSION 0.15.1
DESCRIPTION "The open operating system for e-mobility charging stations"
LANGUAGES CXX C
)
Expand All @@ -20,6 +20,13 @@ option(EVEREST_ENABLE_PY_SUPPORT "Enable everestpy for Python modules" ON)
option(EVEREST_ENABLE_RS_SUPPORT "Enable everestrs for Rust modules" OFF)
option(EVEREST_ENABLE_ADMIN_PANEL_BACKEND "Enable everest admin panel backend" ON)
option(EVEREST_INSTALL_ADMIN_PANEL "Download and install everest admin panel" ON)
ev_setup_cmake_variables_python_wheel()
option(${PROJECT_NAME}_USE_PYTHON_VENV "Use python venv for pip install targets" OFF)
set(${PROJECT_NAME}_PYTHON_VENV_PATH "${CMAKE_BINARY_DIR}/venv" CACHE PATH "Path to python venv")
ev_setup_python_executable(
USE_PYTHON_VENV ${${PROJECT_NAME}_USE_PYTHON_VENV}
PYTHON_VENV_PATH ${${PROJECT_NAME}_PYTHON_VENV_PATH}
)

# make own cmake modules available
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
Expand Down
36 changes: 12 additions & 24 deletions everestpy/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
add_subdirectory(src/everest)

add_custom_target(everestpy_pip_install_dist
# remove build dir from pip
COMMAND
cmake -E remove_directory build
COMMAND
${PYTHON_EXECUTABLE} -m pip install --force-reinstall .
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS
ev_create_pip_install_targets(
PACKAGE_NAME
everestpy
DIST_DEPENDS
everestpy_ln_dist
COMMENT
"Installing everestpy from distribution"
LOCAL_DEPENDS
everestpy_ln_local
)

add_custom_target(everestpy_pip_install_local
# remove build dir from pip
COMMAND
cmake -E remove_directory build
COMMAND
${PYTHON_EXECUTABLE} -m pip install --force-reinstall -e .
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
ev_create_python_wheel_targets(
PACKAGE_NAME
everestpy
DEPENDS
everestpy_ln_local
COMMENT
"Installing everestpy via user-mode from build"
everestpy_ln_dist
)

add_subdirectory(src/everest)
6 changes: 0 additions & 6 deletions everestpy/src/everest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
find_program(
PYTHON_EXECUTABLE
python3
REQUIRED
)

if (DISABLE_EDM)
find_package(pybind11 REQUIRED)
find_package(pybind11_json REQUIRED)
Expand Down

0 comments on commit 34d0b10

Please sign in to comment.