From 95f5c117035f1e7434cea9128d39dab9e4196365 Mon Sep 17 00:00:00 2001 From: Savio Sena Date: Wed, 7 May 2014 23:40:43 +0200 Subject: [PATCH] eolian_cxx: fix install-examples and (post-install) compilation. Summary: This patch fixes T1226 by adding a Makefile.examples to examples/eolian_cxx. It also fixes a bug in bin/eolian_cxx: the include paths were not being correctly generated for directories outside EFL tree. Reviewers: cedric, smohanty, stefan_schmidt, stefan CC: uartie, wayland-efl, felipealmeida, raster, woohyun, cedric Maniphest Tasks: T1226 Differential Revision: https://phab.enlightenment.org/D824 Signed-off-by: Cedric Bail --- configure.ac | 4 +- src/bin/eolian_cxx/eolian_cxx.cc | 7 +++- src/examples/eolian_cxx/Makefile.am | 27 +++++++------ src/examples/eolian_cxx/Makefile.examples | 47 +++++++++++++++++++++++ 4 files changed, 69 insertions(+), 16 deletions(-) create mode 100644 src/examples/eolian_cxx/Makefile.examples diff --git a/configure.ac b/configure.ac index 9dc0a052b3..061b5ca7a3 100644 --- a/configure.ac +++ b/configure.ac @@ -1121,8 +1121,8 @@ EFL_LIB_START([Eolian_Cxx]) ## Compatibility layers ### Checks for libraries -EFL_INTERNAL_DEPEND_PKG([EOLIAN], [eina]) -EFL_INTERNAL_DEPEND_PKG([EOLIAN], [eo]) +EFL_INTERNAL_DEPEND_PKG([EOLIAN_CXX], [eina]) +EFL_INTERNAL_DEPEND_PKG([EOLIAN_CXX], [eo]) ### Checks for header files diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_cxx.cc index 2ec77fbbaa..8cc5e53580 100644 --- a/src/bin/eolian_cxx/eolian_cxx.cc +++ b/src/bin/eolian_cxx/eolian_cxx.cc @@ -133,9 +133,12 @@ _resolve_includes(std::string const& classname) std::string filename, namespace_; std::tie(filename, namespace_) = get_filename_info(eo_parent_file); // we have our own eo_base.hh - if (filename != "eo_base.eo" || namespace_ != "eo") + std::string eo_base_eo = "eo_base.eo"; + if (filename.length() < eo_base_eo.length() || + !std::equal(eo_base_eo.begin(), eo_base_eo.end(), + filename.end() - eo_base_eo.length())) { - gen_opts.cxx_headers.push_back(filename + ".hh"); + gen_opts.cxx_headers.push_back(filename + ".hh"); } } else diff --git a/src/examples/eolian_cxx/Makefile.am b/src/examples/eolian_cxx/Makefile.am index 44059fe11a..8127e657c0 100644 --- a/src/examples/eolian_cxx/Makefile.am +++ b/src/examples/eolian_cxx/Makefile.am @@ -4,7 +4,8 @@ AUTOMAKE_OPTIONS = subdir-objects MAINTAINERCLEANFILES = Makefile.in AM_CXXFLAGS = \ - -I. \ + -I$(srcdir) \ + -I$(builddir) \ -I$(top_builddir)/src/lib/efl \ -I$(top_srcdir)/src/lib/eina \ -I$(top_builddir)/src/lib/eina \ @@ -34,7 +35,7 @@ AM_LDFLAGS = \ -L$(top_builddir)/src/lib/evas \ -L$(top_builddir)/src/lib/ecore \ -L$(top_builddir)/src/lib/ecore_evas \ - -leina -levas -leo -lecore -lecore_evas + -leina -levas -leo -lecore -lecore_evas -pthread LDADD = \ $(top_builddir)/src/lib/eo/libeo.la \ @@ -54,25 +55,27 @@ EOS = \ colourable.eo \ colourablesquare.eo +IMPL = \ + colourable.c \ + colourablesquare.c + SRCS = \ eolian_cxx_simple_01.cc \ - eolian_cxx_inherit_01.cc + eolian_cxx_inherit_01.cc \ + $(IMPL) EXTRA_PROGRAMS = \ eolian_cxx_simple_01 \ eolian_cxx_inherit_01 +DATA_FILES = Makefile.examples $(EOS) CLEANFILES = -eolian_cxx_simple_01_SOURCES = \ - eolian_cxx_simple_01.cc \ - colourable.c \ - colourablesquare.c +eolian_cxx_simple_01_SOURCES = eolian_cxx_simple_01.cc $(IMPL) +eolian_cxx_simple_01_DEPENDENCIES = $(GENERATED) -eolian_cxx_inherit_01_SOURCES = \ - eolian_cxx_inherit_01.cc \ - colourable.c \ - colourablesquare.c +eolian_cxx_inherit_01_SOURCES = eolian_cxx_inherit_01.cc $(IMPL) +eolian_cxx_inherit_01_DEPENDENCIES = $(GENERATED) EOLIAN_GEN = $(top_builddir)/src/bin/eolian/eolian_gen${EXEEXT} EOLIAN_CXX = $(top_builddir)/src/bin/eolian_cxx/eolian_cxx${EXEEXT} @@ -86,7 +89,7 @@ EOLIAN_FLAGS = \ SUFFIXES = .eo .eo.c .eo.h .eo.hh %.eo.hh: %.eo $(EOLIAN_CXX) - $(AM_V_EOLCXX)$(EOLIAN_CXX) $(EOLIAN_FLAGS) -I$< -o $@ + $(AM_V_EOLCXX)$(EOLIAN_CXX) $(EOLIAN_FLAGS) -I./$< -o $@ %.eo.c: %.eo $(EOLIAN_GEN) $(AM_V_EOL)$(EOLIAN_GEN) --eo --legacy $(EOLIAN_FLAGS) --gc -o $@ $< diff --git a/src/examples/eolian_cxx/Makefile.examples b/src/examples/eolian_cxx/Makefile.examples new file mode 100644 index 0000000000..7577932797 --- /dev/null +++ b/src/examples/eolian_cxx/Makefile.examples @@ -0,0 +1,47 @@ + +CXX=g++ +CC=gcc +EOLIAN_GEN=eolian_gen +EOLIAN_CXX=eolian_cxx +COMMON_FLAGS=`pkg-config --libs --cflags eina,ecore,evas,ecore-evas,emotion,eolian,eolian-cxx,eo-cxx,eina-cxx` -DEFL_BETA_API_SUPPORT +EOLIAN_FLAGS=`pkg-config --variable=eolian_flags eo` -I. + +EOS = colourable.eo colourablesquare.eo + +IMPL = colourable.c colourablesquare.c + +GENERATED = \ + colourable.eo.c \ + colourable.eo.h \ + colourable.eo.hh \ + colourablesquare.eo.c \ + colourablesquare.eo.h \ + colourablesquare.eo.hh + +EXAMPLES= eolian_cxx_inherit_01 \ + eolian_cxx_simple_01 + +OBJS = colourable.o colourablesquare.o + +all: $(OBJS) examples + +codegen: + $(EOLIAN_CXX) $(EOLIAN_FLAGS) -I./colourable.eo -o colourable.eo.hh + $(EOLIAN_CXX) $(EOLIAN_FLAGS) -I./colourablesquare.eo -o colourablesquare.eo.hh + $(EOLIAN_GEN) --eo --legacy $(EOLIAN_FLAGS) --gc -o colourable.eo.c colourable.eo + $(EOLIAN_GEN) --eo --legacy $(EOLIAN_FLAGS) --gc -o colourablesquare.eo.c colourablesquare.eo + $(EOLIAN_GEN) --eo $(EOLIAN_FLAGS) --gh -o colourable.eo.h colourable.eo + $(EOLIAN_GEN) --eo $(EOLIAN_FLAGS) --gh -o colourablesquare.eo.h colourablesquare.eo + +$(OBJS): codegen + $(CC) -c colourable.c $(COMMON_FLAGS) + $(CC) -c colourablesquare.c $(COMMON_FLAGS) + +examples: $(EXAMPLES) + +$(EXAMPLES): + $(CXX) -o $@ $@.cc $(OBJS) $(COMMON_FLAGS) -std=c++11 + +clean: + @echo "Cleaning up built objects..." + @rm -Rf $(EXAMPLES)