Commit f9d511cf authored by Ralf Mueller's avatar Ralf Mueller 🎣
Browse files

rename rb/py class/module to Cdi

parent 0f7fb911
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
# #
SWIGCDILIB = cdilib.i SWIG_FILE = $(abs_top_srcdir)/interfaces/cdi.i
SWIGCDIOBJ = cdiobj.i BINDINGS =
BINDINGS =
INTERFACES_FILES = \
$(abs_top_srcdir)/interfaces/ruby/test.rb \
$(abs_top_srcdir)/interfaces/ruby/setup.rb \
$(abs_top_srcdir)/interfaces/python/test.py \
$(abs_top_srcdir)/interfaces/python/setup.py \
$(abs_top_srcdir)/interfaces/python/table.py \
$(abs_top_srcdir)/interfaces/python/Cdi.py \
$(abs_top_srcdir)/interfaces/CdiInfo.cpp \
$(abs_top_srcdir)/interfaces/f2003/bindGen.rb
EXTRA_DIST = $(SWIG_FILE) $(INTERFACES_FILES)
MODULE_NAME = Cdi
RUBY_WRAPPER_FILE = $(abs_top_builddir)/interfaces/ruby/cdi_wrapper.cpp
RUBY_SHARED_LIB = $(abs_top_builddir)/interfaces/ruby/$(MODULE_NAME).so
RUBY_MAKEFILE = $(abs_top_builddir)/interfaces/ruby/Makefile
PYTHON_WRAPPER_FILE = $(abs_top_builddir)/interfaces/python/cdi_wrapper.cpp
PYTHON_SHARED_LIB = $(abs_top_builddir)/interfaces/python/$(MODULE_NAME).so
PYTHON_MAKEFILE = $(abs_top_builddir)/interfaces/python/Makefile
INTERFACES_FILES = ruby/cdilib_wrap.c ruby/cdiobj_wrap.cpp ruby/testLib.rb \
ruby/testObj.rb \
\
python/cdilib_wrap.c python/cdiobj_wrap.cpp python/testLib.py \
python/testObj.py python/setupObj.py python/setupLib.py \
python/setup.py python/table.py python/CdiLib.py \
python/CdiObj.py \
\
CdiInfo.cpp \
\
f2003/bindGen.rb
EXTRA_DIST = $(SWIGCDIOBJ) $(SWIGCDILIB) $(INTERFACES_FILES)
if CREATE_INTERFACES
BINDINGS += help
endif
# #
bin_PROGRAMS = bin_PROGRAMS =
noinst_PROGRAMS = noinst_PROGRAMS =
...@@ -42,88 +44,50 @@ CdiInfo_LDFLAGS = @NETCDF_LIBS@ @SZLIB_LIBS@ $(LDFLAGS) ...@@ -42,88 +44,50 @@ CdiInfo_LDFLAGS = @NETCDF_LIBS@ @SZLIB_LIBS@ $(LDFLAGS)
# #
# #
if ENABLE_RUBY if ENABLE_RUBY
BINDINGS += rubyObj BINDINGS += ruby-binding
# Ruby ==================================================== # Ruby ====================================================
rubyLibMakefile: $(RUBY_WRAPPER_FILE): $(SWIG_FILE)
cd ruby; CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="$(locallibs) $(LDFLAGS)" INCFLAGS="-I../../src" ruby extconfLib.rb mkdir -p $(dir $@)
$(SWIG) -ruby -c++ -globalmodule -debug-classes -o $@ $(AM_CPPFLAGS) $<
rubyLibWrapper: cdilib.i
if ENABLE_SWIG
$(SWIG) -ruby -module CdiLib -o ruby/cdilib_wrap.c $(AM_CPPFLAGS) cdilib.i
endif
rubyLib: rubyLibWrapper rubyLibMakefile
@cd ruby; make
rubyLibTest: rubyLib $(RUBY_MAKEFILE): $(abs_top_srcdir)/interfaces/ruby/setup.rb
@cd ruby; ruby testLib.rb mkdir -p $(dir $@)
# ========================================================= cd ruby && CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="$(LDFLAGS)" INCFLAGS="-I$(abs_top_srcdir)/interfaces" ruby $<
rubyObjMakefile:
cd ruby; CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="$(LDFLAGS)" INCFLAGS="-I../" ruby extconfObj.rb
rubyObjWrapper: cdiobj.i $(RUBY_SHARED_LIB): $(RUBY_WRAPPER_FILE) $(RUBY_MAKEFILE)
if ENABLE_SWIG cd ruby && make
$(SWIG) -ruby -c++ -module CdiObj -o ruby/cdiobj_wrap.cpp $(AM_CPPFLAGS) cdiobj.i
endif
rubyObj: rubyObjWrapper rubyObjMakefile ruby-binding: $(RUBY_SHARED_LIB)
@cd ruby; make
rubyObjTest: rubyObj rubyTest: $(RUBY_SHARED_LIB)
@cd ruby; ruby testObj.rb cd ruby && ruby $(abs_top_srcdir)/interfaces/ruby/test.rb
rubyObjInstall: rubyObj install-ruby: $(RUBY_SHARED_LIB)
@cd ruby; make install cd ruby && make install
endif endif
# ========================================================= # =========================================================
if ENABLE_PYTHON if ENABLE_PYTHON
BINDINGS += pythonObj BINDINGS += python-binding
# Python ================================================== # Python ==================================================
pythonLibWrapper: cdilib.i $(PYTHON_WRAPPER_FILE): $(SWIG_FILE)
if ENABLE_SWIG mkdir -p $(dir $@)
$(SWIG) -python -module CdiLib -o python/cdilib_wrap.c $(AM_CPPFLAGS) cdilib.i $(SWIG) -python -c++ -debug-classes -o $(PYTHON_WRAPPER_FILE) $(AM_CPPFLAGS) $<
endif
pythonLib: pythonLibWrapper $(PYTHON_SHARED_LIB): $(PYTHON_WRAPPER_FILE) $(abs_top_srcdir)/interfaces/python/setup.py
@cd python; CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="$(LDFLAGS)" INCFLAGS="-I../../src" python setupLib.py build_ext --inplace mkdir -p $(dir $@)
cd python; CC="$(CC)" CXX="$(CXX)" BUILDLIBDIR="$(top_builddir)/src/.libs" LIBDIR=$(libdir) CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="-L../../src/.libs $(LDFLAGS)" INCFLAGS="-I$(abs_top_srcdir)/interfaces" python $(abs_top_srcdir)/interfaces/python/setup.py build_ext --inplace
pythonLibTest: pythonLib python-binding: $(PYTHON_SHARED_LIB)
@cd python; python testLib.py
# =========================================================
python/cdiobj_wrap.cpp: cdiobj.i
if ENABLE_SWIG
$(SWIG) -python -c++ -module CdiObj -o python/cdiobj_wrap.cpp $(AM_CPPFLAGS) cdiobj.i
endif
pythonObj: python/cdiobj_wrap.cpp
cd python; CC="$(CC)" CXX="$(CXX)" BUILDLIBDIR="$(top_builddir)/src/.libs" LIBDIR=$(libdir) CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="-L../../src/.libs $(LDFLAGS)" INCFLAGS="-I../" python setupObj.py build_ext --inplace
pythonObjTest: pythonObj pythonTest: $(abs_top_srcdir)/interfaces/python/test.py
@cd python; python testObj.py @cd python; python $<
pythonObjInstall: pythonObj install-python: $(PYTHON_SHARED_LIB)
cd python; CC="$(CC)" CXX="$(CXX)" BUILDLIBDIR="$(top_builddir)/src/.libs" LIBDIR=$(libdir) CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="-L../../src/.libs $(LDFLAGS)" INCFLAGS="-I../" python setupObj.py install --prefix=$(prefix) cd python; CC="$(CC)" CXX="$(CXX)" BUILDLIBDIR="$(top_builddir)/src/.libs" LIBDIR=$(libdir) CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="-L../../src/.libs $(LDFLAGS)" INCFLAGS="-I$(abs_top_srcdir)/interfaces" python setup.py install --prefix=$(prefix)
endif endif
# =========================================================
help:
@echo "#=====================================================#"
@echo "# EXPERIMENTAL FEATURE ===============================#"
@echo "#=====================================================#"
@echo "Bindings for: python ruby"
@echo "(please exchange <lang> with the corresponding language)"
@echo "#=====================================================#"
@echo " help - this message"
@echo " <lang>Obj - create object interface for Ruby"
@echo " <lang>Lib - create function interface for Ruby"
@echo " <lang>ObjWrapper - create the wrapper files using swig (object interface)"
@echo " <lang>LibWrapper - create the wrapper files using swig (function interface)"
@echo " <lang>ObjTest - run object interface test (./<lang>/testObj.rb). Accepts input file argument."
@echo " <lang>LibTest - run function library test (./<lang>/testLib.rb). Accepts input file argument."
@echo " <lang>ObjInstall - install shared libraries and optional language files for <lang>"
@echo " <lang>LibInstall - see <lang>ObjInstall"
# #
AM_CPPFLAGS = -I$(top_srcdir)/src AM_CPPFLAGS = -I$(top_srcdir)/src
# #
#all-local: $(BINDINGS) all-local: $(BINDINGS)
# #
CLEANFILES = `ls *~` CLEANFILES = `ls *~ *.o *.so */*.o */*.so`
%module CdiObj %module Cdi
%{ %{
#define SWIG_FILE_WITH_INIT #define SWIG_FILE_WITH_INIT
#include "cdi.hpp" #include "cdi.hpp"
......
#!/usr/bin/env python
import os, string import os, string
INCFLAGS = [] INCFLAGS = []
...@@ -15,3 +16,26 @@ if 'LDFLAGS' in os.environ: ...@@ -15,3 +16,26 @@ if 'LDFLAGS' in os.environ:
if 'LIBS' in os.environ: if 'LIBS' in os.environ:
LIBS = os.environ['LIBS'].split() LIBS = os.environ['LIBS'].split()
from distutils.core import setup, Extension
from setup import *
cdiobj_module = Extension('_Cdi',
sources=['cdi_wrapper.cpp'],
extra_compile_args = INCFLAGS,
library_dirs = LDFLAGS,
extra_objects = ['../cdi.o'],
runtime_library_dirs = [os.environ['BUILDLIBDIR'],os.environ['LIBDIR']],
extra_link_args = LIBS,
libraries = ['cdi','stdc++'],
language = 'c++',
)
setup (name = 'Cdi',
version = '0.1',
author = "Ralf Mueller",
description = """pyhton bindings to CDI class library""",
ext_modules = [cdiobj_module],
py_modules = ["Cdi"],
)
$INCFLAGS = "#{ENV['INCFLAGS']} #{$INCFLAGS}"
$CFLAGS = "#{ENV['CFLAGS']} #{$CFLAGS}"
$LDFLAGS = "#{ENV['LDFLAGS']} #{$LDFLAGS}"
$LIBS = "#{ENV['LIBS']} #{$LIBS}"
require 'mkmf' require 'mkmf'
load "extconf.rb"
$INCFLAGS = "#{ENV['INCFLAGS']} #{$INCFLAGS}"
$CFLAGS = "#{ENV['CFLAGS']} #{$CFLAGS}"
$LDFLAGS = "#{ENV['LDFLAGS']} #{$LDFLAGS}"
$LIBS = "#{ENV['LIBS']} #{$LIBS}"
$libs = append_library($libs, "stdc++") $libs = append_library($libs, "stdc++")
$LDFLAGS += " ../.libs/libcdipp.a ../../src/.libs/libcdi.a" $LDFLAGS += " ../.libs/libcdipp.a ../../src/.libs/libcdi.a"
$srcs = %w[cdiobj_wrap.cpp] $srcs = %w[cdi_wrapper.cpp]
$objs = %w[cdiobj_wrap.o] $objs = %w[cdi_wrapper.o]
create_makefile('CdiObj') create_makefile('Cdi')
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