Skip to content

Commit e979434

Browse files
Merge pull request #24 from qingfengxia/dev
fix error of ubuntu 20.04 package and update conda recipe
2 parents cd072fb + 064ef35 commit e979434

8 files changed

Lines changed: 225 additions & 122 deletions

File tree

.github/workflows/github-ci.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,6 @@ jobs:
6464
sha256sum ${{ env.PROJECT_NAME }}.zip | awk '{ print $1; }' > ${{ github.workspace }}/${{ env.PROJECT_NAME }}.zip.sha256.txt
6565
if: matrix.os == 'ubuntu-20.04'
6666

67-
- name: Compile on Linux (debug)
68-
# env:
69-
# CC: ${{ matrix.compiler }}
70-
# CXX: ${{ matrix.compilerpp }}
71-
run: |
72-
git submodule update --init --recursive
73-
mkdir build
74-
cd build
75-
cmake -DCODE_COVERAGE=ON -DPython_EXECUTABLE=$(which python3) -DPPP_VERSION_NAME=${{ env.PROJECT_VERSION }} .. -Wno-dev
76-
make 2>&1 | tee clang_tidy_build_results.log
77-
if: matrix.os == 'ubuntu-20.04'
78-
7967
- name: Compile on Linux (release)
8068
env:
8169
CC: ${{ matrix.compiler }}
@@ -86,7 +74,7 @@ jobs:
8674
cd build
8775
cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$(which python3) -DPPP_VERSION_NAME=${{ env.PROJECT_VERSION }} .. -Wno-dev
8876
make 2>&1 | tee clang_tidy_build_results.log
89-
if: matrix.os == 'ubuntu-18.04'
77+
if: matrix.os == 'ubuntu-18.04' || matrix.os == 'ubuntu-20.04'
9078

9179
- name: package and installation on Ubuntu
9280
working-directory: ${{ github.workspace }}/build
@@ -178,6 +166,19 @@ jobs:
178166
# https://github.com/ukaea/parallel-preprocessor/releases/download/dev/parallel-preprocessor.zip
179167

180168
########################################## only for Ubuntu debug release ############################################
169+
- name: Re-compile on Linux (debug + coverage)
170+
working-directory: ${{ github.workspace }}
171+
# env:
172+
# CC: ${{ matrix.compiler }}
173+
# CXX: ${{ matrix.compilerpp }}
174+
run: |
175+
rm -rf build
176+
mkdir build
177+
cd build
178+
cmake -DCODE_COVERAGE=ON -DPython_EXECUTABLE=$(which python3) -DPPP_VERSION_NAME=${{ env.PROJECT_VERSION }} .. -Wno-dev
179+
make 2>&1 | tee clang_tidy_build_results.log
180+
if: matrix.os == 'ubuntu-20.04' && ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' )
181+
181182
- name: Run Cpp Check Flawfinder Sim C++ ( Ubuntu GCC Dev/Master )
182183
working-directory: ${{ github.workspace }}
183184
run: |

recipe/bld.bat

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
git submodule update --init --recursive
2+
13
mkdir build-conda
24
cd build-conda
35

46
cmake ^
57
-DCMAKE_BUILD_TYPE="Release" ^
68
-DPPP_USE_TEST=OFF ^
9+
-DPython3_EXECUTABLE="%PYTHON%" ^
710
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
811
-DCMAKE_INSTALL_LIBDIR=%LIBRARY_LIB% ^
912
-G "NMake Makefiles" ..
@@ -12,5 +15,5 @@ if errorlevel 1 exit 1
1215
cmake --build . --target install --config Release
1316
if errorlevel 1 exit 1
1417

15-
REM python package built and installed to site-package, by setup.py
18+
REM python package built and installed to site-package by cmake, no need to run setup.py
1619

recipe/build.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1+
git submodule update --init --recursive
2+
13
mkdir build-conda
24
pushd build-conda
35

6+
# this cause error in pybind11 cmake
7+
# #-DPYTHON_EXECUTABLE=$PREFIX/bin/python \
8+
49
# for conda, pybind11 should detect the python installation correctly
510
cmake \
11+
-DPython3_EXECUTABLE="$PYTHON" \
612
-DCMAKE_BUILD_TYPE=Release \
713
-DCMAKE_INSTALL_PREFIX=$PREFIX \
8-
-DPYTHON_EXECUTABLE=$PREFIX/bin/python \
9-
..
14+
-DCMAKE_INSTALL_LIBDIR=$LIBRARY_LIB \
15+
..
1016

1117
make -j4
1218
make install
1319

14-
# python package built and installed to site-package by make install
15-
# ` build-conda/python` folder should have been copied/symlink to
16-
#python python/setup.py install --single-version-externally-managed --record record.txt
20+
# there is no need to run setup.py in this repo
21+
# python package should has been built and installed to site-package by make install
1722

1823
popd

recipe/conda_build_config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
MACOSX_DEPLOYMENT_TARGET: # [osx]
2+
- '10.15' # [osx]
3+
# some c++17 is only available in macos 10.13
4+
# PropertyContainerTest.cpp:46:22: error: 'any_cast<std::__1::shared_ptr<A> >' is unavailable: introduced in macOS 10.13
5+
6+
#python:
7+
# - 3.8

recipe/meta.yaml

Lines changed: 61 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,80 @@
11
# manually update or generated from template
22
package:
3-
name: ppp
4-
version: 0.3
3+
name: parallel-preprocessor
4+
version: '0.3'
55
source:
6-
#sha256: 0387bf0f9d313e2311742e1ad0b64e07f2f3e76039eed20e3b9aa9951b88e187
7-
#url: https://pocoproject.org/releases/poco-1.9.0/poco-1.9.0-all.tar.gz
8-
path: ../
6+
# calc check sum by command sha256sum
7+
#sha256: 3f779c5096acc8a2c39dc645e09c577d2741f0271c7b3c589e2ff77a54588833
8+
url: https://github.com/ukaea/parallel-preprocessor/releases/download/dev/parallel-preprocessor.zip
9+
910
build:
10-
number: '2003' # should be generated, or manully update
11-
string: hdef9aff_2003
11+
# number should be generated, or manually update, YYMM pattern here, must be 0 for the first PR
12+
number: '0'
13+
string: oct_2020
14+
skip: true # [py < 38]
15+
16+
# libGL needs Core Dependency Tree (CDT) packages
17+
# https://conda-forge.org/docs/maintainer/knowledge_base.html#special-dependencies
1218
requirements:
19+
run_constrained:
20+
- __osx >={{ MACOSX_DEPLOYMENT_TARGET|default("10.9") }} # [osx]
1321
build:
22+
- python
1423
- cmake
15-
- vs2015_runtime [win]
16-
- vs2015_win-64 [win]
24+
- git
25+
- ninja
26+
- make # [unix]
27+
- {{ compiler("cxx") }}
28+
- {{ cdt('mesa-libgl-devel') }} # [linux]
29+
- {{ cdt('mesa-dri-drivers') }} # [linux]
30+
- {{ cdt('mesa-libegl-devel') }} # [linux]
31+
- {{ cdt('libselinux') }} # [linux]
32+
- {{ cdt('libxdamage') }} # [linux]
33+
- {{ cdt('libxfixes') }} # [linux]
34+
- {{ cdt('libxxf86vm') }} # [linux]
35+
- {{ cdt('libxcb') }} # [linux]
36+
- {{ cdt('libxext') }} # [linux]
37+
- {{ cdt('xorg-x11-server-xvfb') }} # [linux]
38+
- {{ cdt('libxau') }} # [linux]
39+
- {{ cdt('libxi-devel') }} # [linux]
1740
- occt >=7.4
1841
- tbb
42+
- freetype
1943
- tbb-devel
44+
- pybind11
2045
host:
46+
- python
47+
- boost-cpp
2148
- ca-certificates
2249
- openssl
23-
- vc >=14,<15.0a0 [win]
24-
- vs2015_runtime [win]
25-
run: # test
26-
- openssl
50+
- occt >=7.4
51+
- xorg-libxt # [linux]
52+
- xorg-libxpm # [linux]
53+
- xorg-libxaw # [linux]
54+
- xorg-libxfixes # [linux]
55+
- vtk
56+
run:
57+
- python
2758
- occt >=7.4
2859
- tbb
29-
- vc >=14,<15.0a0 [win]
30-
#test:
31-
# commands:
32-
# - if not exist %LIBRARY_BIN%\pppApp%SHLIB_EXT% exit 1
60+
- xorg-libxt # [linux]
61+
- freetype
62+
63+
test:
64+
commands:
65+
- if not exist %LIBRARY_BIN%\pppApp%SHLIB_EXT% exit 1 # [win]
66+
- test -f $PREFIX/lib/libpppApp$SHLIB_EXT # [unix]
67+
- echo "started test in the folder $(pwd)" # [unix]
68+
- if [ -d conda-build ]; then cd conda-build; fi # [unix]
69+
#- if [ -f run_all_tests.sh ]; then sh run_all_tests.sh; fi # [unix]
70+
3371
about:
34-
home: https://github.com/qingfengxia/CAE_pipeline
35-
license: LGPL
36-
license_family: OTHER
37-
#license_file: LICENSE
38-
summary: 'parallel preprocessor for CAD and CAE'
72+
home: https://github.com/ukaea/parallel-preprocessor
73+
license: LGPL-2.1-only
74+
license_family: LGPL
75+
license_file: LICENSE
76+
summary: 'parallel CAD preprocessor for large assembly simulation'
77+
3978
extra:
40-
copy_test_source_files: true
41-
final: true
4279
recipe-maintainers:
4380
- qingfengxia

recipe/yum_requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
mesa-libGL
2+
mesa-dri-drivers
3+
libselinux
4+
libXdamage
5+
libXxf86vm
6+
libXext-devel

wiki/BuildOnConda.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
## Build for Anaconda
2+
3+
Conda package can be generated to support more Linux platforms, and Windows. Conda package build has been tested successfully on local host.
4+
In the future, parallel-preprocessor will be available on conda-forge channel for `conda install -c condaforge parallel-preprocessor` This conda package for parallel-preprocessor has both c++ binary and python wrapper installed, just like build deb package from source by cmake.
5+
6+
7+
```
8+
conda config --add channels conda-forge
9+
conda config --set channel_priority strict
10+
conda install occt
11+
conda install parallel-preprocessor
12+
```
13+
14+
### conda recipe: meta.yaml and build scripts
15+
16+
The meta.yaml and build scripts have been provided in the `recipe` folder of this repository.
17+
18+
The package config file `meta.yaml` can be generated by a command, or just adapted from an existing recipe online, e.g.
19+
<https://github.com/conda/conda-recipes/tree/master/libtiff>
20+
Also note that the compilers used by conda-build can be specified using a `conda_build_config.yaml`.
21+
22+
The build scripts `build.sh` (for Unix-like OS) and `bld.bat` (windows batch file) have the install instruction (cmake is called just as compiling from source code.), install to a tmp prefix, then compressed into a zipped file, i.e. conda package.
23+
24+
25+
### build conda package from local machine
26+
27+
`parallel-preprocessor` depends on OpenCASCADE conda package, whose conda packaging configuration can be found at `https://github.com/conda-forge/occt-feedstock/`. To build conda package from local machine, user should install all the necessary dependency, such as OpenCASCADE 7.x, TBB, if conda build failed to download the dependencies specified in `meta.yaml`.
28+
29+
To build conda package, first of all, install anaconda python3 and install necessary packages like `conda-build`, and run the command in the `recipe` folder of this repository: `conda build meta.ymal`
30+
31+
The conda build task is conducted a seperate virtual environment automatically, so is the test(run) process.
32+
`D:\Software\anaconda3\envs\cf\conda-bld\ppp_1597347412425`
33+
On windows, cmake isntalled to the `base` conda environment can still detect `occt` package installed in the conda-build tmp conda environment.
34+
35+
NOTE: conda will not auto clean those tmp virtual env, user must manually remove the build virtual env.
36+
37+
38+
anaconda upload /opt/anaconda3/conda-bld/linux-64/parallel-preprocessor-0.3-oct_2020.tar.bz2
39+
40+
To have conda build upload to anaconda.org automatically, use
41+
42+
`conda config --set anaconda_upload yes`
43+
44+
45+
### install built local conda package
46+
47+
Where is the generated conda package?
48+
If testing script passed, the generated conda package, a compressed file, should be copied to the current working directory.
49+
If test failed, there may be error message:
50+
> Tests failed for ppp-0.3-hdef9aff_2003.tar.bz2 - moving package to D:\Software\anaconda3\envs\cf\conda-bld\broken
51+
52+
After conda build, the built package can be installed: `conda install --use-local ppp` or equally `conda install -c local ppp` to install the built pkg.
53+
`conda install --use-local ppp --dry-run` to test if built package can be found and installed. `conda verify` may also verify the package without installation.
54+
55+
56+
It is expected binary conda package for parallel-preprocessor will be hosted on github or conda-forge. After downloaded from github Release, the compressed package file can be installed by the command
57+
58+
```sh
59+
conda install package-path/package-filename.tar.bz2
60+
```
61+
62+
### Conda build variants
63+
64+
https://docs.conda.io/projects/conda-build/en/latest/resources/variants.html
65+
66+
selector document
67+
68+
Here is an example to skip some variants in meta.yaml file.
69+
70+
```yaml
71+
build:
72+
skip: true # [win or osx]
73+
```
74+
75+
### build for multiple python versions
76+
77+
Since python the optional interface module for parallel preprocessor is C-extension, so separate binary packages are needed for conda python 3.6, 3.7 and 3.8. Depends on platforms, conda python 3.8 may be minimum version to support C++17.
78+
79+
conda build support build for multiple version, by specify `--py` option multiple times.
80+
`conda build --py 3.6 --py 3.7 --py 3.8 recipe` if this does not work, try
81+
`conda build recipe --variants "{'python': ['2.7', '3.6'], 'vc': ['9', '14']}"`
82+
83+
After all, variant control is done by the yaml file`conda_build_config.yaml`. If this file does not exists same directory as` meta.yaml`, `conda build` may generate one. real also [Conda multi variant builds](https://medium.com/@MaheshSawaiker/conda-multi-variant-builds-8edc35c215d7)
84+
85+
86+
### conda-forge build environment
87+
88+
Build environments in conda-forge CI (miniconda azure pipeline, ) is quite different from conda build on local machine. After trials and referencing to https://github.com/FreeCAD/FreeCAD/blob/master/conda/, finally conda build is working.
89+
90+
conda windows python 3.8 using "VS 2017 update 9", although it is called `vs2015_runtime` indicating binary compatible, it may be using vs2017 (14.1) compiler.
91+
92+
| [vs2015_runtime](https://docs.anaconda.com/anaconda/packages/py3.8_win-64/None) | 14.16.27012 | MSVC runtimes associated with cl.exe version 19.16.27032.1 (VS 2017 update 9) / None |
93+
| ------------------------------------------------------------ | ----------- | ------------------------------------------------------------ |
94+
| [vc](https://github.com/conda/conda/wiki/VC-features) | 14.1 | A meta-package to impose mutual exclusivity among software built with different VS versions / Modified BSD License (3-clause) |
95+
96+
The default conda macos conda-build using MacOS SDK 10.09, XCode 11.6, but MacOS 10.13 is needed for C++17 support. Therefore, the MacOS deploy target has been limited to "10.15", in <../recipe/conda_build_config.yaml>
97+
98+
99+
> /src/PropertyContainer/PropertyContainerTest.cpp:46:22: error: 'any_cast<std::__1::shared_ptr<A> >' is unavailable: introduced in macOS 10.13
100+
auto data = std::any_cast<std::shared_ptr<myType>>(a);
101+
102+
### Upload to conda forge (yet done)
103+
104+
Here is guide from conda-forge website:
105+
> If your package is not on conda-forge yet you can follow their contribution documentation here: https://conda-forge.org/#add_recipe
106+
107+
The process:
108+
https://conda-forge.org/docs/maintainer/adding_pkgs.html
109+
110+
1. fork conda-forge example repo
111+
112+
https://github.com/qingfengxia/staged-recipes
113+
114+
2. push it as a new repo from the branch "parallel-preprocessor"
115+
116+
https://github.com/conda-forge/staged-recipes/pull/12901#issuecomment-709514486
117+
118+
119+
3. later the maintainer (pusher) will have the write control on that repo.
120+
121+
122+
123+

0 commit comments

Comments
 (0)