diff --git a/CMakeLists.txt b/CMakeLists.txt index 502ca29..61aeffd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ if (APPLE) endif() ## ################################################################### -## Dependencies +## Dependencies ## ################################################################### # --- Python @@ -59,7 +59,7 @@ if (WIN32) set(Python3_FIND_REGISTRY LAST) endif() -find_package (Python3 COMPONENTS Interpreter Development NumPy REQUIRED) +find_package (Python3 3.9 EXACT COMPONENTS Interpreter Development NumPy REQUIRED) include_directories(${Python3_INCLUDE_DIRS}) # --- Libraries @@ -102,4 +102,4 @@ endif() add_subdirectory("src/cpp") add_subdirectory("src/wrapper") -install_share("share" "lpy") \ No newline at end of file +install_share("share" "lpy") diff --git a/conda/conda_build_config.yaml b/conda/conda_build_config.yaml index 05379a8..a5f597f 100644 --- a/conda/conda_build_config.yaml +++ b/conda/conda_build_config.yaml @@ -18,4 +18,4 @@ MACOSX_SDK_VERSION: # [osx and x86_64] - '10.12' # [osx and x86_64] pin_run_as_build: boost: x.x - openalea.plantgl: x.x \ No newline at end of file + openalea.plantgl: x.x diff --git a/conda/meta.yaml b/conda/meta.yaml index 454c326..504351c 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -27,21 +27,20 @@ requirements: - binutils_impl_linux-64 # [linux] - {{ compiler('cxx') }} - python x.x - - cmake + - cmake - pkg-config # [linux] - make # [unix] - menuinst # [win] run: - python x.x - setuptools - - {{ pin_compatible('openalea.plantgl', max_pin='x.x') }} + - {{ pin_compatible('openalea.plantgl', max_pin='x.x') }} - boost x.x - pyqt - ipython - - qtconsole + - qtconsole-base - jupyter_client # <6 - pyopengl - - pyqglviewer >=1.3 - jsonschema app: diff --git a/conda_qt6/README.md b/conda_qt6/README.md new file mode 100644 index 0000000..143d66e --- /dev/null +++ b/conda_qt6/README.md @@ -0,0 +1,2 @@ +to build do: +`mamba build -c gnomon -c dtk-forge6 -c conda-forge conda_qt6/ ` diff --git a/conda_qt6/bld.bat b/conda_qt6/bld.bat new file mode 100644 index 0000000..005ceac --- /dev/null +++ b/conda_qt6/bld.bat @@ -0,0 +1,16 @@ +:: Working Dir +mkdir build +cd build + +:: Build +cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -DCMAKE_BUILD_TYPE=Release -DPython3_EXECUTABLE=%PYTHON% -LAH .. +if errorlevel 1 exit 1 +nmake +if errorlevel 1 exit 1 +nmake install +if errorlevel 1 exit 1 + +:: Install Python Files +cd .. +%PYTHON% setup.py install +if errorlevel 1 exit 1 diff --git a/conda_qt6/build.sh b/conda_qt6/build.sh new file mode 100644 index 0000000..5bd82c6 --- /dev/null +++ b/conda_qt6/build.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +if [[ -d build ]]; then + rm -rf build +fi +mkdir build +cd build + +if [ `uname` = "Darwin" ]; then + SYSTEM_DEPENDENT_ARGS=( + "-DCMAKE_OSX_SYSROOT=${CONDA_BUILD_SYSROOT}" + ) + export LDFLAGS="-undefined dynamic_lookup ${LDFLAGS}" +else + SYSTEM_DEPENDENT_ARGS=( + "-DOPENGL_opengl_LIBRARY=${BUILD_PREFIX}/${HOST}/sysroot/usr/lib64/libGL.so" + "-DOPENGL_glx_LIBRARY=${BUILD_PREFIX}/${HOST}/sysroot/usr/lib64/libGL.so" + ) +fi + +export SYSTEM_DEPENDENT_ARGS + +echo +echo "****** CMAKE" +which cmake +echo 'CONDA_BUILD_SYSROOT:' $CONDA_BUILD_SYSROOT +echo +echo "****** ENV" +env + +echo +echo "****** CMAKE CONFIG" + +cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} \ + -DCMAKE_PREFIX_PATH=${PREFIX} \ + -DCMAKE_BUILD_TYPE=Release \ + -DPython3_EXECUTABLE=${PYTHON} \ + ${SYSTEM_DEPENDENT_ARGS[@]} \ + -LAH .. + +echo +echo "****** LPY CONFIG" +cat $SRC_DIR/src/openalea/lpy/__version__.py + +echo +echo "****** COMPILE" +make -j${CPU_COUNT} +echo "****** INSTALL CXX LIB" +make install + +echo +echo "****** INSTALL PYTHON LIB" +cd .. +echo "PYTHON:" ${PYTHON} + +#echo "** PYTHON CALL" +#export PYTHONPATH=${PREFIX}/lib/python${PY_VER}/site-packages/ +${PYTHON} setup.py install --prefix=${PREFIX} + +#cp -r share `${PYTHON} -c "import os, openalea.lpy as lpy ; print(os.path.dirname(lpy.__file__))"`/.. + +echo +echo "****** CHECK PYTHON LIB" + +# To check if Python lib is not in the dependencies with conda-forge distribution. +# See https://github.com/conda-forge/boost-feedstock/issues/81 +if [ `uname` = "Darwin" ]; then + export LDD='otool -L' +else + export LDD='ldd' +fi + +echo `${PYTHON} -c "import openalea.lpy.__lpy_kernel__ as lpy ; print(lpy.__file__)"` + +echo "****** END OF BUILD PROCESS" diff --git a/conda_qt6/conda_build_config.yaml b/conda_qt6/conda_build_config.yaml new file mode 100644 index 0000000..aca02d5 --- /dev/null +++ b/conda_qt6/conda_build_config.yaml @@ -0,0 +1,21 @@ +cdt_name: cos7 # [linux] +python: + - 3.9 +numpy: + - 1.22 +cxx_compiler: + - gxx # [linux] + - clangxx # [osx] + - vs2019 # [win] +compiler_version: + - 11 # [osx] + - 11.2.0 # [linux] +cxx_compiler_version: + - 11 # [osx] + - 11.2.0 # [linux] +MACOSX_DEPLOYMENT_TARGET: # [osx] + - '10.14' # [osx] +MACOSX_SDK_VERSION: # [osx and x86_64] + - '10.14' # [osx and x86_64] +CONDA_BUILD_SYSROOT: # [osx] + - /Users/ci/Desktop/MacOSX-SDKs/MacOSX10.12.sdk # [osx] diff --git a/conda_qt6/icon_64x64.png b/conda_qt6/icon_64x64.png new file mode 100644 index 0000000..8349291 Binary files /dev/null and b/conda_qt6/icon_64x64.png differ diff --git a/conda_qt6/meta.yaml b/conda_qt6/meta.yaml new file mode 100644 index 0000000..98437c3 --- /dev/null +++ b/conda_qt6/meta.yaml @@ -0,0 +1,59 @@ +#{% set version = "2.7.2" %} +{% set data = load_setup_py_data() %} + +package: + name: openalea.lpy + version: {{ data.get('version') }} + +source: + path: .. + +about: + home: https://github.com/openalea/lpy + license: Cecill-C + summary: L-Py is a simulation software that mixes L-systems construction with the Python high-level modeling language. + +build: + preserve_egg_dir: True + number: 2 +requirements: + host: + - python + - setuptools + - openalea.plantgl>=3.20 + - qt6-main=6.5 + build: + - {{ compiler('cxx') }} + - cmake >=3.20.0 + - pkg-config # [linux] + - make # [unix] + - menuinst # [win] + run: + - python + - setuptools + - {{ pin_compatible('numpy', max_pin='x.x') }} + - {{ pin_compatible('openalea.plantgl', max_pin='x.x') }} + - {{ pin_compatible('boost', max_pin='x.x.x') }} + - pyside6 + - ipython + - qtconsole-base + - jupyter_client # <6 + - pyopengl + - jsonschema + +app: + entry: lpy + summary: Plant simulation software + icon: icon_64x64.png + +test: + requires: + - nose + imports: + - openalea.lpy + source_files: + - test/ + - share/ + commands: + - nosetests -v -I test_predecessor_at_scale.py -I test_ui.py [unix] + - nosetests -v -I test_predecessor_at_scale.py -I test_ui.py -I test_axialtree.py -I test_successor_at_scale.py [win] diff --git a/src/openalea/lpy/gui/lpyview3d.py b/src/openalea/lpy/gui/lpyview3d.py index d325149..ed586a5 100644 --- a/src/openalea/lpy/gui/lpyview3d.py +++ b/src/openalea/lpy/gui/lpyview3d.py @@ -6,7 +6,13 @@ ParentClass = QGLViewer hasPyQGLViewer = True except ImportError as e: - ParentClass = qt.QtWidgets.QOpenGLWidget + try: + from openalea.plantgl.gui.qt.QtWidgets import QOpenGLWidget + ParentClass = QOpenGLWidget + pass + except: + from openalea.plantgl.gui.qt.QtOpenGL import QOpenGLWidget + ParentClass = QOpenGLWidget print('Missing PyQGLViewer !!!!!! Unstable Lpy !!!!!!!!!') hasPyQGLViewer = False diff --git a/src/openalea/lpy/gui/objectpanel.py b/src/openalea/lpy/gui/objectpanel.py index 854eda7..1d10a7b 100644 --- a/src/openalea/lpy/gui/objectpanel.py +++ b/src/openalea/lpy/gui/objectpanel.py @@ -19,8 +19,8 @@ NewOpenGLClass = True pass except: - from openalea.plantgl.gui.qt.QtOpenGL import QGLWidget - QGLParentClass = QGLWidget + from openalea.plantgl.gui.qt.QtOpenGL import QOpenGLWidget + QGLParentClass = QOpenGLWidget NewOpenGLClass = False