Commit 291525d0 authored by Berk Onat's avatar Berk Onat
Browse files

Initial attenpt to add cmake setup

parent 9d450070
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 2.8.12)
if(NOT DEFINED CMAKE_MACOSX_RPATH)
set(CMAKE_MACOSX_RPATH 0)
endif()
project(molfile) project(molfile)
# Set source directory # Set source directory
set(SOURCE_DIR "molfile") set(SOURCE_DIR "molfile")
# Tell CMake that headers are also in SOURCE_DIR # Tell CMake that headers are also in SOURCE_DIR
include_directories(${SOURCE_DIR}, "./vmd_molfile_plugin/molfile_plugin/include", "./vmd_molfile_plugin/molfile_plugin/lib") include_directories(${SOURCE_DIR} "${SOURCE_DIR}/vmd_molfile_plugin/molfile_plugin/include" "${SOURCE_DIR}/vmd_molfile_plugin/molfile_plugin/lib")
set(SOURCES "${SOURCE_DIR}/libpymolfile_wrap.cxx", "${SOURCE_DIR}/pymolfile.c") set(SOURCES "${SOURCE_DIR}/libpymolfile_wrap.cxx" "${SOURCE_DIR}/pymolfile.c" "${SOURCE_DIR}/lib/libmolfile_plugin.a")
find_package (EXPAT)
find_package (NetCDF)
# Set source directory
set(SOURCE_DIR "molfile")
# Tell CMake that headers are also in SOURCE_DIR
include_directories(${SOURCE_DIR} "${SOURCE_DIR}/vmd_molfile_plugin/molfile_plugin/include" "${SOURCE_DIR}/vmd_molfile_plugin/molfile_plugin/lib")
set(SOURCES "${SOURCE_DIR}/libpymolfile_wrap.cxx" "${SOURCE_DIR}/pymolfile.c" "${SOURCE_DIR}/lib/libmolfile_plugin.a")
#!/usr/bin/env python #!/usr/bin/env python
import sys import sys
from setuptools import setup, Extension, find_packages try:
from setuptools.command.build_ext import build_ext
from setuptools import setup, Extension, Command, find_packages
except:
from distutils.command.build_ext import build_ext
from distutils import setup, Extension, Command, find_packages
VERSION = "0.0.1" VERSION = "0.0.1"
...@@ -91,6 +96,37 @@ largefile_macros = [ ...@@ -91,6 +96,37 @@ largefile_macros = [
] ]
if __name__ == '__main__': if __name__ == '__main__':
libpymolfile_module = Extension(
'pymolfile/molfile/_libpymolfile',
sources=[
'pymolfile/molfile/libpymolfile.i' ,
'pymolfile/molfile/pymolfile.c'
],
swig_opts=['-py3 -c++ -python'],
library_dirs=[
'/usr/lib',
'lib/'
],
libraries=['libmolfile_plugin.a'],
include_dirs = [
get_numpy_include,
'/usr/include',
'pymolfile/molfile',
'pymolfile/molfile/lib/'
'pymolfile/molfile/include/',
'pymolfile/molfile/include/molfile_plugin/include',
'pymolfile/molfile/lib/molfile_plugin/lib',
'pymolfile/molfile/include/plugin_src/include',
'pymolfile/molfile/include/netcdf/include',
'pymolfile/molfile/include/expat/include',
'pymolfile/molfile/include/tng/include',
],
extra_compile_args = [
'-DNDEBUG', '-DUNIX', '-D__UNIX', '-m64',
'-fPIC', '-O2', '-w', '-fmessage-length=0'
]
)
setup( setup(
name = "pymolfile", name = "pymolfile",
author = "Berk Onat", author = "Berk Onat",
...@@ -103,34 +139,36 @@ if __name__ == '__main__': ...@@ -103,34 +139,36 @@ if __name__ == '__main__':
zip_safe = False, zip_safe = False,
packages = find_packages(), packages = find_packages(),
ext_modules = [ ext_modules = [
LibpymolfileExtension(cmake_compile #libmolfile_plugin_compile(cmake_libmolfile_plugin_compile),
), libpymolfile_module,
NumpyExtension( # NumpyExtension(
"pymolfile/molfile._libpymolfile", # "pymolfile/molfile/_libpymolfile",
sources = [ # "pymolfile"
"pymolfile/molfile/libpymolfile_wrap.cxx", # sources = [
"pymolfile/molfile/pymolfile.c", # "pymolfile/molfile/libpymolfile_wrap.cxx",
"pymolfile/molfile/lib/libmolfile_plugin.a", # "pymolfile/molfile/pymolfile.c",
], # "pymolfile/molfile/lib/libmolfile_plugin.a",
include_dirs = [ # ],
get_numpy_include, # include_dirs = [
"pymolfile/molfile/include/", # get_numpy_include,
"pymolfile/molfile/include/molfile_plugin/include", # "pymolfile/molfile/include/",
"pymolfile/molfile/lib/molfile_plugin/lib", # "pymolfile/molfile/include/molfile_plugin/include",
"pymolfile/molfile/include/plugin_src/include", # "pymolfile/molfile/lib/molfile_plugin/lib",
"pymolfile/molfile/include/netcdf/include", # "pymolfile/molfile/include/plugin_src/include",
"pymolfile/molfile/include/expat/include", # "pymolfile/molfile/include/netcdf/include",
"pymolfile/molfile/include/tng/include", # "pymolfile/molfile/include/expat/include",
], # "pymolfile/molfile/include/tng/include",
define_macros = largefile_macros # ],
), # define_macros = largefile_macros
# ),
], ],
py_modules=["pymolfile"],
requires = [ "numpy" ], requires = [ "numpy" ],
setup_requires = [ "numpy" ], setup_requires = [ "numpy" ],
install_requires = [ "numpy" ], install_requires = [ "numpy" ],
extras_require = { extras_require = {
"netcdf": [ "netCDF Library" ], #?do we need this? "netcdf": [ "netCDF Library" ],
"tng_io": [ "TNG Library" ], #?and this? "tng_io": [ "TNG Library" ],
"expat": [ "Expat XML Library" ] #?and this? "expat": [ "Expat XML Library" ]
} }
) )
...@@ -24,10 +24,14 @@ path="./test/" ...@@ -24,10 +24,14 @@ path="./test/"
#sfname = path + "betaGal.mrc" #sfname = path + "betaGal.mrc"
#sfname = path + "adrenalin.mol2" #sfname = path + "adrenalin.mol2"
#sfname = path + "adrenalin.sdf" #sfname = path + "adrenalin.sdf"
#sfname = path + "1CRN.cif"
#sfname = path + "esp.dx" #sfname = path + "esp.dx"
#sfname = path + "md_ascii_trj.gro" #sfname = path + "md_ascii_trj.gro"
sfname = path + "md_ascii_trj.pdb" sfname = path + "md_ascii_trj.pdb"
#sfname = path + "3pqr.pqr"
#cfname = path + "3pqr_validation.xml"
#sfname = path + "3pqr-pot.dxbin"
#sfname = path + "3pqr.cns"
#sfname = path + "1cnr.ply"
print("Reading file...") print("Reading file...")
moltopo = pym.OpenMolfile(sfname, silent=True) moltopo = pym.OpenMolfile(sfname, silent=True)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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