From 0a7ffb084af10c980049f9ac8fe471423c7f7802 Mon Sep 17 00:00:00 2001 From: ye11owSub Date: Sun, 12 May 2024 11:28:15 +0300 Subject: [PATCH] moving project meta and packages search to pyproject.toml --- .github/workflows/build.yml | 58 +- .gitignore | 2 + CMakeLists.txt | 31 - INSTALL | 5 +- contrib/champ/meson.build | 26 + contrib/uiuc/plugins/meson.build | 0 create_shadertext.py | 3 +- layer0/meson.build | 42 ++ layer1/meson.build | 50 ++ layer2/meson.build | 56 ++ layer3/meson.build | 20 + layer4/meson.build | 7 + layer5/meson.build | 7 + layerCTest/meson.build | 31 + meson.build | 135 +++++ meson_options.txt | 64 +++ modules/chempy/bmin/meson.build | 13 + modules/chempy/champ/meson.build | 12 + modules/chempy/fast/meson.build | 9 + modules/chempy/fragments/meson.build | 9 + modules/chempy/meson.build | 52 ++ modules/chempy/mmtf/meson.build | 10 + modules/chempy/tinker/meson.build | 14 + modules/pmg_qt/forms/meson.build | 29 + modules/pmg_qt/meson.build | 25 + modules/pmg_qt/syntax/meson.build | 12 + modules/pmg_tk/meson.build | 20 + modules/pmg_tk/skins/demo/meson.build | 9 + modules/pmg_tk/skins/meson.build | 12 + modules/pmg_tk/skins/normal/meson.build | 9 + modules/pmg_tk/startup/meson.build | 9 + modules/pymol/Qt/meson.build | 10 + modules/pymol/__main__.py | 10 - modules/pymol/meson.build | 76 +++ modules/pymol/plugins/meson.build | 14 + modules/pymol/stereochemistry/meson.build | 9 + modules/pymol/wizard/meson.build | 35 ++ modules/pymol2/meson.build | 9 + modules/version.py | 5 + ov/src/meson.build | 12 + pyproject.toml | 42 ++ setup.py | 672 ---------------------- subprojects/catch2.wrap | 11 + subprojects/freetype2.wrap | 11 + subprojects/glew.wrap | 12 + subprojects/glm.wrap | 13 + subprojects/libpng.wrap | 13 + 47 files changed, 965 insertions(+), 770 deletions(-) delete mode 100644 CMakeLists.txt create mode 100644 contrib/champ/meson.build create mode 100644 contrib/uiuc/plugins/meson.build create mode 100644 layer0/meson.build create mode 100644 layer1/meson.build create mode 100644 layer2/meson.build create mode 100644 layer3/meson.build create mode 100644 layer4/meson.build create mode 100644 layer5/meson.build create mode 100644 layerCTest/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 modules/chempy/bmin/meson.build create mode 100644 modules/chempy/champ/meson.build create mode 100644 modules/chempy/fast/meson.build create mode 100644 modules/chempy/fragments/meson.build create mode 100644 modules/chempy/meson.build create mode 100644 modules/chempy/mmtf/meson.build create mode 100644 modules/chempy/tinker/meson.build create mode 100644 modules/pmg_qt/forms/meson.build create mode 100644 modules/pmg_qt/meson.build create mode 100644 modules/pmg_qt/syntax/meson.build create mode 100644 modules/pmg_tk/meson.build create mode 100644 modules/pmg_tk/skins/demo/meson.build create mode 100644 modules/pmg_tk/skins/meson.build create mode 100644 modules/pmg_tk/skins/normal/meson.build create mode 100644 modules/pmg_tk/startup/meson.build create mode 100644 modules/pymol/Qt/meson.build delete mode 100644 modules/pymol/__main__.py create mode 100644 modules/pymol/meson.build create mode 100644 modules/pymol/plugins/meson.build create mode 100644 modules/pymol/stereochemistry/meson.build create mode 100644 modules/pymol/wizard/meson.build create mode 100644 modules/pymol2/meson.build create mode 100644 modules/version.py create mode 100644 ov/src/meson.build create mode 100644 pyproject.toml delete mode 100644 setup.py create mode 100644 subprojects/catch2.wrap create mode 100644 subprojects/freetype2.wrap create mode 100644 subprojects/glew.wrap create mode 100644 subprojects/glm.wrap create mode 100644 subprojects/libpng.wrap diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9953c74f..d2ba68ba6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,37 +13,12 @@ jobs: - name: Install system dependencies run: > sudo apt-get update; - sudo apt-get --no-install-recommends install - catch2 - cmake - libfreetype6-dev - libglew-dev - libglm-dev - libmsgpack-dev - libnetcdf-dev - libpng-dev - libxml2-dev - python-is-python3 - python3-biopython - python3-dev - python3-setuptools - python3-numpy - python3-pil - python3-pytest - - - name: Install collada2gltf - run: | - wget -nv https://anaconda.org/schrodinger/collada2gltf/2.1.4/download/linux-64/collada2gltf-2.1.4-h6bb024c_0.tar.bz2 - sudo tar xf collada2gltf-*.tar.bz2 -C / bin/collada2gltf - - - name: Get additional sources - run: | - git clone --depth 1 https://github.com/rcsb/mmtf-cpp.git - cp -R mmtf-cpp/include/mmtf* include/ + sudo apt-get --no-install-recommends install python3-dev python3-pytest - name: Build run: | - python setup.py --testing install --prefix=install-prefix + python -m pip install --upgrade pip; + pip install '.[test]' -Csetup-args=-Dtesting=true --prefix=install-prefix env: DEBUG: 1 @@ -72,7 +47,7 @@ jobs: shell: cmd run: |- CALL %CONDA_ROOT%\\Scripts\\activate.bat - conda install -y -c conda-forge -c schrodinger python cmake libpng freetype pyqt glew libxml2 numpy catch2=2.13.3 glm libnetcdf collada2gltf biopython pillow msgpack-python pytest + conda install -y -c conda-forge -c python glew pytest - name: Conda info shell: cmd @@ -92,7 +67,7 @@ jobs: shell: cmd run: | CALL %CONDA_ROOT%\\Scripts\\activate.bat - python setup.py --testing install --prefix=%GITHUB_WORKSPACE%\\install-prefix + pip install . -Csetup-args=-Dtesting=true --prefix=%GITHUB_WORKSPACE%\\install-prefix - name: Test shell: cmd @@ -104,34 +79,13 @@ jobs: runs-on: macos-latest - env: - CONDA_ROOT: "/tmp/miniconda" - steps: - uses: actions/checkout@v4.0.0 - - name: Set up Miniconda and Build - run: |- - curl -L -o $CONDA_ROOT.sh https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Mambaforge-MacOSX-x86_64.sh - bash $CONDA_ROOT.sh -b -p $CONDA_ROOT - export PATH="$CONDA_ROOT/bin:$PATH" - conda config --set quiet yes - conda install -y -c conda-forge -c schrodinger python cmake libpng freetype pyqt glew libxml2 numpy catch2=2.13.3 glm libnetcdf collada2gltf biopython pillow msgpack-python pytest - conda info - - - name: Get additional sources - run: | - git clone --depth 1 https://github.com/rcsb/mmtf-cpp.git - cp -R mmtf-cpp/include/mmtf* ${CONDA_ROOT}/include/ - git clone --depth 1 --single-branch --branch cpp_master https://github.com/msgpack/msgpack-c.git - cp -R msgpack-c/include/msgpack* ${CONDA_ROOT}/include/ - - name: Build PyMOL run: |- export MACOSX_DEPLOYMENT_TARGET=12.0 - export PATH="$CONDA_ROOT/bin:$PATH" - python setup.py install --prefix=${GITHUB_WORKSPACE}/install-prefix + pip install '.[test]' -Csetup-args=-Dtesting=true --prefix=${GITHUB_WORKSPACE}/install-prefix - name: Test run: |- - export PATH="$CONDA_ROOT/bin:$PATH" ${GITHUB_WORKSPACE}/install-prefix/bin/pymol -ckqy testing/testing.py --run all diff --git a/.gitignore b/.gitignore index eb37b3f15..f3a64222d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ *.d generated build +subprojects/* +!subprojects/*.wrap diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 0620b6f5f..000000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -cmake_minimum_required(VERSION 3.13) - -project(${TARGET_NAME}) - -set(CMAKE_VERBOSE_MAKEFILE on) - -add_library(${TARGET_NAME} SHARED ${ALL_SRC}) - -target_compile_options(${TARGET_NAME} PRIVATE ${ALL_COMP_ARGS}) - -set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ${SHARED_SUFFIX}) - -target_compile_features(${TARGET_NAME} PRIVATE cxx_std_17) - -set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "") - -target_include_directories(${TARGET_NAME} PUBLIC ${ALL_INC_DIR}) - -target_link_directories(${TARGET_NAME} PUBLIC ${ALL_LIB_DIR}) - - -if(APPLE) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup") -endif() - -target_link_libraries(${TARGET_NAME} - ${ALL_LIB} - ${ALL_EXT_LINK} -) - -target_compile_definitions(${TARGET_NAME} PUBLIC ${ALL_DEF}) diff --git a/INSTALL b/INSTALL index abe3c8b14..4edaac0e1 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,6 @@ ---------------------------------------------------------------------- -INSTALLATION VIA COMPILATION +INSTALLATION VIA COMPILATION ---------------------------------------------------------------------- See also: http://pymolwiki.org/index.php/Linux_Install @@ -8,7 +8,6 @@ See also: http://pymolwiki.org/index.php/Linux_Install REQUIREMENTS - C++17 compiler (e.g. gcc 8+) - - CMake (3.13+) - Python 3.9+ - Pmw (Python Megawidgets) (optional, for legacy GUI/plugins) https://github.com/schrodinger/pmw-patched @@ -50,7 +49,7 @@ SETUP OPTIONS INSTALLATION - python setup.py install --prefix=~/someplace + pip install . --prefix=~/someplace RUNNING PyMOL diff --git a/contrib/champ/meson.build b/contrib/champ/meson.build new file mode 100644 index 000000000..ccb0ec0c0 --- /dev/null +++ b/contrib/champ/meson.build @@ -0,0 +1,26 @@ +files_names = [ + 'champ.c', + 'champ_module.c', + 'chiral.c', + 'err2.c', + 'feedback2.c', + 'list.c', + 'os_memory.c', + 'sort.c', + 'strblock.c', + 'vla.c', +] +champ_src_files = [] + +foreach file_name : files_names + champ_src_files += files(file_name) +endforeach + +py.extension_module( + '_champ', + champ_src_files, + include_directories : include_directories('.'), + install: true, + subdir: 'chempy/champ' +) + diff --git a/contrib/uiuc/plugins/meson.build b/contrib/uiuc/plugins/meson.build new file mode 100644 index 000000000..e69de29bb diff --git a/create_shadertext.py b/create_shadertext.py index f6857087e..1fd257b77 100644 --- a/create_shadertext.py +++ b/create_shadertext.py @@ -130,5 +130,4 @@ def create_buildinfo(outputdir, pymoldir='.'): ''' % (time.time(), sha), file=out) if __name__ == "__main__": - create_shadertext(*sys.argv[1:6]) - create_buildinfo(dirname(sys.argv[4]), dirname(dirname(sys.argv[1]))) + create_all("build") diff --git a/layer0/meson.build b/layer0/meson.build new file mode 100644 index 000000000..862c99c4e --- /dev/null +++ b/layer0/meson.build @@ -0,0 +1,42 @@ +src_files += files( + 'Bezier.cpp', + 'Block.cpp', + 'CarveHelper.cpp', + 'ccealignmodule.cpp', + 'ContourSurf.cpp', + 'Crystal.cpp', + 'Err.cpp', + 'Feedback.cpp', + 'Field.cpp', + 'File.cpp', + 'GenericBuffer.cpp', + 'GFXManager.cpp', + 'GraphicsUtil.cpp', + 'Isosurf.cpp', + 'Map.cpp', + 'marching_cubes.cpp', + 'Match.cpp', + 'Matrix.cpp', + 'MemoryDebug.cpp', + 'MemoryUsage.cpp', + 'MyPNG.cpp', + 'os_gl.cpp', + 'Parse.cpp', + 'Pixmap.cpp', + 'PostProcess.cpp', + 'ShaderMgr.cpp', + 'ShaderPreprocessor.cpp', + 'ShaderPrg.cpp', + 'Sphere.cpp', + 'Tetsurf.cpp', + 'Texture.cpp', + 'Tracker.cpp', + 'Triangle.cpp', + 'TTT.cpp', + 'Util.cpp', + 'Util2.cpp', + 'Vector.cpp', + 'Word.cpp', +) + +include_dirs += include_directories('.') diff --git a/layer1/meson.build b/layer1/meson.build new file mode 100644 index 000000000..20920ad5f --- /dev/null +++ b/layer1/meson.build @@ -0,0 +1,50 @@ +src_files += files( + 'Basis.cpp', + 'ButMode.cpp', + 'Camera.cpp', + 'CGO.cpp', + 'CGOGL.cpp', + 'CGORenderer.cpp', + 'Character.cpp', + 'COLLADA.cpp', + 'Color.cpp', + 'Control.cpp', + 'Extrude.cpp', + 'Font.cpp', + 'FontGLUT.cpp', + 'FontGLUT8x13.cpp', + 'FontGLUT9x15.cpp', + 'FontGLUTHel10.cpp', + 'FontGLUTHel12.cpp', + 'FontGLUTHel18.cpp', + 'FontType.cpp', + 'Movie.cpp', + 'Ortho.cpp', + 'P.cpp', + 'PConv.cpp', + 'Picking.cpp', + 'Pop.cpp', + 'PyMOLObject.cpp', + 'Ray.cpp', + 'Rep.cpp', + 'Scene.cpp', + 'SceneMouse.cpp', + 'ScenePicking.cpp', + 'SceneRay.cpp', + 'SceneRender.cpp', + 'SceneView.cpp', + 'ScrollBar.cpp', + 'Seq.cpp', + 'Setting.cpp', + 'Shaker.cpp', + 'Symmetry.cpp', + 'SymOp.cpp', + 'SymOpPConv.cpp', + 'SymOpTools.cpp', + 'Text.cpp', + 'TypeFace.cpp', + 'View.cpp', + 'Wizard.cpp', +) + +include_dirs += include_directories('.') diff --git a/layer2/meson.build b/layer2/meson.build new file mode 100644 index 000000000..9c96592cf --- /dev/null +++ b/layer2/meson.build @@ -0,0 +1,56 @@ +src_files += files( + 'AssemblyHelpers.cpp', + 'AtomInfo.cpp', + 'AtomInfoHistory.cpp', + 'BondTypeHistory.cpp', + 'CifFile.cpp', + 'CifMoleculeReader.cpp', + 'CoordSet.cpp', + 'DistSet.cpp', + 'GadgetSet.cpp', + 'HydrogenAdder.cpp', + 'MmodTyping.cpp', + 'MmtfMoleculeReader.cpp', + 'Mol2Typing.cpp', + 'MolV3000.cpp', + 'ObjectAlignment.cpp', + 'ObjectCallback.cpp', + 'ObjectCGO.cpp', + 'ObjectCurve.cpp', + 'ObjectDist.cpp', + 'ObjectGadget.cpp', + 'ObjectGadgetRamp.cpp', + 'ObjectGroup.cpp', + 'ObjectMap.cpp', + 'ObjectMesh.cpp', + 'ObjectMolecule.cpp', + 'ObjectMolecule2.cpp', + 'ObjectMolecule3.cpp', + 'ObjectSlice.cpp', + 'ObjectSurface.cpp', + 'ObjectVolume.cpp', + 'RepAngle.cpp', + 'RepCartoon.cpp', + 'RepCylBond.cpp', + 'RepDihedral.cpp', + 'RepDistDash.cpp', + 'RepDistLabel.cpp', + 'RepDot.cpp', + 'RepEllipsoid.cpp', + 'RepLabel.cpp', + 'RepMesh.cpp', + 'RepNonbonded.cpp', + 'RepNonbondedSphere.cpp', + 'RepRibbon.cpp', + 'RepSphere.cpp', + 'RepSphereGenerate.cpp', + 'RepSphereImmediate.cpp', + 'RepSurface.cpp', + 'RepWireBond.cpp', + 'Sculpt.cpp', + 'SculptCache.cpp', + 'SideChainHelper.cpp', + 'VFont.cpp', +) + +include_dirs += include_directories('.') diff --git a/layer3/meson.build b/layer3/meson.build new file mode 100644 index 000000000..f453c0c63 --- /dev/null +++ b/layer3/meson.build @@ -0,0 +1,20 @@ +src_files += files( + 'AtomIterators.cpp', + 'CifDataValueFormatter.cpp', + 'Editor.cpp', + 'Executive.cpp', + 'ExecutivePython.cpp', + 'Interactions.cpp', + 'MaeExportHelpers.cpp', + 'MoleculeExporter.cpp', + 'MovieScene.cpp', + 'PlugIOManager.cpp', + 'RingFinder.cpp', + 'Seeker.cpp', + 'Selector.cpp', + 'SelectorTmp.cpp', + 'SpecRec.cpp', + 'SpecRecSpecial.cpp', +) + +include_dirs += include_directories('.') diff --git a/layer4/meson.build b/layer4/meson.build new file mode 100644 index 000000000..b9aa4443c --- /dev/null +++ b/layer4/meson.build @@ -0,0 +1,7 @@ +src_files += files( + 'Cmd.cpp', + 'Menu.cpp', + 'PopUp.cpp', +) + +include_dirs += include_directories('.') diff --git a/layer5/meson.build b/layer5/meson.build new file mode 100644 index 000000000..37691877c --- /dev/null +++ b/layer5/meson.build @@ -0,0 +1,7 @@ +src_files += files( + 'main.cpp', + 'PyMOL.cpp', + 'TestPyMOL.cpp' +) + +include_dirs += include_directories('.') diff --git a/layerCTest/meson.build b/layerCTest/meson.build new file mode 100644 index 000000000..2d810a256 --- /dev/null +++ b/layerCTest/meson.build @@ -0,0 +1,31 @@ +src_files += files( + 'Test.cpp', + 'Test_Algorithm.cpp', + 'Test_Bezier.cpp', + 'Test_cache_ptr.cpp', + 'Test_CCrystal.cpp', + 'Test_CifFile.cpp', + 'Test_Classic_VLA.cpp', + 'Test_copyable_ptr.cpp', + 'Test_Event.cpp', + 'Test_Executive.cpp', + 'Test_Image.cpp', + 'Test_List.cpp', + 'Test_Picking.cpp', + 'Test_Result.cpp', + 'Test_ScrollBar.cpp', + 'Test_ShaderPreprocessor.cpp', + 'Test_SymOp.cpp', + 'Test_Test.cpp', + 'Test_TTT.cpp', + 'Test_type_traits.cpp', + 'Test_Util.cpp', + 'Test_VLA.cpp', + 'Test_zstring_view.cpp', +) + + +dependencies += subproject('catch2').get_variable('catch2_dep') +include_dirs += include_directories('.') +macros += '-D_PYMOL_CTEST' + diff --git a/meson.build b/meson.build new file mode 100644 index 000000000..9e5ef41bb --- /dev/null +++ b/meson.build @@ -0,0 +1,135 @@ +project( + 'pymol', + 'c', 'cpp', + version: run_command( + ['modules/version.py'], + check: true + ).stdout().strip(), + meson_version: '>= 1.4.0', + default_options: [ + 'cpp_std=c++17', + ], +) + +py = import('python').find_installation(pure: false) + +dependencies = [ + dependency('libpng', fallback: 'libpng'), + dependency('freetype2', fallback: 'freetype'), + dependency('gl', 'opengl'), + dependency('glew', fallback: 'glew'), + dependency('glm', fallback: 'glm'), +] + +run_command(py, files('create_shadertext.py')) +src_files = files('build/ShaderText.cpp') +include_dirs = [ + include_directories('include'), + include_directories('build'), +] +incdir_numpy = run_command(py, + [ + '-c', + 'import os, numpy; print(os.path.relpath(numpy.get_include()))' + ], + check: true +).stdout().strip() +include_dirs += include_directories(incdir_numpy) + +macros = [ + '-D_PYMOL_LIBPNG', + '-D_PYMOL_FREETYPE', + '-D_PYMOL_NUMPY', +] +flags = host_machine.system() == 'windows' ? ['-WMP'] : [ + '-Werror=return-type', + '-Wunused-variable', + '-Wno-switch', + '-Wno-narrowing', + '-Wno-char-subscripts', +] + + +#if get_option('use-openmp') +# dependencies += dependency('openmp') +# # shouldn't it be _PYMOL_OPENMP? +# macros += '-DPYMOL_OPENMP' +#endif + +if not get_option('no-vmd-plugins') + include_dirs += include_directories('contrib/uiuc/plugins/include') + src_dirs += 'contrib/uiuc/plugins/molfile_plugin/src' + dependencies += dependency('netcdf') + macros += '-D_PYMOL_VMD_PLUGINS' +endif + +if not get_option('no-libxml') + dependencies += dependency('libxml-2.0') + macros += '-D_HAVE_LIBXML' +endif + +msg_dep = get_option('use-msgpackc') +if msg_dep != 'guess' + dependencies += dependency('msgpackc') +else + macros += '-D_PYMOL_NO_MSGPACKC' +endif + +if not get_option('no-glut') + macros += '-D_PYMOL_NO_MAIN' +endif + +if get_option('testing') + subdir('layerCTest') +endif + +if get_option('openvr') + dependencies += dependency('openvr') + macros += '-D_PYMOL_OPENVR' +endif + +# macos +if host_machine.system() == 'darwin' + dependencies += [ + dependency('glut'), + ] + # shouldn't it be _PYMOL_CURVE_VALIDATE? + macros += '-DPYMOL_CURVE_VALIDATE' + + if get_option('no-osx-frameworks') + macros += '-D_PYMOL_OSX' + endif +endif + +if host_machine.system() == 'linux' + dependencies += [ + dependency('glut'), + ] +endif + + +subdir('ov/src') +subdir('layer0') +subdir('layer1') +subdir('layer2') +subdir('layer3') +subdir('layer4') +subdir('layer5') + +py.extension_module( + '_cmd', + src_files, + include_directories : include_dirs, + cpp_args: macros + flags, + dependencies: dependencies, + install: true, + subdir: 'pymol' +) +subdir('contrib/champ') + +subdir('modules/chempy') +subdir('modules/pmg_qt') +subdir('modules/pmg_tk') +subdir('modules/pymol') +subdir('modules/pymol2') + diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 000000000..f1fdc35d7 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,64 @@ +option( + 'no-glut', + type : 'boolean', + value : true, + description : 'link with GLUT (legacy GUI)' +) + +option( + 'no-osx-frameworks', + type : 'boolean', + value : true, + description : 'on MacOS use XQuartz instead of native frameworks' +) + +option( + 'no-libxml', + type : 'boolean', + value : false, + description : 'skip libxml2 dependency, disables COLLADA export' +) + +option( + 'use-openmp', + type : 'boolean', + value : true, + description : 'Use OpenMP' +) + +option( + 'use-vtkm', + type : 'combo', + choices : ['1.5', '1.6', '1.7', 'no'], + value : 'no', + description : 'Use VTK-m for isosurface generation' +) + +option( + 'use-msgpackc', + type : 'combo', + choices : ['c++11', 'c', 'guess', 'no'], + value : 'guess', + description : 'c++11: use msgpack-c header-only library; c: link against shared library; no: disable fast MMTF load support' +) + +option( + 'testing', + type : 'boolean', + value : false, + description : 'Build C-level tests' +) + +option( + 'openvr', + type : 'boolean', + value : false +) + +option( + 'no-vmd-plugins', + type : 'boolean', + value : true, + description : 'Disable VMD molfile plugins (libnetcdf dependency)' +) + diff --git a/modules/chempy/bmin/meson.build b/modules/chempy/bmin/meson.build new file mode 100644 index 000000000..f99d7252d --- /dev/null +++ b/modules/chempy/bmin/meson.build @@ -0,0 +1,13 @@ +python_sources = [ + '__init__.py', + 'commands.py', + 'realtime.py', + 'state.py', + 'util.py', +] + +py.install_sources( + python_sources, + subdir: 'chempy/bmin' +) + diff --git a/modules/chempy/champ/meson.build b/modules/chempy/champ/meson.build new file mode 100644 index 000000000..98595957b --- /dev/null +++ b/modules/chempy/champ/meson.build @@ -0,0 +1,12 @@ +python_sources = [ + '__init__.py', + 'amber99.py', + 'assign.py', + 'formal_charges.py', +] + +py.install_sources( + python_sources, + subdir: 'chempy/champ' +) + diff --git a/modules/chempy/fast/meson.build b/modules/chempy/fast/meson.build new file mode 100644 index 000000000..8f43753cf --- /dev/null +++ b/modules/chempy/fast/meson.build @@ -0,0 +1,9 @@ +python_sources = [ + '__init__.py', +] + +py.install_sources( + python_sources, + subdir: 'chempy/fast' +) + diff --git a/modules/chempy/fragments/meson.build b/modules/chempy/fragments/meson.build new file mode 100644 index 000000000..a7a650400 --- /dev/null +++ b/modules/chempy/fragments/meson.build @@ -0,0 +1,9 @@ +python_sources = [ + '__init__.py', +] + +py.install_sources( + python_sources, + subdir: 'chempy/fragments' +) + diff --git a/modules/chempy/meson.build b/modules/chempy/meson.build new file mode 100644 index 000000000..174a81cfd --- /dev/null +++ b/modules/chempy/meson.build @@ -0,0 +1,52 @@ +python_sources = [ + '__init__.py', + 'arc.py', + 'bond_amber.py', + 'bond_mmff.py', + 'bonds.py', + 'brick.py', + 'cc1.py', + 'charge.py', + 'cif.py', + 'cpv.py', + 'dictdb.py', + 'gamess1.py', + 'gms.py', + 'hetatm.py', + 'io.py', + 'lst.py', + 'mae.py', + 'map.py', + 'mass.py', + 'mmd.py', + 'models.py', + 'mol.py', + 'mol2.py', + 'neighbor.py', + 'pdb.py', + 'pkl.py', + 'place.py', + 'protein.py', + 'protein_amber.py', + 'protein_amber99.py', + 'protein_mmff.py', + 'protein_residues.py', + 'sdf.py', + 'solvate.py', + 'water_amber.py', + 'water_residues.py', + 'xyz.py', +] + +py.install_sources( + python_sources, + subdir: 'chempy' +) + +subdir('bmin') +subdir('champ') +subdir('fast') +subdir('fragments') +subdir('mmtf') +subdir('tinker') + diff --git a/modules/chempy/mmtf/meson.build b/modules/chempy/mmtf/meson.build new file mode 100644 index 000000000..82b2e6fcb --- /dev/null +++ b/modules/chempy/mmtf/meson.build @@ -0,0 +1,10 @@ +python_sources = [ + '__init__.py', + 'io.py', +] + +py.install_sources( + python_sources, + subdir: 'chempy/tinker' +) + diff --git a/modules/chempy/tinker/meson.build b/modules/chempy/tinker/meson.build new file mode 100644 index 000000000..09771fe5c --- /dev/null +++ b/modules/chempy/tinker/meson.build @@ -0,0 +1,14 @@ +python_sources = [ + '__init__.py', + 'amber.py', + 'keyword.py', + 'realtime.py', + 'state.py', +] + +py.install_sources( + python_sources, + subdir: 'chempy/tinker' +) + + diff --git a/modules/pmg_qt/forms/meson.build b/modules/pmg_qt/forms/meson.build new file mode 100644 index 000000000..68da43ac6 --- /dev/null +++ b/modules/pmg_qt/forms/meson.build @@ -0,0 +1,29 @@ +python_sources = [ + '__init__.py', + 'askpartial.ui', + 'change_confirm.ui', + 'colors.ui', + 'create_shortcut.ui', + 'fetch.ui', + 'help_shortcut.ui', + 'load_aln.ui', + 'load_mae.ui', + 'load_map.ui', + 'load_mtz.ui', + 'load_traj.ui', + 'movieexport.ui', + 'pluginitem.ui', + 'pluginmanager.ui', + 'png.ui', + 'props.ui', + 'render.ui', + 'save_molecule.ui', + 'save_object.ui', + 'shortcut_menu.ui', +] + +py.install_sources( + python_sources, + subdir: 'pmg_qt/forms' +) + diff --git a/modules/pmg_qt/meson.build b/modules/pmg_qt/meson.build new file mode 100644 index 000000000..87885e391 --- /dev/null +++ b/modules/pmg_qt/meson.build @@ -0,0 +1,25 @@ +python_sources = [ + '__init__.py', + 'advanced_settings_gui.py', + 'builder.py', + 'file_dialogs.py', + 'keymapping.py', + 'mimic_pmg_tk.py', + 'mimic_tk.py', + 'properties_dialog.py', + 'pymol_gl_widget.py', + 'pymol_qt_gui.py', + 'scene_bin_gui.py', + 'shortcut_menu_gui.py', + 'TextEditor.py', + 'volume.py', +] + +py.install_sources( + python_sources, + subdir: 'pmg_qt' +) + +subdir('forms') +subdir('syntax') + diff --git a/modules/pmg_qt/syntax/meson.build b/modules/pmg_qt/syntax/meson.build new file mode 100644 index 000000000..bce180a68 --- /dev/null +++ b/modules/pmg_qt/syntax/meson.build @@ -0,0 +1,12 @@ +python_sources = [ + '__init__.py', + 'pml.py', + 'pmlparser.py', + 'python.py', +] + +py.install_sources( + python_sources, + subdir: 'pmg_qt/syntax' +) + diff --git a/modules/pmg_tk/meson.build b/modules/pmg_tk/meson.build new file mode 100644 index 000000000..0998ac151 --- /dev/null +++ b/modules/pmg_tk/meson.build @@ -0,0 +1,20 @@ +python_sources = [ + '__init__.py', + 'ColorEditor.py', + 'Demo.py', + 'PMGApp.py', + 'PyMOLMapLoad.py', + 'SetEditor.py', + 'Setting.py', + 'TextEditor.py', + 'volume.py', +] + +py.install_sources( + python_sources, + subdir: 'pmg_tk' +) + +subdir('skins') +subdir('startup') + diff --git a/modules/pmg_tk/skins/demo/meson.build b/modules/pmg_tk/skins/demo/meson.build new file mode 100644 index 000000000..004cb8126 --- /dev/null +++ b/modules/pmg_tk/skins/demo/meson.build @@ -0,0 +1,9 @@ +python_sources = [ + '__init__.py', +] + +py.install_sources( + python_sources, + subdir: 'pmg_tk/skins/demo' +) + diff --git a/modules/pmg_tk/skins/meson.build b/modules/pmg_tk/skins/meson.build new file mode 100644 index 000000000..e32184e54 --- /dev/null +++ b/modules/pmg_tk/skins/meson.build @@ -0,0 +1,12 @@ +python_sources = [ + '__init__.py', +] + +py.install_sources( + python_sources, + subdir: 'pmg_tk/skins' +) + +subdir('demo') +subdir('normal') + diff --git a/modules/pmg_tk/skins/normal/meson.build b/modules/pmg_tk/skins/normal/meson.build new file mode 100644 index 000000000..5adcbb907 --- /dev/null +++ b/modules/pmg_tk/skins/normal/meson.build @@ -0,0 +1,9 @@ +python_sources = [ + '__init__.py', + 'builder.py', +] + +py.install_sources( + python_sources, + subdir: 'pmg_tk/skins/normal' +) diff --git a/modules/pmg_tk/startup/meson.build b/modules/pmg_tk/startup/meson.build new file mode 100644 index 000000000..2d6d79eb8 --- /dev/null +++ b/modules/pmg_tk/startup/meson.build @@ -0,0 +1,9 @@ +python_sources = [ + '__init__.py', +] + +py.install_sources( + python_sources, + subdir: 'pmg_tk/startup' +) + diff --git a/modules/pymol/Qt/meson.build b/modules/pymol/Qt/meson.build new file mode 100644 index 000000000..c1d8bb4e1 --- /dev/null +++ b/modules/pymol/Qt/meson.build @@ -0,0 +1,10 @@ +python_sources = [ + '__init__.py', + 'utils.py', +] + +py.install_sources( + python_sources, + subdir: 'pymol/Qt' +) + diff --git a/modules/pymol/__main__.py b/modules/pymol/__main__.py deleted file mode 100644 index 831402754..000000000 --- a/modules/pymol/__main__.py +++ /dev/null @@ -1,10 +0,0 @@ -''' -PyMOL Molecular Graphics System -Copyright (c) Schrodinger, Inc. -''' - -import sys - -if __name__ == '__main__': - import pymol - sys.exit(pymol.launch()) diff --git a/modules/pymol/meson.build b/modules/pymol/meson.build new file mode 100644 index 000000000..3533ccf1d --- /dev/null +++ b/modules/pymol/meson.build @@ -0,0 +1,76 @@ +python_sources = [ + '__init__.py', + '_gui.py', + 'api.py', + 'callback.py', + 'cgo.py', + 'cgobuilder.py', + 'checking.py', + 'cmd.py', + 'colorprinting.py', + 'colorramping.py', + 'commanding.py', + 'completing.py', + 'computing.py', + 'constants.py', + 'constants_palette.py', + 'controlling.py', + 'creating.py', + 'diagnosing.py', + 'editing.py', + 'editor.py', + 'experimenting.py', + 'exporting.py', + 'externing.py', + 'feedingback.py', + 'fitting.py', + 'gui.py', + 'headering.py', + 'helping.py', + 'importing.py', + 'internal.py', + 'invocation.py', + 'keyboard.py', + 'keywords.py', + 'lazyio.py', + 'locking.py', + 'menu.py', + 'monitoring.py', + 'morphing.py', + 'movie.py', + 'moving.py', + 'mpeg_encode.py', + 'parser.py', + 'parsing.py', + 'povray.py', + 'preset.py', + 'pymolhttpd.py', + 'querying.py', + 'rpc.py', + 'save_shortcut.py', + 'selecting.py', + 'selector.py', + 'seqalign.py', + 'setting.py', + 'shortcut.py', + 'shortcut_dict.py', + 'shortcut_manager.py', + 'util.py', + 'vfont.py', + 'viewing.py', + 'wizarding.py', + 'xray.py', + 'xwin.py', +] + +py.install_sources( + python_sources, + subdir: 'pymol' +) + + +subdir('plugins') +subdir('Qt') +subdir('stereochemistry') +subdir('wizard') + diff --git a/modules/pymol/plugins/meson.build b/modules/pymol/plugins/meson.build new file mode 100644 index 000000000..60c258953 --- /dev/null +++ b/modules/pymol/plugins/meson.build @@ -0,0 +1,14 @@ +python_sources = [ + '__init__.py', + 'installation.py', + 'legacysupport.py', + 'managergui.py', + 'managergui_qt.py', + 'repository.py', +] + +py.install_sources( + python_sources, + subdir: 'pymol/plugins' +) + diff --git a/modules/pymol/stereochemistry/meson.build b/modules/pymol/stereochemistry/meson.build new file mode 100644 index 000000000..acd446c66 --- /dev/null +++ b/modules/pymol/stereochemistry/meson.build @@ -0,0 +1,9 @@ +python_sources = [ + '__init__.py', +] + +py.install_sources( + python_sources, + subdir: 'pymol/stereochemistry' +) + diff --git a/modules/pymol/wizard/meson.build b/modules/pymol/wizard/meson.build new file mode 100644 index 000000000..531ce6339 --- /dev/null +++ b/modules/pymol/wizard/meson.build @@ -0,0 +1,35 @@ + +python_sources = [ + '__init__.py', + 'annotation.py', + 'appearance.py', + 'benchmark.py', + 'box.py', + 'charge.py', + 'cleanup.py', + 'command.py', + 'demo.py', + 'density.py', + 'distance.py', + 'dragging.py', + 'filter.py', + 'label.py', + 'measurement.py', + 'message.py', + 'mutagenesis.py', + 'nucmutagenesis.py', + 'openvr.py', + 'pair_fit.py', + 'pseudoatom.py', + 'renaming.py', + 'sculpting.py', + 'security.py', + 'stereodemo.py', + 'toggle.py', +] + +py.install_sources( + python_sources, + subdir: 'pymol/wizard' +) + diff --git a/modules/pymol2/meson.build b/modules/pymol2/meson.build new file mode 100644 index 000000000..767b3c9dd --- /dev/null +++ b/modules/pymol2/meson.build @@ -0,0 +1,9 @@ +python_sources = [ + '__init__.py', + 'cmd2.py', +] + +py.install_sources( + python_sources, + subdir: 'pymol2' +) diff --git a/modules/version.py b/modules/version.py new file mode 100644 index 000000000..58ae4e4ad --- /dev/null +++ b/modules/version.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 +import re + + +print(re.findall(r'_PyMOL_VERSION "(.*)"', open('layer0/Version.h').read())[0]) diff --git a/ov/src/meson.build b/ov/src/meson.build new file mode 100644 index 000000000..7591580d3 --- /dev/null +++ b/ov/src/meson.build @@ -0,0 +1,12 @@ +src_files += files( + 'ov_utility.cpp', + 'OVContext.cpp', + 'OVHeap.cpp', + 'OVHeapArray.cpp', + 'OVLexicon.cpp', + 'OVOneToAny.cpp', + 'OVOneToOne.cpp', + 'OVRandom.cpp', +) + +include_dirs += include_directories('.') diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..d70bf2772 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,42 @@ +[project] +name = "pymol" +readme = "README.md" +requires-python = ">=3.9" +dynamic=["version"] +license = {file = "LICENSE"} +description = """ +PyMOL is a Python-enhanced molecular graphics tool. +It excels at 3D visualization of proteins, small molecules, density, +surfaces, and trajectories. It also includes molecular editing, +ray tracing, and movies. Open Source PyMOL is free to everyone! +""" +authors = [ + {name = "Schrodinger", email = "pymol-users@lists.sourceforge.net"}, +] +dependencies = [ + "numpy>=1.26.4", +] + +[project.optional-dependencies] +test = [ + "pillow==10.3.0", + "pytest==8.2.2", +] + +[project.urls] +Homepage = "https://pymol.org" +Documentation = "https://pymol.org/dokuwiki" +Repository = "https://github.com/schrodinger/pymol-open-source" +"Bug Tracker" = "https://github.com/schrodinger/pymol-open-source/issues" +Changelog = "https://github.com/schrodinger/pymol-open-source/blob/master/ChangeLog" + +[build-system] +requires = [ + "meson-python>=0.15.0", + "numpy>=1.26.4" +] +build-backend = "mesonpy" + +[project.scripts] +pymol = "pymol:launch" + diff --git a/setup.py b/setup.py deleted file mode 100644 index 83111878b..000000000 --- a/setup.py +++ /dev/null @@ -1,672 +0,0 @@ -#!/usr/bin/env python -# -# This script only applies if you are performing a Python setuptools-based -# installation of PyMOL. -# -# It may assume that all of PyMOL's external dependencies are -# pre-installed into the system. - -import argparse -import glob -import os -import pathlib -import re -import sys -import sysconfig -import shutil - -from setuptools import setup, Extension -from setuptools.command.build_ext import build_ext -from setuptools.command.build_py import build_py -from setuptools.command.install import install - -import create_shadertext - -# non-empty DEBUG variable turns off optimization and adds -g flag -DEBUG = bool(os.getenv('DEBUG', '')) - -WIN = sys.platform.startswith('win') -MAC = sys.platform.startswith('darwin') - -# handle extra arguments - - -class options: - osx_frameworks = True - jobs = int(os.getenv('JOBS', 0)) - no_libxml = False - no_glut = True - use_msgpackc = 'guess' - testing = False - openvr = False - use_openmp = 'no' if MAC else 'yes' - use_vtkm = 'no' - vmd_plugins = True - - -parser = argparse.ArgumentParser() -parser.add_argument('--glut', dest='no_glut', action="store_false", - help="link with GLUT (legacy GUI)") -parser.add_argument('--no-osx-frameworks', dest='osx_frameworks', - help="on MacOS use XQuartz instead of native frameworks", - action="store_false") -parser.add_argument('--jobs', '-j', type=int, help="for parallel builds " - "(defaults to number of processors)") -parser.add_argument('--no-libxml', action="store_true", - help="skip libxml2 dependency, disables COLLADA export") -parser.add_argument('--use-openmp', choices=('yes', 'no'), - help="Use OpenMP") -parser.add_argument('--use-vtkm', choices=('1.5', '1.6', '1.7', 'no'), - help="Use VTK-m for isosurface generation") -parser.add_argument('--use-msgpackc', choices=('c++11', 'c', 'guess', 'no'), - help="c++11: use msgpack-c header-only library; c: link against " - "shared library; no: disable fast MMTF load support") -parser.add_argument('--testing', action="store_true", - help="Build C-level tests") -parser.add_argument('--openvr', dest='openvr', action='store_true') -parser.add_argument('--no-vmd-plugins', dest='vmd_plugins', - action='store_false', - help='Disable VMD molfile plugins (libnetcdf dependency)') -options, sys.argv[1:] = parser.parse_known_args(namespace=options) - -if False: - import monkeypatch_distutils - monkeypatch_distutils.set_parallel_jobs(options.jobs) - - -def forms_uic(build_lib='modules'): - ''' - Convert Qt UI files in "modules/pmg_qt/forms" to Python files in place - ''' - - -def get_prefix_path(): - ''' - Return a list of paths which will be searched for "include", - "include/freetype2", "lib", "lib64" etc. - ''' - try: - return os.environ['PREFIX_PATH'].split(os.pathsep) - except KeyError: - pass - - if sys.platform.startswith("freebsd"): - return ["/usr/local"] - - X11 = ['/usr/X11'] * (not options.osx_frameworks) - - if sys.platform == 'darwin': - for prefix in ['/sw', '/opt/local', '/usr/local']: - if sys.base_prefix.startswith(prefix): - return [prefix] + X11 - - if is_conda_env(): - if sys.platform.startswith('win'): - return [os.path.join(sys.prefix, 'Library')] - - return [sys.prefix] + X11 - - return ['/usr'] + X11 - - -def is_conda_env(): - return ( - 'conda' in sys.prefix or - 'conda' in sys.version or - 'Continuum' in sys.version or - sys.prefix == os.getenv('CONDA_PREFIX')) - - -def guess_msgpackc(): - for prefix in prefix_path: - for suffix in ['h', 'hpp']: - f = os.path.join(prefix, 'include', 'msgpack', f'version_master.{suffix}') - - try: - m = re.search(r'MSGPACK_VERSION_MAJOR\s+(\d+)', open(f).read()) - except EnvironmentError: - continue - - if m is not None: - major = int(m.group(1)) - if major > 1: - return 'c++11' - - return 'no' - - -class CMakeExtension(Extension): - - def __init__(self, - name, - sources, - include_dirs=[], - libraries=[], - library_dirs=[], - define_macros=[], - extra_link_args=[], - extra_compile_args=[]): - # don't invoke the original build_ext for this special extension - super().__init__(name, sources=[]) - self.sources = sources - self.include_dirs = include_dirs - self.libraries = libraries - self.library_dirs = library_dirs - self.define_macros = define_macros - self.extra_link_args = extra_link_args - self.extra_compile_args = extra_compile_args - - -class build_ext_pymol(build_ext): - def initialize_options(self) -> None: - super().initialize_options() - if DEBUG and not WIN: - self.debug = False - - def run(self): - for ext in self.extensions: - self.build_cmake(ext) - - def build_cmake(self, ext): - cwd = pathlib.Path().absolute() - - # these dirs will be created in build_py, so if you don't have - # any python sources to bundle, the dirs will be missing - name_split = ext.name.split('.') - target_name = name_split[-1] - build_temp = pathlib.Path(self.build_temp) / target_name - build_temp.mkdir(parents=True, exist_ok=True) - extdir = pathlib.Path(self.get_ext_fullpath(ext.name)) - extdirabs = extdir.absolute() - - extdir.parent.mkdir(parents=True, exist_ok=True) - - def concat_paths(paths): - return ''.join(path.replace('\\', '/') + ";" for path in paths) - - config = 'Debug' if DEBUG else 'Release' - lib_output_dir = str(extdir.parent.absolute()) - all_files = ext.sources - all_src = concat_paths(all_files) - all_defs = ''.join(mac[0] + ";" for mac in ext.define_macros) - all_libs = ''.join(f"{lib};" for lib in ext.libraries) - all_ext_link = ' '.join(ext.extra_link_args) - all_comp_args = ''.join(f"{arg};" for arg in ext.extra_compile_args) - all_lib_dirs = concat_paths(ext.library_dirs) - all_inc_dirs = concat_paths(ext.include_dirs) - - lib_mode = "RUNTIME" if WIN else "LIBRARY" - - shared_suffix = sysconfig.get_config_var('EXT_SUFFIX') - - cmake_args = [ - f"-DTARGET_NAME={target_name}", - f"-DCMAKE_{lib_mode}_OUTPUT_DIRECTORY={lib_output_dir}", - f"-DCMAKE_BUILD_TYPE={config}", - f"-DALL_INC_DIR={all_inc_dirs}", - f"-DALL_SRC={all_src}", - f"-DALL_DEF={all_defs}", - f"-DALL_LIB_DIR={all_lib_dirs}", - f"-DALL_LIB={all_libs}", - f"-DALL_COMP_ARGS={all_comp_args}", - f"-DALL_EXT_LINK={all_ext_link}", - f"-DSHARED_SUFFIX={shared_suffix}" - ] - - # example of build args - build_args = ['--config', config] - if not WIN: # Win /MP flag on compilation level - cpu_count = os.cpu_count() or 1 - build_args += [f'-j{cpu_count}'] - - os.chdir(str(build_temp)) - self.spawn(['cmake', str(cwd)] + cmake_args) - if not self.dry_run: - self.spawn(['cmake', '--build', '.'] + build_args) - - if WIN: - # Move up from VS release folder - cmake_lib_loc = pathlib.Path(lib_output_dir, "Release", f"{target_name}{shared_suffix}") - if cmake_lib_loc.exists(): - shutil.move(cmake_lib_loc, extdirabs) - - # Troubleshooting: if fail on line above then delete all possible - # temporary CMake files including "CMakeCache.txt" in top level dir. - os.chdir(str(cwd)) - - -class build_py_pymol(build_py): - def run(self): - build_py.run(self) - forms_uic(self.build_lib) - - -class install_pymol(install): - pymol_path = None - bundled_pmw = False - no_launcher = False - - user_options = install.user_options + [ - ('pymol-path=', None, 'PYMOL_PATH'), - ('bundled-pmw', None, 'install bundled Pmw module'), - ('no-launcher', None, 'skip installation of the pymol launcher'), - ] - - def finalize_options(self): - install.finalize_options(self) - - self.pymol_path_is_default = self.pymol_path is None - - if self.pymol_path is None: - self.pymol_path = os.path.join( - self.install_libbase, 'pymol', 'pymol_path') - elif self.root is not None: - self.pymol_path = install_pymol.change_root( - self.root, self.pymol_path) - - def run(self): - super().run() - self.install_pymol_path() - - if not self.no_launcher: - self.make_launch_script() - - if self.bundled_pmw: - raise Exception('--bundled-pmw has been removed, please install Pmw from ' - 'https://github.com/schrodinger/pmw-patched') - - def unchroot(self, name): - if self.root is not None and name.startswith(self.root): - return name[len(self.root):] - return name - - def copy_tree_nosvn(self, src, dst): - def ignore(src, names): return set([ - ]).intersection(names) - if os.path.exists(dst): - shutil.rmtree(dst) - print('copying %s -> %s' % (src, dst)) - shutil.copytree(src, dst, ignore=ignore) - - def copy(self, src, dst): - copy = self.copy_tree_nosvn if os.path.isdir(src) else self.copy_file - copy(src, dst) - - def install_pymol_path(self): - self.mkpath(self.pymol_path) - for name in ['LICENSE', 'data', 'test', 'examples', ]: - self.copy(name, os.path.join(self.pymol_path, name)) - - if options.openvr: - self.copy('contrib/vr/README.md', - os.path.join(self.pymol_path, 'README-VR.txt')) - - def make_launch_script(self): - if sys.platform.startswith('win'): - launch_script = 'pymol.bat' - else: - launch_script = 'pymol' - - self.mkpath(self.install_scripts) - launch_script = os.path.join(self.install_scripts, launch_script) - - python_exe = os.path.abspath(sys.executable) - pymol_file = self.unchroot(os.path.join( - self.install_libbase, 'pymol', '__init__.py')) - pymol_path = self.unchroot(self.pymol_path) - - with open(launch_script, 'w') as out: - if sys.platform.startswith('win'): - # paths relative to launcher, if possible - try: - python_exe = '%~dp0\\' + \ - os.path.relpath(python_exe, self.install_scripts) - except ValueError: - pass - try: - pymol_file = '%~dp0\\' + \ - os.path.relpath(pymol_file, self.install_scripts) - except ValueError: - pymol_file = os.path.abspath(pymol_file) - - if not self.pymol_path_is_default: - out.write(f'set PYMOL_PATH={pymol_path}' + os.linesep) - out.write('"%s" "%s"' % (python_exe, pymol_file)) - out.write(' %*' + os.linesep) - else: - out.write('#!/bin/sh' + os.linesep) - if not self.pymol_path_is_default: - out.write(f'export PYMOL_PATH="{pymol_path}"' + os.linesep) - out.write('exec "%s" "%s" "$@"' % - (python_exe, pymol_file) + os.linesep) - - os.chmod(launch_script, 0o755) - -# ============================================================================ - - -# should be something like (build_base + "/generated"), but that's only -# known to build and install instances -generated_dir = os.path.join(os.environ.get("PYMOL_BLD", "build"), "generated") - -create_shadertext.create_all(generated_dir) - -# can be changed with environment variable PREFIX_PATH -prefix_path = get_prefix_path() - -inc_dirs = [ - "include", -] - -pymol_src_dirs = [ - "ov/src", - "layer0", - "layer1", - "layer2", - "layer3", - "layer4", - "layer5", - generated_dir, -] - -def_macros = [ - ("_PYMOL_LIBPNG", None), - ("_PYMOL_FREETYPE", None), -] - -if DEBUG and not WIN: - def_macros += [ - # bounds checking in STL containers - ("_GLIBCXX_ASSERTIONS", None), - ] - -libs = ["png", "freetype"] -lib_dirs = [] -ext_comp_args = [ - "-Werror=return-type", - "-Wunused-variable", - "-Wno-switch", - "-Wno-narrowing", - # legacy stuff - '-Wno-char-subscripts', - # optimizations - "-Og" if DEBUG else "-O3", -] if not WIN else ["/MP"] -ext_link_args = [] -ext_objects = [] -data_files = [] -ext_modules = [] - -if options.use_openmp == 'yes': - def_macros += [ - ("PYMOL_OPENMP", None), - ] - if MAC: - ext_comp_args += ["-Xpreprocessor", "-fopenmp"] - libs += ["omp"] - elif WIN: - ext_comp_args += ["/openmp"] - else: - ext_comp_args += ["-fopenmp"] - ext_link_args += ["-fopenmp"] - -if options.vmd_plugins: - # VMD plugin support - inc_dirs += [ - 'contrib/uiuc/plugins/include', - ] - pymol_src_dirs += [ - 'contrib/uiuc/plugins/molfile_plugin/src', - ] - def_macros += [ - ("_PYMOL_VMD_PLUGINS", None), - ] - -if not options.no_libxml: - # COLLADA support - def_macros += [ - ("_HAVE_LIBXML", None) - ] - libs += ["xml2"] - -if options.use_msgpackc == 'guess': - options.use_msgpackc = guess_msgpackc() - -if options.use_msgpackc == 'no': - def_macros += [("_PYMOL_NO_MSGPACKC", None)] -else: - if options.use_msgpackc == 'c++11': - def_macros += [ - ("MMTF_MSGPACK_USE_CPP11", None), - ("MSGPACK_NO_BOOST", None), - ] - else: - libs += ['msgpackc'] - - pymol_src_dirs += ["contrib/mmtf-c"] - -if options.no_glut: - def_macros += [ - ("_PYMOL_NO_MAIN", None), - ] - -if options.testing: - pymol_src_dirs += ["layerCTest"] - def_macros += [("_PYMOL_CTEST", None)] - -if options.openvr: - def_macros += [("_PYMOL_OPENVR", None)] - pymol_src_dirs += [ - "contrib/vr", - ] - -inc_dirs += pymol_src_dirs - -# ============================================================================ -if MAC: - libs += ["GLEW"] - def_macros += [("PYMOL_CURVE_VALIDATE", None)] - - if options.osx_frameworks: - ext_link_args += [ - "-framework OpenGL", - ] + (not options.no_glut) * [ - "-framework GLUT", - ] - def_macros += [ - ("_PYMOL_OSX", None), - ] - else: - libs += [ - "GL", - ] + (not options.no_glut) * [ - "glut", - ] - -if WIN: - # clear - libs = [] - - def_macros += [ - ("WIN32", None), - ] - - libs += [ - "Advapi32", # Registry (RegCloseKey etc.) - "Ws2_32", # htonl - ] - - if True: - libs += [ - "glew32", - "freetype", - "libpng", - ] + (not options.no_glut) * [ - "freeglut", - ] + (not options.no_libxml) * [ - "libxml2", - ] - - if DEBUG: - ext_comp_args += ['/Z7'] - ext_link_args += ['/DEBUG'] - - libs += [ - "opengl32", - ] - # TODO: Remove when we move to setup-CMake - ext_comp_args += ["/std:c++17"] - -if not (MAC or WIN): - libs += [ - "GL", - "GLEW", - ] + (not options.no_glut) * [ - "glut", - ] - -if options.use_vtkm != "no": - for prefix in prefix_path: - vtkm_inc_dir = os.path.join( - prefix, "include", f"vtkm-{options.use_vtkm}") - if os.path.exists(vtkm_inc_dir): - break - else: - raise LookupError('VTK-m headers not found.' - f' PREFIX_PATH={":".join(prefix_path)}') - def_macros += [ - ("_PYMOL_VTKM", None), - ] - inc_dirs += [ - vtkm_inc_dir, - vtkm_inc_dir + "/vtkm/thirdparty/diy/vtkmdiy/include", - vtkm_inc_dir + "/vtkm/thirdparty/lcl/vtkmlcl", - ] + (options.use_vtkm == "1.5") * [ - vtkm_inc_dir + "/vtkm/thirdparty/diy", - vtkm_inc_dir + "/vtkm/thirdparty/taotuple", - ] - libs += [ - f"vtkm_cont-{options.use_vtkm}", - f"vtkm_filter-{options.use_vtkm}" if options.use_vtkm == "1.5" else - f"vtkm_filter_contour-{options.use_vtkm}", - ] - -if options.vmd_plugins: - libs += [ - "netcdf", - ] - -if options.openvr: - libs += [ - "openvr_api", - ] - -if True: - try: - import numpy - inc_dirs += [ - numpy.get_include(), - ] - def_macros += [ - ("_PYMOL_NUMPY", None), - ] - except ImportError: - print("numpy not available") - -if True: - for prefix in prefix_path: - for dirs, suffixes in [ - [inc_dirs, [("include",), ("include", "freetype2"), - ("include", "libxml2"), ("include", "openvr")]], - [lib_dirs, [("lib64",), ("lib",)]], - ]: - dirs.extend( - filter(os.path.isdir, [os.path.join(prefix, *s) for s in suffixes])) - -if True: - # optimization currently causes a clang segfault on OS X 10.9 when - # compiling layer2/RepCylBond.cpp - if sys.platform == 'darwin': - ext_comp_args += ["-fno-strict-aliasing"] - - -def get_pymol_version(): - return re.findall(r'_PyMOL_VERSION "(.*)"', open('layer0/Version.h').read())[0] - - -def get_sources(subdirs, suffixes=('.c', '.cpp')): - return sorted([f for d in subdirs for s in suffixes for f in glob.glob(d + '/*' + s)]) - - -def get_packages(base, parent='', r=None): - from os.path import join, exists - if r is None: - r = [] - if parent: - r.append(parent) - for name in os.listdir(join(base, parent)): - if '.' not in name and exists(join(base, parent, name, '__init__.py')): - get_packages(base, join(parent, name), r) - return r - - -package_dir = dict((x, os.path.join(base, x)) - for base in ['modules'] - for x in get_packages(base)) - -# Python includes -inc_dirs.append(sysconfig.get_paths()['include']) -inc_dirs.append(sysconfig.get_paths()['platinclude']) - -champ_inc_dirs = ['contrib/champ'] -champ_inc_dirs.append(sysconfig.get_paths()['include']) -champ_inc_dirs.append(sysconfig.get_paths()['platinclude']) - -if WIN: - # pyconfig.py forces linking against pythonXY.lib on MSVC - py_lib = pathlib.Path(sysconfig.get_paths()['stdlib']).parent / 'libs' - lib_dirs.append(str(py_lib)) - -ext_modules += [ - CMakeExtension( - name="pymol._cmd", - sources=get_sources(pymol_src_dirs), - include_dirs=inc_dirs, - libraries=libs, - library_dirs=lib_dirs, - define_macros=def_macros, - extra_link_args=ext_link_args, - extra_compile_args=ext_comp_args, - ), - - CMakeExtension( - name="chempy.champ._champ", - sources=get_sources(['contrib/champ']), - include_dirs=champ_inc_dirs, - library_dirs=lib_dirs, - ), -] - -distribution = setup( # Distribution meta-data - cmdclass={ - 'build_ext': build_ext_pymol, - 'build_py': build_py_pymol, - 'install': install_pymol, - }, - name="pymol", - version=get_pymol_version(), - author="Schrodinger", - url="http://pymol.org", - contact="pymol-users@lists.sourceforge.net", - description=("PyMOL is a Python-enhanced molecular graphics tool. " - "It excels at 3D visualization of proteins, small molecules, density, " - "surfaces, and trajectories. It also includes molecular editing, " - "ray tracing, and movies. Open Source PyMOL is free to everyone!"), - - package_dir=package_dir, - packages=list(package_dir), - package_data={'pmg_qt': ['forms/*.ui']}, - - ext_modules=ext_modules, - data_files=data_files, -) diff --git a/subprojects/catch2.wrap b/subprojects/catch2.wrap new file mode 100644 index 000000000..738c3fc6a --- /dev/null +++ b/subprojects/catch2.wrap @@ -0,0 +1,11 @@ +[wrap-file] +directory = Catch2-2.13.8 +source_url = https://github.com/catchorg/Catch2/archive/v2.13.8.tar.gz +source_filename = Catch2-2.13.8.tar.gz +source_hash = b9b592bd743c09f13ee4bf35fc30eeee2748963184f6bea836b146e6cc2a585a +patch_filename = catch2_2.13.8-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/catch2_2.13.8-1/get_patch +patch_hash = 3565968970ce11c1d128aa09771512047f5f9c205d2e341abf33d4a985bd0eb5 + +[provide] +catch2 = catch2_dep diff --git a/subprojects/freetype2.wrap b/subprojects/freetype2.wrap new file mode 100644 index 000000000..e3554c9a1 --- /dev/null +++ b/subprojects/freetype2.wrap @@ -0,0 +1,11 @@ +[wrap-file] +directory = freetype-2.13.2 +source_url = https://download.savannah.gnu.org/releases/freetype/freetype-2.13.2.tar.xz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/freetype2_2.13.2-1/freetype-2.13.2.tar.xz +source_filename = freetype-2.13.2.tar.xz +source_hash = 12991c4e55c506dd7f9b765933e62fd2be2e06d421505d7950a132e4f1bb484d +wrapdb_version = 2.13.2-1 + +[provide] +freetype2 = freetype_dep +freetype = freetype_dep diff --git a/subprojects/glew.wrap b/subprojects/glew.wrap new file mode 100644 index 000000000..390dc9a33 --- /dev/null +++ b/subprojects/glew.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = glew-2.2.0 +source_url = http://downloads.sourceforge.net/glew/glew-2.2.0.tgz +source_filename = glew-2.2.0.tgz +source_hash = d4fc82893cfb00109578d0a1a2337fb8ca335b3ceccf97b97e5cc7f08e4353e1 +patch_filename = glew_2.2.0-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/glew_2.2.0-2/get_patch +patch_hash = df7bc80456da53f83e93e89ca5035d04cdff19a836c956887a684b2bee16eb9b +wrapdb_version = 2.2.0-2 + +[provide] +glew = glew_dep diff --git a/subprojects/glm.wrap b/subprojects/glm.wrap new file mode 100644 index 000000000..d75571ec0 --- /dev/null +++ b/subprojects/glm.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = glm-1.0.1 +source_url = https://github.com/g-truc/glm/archive/refs/tags/1.0.1.tar.gz +source_filename = glm-1.0.1.tar.gz +source_hash = 9f3174561fd26904b23f0db5e560971cbf9b3cbda0b280f04d5c379d03bf234c +patch_filename = glm_1.0.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/glm_1.0.1-1/get_patch +patch_hash = 25679275e26bc4c36bb617d1b4a52197039402af828d2a4bf67b3c0260a5df6a +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/glm_1.0.1-1/glm-1.0.1.tar.gz +wrapdb_version = 1.0.1-1 + +[provide] +glm = glm_dep diff --git a/subprojects/libpng.wrap b/subprojects/libpng.wrap new file mode 100644 index 000000000..2c5f9c6a2 --- /dev/null +++ b/subprojects/libpng.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = libpng-1.6.43 +source_url = https://github.com/glennrp/libpng/archive/v1.6.43.tar.gz +source_filename = libpng-1.6.43.tar.gz +source_hash = fecc95b46cf05e8e3fc8a414750e0ba5aad00d89e9fdf175e94ff041caf1a03a +patch_filename = libpng_1.6.43-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.43-2/get_patch +patch_hash = 49951297edf03e81d925ab03726555f09994ad1ed78fb539a269216430eef3da +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libpng_1.6.43-2/libpng-1.6.43.tar.gz +wrapdb_version = 1.6.43-2 + +[provide] +libpng = libpng_dep