Skip to content

Commit

Permalink
moving project meta and packages search to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
ye11owSub authored and ye11owSub committed May 27, 2024
1 parent fbfda4a commit c803e9a
Show file tree
Hide file tree
Showing 8 changed files with 216 additions and 715 deletions.
31 changes: 0 additions & 31 deletions CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ See also: http://pymolwiki.org/index.php/Linux_Install
REQUIREMENTS

- C++17 compiler (e.g. gcc 8+)
- CMake (3.13+)
- CMake (3.15+)
- Python 3.9+
- Pmw (Python Megawidgets) (optional, for legacy GUI/plugins)
https://github.com/schrodinger/pmw-patched
Expand Down
5 changes: 4 additions & 1 deletion create_shadertext.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@
from os.path import dirname
from subprocess import Popen, PIPE

def create_all(generated_dir, pymoldir="."):
def create_all(pymoldir="."):
'''
Generate various stuff
'''
generated_dir = os.path.join(os.environ.get("PYMOL_BLD", "build"), "generated")
create_shadertext(
os.path.join(pymoldir, "data", "shaders"),
generated_dir,
os.path.join(generated_dir, "ShaderText.h"),
os.path.join(generated_dir, "ShaderText.cpp"))
create_buildinfo(generated_dir, pymoldir)
print(generated_dir)

class openw(object):
"""
Expand Down Expand Up @@ -129,6 +131,7 @@ def create_buildinfo(outputdir, pymoldir='.'):
#define _PYMOL_BUILD_GIT_SHA "%s"
''' % (time.time(), sha), file=out)

create_all()
if __name__ == "__main__":
create_shadertext(*sys.argv[1:6])
create_buildinfo(dirname(sys.argv[4]), dirname(dirname(sys.argv[1])))
114 changes: 114 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
project(
'pymol',
'c', 'cpp',
meson_version: '>= 1.4.0',
default_options: [
'cpp_std=c++14',
],
)

#generated_dir = run_command('./create_shadertext.py', check: true).stdout().strip()

dependencies = [dependency('libpng'), dependency('freetype2')]
include_dirs = ['include']
src_dirs = [
'ov/src/',
'layer0',
'layer1',
'layer2',
'layer3',
'layer4',
'layer5',
]

macros = [
'-D_PYMOL_LIBPNG',
'-D_PYMOL_FREETYPE',
'-D_PYMOL_NUMPY',
]

flags = []
if host_machine.system() == 'windows'
flags += '-WMP'
else
flags += [
'-Werror=return-type',
'-Wunused-variable',
'-Wno-switch',
'-Wno-narrowing',
'-Wno-char-subscripts',
]
endif


if get_option('use-openmp')
openmp_dep = dependency('openmp')
dependencies += openmp_dep
# shouldn't it be _PYMOL_OPENMP?
macros += '-DPYMOL_OPENMP'
endif

if not get_option('no-vmd-plugins')
include_dirs += '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_PYMOL_VMD_PLUGINS'
endif

msg_dep = get_option('use-msgpackc')
if msg_dep != 'guess'
msgpackc_dep = dependency('msgpackc')
dependencies += msgpackc_dep
else
macros += '-D_PYMOL_NO_MSGPACKC'
endif

if not get_option('no-glut')
macros += '-D_PYMOL_NO_MAIN'
endif

if get_option('testing')
src_dirs += 'layerCTest'
macros += '-D_PYMOL_CTEST'
endif

if get_option('openvr')
dependencies += dependency('openvr')
macros += '-D_PYMOL_OPENVR'
endif

# macos
if host_machine.system() == 'darwin'
dependencies += [dependency('GLEW'), dependency('glut')]
# shouldn't it be _PYMOL_CURVE_VALIDATE?
macros += '-DPYMOL_CURVE_VALIDATE'

endif

pymol_cpp_args = macros + flags

py = import('python').find_installation(pure: false)
py.extension_module(
'pymol._cmd',
src_dirs,
include_directories : include_dirs,
cpp_args: pymol_cpp_args,
dependencies: dependencies,
install: true,
)

py.extension_module(
'chempy.champ._champ',
'contrib/champ',
install: true,
)

py3.install_sources(
'modules/',
)

64 changes: 64 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -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)'
)

10 changes: 0 additions & 10 deletions modules/pymol/__main__.py

This file was deleted.

33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[project]
name = "pymol"
readme = "README.md"
requires-python = ">=3.9"
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!
"""
dynamic=["version"]
authors = [
{name = "Schrodinger", email = "[email protected]"},
]

[build-system]
requires = ["meson-python>=0.15.0"]
build-backend = "mesonpy"

[project.scripts]
pymol = "modules.pymol:launch"

[project.gui-scripts]
pymol-gui = "modules.pymol:launch_gui"

[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"

Loading

0 comments on commit c803e9a

Please sign in to comment.