Merge branch 'feature/python-builtin-separate-runtime-data'
* feature/python-builtin-separate-runtime-data: Rework swig_and_compile_multi_cpp makefile helper Different capsule names for builtin changes entry Use different capsule names with and without -builtin Conflicts: CHANGES.current
This commit is contained in:
commit
d1b93f2c0e
10 changed files with 72 additions and 8 deletions
|
|
@ -831,6 +831,13 @@ endif
|
|||
partialcheck:
|
||||
$(MAKE) check CC=true CXX=true LDSHARED=true CXXSHARED=true RUNTOOL=true COMPILETOOL=true
|
||||
|
||||
swig_and_compile_cpp_helper = \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT=$(2) NOLINK=true \
|
||||
TARGET="$(TARGETPREFIX)$(1)$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$(1).i" \
|
||||
$(LANGUAGE)$(VARIANT)_cpp
|
||||
|
||||
swig_and_compile_cpp = \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
|
|
@ -847,11 +854,7 @@ swig_and_compile_c = \
|
|||
|
||||
swig_and_compile_multi_cpp = \
|
||||
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
|
||||
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
|
||||
$(LANGUAGE)$(VARIANT)_cpp; \
|
||||
$(call swig_and_compile_cpp_helper,$${f},'$(SWIGOPT)'); \
|
||||
done
|
||||
|
||||
swig_and_compile_external = \
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@ C_TEST_CASES += \
|
|||
python_nondynamic \
|
||||
python_varargs_typemap \
|
||||
|
||||
MULTI_CPP_TEST_CASES += \
|
||||
python_runtime_data \
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Overridden variables here
|
||||
|
|
@ -102,6 +105,13 @@ VALGRIND_OPT += --suppressions=pythonswig.supp
|
|||
# Custom tests - tests with additional commandline options
|
||||
python_flatstaticmethod.cpptest: SWIGOPT += -flatstaticmethod
|
||||
|
||||
# Make sure just python_runtime_data_builtin.i uses the -builtin option. Note: does not use python_runtime_data.list for all steps.
|
||||
python_runtime_data.multicpptest: override SWIG_FEATURES := $(filter-out -builtin,$(SWIG_FEATURES))
|
||||
python_runtime_data.multicpptest: override SWIGOPT := $(filter-out -builtin,$(SWIGOPT))
|
||||
python_runtime_data.multicpptest: swig_and_compile_multi_cpp = \
|
||||
$(call swig_and_compile_cpp_helper,python_runtime_data_builtin,'$(SWIGOPT) -builtin') && \
|
||||
$(call swig_and_compile_cpp_helper,python_runtime_data_nobuiltin,'$(SWIGOPT)')
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
|
|
@ -149,7 +159,7 @@ clean:
|
|||
rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
|
||||
rm -f imports_a.py imports_b.py mod_a.py mod_b.py multi_import_a.py
|
||||
rm -f multi_import_b.py multi_import_d.py packageoption_a.py packageoption_b.py packageoption_c.py
|
||||
rm -f template_typedef_cplx2.py
|
||||
rm -f template_typedef_cplx2.py python_runtime_data_builtin.py python_runtime_data_nobuiltin.py
|
||||
|
||||
hugemod_runme = hugemod$(SCRIPTPREFIX)
|
||||
|
||||
|
|
|
|||
15
Examples/test-suite/python/python_runtime_data_runme.py
Normal file
15
Examples/test-suite/python/python_runtime_data_runme.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import python_runtime_data_builtin as builtin
|
||||
import python_runtime_data_nobuiltin as nobuiltin
|
||||
|
||||
def swig_assert(a):
|
||||
if not a:
|
||||
raise RuntimeError("Failed")
|
||||
|
||||
swig_assert(builtin.is_python_builtin())
|
||||
swig_assert(not nobuiltin.is_python_builtin())
|
||||
|
||||
for i in range(1, 5):
|
||||
v1 = builtin.vectord([1.] * i)
|
||||
swig_assert(len(v1) == i)
|
||||
v2 = nobuiltin.vectord([1.] * i)
|
||||
swig_assert(len(v2) == i)
|
||||
2
Examples/test-suite/python_runtime_data.list
Normal file
2
Examples/test-suite/python_runtime_data.list
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
python_runtime_data_builtin
|
||||
python_runtime_data_nobuiltin
|
||||
15
Examples/test-suite/python_runtime_data_builtin.i
Normal file
15
Examples/test-suite/python_runtime_data_builtin.i
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Test swig_runtime_data with and without -builtin
|
||||
|
||||
%module python_runtime_data_builtin
|
||||
|
||||
%inline %{
|
||||
#ifdef SWIGPYTHON_BUILTIN
|
||||
bool is_python_builtin() { return true; }
|
||||
#else
|
||||
bool is_python_builtin() { return false; }
|
||||
#endif
|
||||
%}
|
||||
|
||||
%include std_vector.i
|
||||
|
||||
%template(vectord) std::vector<double>;
|
||||
3
Examples/test-suite/python_runtime_data_nobuiltin.i
Normal file
3
Examples/test-suite/python_runtime_data_nobuiltin.i
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
%module python_runtime_data_nobuiltin
|
||||
|
||||
%include "python_runtime_data_builtin.i"
|
||||
Loading…
Add table
Add a link
Reference in a new issue