Skip to content

Commit

Permalink
check for Eigen3 presence before
Browse files Browse the repository at this point in the history
  • Loading branch information
hallfjonas committed Dec 31, 2023
1 parent 8dc8778 commit 9e7d9c5
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 28 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/project-builder-wo-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build & Test (ubuntu)

on:
push:
branches:
- 'improve-python-installation'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: install pre-reqs
run: sudo apt-get install -y build-essential cmake
- name: build step
run: mkdir build; cd build; cmake ..; make;
- name: run tests
run: sh test.sh
63 changes: 36 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -436,39 +436,48 @@ endif()

## Build Python interface ---------------------------------------------------------------
if (${BUILD_PYTHON_INTERFACE})

add_subdirectory(external/pybind11)
add_subdirectory(interfaces/python/lcqpow)

set(
PYTHON_INTERFACE_DIR
${CMAKE_SOURCE_DIR}/interfaces/python
)
find_package(Eigen3)

set(
PYTHON_INTERFACE_NAME
lcqpow
)
if (Eigen3_found)
add_subdirectory(external/pybind11)
add_subdirectory(interfaces/python/lcqpow)

set(
PYTHON_INTERFACE_DESTINATION
${CMAKE_BINARY_DIR}/interfaces/python
)
set(
PYTHON_INTERFACE_DIR
${CMAKE_SOURCE_DIR}/interfaces/python
)

file(
COPY ${PYTHON_INTERFACE_DIR}/${PYTHON_INTERFACE_NAME}/__init__.py
DESTINATION ${PYTHON_INTERFACE_DESTINATION}/${PYTHON_INTERFACE_NAME}
)
set(
PYTHON_INTERFACE_NAME
lcqpow
)

file(
COPY ${PYTHON_INTERFACE_DIR}/examples/
DESTINATION ${PYTHON_INTERFACE_DESTINATION}
)
set(
PYTHON_INTERFACE_DESTINATION
${CMAKE_BINARY_DIR}/interfaces/python
)

file(
COPY ${PROJECT_SOURCE_DIR}/examples/example_data
DESTINATION ${PYTHON_INTERFACE_DESTINATION}
)
file(
COPY ${PYTHON_INTERFACE_DIR}/${PYTHON_INTERFACE_NAME}/__init__.py
DESTINATION ${PYTHON_INTERFACE_DESTINATION}/${PYTHON_INTERFACE_NAME}
)

file(
COPY ${PYTHON_INTERFACE_DIR}/examples/
DESTINATION ${PYTHON_INTERFACE_DESTINATION}
)

file(
COPY ${PROJECT_SOURCE_DIR}/examples/example_data
DESTINATION ${PYTHON_INTERFACE_DESTINATION}
)

else()

message(WARNING "Eigen3 not found. Skipping installation of python interface.")

endif()

endif()

Expand Down
1 change: 0 additions & 1 deletion interfaces/python/lcqpow/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
find_package(Eigen3 REQUIRED)

macro(pybind11_add_lcqpow_module MODULE)
pybind11_add_module(
Expand Down

0 comments on commit 9e7d9c5

Please sign in to comment.