mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Split CP up into components that can be called individually
Fixed some library dependency bugs. JEOD test sims compile now. refs #86
This commit is contained in:
parent
dfa961808b
commit
d7b386227a
@ -300,7 +300,7 @@ OBJECTS += \$(SWIG_MODULE_OBJECTS)
|
||||
open TOPFILE , ">build/top.i" or return ;
|
||||
print TOPFILE "\%module top\n\n" ;
|
||||
print TOPFILE "\%{\n#include \"../S_source.hh\"\n\n" ;
|
||||
print TOPFILE map { "extern $_" } @instances ;
|
||||
print TOPFILE @instances ;
|
||||
print TOPFILE "\n\%}\n\n" ;
|
||||
print TOPFILE "\%import \"build$wd/S_source.i\"\n\n" ;
|
||||
print TOPFILE @instances ;
|
||||
|
@ -15,7 +15,7 @@ sub get_lib_deps ($$) {
|
||||
my (@lib_list) ;
|
||||
my (@inc_paths) ;
|
||||
|
||||
($lib_deps) = $contents =~ /LIBRARY[ _]DEPENDENC(?:Y|IES):[^(]*(.*?)\)([A-Z _\t\n\r]+:|[ \t\n\r]*$)/si ;
|
||||
($lib_deps) = $contents =~ /LIBRARY[ _]DEPENDENC(?:Y|IES):[^(]*(.*?)\)([A-Z _\t\n\r]+:|\s*\*)/si ;
|
||||
@lib_list = split /\)[ \t\n\r\*]*\(/ , $lib_deps ;
|
||||
|
||||
@inc_paths = $ENV{"TRICK_CFLAGS"} =~ /-I\s*(\S+)/g ; # get include paths from TRICK_CFLAGS
|
||||
@ -59,18 +59,20 @@ sub get_lib_deps ($$) {
|
||||
}
|
||||
} else {
|
||||
$l =~ s/o$// ;
|
||||
my ($rel_dir) = dirname($l) ;
|
||||
my ($base) = basename($l) ;
|
||||
foreach my $inc ( $file_path_dir , @inc_paths) {
|
||||
foreach my $ext ( "cpp" , "cc" , "c" , "c++" , "cxx" , "C" ) {
|
||||
if ( -e "$inc/$l$ext" ) {
|
||||
if ( -e "$inc/$rel_dir/$base$ext" ) {
|
||||
#print "found $inc/$l$ext\n" ;
|
||||
my $f = abs_path(dirname("$inc/$l$ext")) . "/" . basename("$inc/$l$ext") ;
|
||||
my $f = abs_path("$inc/$rel_dir") . "/$base$ext" ;
|
||||
push @resolved_files, $f ;
|
||||
$found = 1 ;
|
||||
last ;
|
||||
}
|
||||
elsif ( -e "$inc/src/$l$ext" ) {
|
||||
elsif ( -e "$inc/$rel_dir/src/$base$ext" ) {
|
||||
#print "found $inc/src/$l$ext\n" ;
|
||||
my $f = abs_path(dirname("$inc/src/$l$ext")) . "/" . basename("$inc/src/$l$ext") ;
|
||||
my $f = abs_path("$inc/$rel_dir/src") . "/$base$ext" ;
|
||||
push @resolved_files, $f ;
|
||||
$found = 1 ;
|
||||
last ;
|
||||
@ -81,7 +83,7 @@ sub get_lib_deps ($$) {
|
||||
}
|
||||
|
||||
if ( $found == 0 ) {
|
||||
print STDERR "[33m@ARGV[0]: Warning: Could not find dependency $l[0m\n" ;
|
||||
print STDERR "[33mWarning: Could not find dependency $l[0m\n" ;
|
||||
}
|
||||
}
|
||||
return @resolved_files ;
|
||||
|
@ -319,9 +319,9 @@ PURPOSE:
|
||||
|
||||
|
||||
open S_INSTANCE, ">build/S_instances" or die "Couldn't open build/S_instances!\n";
|
||||
print S_INSTANCE $$sim_ref{instance_declarations} ;
|
||||
print S_INSTANCE $$sim_ref{extern_instance_declarations} ;
|
||||
foreach my $integ_loop ( @{$$sim_ref{integ_loop}} ) {
|
||||
print S_INSTANCE "IntegLoopSimObject $$integ_loop{name} ;\n" ;
|
||||
print S_INSTANCE "extern IntegLoopSimObject $$integ_loop{name} ;\n" ;
|
||||
}
|
||||
close S_INSTANCE ;
|
||||
}
|
||||
|
@ -85,11 +85,8 @@ convert_swig:
|
||||
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/convert_swig ${TRICK_CONVERT_SWIG_FLAGS}
|
||||
@ touch $(CURDIR)/build/convert_swig_last_run
|
||||
|
||||
S_define_exp:
|
||||
$(TRICK_CC) -E -C -xc++ ${TRICK_SFLAGS} S_define > $@
|
||||
|
||||
# Pass these options
|
||||
sie:
|
||||
sie S_define_exp:
|
||||
@if [ -f build/Makefile_src ] ; then $(MAKE) --no-print-directory -f build/Makefile_src $@ ; else echo "No build/Makefile_src found" ; fi
|
||||
|
||||
help:
|
||||
@ -121,7 +118,7 @@ apocalypse: clean
|
||||
|
||||
|
||||
# Dependencies for the above rules generated by configuration_process, ICG, make_makefile and make_makefile_swig
|
||||
-include S_overrides.mk
|
||||
#-include S_overrides.mk
|
||||
-include build/S_define.deps
|
||||
-include build/Makefile_ICG
|
||||
-include build/Makefile_convert_swig
|
||||
|
@ -357,6 +357,36 @@ void PrintAttributes::closeMapFiles() {
|
||||
}
|
||||
}
|
||||
|
||||
void PrintAttributes::addEmptyFiles() {
|
||||
// Make a list of the empty files we processed.
|
||||
// This list is written to the ICG_processed file and used by other processors.
|
||||
clang::SourceManager::fileinfo_iterator fi ;
|
||||
for ( fi = ci.getSourceManager().fileinfo_begin() ; fi != ci.getSourceManager().fileinfo_end() ; fi++ ) {
|
||||
const clang::FileEntry * fe = (*fi).first ;
|
||||
std::string header_file_name = fe->getName() ;
|
||||
if ( visited_files.find(header_file_name) == visited_files.end() ) {
|
||||
visited_files.insert(header_file_name) ;
|
||||
// several tests require the real path of the header file.
|
||||
char * rp = almostRealPath(header_file_name.c_str()) ;
|
||||
if ( rp != NULL ) {
|
||||
// Only include user directories (not system dirs like /usr/include)
|
||||
if ( hsd.isPathInUserDir(rp) ) {
|
||||
// Don't process files in excluded directories
|
||||
if ( hsd.isPathInICGExclude(rp) == false ) {
|
||||
// Only include files that do not have ICG: (No)
|
||||
// hasICGNo uses original header name, not the real path
|
||||
if ( ! cs.hasICGNo(header_file_name) ) {
|
||||
std::string io_file_name = createIOFileName(std::string(rp)) ;
|
||||
empty_header_files.insert(rp) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
free(rp) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Move this into PrintFileContents10.
|
||||
void PrintAttributes::printIOMakefile() {
|
||||
std::ofstream makefile_io_src ;
|
||||
@ -447,6 +477,12 @@ void PrintAttributes::printIOMakefile() {
|
||||
link_io_objs << (*mit).second.substr(0,found) << ".o" << std::endl ;
|
||||
ICG_processed << (*mit).first << std::endl ;
|
||||
}
|
||||
// Create the list of empty (of classes/enums) header files to be written to ICG_processed.
|
||||
addEmptyFiles() ;
|
||||
std::set< std::string >::iterator sit ;
|
||||
for ( sit = empty_header_files.begin() ; sit != empty_header_files.end() ; sit++ ) {
|
||||
ICG_processed << (*sit) << std::endl ;
|
||||
}
|
||||
makefile_ICG << std::endl << std::endl ;
|
||||
makefile_ICG.close() ;
|
||||
link_io_objs << "build/class_map.o" << std::endl ;
|
||||
|
@ -98,6 +98,9 @@ class PrintAttributes {
|
||||
bool isIOFileOutOfDate(std::string header_file_name, std::string io_file_name ) ;
|
||||
bool doesIODirectoryExist(std::string io_file_name ) ;
|
||||
|
||||
/** Adds empty header files to list of processed files. */
|
||||
void addEmptyFiles() ;
|
||||
|
||||
/** Determines the io_file_name based on the given header file name
|
||||
@param header_file_name = full path to header file
|
||||
@return string of full path to io_src file name.
|
||||
@ -110,6 +113,9 @@ class PrintAttributes {
|
||||
/** map of all io_files we processed */
|
||||
std::map< std::string , std::string > all_io_files ;
|
||||
|
||||
/** map of all io_files we processed */
|
||||
std::set< std::string > empty_header_files ;
|
||||
|
||||
/** map of open files to the out of date io_src file */
|
||||
std::map< std::string , std::string > out_of_date_io_files ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user