Fix out-of-source builds, make field_reflector report errors finding template file
This commit is contained in:
parent
52a72cdd9f
commit
db85d35b19
2 changed files with 12 additions and 6 deletions
|
|
@ -13,10 +13,10 @@ target_include_directories( field_reflector
|
||||||
|
|
||||||
target_link_libraries( field_reflector fc graphene_db )
|
target_link_libraries( field_reflector fc graphene_db )
|
||||||
|
|
||||||
add_custom_command( OUTPUT db_reflect_cmp.cpp
|
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/db_reflect_cmp.cpp
|
||||||
COMMAND field_reflector db_reflect_cmp.tmpl db_reflect_cmp.cpp.new
|
COMMAND field_reflector ${CMAKE_CURRENT_SOURCE_DIR}/db_reflect_cmp.tmpl ${CMAKE_CURRENT_BINARY_DIR}/db_reflect_cmp.cpp.new
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different db_reflect_cmp.cpp.new db_reflect_cmp.cpp
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/db_reflect_cmp.cpp.new ${CMAKE_CURRENT_BINARY_DIR}/db_reflect_cmp.cpp
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove db_reflect_cmp.cpp.new
|
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/db_reflect_cmp.cpp.new
|
||||||
DEPENDS field_reflector db_reflect_cmp.tmpl
|
DEPENDS field_reflector db_reflect_cmp.tmpl
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ add_library( graphene_chain
|
||||||
types.cpp
|
types.cpp
|
||||||
type_id.cpp
|
type_id.cpp
|
||||||
|
|
||||||
db_reflect_cmp.cpp
|
${CMAKE_CURRENT_BINARY_DIR}/db_reflect_cmp.cpp
|
||||||
|
|
||||||
address.cpp
|
address.cpp
|
||||||
asset.cpp
|
asset.cpp
|
||||||
|
|
|
||||||
|
|
@ -222,12 +222,18 @@ int main( int argc, char** argv )
|
||||||
tmpl_params["cmp_attr_impl_body"] = generate_cmp_attr_impl( switch_table );
|
tmpl_params["cmp_attr_impl_body"] = generate_cmp_attr_impl( switch_table );
|
||||||
|
|
||||||
std::ifstream template_file( argv[1] );
|
std::ifstream template_file( argv[1] );
|
||||||
|
if (!template_file)
|
||||||
|
FC_THROW("Error opening template file ${template_file}", ("template_file", argv[1]));
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << template_file.rdbuf();
|
ss << template_file.rdbuf();
|
||||||
std::string result = fc::format_string( ss.str(), tmpl_params );
|
std::string result = fc::format_string( ss.str(), tmpl_params );
|
||||||
std::ofstream result_file( argv[2] );
|
std::ofstream result_file( argv[2] );
|
||||||
result_file << result;
|
result_file << result;
|
||||||
}
|
}
|
||||||
catch ( const fc::exception& e ){ edump((e.to_detail_string())); }
|
catch ( const fc::exception& e )
|
||||||
|
{
|
||||||
|
edump((e.to_detail_string()));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue