eolian_cxx: fix install-examples and (post-install) compilation.
authorSavio Sena <savio@expertisesolutions.com.br>
Wed, 7 May 2014 21:40:43 +0000 (23:40 +0200)
committerCedric Bail <cedric.bail@free.fr>
Wed, 7 May 2014 21:40:46 +0000 (23:40 +0200)
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 <cedric.bail@free.fr>
configure.ac
src/bin/eolian_cxx/eolian_cxx.cc
src/examples/eolian_cxx/Makefile.am
src/examples/eolian_cxx/Makefile.examples [new file with mode: 0644]

index 9dc0a05..061b5ca 100644 (file)
@@ -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
 
index 2ec77fb..8cc5e53 100644 (file)
@@ -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
index 44059fe..8127e65 100644 (file)
@@ -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 (file)
index 0000000..7577932
--- /dev/null
@@ -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)