Memory Manager tests trying to write io_src files in sim_services/include

Added 2 flags to trick-ICG. "-o" will specify an output directory.  Added this
option to the calls to trick-ICG for the Memory Manager tests.  Also added
a "-m" option to create the map files ICG creates for sims.  The memory manager
tests do not need these maps so we don't include the option.  Added the -m option
to the sim makefile and the master makefile so we do create the map when compile
Trick core and sims.

refs #72
This commit is contained in:
Alex Lin 2015-06-24 17:49:14 -05:00
parent bfc197f81c
commit cf3738d3fd
6 changed files with 35 additions and 22 deletions

View File

@ -206,7 +206,7 @@ endif
# header files.
.PHONY: icg_sim_serv
icg_sim_serv: $(ICG_EXE)
${TRICK_HOME}/bin/trick-ICG -s ${TRICK_CXXFLAGS} ${TRICK_HOME}/include/trick/files_to_ICG.hh
${TRICK_HOME}/bin/trick-ICG -s -m ${TRICK_CXXFLAGS} ${TRICK_HOME}/include/trick/files_to_ICG.hh
# 1.1.1.4.1 Build the Interface Code Generator (ICG) executable.
$(ICG_EXE) :
@ -409,7 +409,7 @@ stand_alone_utils:
# ICG all sim_services files (for testing and debugging ICG).
# The -f flag forces io_src files to be regenerated whether or not they need to be.
ICG: $(ICG_EXE)
${TRICK_HOME}/bin/trick-ICG -f -s ${TRICK_CXXFLAGS} ${TRICK_HOME}/include/trick/files_to_ICG.hh
${TRICK_HOME}/bin/trick-ICG -f -s -m ${TRICK_CXXFLAGS} ${TRICK_HOME}/include/trick/files_to_ICG.hh
# This builds a tricklib share library.
ifeq ($(USE_ER7_UTILS_INTEGRATORS), 1)

View File

@ -555,9 +555,9 @@ test_all: TRICK_CFLAGS += -DTRICK_UNIT_TEST
print MAKEFILE "test_all: all\n\n" ;
print MAKEFILE "ICG:\n" ;
print MAKEFILE "\t\${TRICK_HOME}/bin/trick-ICG \${TRICK_CXXFLAGS} S_source.hh\n" ;
print MAKEFILE "\t\${TRICK_HOME}/bin/trick-ICG -m \${TRICK_CXXFLAGS} S_source.hh\n" ;
print MAKEFILE "force_ICG:\n" ;
print MAKEFILE "\t\${TRICK_HOME}/bin/trick-ICG -f \${TRICK_CXXFLAGS} S_source.hh\n" ;
print MAKEFILE "\t\${TRICK_HOME}/bin/trick-ICG -f -m \${TRICK_CXXFLAGS} S_source.hh\n" ;
print MAKEFILE "
S_main : objects \$(LIB_DIR) \$(S_MAIN) \$(OBJECT_DIR)/S_define.deps S_sie.resource

View File

@ -20,12 +20,14 @@
#include "Utilities.hh"
PrintAttributes::PrintAttributes(int in_attr_version , HeaderSearchDirs & in_hsd ,
CommentSaver & in_cs , clang::CompilerInstance & in_ci, bool in_force , bool in_sim_services_flag ) :
CommentSaver & in_cs , clang::CompilerInstance & in_ci, bool in_force , bool in_sim_services_flag ,
std::string in_output_dir ) :
hsd(in_hsd) ,
cs(in_cs) ,
ci(in_ci) ,
force(in_force) ,
sim_services_flag( in_sim_services_flag )
sim_services_flag( in_sim_services_flag ) ,
output_dir( in_output_dir )
{
printer = createFileContents(in_attr_version) ;
}
@ -195,10 +197,14 @@ std::string PrintAttributes::createIOFileName(std::string header_file_name) {
}
// Put all of the sim_services io_files in ${TRICK_HOME}/trick_source/sim_services/include/io_src unless
// it is in er7_utils. The er7_utils io_files have duplicate file names so the overwrite each other
if ( sim_services_flag and (dir_name.find("er7_utils") == std::string::npos) ) {
io_file_name = std::string(getenv("TRICK_HOME")) + "/trick_source/sim_services/include/io_src/" + base_name ;
if ( ! output_dir.empty() ) {
io_file_name = output_dir + "/io_src/" + base_name ;
} else {
io_file_name = dir_name + "/io_src/" + base_name ;
if ( sim_services_flag and (dir_name.find("er7_utils") == std::string::npos) ) {
io_file_name = std::string(getenv("TRICK_HOME")) + "/trick_source/sim_services/include/io_src/" + base_name ;
} else {
io_file_name = dir_name + "/io_src/" + base_name ;
}
}
return io_file_name ;
}

View File

@ -35,7 +35,7 @@ class PrintFileContentsBase ;
class PrintAttributes {
public:
PrintAttributes( int attr_version , HeaderSearchDirs & hsd , CommentSaver & cs ,
clang::CompilerInstance & in_ci, bool force , bool sim_services) ;
clang::CompilerInstance & in_ci, bool force , bool sim_services, std::string output_dir ) ;
/** Prints all of the processed classes and enumerations */
virtual void removeMapFiles() ;
@ -86,6 +86,9 @@ class PrintAttributes {
/** We are processing sim_services */
bool sim_services_flag ;
/** We are specifying an output directory for all files */
std::string output_dir ;
bool openIOFile(std::string header_file_name) ;
bool isFileIncluded(std::string header_file_name) ;

View File

@ -35,6 +35,8 @@ llvm::cl::opt< bool > sim_services_flag ("s", llvm::cl::desc("Gernerate io_src f
llvm::cl::opt< bool > force ("f", llvm::cl::desc("Force all io_src files to be generated")) ;
llvm::cl::opt< int > attr_version ("v", llvm::cl::desc("Select version of attributes to produce. 10 and 13 are valid"), llvm::cl::init(10)) ;
llvm::cl::opt< int > debug_level ("d", llvm::cl::desc("Set debug level"), llvm::cl::init(0), llvm::cl::ZeroOrMore) ;
llvm::cl::opt< bool > create_map ("m", llvm::cl::desc("Create map files"), llvm::cl::init(false)) ;
llvm::cl::opt< std::string > output_dir ("o", llvm::cl::desc("Output directory")) ;
llvm::cl::alias ssf_alias ("sim_services" , llvm::cl::desc("Alias for -s") , llvm::cl::aliasopt(sim_services_flag)) ;
llvm::cl::alias force_alias ("force" , llvm::cl::desc("Alias for -f") , llvm::cl::aliasopt(force)) ;
llvm::cl::list< std::string > input_file_names(llvm::cl::Positional, llvm::cl::desc("<input_file>"), llvm::cl::ZeroOrMore) ;
@ -145,10 +147,12 @@ int main( int argc , char * argv[] ) {
CommentSaver cs(ci, hsd) ;
pp.addCommentHandler(&cs) ;
PrintAttributes pa( attr_version, hsd, cs, ci, force, sim_services_flag) ;
PrintAttributes pa( attr_version, hsd, cs, ci, force, sim_services_flag, output_dir) ;
// create new class and enum map files
pa.createMapFiles() ;
if ( create_map ) {
pa.createMapFiles() ;
}
// Tell the compiler to use our ICGASTconsumer
ICGASTConsumer *astConsumer = new ICGASTConsumer(ci, hsd, cs, pa);

View File

@ -91,24 +91,24 @@ clean :
# Builds gtest.a and gtest_main.a.
io_MM_user_defined_types.o : MM_user_defined_types.hh
${TRICK_HOME}/bin/trick-ICG -s $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c ../../include/io_src/io_MM_user_defined_types.cpp
${TRICK_HOME}/bin/trick-ICG -s -o . $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c io_src/io_MM_user_defined_types.cpp
io_MM_alloc_deps.o : MM_alloc_deps.hh
${TRICK_HOME}/bin/trick-ICG -s $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c ../../include/io_src/io_MM_alloc_deps.cpp
${TRICK_HOME}/bin/trick-ICG -s -o . $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c io_src/io_MM_alloc_deps.cpp
io_MM_write_checkpoint.o : MM_write_checkpoint.hh
${TRICK_HOME}/bin/trick-ICG -s $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c ../../include/io_src/io_MM_write_checkpoint.cpp
${TRICK_HOME}/bin/trick-ICG -s -o . $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c io_src/io_MM_write_checkpoint.cpp
io_MM_get_enumerated.o : MM_get_enumerated.hh
${TRICK_HOME}/bin/trick-ICG -s $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c ../../include/io_src/io_MM_get_enumerated.cpp
${TRICK_HOME}/bin/trick-ICG -s -o . $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c io_src/io_MM_get_enumerated.cpp
io_MM_ref_name_from_address.o : MM_ref_name_from_address.hh
${TRICK_HOME}/bin/trick-ICG -s $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c ../../include/io_src/io_MM_ref_name_from_address.cpp
${TRICK_HOME}/bin/trick-ICG -s -o . $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c io_src/io_MM_ref_name_from_address.cpp
MM_creation_unittest.o : MM_creation_unittest.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<