diff --git a/.github/workflows/project-builder-wo-python.yml b/.github/workflows/project-builder-wo-python.yml new file mode 100644 index 0000000..ea069db --- /dev/null +++ b/.github/workflows/project-builder-wo-python.yml @@ -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 \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index b286cff..3754470 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/interfaces/python/lcqpow/CMakeLists.txt b/interfaces/python/lcqpow/CMakeLists.txt index a4fd31f..2a7bf5c 100644 --- a/interfaces/python/lcqpow/CMakeLists.txt +++ b/interfaces/python/lcqpow/CMakeLists.txt @@ -1,4 +1,3 @@ -find_package(Eigen3 REQUIRED) macro(pybind11_add_lcqpow_module MODULE) pybind11_add_module(