summaryrefslogtreecommitdiff
path: root/src/bin/eolian_cxx
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2014-05-04 12:19:39 +0200
committerCedric Bail <cedric.bail@free.fr>2014-05-04 12:21:30 +0200
commit814982389759069625f4fb0c460436a8f4d894c6 (patch)
tree3ff7ddf4880bc1ec21d65f9369e0024047a782e7 /src/bin/eolian_cxx
parent05963f40523c952470cce5ab5aac582cca1d4d32 (diff)
eolian-cxx: fix make distcheck and automake files for Eolian C++
Summary: Fixed distcheck for Eolian C++. Made the generated files as nodist so it doesn't get picked up for generation way too early. Reviewers: cedric, seoz CC: cedric Maniphest Tasks: T1220 Differential Revision: https://phab.enlightenment.org/D820 Signed-off-by: Cedric Bail <cedric.bail@free.fr>
Diffstat (limited to 'src/bin/eolian_cxx')
-rw-r--r--src/bin/eolian_cxx/eolian_cxx.cc36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_cxx.cc
index c6d146205f..45b2b115b9 100644
--- a/src/bin/eolian_cxx/eolian_cxx.cc
+++ b/src/bin/eolian_cxx/eolian_cxx.cc
@@ -92,6 +92,27 @@ _guess_classname_from_sources(::options_type& opts)
92 return ""; 92 return "";
93} 93}
94 94
95std::pair<std::string, std::string> get_filename_info(std::string path)
96{
97 const size_t last = path.rfind("lib/");
98 if (last != std::string::npos)
99 {
100 path.erase(0, last+4);
101
102 std::string::iterator slash
103 = std::find(path.begin(), path.end(), '/');
104 if(slash != path.end())
105 {
106 std::string namespace_ (path.begin(), slash);
107 std::string filename (slash+1, path.end());
108 return {filename, namespace_};
109 }
110 }
111 EINA_CXX_DOM_LOG_ERR(::domain)
112 << "Couldn't find source file for class '" << path << "'";
113 return {};
114}
115
95efl::eolian::eo_generator_options 116efl::eolian::eo_generator_options
96_resolve_includes(std::string const& classname, ::options_type const& opts) 117_resolve_includes(std::string const& classname, ::options_type const& opts)
97{ 118{
@@ -101,9 +122,7 @@ _resolve_includes(std::string const& classname, ::options_type const& opts)
101 std::transform(cls_name.begin(), cls_name.end(), cls_name.begin(), ::tolower); 122 std::transform(cls_name.begin(), cls_name.end(), cls_name.begin(), ::tolower);
102 123
103 std::string eo_file = safe_str(eolian_class_file_get(classname.c_str())); 124 std::string eo_file = safe_str(eolian_class_file_get(classname.c_str()));
104 const size_t last = eo_file.rfind("/"); 125 gen_opts.c_headers.push_back(get_filename_info(eo_file).first + ".h");
105 if (last != std::string::npos) eo_file.erase(0, last+1);
106 gen_opts.c_headers.push_back(eo_file + ".h");
107 126
108 void *cur = NULL; 127 void *cur = NULL;
109 const Eina_List *itr, *inheritances = eolian_class_inherits_list_get(classname.c_str()); 128 const Eina_List *itr, *inheritances = eolian_class_inherits_list_get(classname.c_str());
@@ -113,16 +132,17 @@ _resolve_includes(std::string const& classname, ::options_type const& opts)
113 std::string eo_parent_file = safe_str(eolian_class_file_get(ext)); 132 std::string eo_parent_file = safe_str(eolian_class_file_get(ext));
114 if (!eo_parent_file.empty()) 133 if (!eo_parent_file.empty())
115 { 134 {
116 const size_t last = eo_parent_file.rfind("/"); 135 std::string filename, namespace_;
117 if (last != std::string::npos) eo_parent_file.erase(0, last+1); 136 std::tie(filename, namespace_) = get_filename_info(eo_parent_file);
118 if (eo_parent_file != "eo_base.eo") // we have our own eo_base.hh 137 // we have our own eo_base.hh
138 if (filename != "eo_base.eo" || namespace_ != "eo")
119 { 139 {
120 gen_opts.cxx_headers.push_back(eo_parent_file + ".hh"); 140 gen_opts.cxx_headers.push_back(filename + ".hh");
121 } 141 }
122 } 142 }
123 else 143 else
124 { 144 {
125 EINA_CXX_DOM_LOG_WARN(::domain) 145 EINA_CXX_DOM_LOG_ERR(::domain)
126 << "Couldn't find source file for class '" << ext << "'"; 146 << "Couldn't find source file for class '" << ext << "'";
127 } 147 }
128 } 148 }