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

Initial attenpt to add cmake setup

parent 9d450070
cmake_minimum_required(VERSION 2.8.12)
if(NOT DEFINED CMAKE_MACOSX_RPATH)
set(CMAKE_MACOSX_RPATH 0)
endif()
project(molfile)
# Set source directory
set(SOURCE_DIR "molfile")
# 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
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"
......@@ -91,6 +96,37 @@ largefile_macros = [
]
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(
name = "pymolfile",
author = "Berk Onat",
......@@ -103,34 +139,36 @@ if __name__ == '__main__':
zip_safe = False,
packages = find_packages(),
ext_modules = [
LibpymolfileExtension(cmake_compile
),
NumpyExtension(
"pymolfile/molfile._libpymolfile",
sources = [
"pymolfile/molfile/libpymolfile_wrap.cxx",
"pymolfile/molfile/pymolfile.c",
"pymolfile/molfile/lib/libmolfile_plugin.a",
],
include_dirs = [
get_numpy_include,
"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",
],
define_macros = largefile_macros
),
#libmolfile_plugin_compile(cmake_libmolfile_plugin_compile),
libpymolfile_module,
# NumpyExtension(
# "pymolfile/molfile/_libpymolfile",
# "pymolfile"
# sources = [
# "pymolfile/molfile/libpymolfile_wrap.cxx",
# "pymolfile/molfile/pymolfile.c",
# "pymolfile/molfile/lib/libmolfile_plugin.a",
# ],
# include_dirs = [
# get_numpy_include,
# "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",
# ],
# define_macros = largefile_macros
# ),
],
py_modules=["pymolfile"],
requires = [ "numpy" ],
setup_requires = [ "numpy" ],
install_requires = [ "numpy" ],
extras_require = {
"netcdf": [ "netCDF Library" ],
"tng_io": [ "TNG Library" ],
"expat": [ "Expat XML Library" ]
#?do we need this? "netcdf": [ "netCDF Library" ],
#?and this? "tng_io": [ "TNG Library" ],
#?and this? "expat": [ "Expat XML Library" ]
}
)
......@@ -24,10 +24,14 @@ path="./test/"
#sfname = path + "betaGal.mrc"
#sfname = path + "adrenalin.mol2"
#sfname = path + "adrenalin.sdf"
#sfname = path + "1CRN.cif"
#sfname = path + "esp.dx"
#sfname = path + "md_ascii_trj.gro"
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...")
moltopo = pym.OpenMolfile(sfname, silent=True)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
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