Commit a402cf17 authored by peastman's avatar peastman
Browse files

Python records where OpenMM is installed, so it doesn't need to be specified...

Python records where OpenMM is installed, so it doesn't need to be specified with environment variables at runtime
parent 622cae17
...@@ -111,6 +111,11 @@ IF (APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET) ...@@ -111,6 +111,11 @@ IF (APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
SET (CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "The minimum version of OS X to support" FORCE) SET (CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "The minimum version of OS X to support" FORCE)
ENDIF (APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET) ENDIF (APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
# Improve the linking behavior of Mac libraries
IF (APPLE)
SET (CMAKE_INSTALL_NAME_DIR "@rpath")
ENDIF (APPLE)
IF(UNIX AND NOT CMAKE_BUILD_TYPE) IF(UNIX AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Debug or Release build" FORCE) SET(CMAKE_BUILD_TYPE Release CACHE STRING "Debug or Release build" FORCE)
ENDIF (UNIX AND NOT CMAKE_BUILD_TYPE) ENDIF (UNIX AND NOT CMAKE_BUILD_TYPE)
......
...@@ -85,6 +85,7 @@ version = '%(version)s' ...@@ -85,6 +85,7 @@ version = '%(version)s'
full_version = '%(full_version)s' full_version = '%(full_version)s'
git_revision = '%(git_revision)s' git_revision = '%(git_revision)s'
release = %(isrelease)s release = %(isrelease)s
openmm_library_path = '%(path)s'
if not release: if not release:
version = full_version version = full_version
...@@ -113,7 +114,8 @@ if not release: ...@@ -113,7 +114,8 @@ if not release:
a.write(cnt % {'version': version, a.write(cnt % {'version': version,
'full_version' : full_version, 'full_version' : full_version,
'git_revision' : git_revision, 'git_revision' : git_revision,
'isrelease': str(IS_RELEASED)}) 'isrelease': str(IS_RELEASED),
'path': os.getenv('OPENMM_LIB_PATH')})
finally: finally:
a.close() a.close()
...@@ -197,7 +199,7 @@ def buildKeywordDictionary(major_version_num=MAJOR_VERSION_NUM, ...@@ -197,7 +199,7 @@ def buildKeywordDictionary(major_version_num=MAJOR_VERSION_NUM,
macVersion = [int(x) for x in platform.mac_ver()[0].split('.')] macVersion = [int(x) for x in platform.mac_ver()[0].split('.')]
if tuple(macVersion) < (10, 6): if tuple(macVersion) < (10, 6):
os.environ['MACOSX_DEPLOYMENT_TARGET']='10.5' os.environ['MACOSX_DEPLOYMENT_TARGET']='10.5'
extra_link_args.append('-Wl,-rpath,@loader_path/OpenMM') extra_link_args.append('-Wl,-rpath,'+openmm_lib_path)
library_dirs=[openmm_lib_path] library_dirs=[openmm_lib_path]
...@@ -209,6 +211,7 @@ def buildKeywordDictionary(major_version_num=MAJOR_VERSION_NUM, ...@@ -209,6 +211,7 @@ def buildKeywordDictionary(major_version_num=MAJOR_VERSION_NUM,
include_dirs = include_dirs, include_dirs = include_dirs,
define_macros = define_macros, define_macros = define_macros,
library_dirs = library_dirs, library_dirs = library_dirs,
runtime_library_dirs = library_dirs,
libraries = libraries, libraries = libraries,
extra_compile_args=extra_compile_args, extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args, extra_link_args=extra_link_args,
...@@ -238,8 +241,8 @@ def main(): ...@@ -238,8 +241,8 @@ def main():
uninstall() uninstall()
except: except:
pass pass
writeVersionPy()
setupKeywords=buildKeywordDictionary() setupKeywords=buildKeywordDictionary()
writeVersionPy()
setup(**setupKeywords) setup(**setupKeywords)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -13,7 +13,7 @@ It also tries to load any plugin modules it can find. ...@@ -13,7 +13,7 @@ It also tries to load any plugin modules it can find.
__author__ = "Randall J. Radmer" __author__ = "Randall J. Radmer"
import os, sys, glob import os, sys, glob, os.path
if sys.platform == "win32": if sys.platform == "win32":
libPrefix="" libPrefix=""
libExt="dll" libExt="dll"
...@@ -34,5 +34,9 @@ else: ...@@ -34,5 +34,9 @@ else:
from simtk.openmm.openmm import * from simtk.openmm.openmm import *
from simtk.openmm.vec3 import Vec3 from simtk.openmm.vec3 import Vec3
pluginLoadedLibNames = Platform.loadPluginsFromDirectory(Platform.getDefaultPluginsDirectory()) from simtk.openmm import version
if os.getenv('OPENMM_PLUGIN_DIR') is None:
pluginLoadedLibNames = Platform.loadPluginsFromDirectory(os.path.join(version.openmm_library_path, 'plugins'))
else:
pluginLoadedLibNames = Platform.loadPluginsFromDirectory(Platform.getDefaultPluginsDirectory())
__version__ = Platform.getOpenMMVersion() __version__ = Platform.getOpenMMVersion()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment