Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved compile time #10

Merged
merged 16 commits into from
Aug 19, 2016
Prev Previous commit
Next Next commit
xspx is generating source code now
Major compiler time improvement: 2.7X
  • Loading branch information
intrig committed Aug 18, 2016
commit 7df87dc78052d31153cf0b495a0f90d0d86868b3
7 changes: 4 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ include_directories(lua-5.1.4/src)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/o)

add_custom_command(
OUTPUT ${CMAKE_SOURCE_DIR}/include/xenon/xddl.h
COMMAND xspx -H t ${CMAKE_CURRENT_SOURCE_DIR}/xddl.xspx
OUTPUT ${CMAKE_SOURCE_DIR}/include/xenon/xddl.h ${CMAKE_SOURCE_DIR}/src/xddl_impl.cpp
COMMAND xspx -H t -S xddl_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xddl.xspx
COMMAND ${CMAKE_COMMAND} -E copy_if_different t ${CMAKE_SOURCE_DIR}/include/xenon/xddl.h
COMMAND ${CMAKE_COMMAND} -E copy_if_different xddl_impl.cpp ${CMAKE_SOURCE_DIR}/src/xddl_impl.cpp
DEPENDS xspx
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/xddl.xspx
VERBATIM)

add_library(xenon ${CMAKE_SOURCE_DIR}/include/xenon/xddl.h lua-5.1.4/src/lua_all.cpp xml_parser_base.cpp message.cpp xddl.cpp)
add_library(xenon ${CMAKE_SOURCE_DIR}/include/xenon/xddl.h lua-5.1.4/src/lua_all.cpp xml_parser_base.cpp message.cpp xddl.cpp xddl_impl.cpp)

set_target_properties(xenon PROPERTIES POSITION_INDEPENDENT_CODE ON)
6 changes: 4 additions & 2 deletions tools/xspx/xspx_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,10 @@ void xsp_parser::to_stream(std::ostream & h, std::ostream & s) const {

std::ostringstream os;
xenon::cpp_code code;
os << "#include <xenon/xddl.h>";
os << "#include <xenon/xenon.h>";
os << "namespace xenon {";
parser_const(os, st::source_impl);
os << "}";
code.add(os.str());
s << code.str();
}
Expand Down Expand Up @@ -464,7 +466,7 @@ void xsp_parser::const_content(std::ostream & os) const {
void xsp_parser::parser_const(std::ostream & os, st::type t) const {
switch (t) {
case st::header_decl :
os << class_name << "()";
os << class_name << "();";
break;
case st::header_impl :
os << class_name << "()";
Expand Down