mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Merge pull request #820 from nasa/819
Use TRICK_CXXFLAGS for include paths & defines
This commit is contained in:
commit
3e28812485
@ -53,10 +53,6 @@ Examples:
|
||||
my $help = ''; # option variable with default value (false)
|
||||
my $stls = 0; # option variable with default value (false)
|
||||
|
||||
my ( @include_dirs , @defines) ;
|
||||
my @exclude_paths ;
|
||||
my @swig_exclude_paths ;
|
||||
my @ext_lib_paths ;
|
||||
my %sim ;
|
||||
my %out_of_date ;
|
||||
my ($version, $thread, $year) ;
|
||||
@ -128,14 +124,13 @@ if ( $help ) {
|
||||
($version, $thread) = get_trick_version() ;
|
||||
($year) = $version =~ /^(\d+)/ ;
|
||||
|
||||
@include_dirs = $ENV{"TRICK_CFLAGS"} =~ /-I\s*(\S+)/g ; # get include paths from TRICK_CFLAGS
|
||||
my @include_dirs = get_include_paths() ;
|
||||
my @defines = get_defines() ;
|
||||
my @exclude_paths = get_paths("TRICK_EXCLUDE") ;
|
||||
my @swig_exclude_paths = get_paths("TRICK_SWIG_EXCLUDE") ;
|
||||
my @ext_lib_paths = get_paths("TRICK_EXT_LIB_DIRS") ;
|
||||
|
||||
@exclude_paths = get_paths( "TRICK_EXCLUDE") ;
|
||||
@swig_exclude_paths = get_paths( "TRICK_SWIG_EXCLUDE") ;
|
||||
@ext_lib_paths = get_paths( "TRICK_EXT_LIB_DIRS") ;
|
||||
|
||||
@defines = $ENV{"TRICK_CFLAGS"} =~ /(-D\S+)/g ; # get defines from TRICK_CFLAGS
|
||||
if ( $ENV{"TRICK_CFLAGS"} !~ /DTRICK_VER=/ ) {
|
||||
if ( "$ENV{'TRICK_CFLAGS'} $ENV{'TRICK_CXXFLAGS'}" !~ /DTRICK_VER=/ ) {
|
||||
push @defines , "-DTRICK_VER=$year" ;
|
||||
}
|
||||
|
||||
|
@ -26,26 +26,13 @@ my %python_modules ;
|
||||
my %python_module_dirs ;
|
||||
|
||||
sub read_files_to_process() {
|
||||
my @include_paths ;
|
||||
my $cc ;
|
||||
my @defines ;
|
||||
my ($version, $thread, $year) ;
|
||||
my $version, my $thread = get_trick_version() ;
|
||||
my $year = $version =~ /^(\d+)/ ;
|
||||
(my $cc = gte("TRICK_CC")) =~ s/\n// ;
|
||||
|
||||
($version, $thread) = get_trick_version() ;
|
||||
($year) = $version =~ /^(\d+)/ ;
|
||||
($cc = gte("TRICK_CC")) =~ s/\n// ;
|
||||
|
||||
# add -I paths and #defines
|
||||
foreach my $value ( "TRICK_CFLAGS", "TRICK_CXXFLAGS" ) {
|
||||
push @include_paths, $ENV{$value} =~ /(-I\s*\S+)/g ;
|
||||
push @defines, $ENV{$value} =~ /(-D\S+)/g ;
|
||||
}
|
||||
push @include_paths , ("-I".$ENV{"TRICK_HOME"}."/include") ;
|
||||
push @include_paths , ("-I".$ENV{"TRICK_HOME"}."/include/trick/compat") ;
|
||||
push @include_paths , ("-I".$ENV{"TRICK_HOME"}."/trick_source" , "-I../include") ;
|
||||
push @defines , "-DTRICK_VER=$year" ;
|
||||
push @defines , "-DSWIG" ;
|
||||
push @defines , "-std=c++11" ;
|
||||
# Prepend -I to each include path before we pass them to the compiler
|
||||
my @include_paths = map("-I$_", (get_include_paths(), "$ENV{TRICK_HOME}/include", "$ENV{TRICK_HOME}/include/trick/compat", "$ENV{TRICK_HOME}/trick_source", "../include")) ;
|
||||
my @defines = (get_defines(), "-DTRICK_VER=$year", "-DSWIG", "-std=c++11") ;
|
||||
|
||||
# get the list of header files from the compiler
|
||||
open FILE_LIST, "$cc -MM @include_paths @defines S_source.hh |" ;
|
||||
|
@ -9,6 +9,7 @@ use strict ;
|
||||
use lib $ENV{"TRICK_HOME"} . "/bin/pm" ;
|
||||
use gte ;
|
||||
use trick_print ;
|
||||
use get_paths ;
|
||||
|
||||
#--------------------------------------------------------------
|
||||
# Make Default Data
|
||||
@ -53,7 +54,7 @@ sub make_default_data($) {
|
||||
// USER: $user\n\n" ;
|
||||
|
||||
my @default_data_list ;
|
||||
@include_paths = $ENV{"TRICK_CFLAGS"} =~ /-I\s*(\S+)/g ; # get include paths from TRICK_CFLAGS
|
||||
@include_paths = get_include_paths() ;
|
||||
|
||||
foreach my $dd_comment ( @{$$sim_ref{default_data}} ) {
|
||||
$dd_comment =~ s/\(\s*\(/\(/sg ;
|
||||
|
@ -5,6 +5,7 @@ use Cwd 'abs_path';
|
||||
use File::Path qw(make_path) ;
|
||||
use Exporter ();
|
||||
use gte ;
|
||||
use get_paths ;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(get_lib_deps write_lib_deps);
|
||||
|
||||
@ -29,7 +30,7 @@ sub get_lib_deps ($$) {
|
||||
# if there is preprocessor directive in the library dependencies, run the text through cpp.
|
||||
if ( $r =~ /#/ ) {
|
||||
(my $cc = gte("TRICK_CC")) =~ s/\n// ;
|
||||
my @defines = $ENV{"TRICK_CFLAGS"} =~ /(-D\S+)/g ;
|
||||
my @defines = get_defines() ;
|
||||
my $temp ;
|
||||
open FILE, "echo \"$r\" | cpp -P @defines |" ;
|
||||
while ( <FILE> ) {
|
||||
@ -40,7 +41,7 @@ sub get_lib_deps ($$) {
|
||||
push @lib_list , (split /\)[ \t\n\r\*]*\(/ , $r) ;
|
||||
}
|
||||
|
||||
@inc_paths = $ENV{"TRICK_CFLAGS"} =~ /-I\s*(\S+)/g ; # get include paths from TRICK_CFLAGS
|
||||
@inc_paths = get_include_paths() ;
|
||||
# Get only the include paths that exist
|
||||
my @valid_inc_paths ;
|
||||
foreach (@inc_paths) {
|
||||
|
@ -3,7 +3,7 @@ package get_paths ;
|
||||
use Exporter ();
|
||||
use Cwd 'abs_path' ;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(get_paths);
|
||||
@EXPORT = qw(get_paths get_include_paths get_defines);
|
||||
|
||||
use strict ;
|
||||
|
||||
@ -12,4 +12,12 @@ sub get_paths {
|
||||
return grep { $_ ne ''} map abs_path($_), grep { $_ ne '' } map { s/(^\s+|\s+$)//g ; $_ } split /:/, $ENV{$_[0]} ;
|
||||
}
|
||||
|
||||
sub get_include_paths {
|
||||
return "$ENV{TRICK_CFLAGS} $ENV{TRICK_CXXFLAGS}" =~ /-I(\S+)/g
|
||||
}
|
||||
|
||||
sub get_defines {
|
||||
return "$ENV{TRICK_CFLAGS} $ENV{TRICK_CXXFLAGS}" =~ /-D\S+/g
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -11,7 +11,6 @@ use strict ;
|
||||
use Cwd 'abs_path';
|
||||
use IPC::Open3 ;
|
||||
|
||||
use lib $ENV{"TRICK_HOME"} . "/bin/pm" ;
|
||||
use edit ;
|
||||
use find_module ;
|
||||
use gte ;
|
||||
@ -19,6 +18,7 @@ use trick_print ;
|
||||
use trick_version ;
|
||||
use Text::Balanced qw(extract_bracketed);
|
||||
use html ;
|
||||
use get_paths ;
|
||||
|
||||
my ($integ_loop_def , $collect_def , $vcollect_def);
|
||||
my ($job_class_order_def ) ;
|
||||
@ -172,15 +172,12 @@ sub parse_s_define ($) {
|
||||
my ($CC, $contents) ;
|
||||
my (@prescan_job_class_order) ;
|
||||
my ($version, $thread, $year) ;
|
||||
my @defines ;
|
||||
my @comments ;
|
||||
|
||||
my @preprocess_output;
|
||||
|
||||
# Get Include Paths From $TRICK_CFLAGS
|
||||
@{$$sim_ref{inc_paths}} = "$ENV{TRICK_CFLAGS} $ENV{TRICK_SYSTEM_CFLAGS}" =~ /-I\s*(\S+)/g ;
|
||||
@{$$sim_ref{inc_paths}} = (get_include_paths(), $ENV{TRICK_SYSTEM_CFLAGS} =~ /-I(\S+)/g, "$ENV{TRICK_HOME}/trick_source" , "../include") ;
|
||||
|
||||
push @{$$sim_ref{inc_paths}} , ("$ENV{TRICK_HOME}/trick_source" , "../include") ;
|
||||
my @valid_inc_paths ;
|
||||
foreach (@{$$sim_ref{inc_paths}}) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user