Skip to content

Commit

Permalink
#20 Make castxml and clang system dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
kwabenantim committed Nov 21, 2024
1 parent f325144 commit 2db10e4
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 17 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test-cells-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install cmake git
sudo apt-get install castxml clang cmake git
- name: Setup Miniconda Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
Expand Down Expand Up @@ -81,7 +81,8 @@ jobs:
run: mamba install boa conda-build conda-verify

- name: Build
run: conda mambabuild recipe -m variants/python${{ matrix.python-version }}.yaml
run: |
conda mambabuild recipe -m variants/python${{ matrix.python-version }}.yaml
working-directory: examples/cells/conda

- name: Install
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test-cells-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
echo "VTK version: ${vtk_ver}"
sudo apt-get install \
castxml \
clang \
cmake \
git \
libboost-all-dev \
Expand All @@ -58,8 +60,9 @@ jobs:
# Check installed package versions
dpkg-query -W \
castxml \
clang \
cmake \
g++ \
git \
libboost-all-dev \
libpetsc-real-dev \
Expand All @@ -73,7 +76,7 @@ jobs:
python3-vtk${vtk_ver}
- name: Install cppwg
run: pipx install . --include-deps
run: pipx install .

- name: Configure
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-shapes-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install cmake git
sudo apt-get install castxml clang cmake git
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Automatically generate pybind11 Python wrapper code for C++ projects.

## Installation

Install CastXML (required) and Clang (recommended). On Ubuntu, this would be:

```bash
sudo apt-get install castxml clang
```

Clone the repository and install cppwg:

```bash
Expand Down
25 changes: 14 additions & 11 deletions examples/cells/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16...3.22)
cmake_minimum_required(VERSION 3.16...3.28)
project(pycells LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 17)
Expand Down Expand Up @@ -53,40 +53,42 @@ file(GLOB_RECURSE MAIN_SOURCES
${CMAKE_SOURCE_DIR}/src/cpp/*.hpp
)
add_library(cells SHARED ${MAIN_SOURCES})
target_link_libraries(cells PUBLIC
${Boost_LIBRARIES}
${VTK_LIBRARIES}
${PETSC_LIBRARIES}
${MPI_C_LIBRARIES}
${MPI_CXX_LIBRARIES}
)
target_include_directories(cells PUBLIC
${CMAKE_SOURCE_DIR}/src/cpp
${CMAKE_SOURCE_DIR}/src/cpp/cell
${CMAKE_SOURCE_DIR}/src/cpp/mesh
${CMAKE_SOURCE_DIR}/src/cpp/utils
${CMAKE_SOURCE_DIR}/src/cpp/visualization
)
target_include_directories(cells SYSTEM PUBLIC
${Boost_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${PETSC_INCLUDES}
${MPI_C_INCLUDE_PATH}
${MPI_CXX_INCLUDE_PATH}
)
target_link_libraries(cells PUBLIC
${Boost_LIBRARIES}
${VTK_LIBRARIES}
${PETSC_LIBRARIES}
${MPI_C_LIBRARIES}
${MPI_CXX_LIBRARIES}
)

# Set up the pycells module with pybind11
file(GLOB WRAPPER_SOURCES
${CMAKE_SOURCE_DIR}/dynamic/wrappers/all/*.cpp
${CMAKE_SOURCE_DIR}/dynamic/wrappers/all/*.hpp
)
pybind11_add_module(_pycells_all MODULE ${WRAPPER_SOURCES})
target_link_libraries(_pycells_all PRIVATE cells)
target_include_directories(_pycells_all PRIVATE
${CMAKE_SOURCE_DIR}/dynamic/wrappers/all
${CMAKE_SOURCE_DIR}/dynamic/typecasters/
${CMAKE_SOURCE_DIR}/dynamic/typecasters/thirdparty/dolfinx
${CMAKE_SOURCE_DIR}/dynamic/typecasters/thirdparty/smtk
${PETSC4PY_INCLUDES}
)
target_include_directories(_pycells_all SYSTEM PRIVATE ${PETSC4PY_INCLUDES})
target_link_libraries(_pycells_all PRIVATE cells)

# Add install targets for scikit-build
if(SKBUILD)
Expand All @@ -106,7 +108,8 @@ add_custom_target(pycells_wrappers
COMMAND ${CPPWG} ${CMAKE_SOURCE_DIR}/src/cpp
-w ${CMAKE_SOURCE_DIR}/dynamic/wrappers
-p ${CMAKE_SOURCE_DIR}/dynamic/config.yaml
-i "$<JOIN:$<TARGET_PROPERTY:_pycells_all,INCLUDE_DIRECTORIES>,;>"
-i "$<JOIN:$<TARGET_PROPERTY:cells,INCLUDE_DIRECTORIES>,;>"
"$<JOIN:$<TARGET_PROPERTY:_pycells_all,INCLUDE_DIRECTORIES>,;>"
-l ${CMAKE_BINARY_DIR}/cppwg.log
--std c++17
COMMAND_EXPAND_LISTS
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ python_requires = >=3.8
install_requires =
pyyaml>=6.0
pygccxml>=2.2
castxml>=0.4

[options.entry_points]
console_scripts =
Expand Down

0 comments on commit 2db10e4

Please sign in to comment.