mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Checkpoint
This commit is contained in:
parent
a6fb41dcf0
commit
2f43db8e2e
@ -7,7 +7,9 @@ $source_dir = "." ; # Base
|
||||
$header_dir = "." ; # Base path to build source from. Default to working directory
|
||||
$trickify_make_args = "" ; # Arguments to pass into the trickify make
|
||||
$trickify_make_path = "$my_path../share/trick/makefiles/trickify.mk" ; # Path of the trickify make file
|
||||
$build_s_source = 0 ; # Whether to generate a S_source
|
||||
$build_s_source = 1 ; # Whether to generate a S_source
|
||||
$build_trickify_src_list = 1 ; # Whether to generate a trickify_src_list
|
||||
$build_trickify_obj_list = 1 ; # Whether to generate a trickify_obj_list
|
||||
$full_build = 1 ; # Whether to build only ICG/Swig artifacts or entire source
|
||||
$name = "trickified" ; # Name of the library
|
||||
$build_type = "o" ; # Type of library to be built (o, a , so)
|
||||
@ -42,9 +44,17 @@ foreach $argnum (0 .. $#ARGV)
|
||||
$header_dir = $ARGV[$argnum + 1] ;
|
||||
$skip_arg = 1 ;
|
||||
}
|
||||
elsif($arg eq "-R") # Rebuild S_source
|
||||
elsif($arg eq "-ph") # Preserve S_source.hh
|
||||
{
|
||||
$build_s_source = 1 ;
|
||||
$build_s_source = 0 ;
|
||||
}
|
||||
elsif($arg eq "-ps") # Preserve trickify_src_list
|
||||
{
|
||||
$build_trickify_src_list = 0 ;
|
||||
}
|
||||
elsif($arg eq "-po") # Preserve trickify_obj_list
|
||||
{
|
||||
$build_trickify_obj_list = 0 ;
|
||||
}
|
||||
elsif($arg eq "-t") # Build trick artifacts only
|
||||
{
|
||||
@ -101,6 +111,10 @@ foreach $argnum (0 .. $#ARGV)
|
||||
}
|
||||
|
||||
#Set Environment Variables
|
||||
if ( $full_build )
|
||||
{
|
||||
$ENV{'FULL_TRICKIFY_BUILD'} = "1" ;
|
||||
}
|
||||
$ENV{'TRICKIFY_CXX_FLAGS'} = "-I $source_dir -I $trick_home" . "/include" ; #TODO: Test with multiple dirs passed in at once
|
||||
$ENV{'TRICKIFY_OBJECT_NAME'} = "$name.$build_type" ;
|
||||
$ENV{'TRICKIFY_SOURCE'} = "$source_dir" ;
|
||||
@ -121,21 +135,28 @@ elsif ( $build_type eq so )
|
||||
}
|
||||
|
||||
#Build the S_source.hh
|
||||
$make_s_source = "python3 $my_path../share/trick/makefiles/build_trickify_S_source_hh.py" ;
|
||||
print(`$make_s_source`) ;
|
||||
if ($build_s_source)
|
||||
{
|
||||
print "Building S_source.hh\n" ;
|
||||
$make_s_source = "python3 $my_path../share/trick/makefiles/build_trickify_S_source_hh.py" ;
|
||||
print(`$make_s_source`) ;
|
||||
}
|
||||
|
||||
#Build source file list, only if trickifying the entire library
|
||||
#TODO: Move build artifacts into build? Maybe?
|
||||
print "Building trickify_src_list\n" ;
|
||||
if($full_build)
|
||||
if ($build_trickify_src_list)
|
||||
{
|
||||
$make_src_list = "python3 $my_path../share/trick/makefiles/build_trickify_src_list.py" ;
|
||||
print(`$make_src_list`) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
open (fh, ">", "$work_dir"."trickify_src_list") ;
|
||||
close (fh) ;
|
||||
print "Building trickify_src_list\n" ;
|
||||
if($full_build)
|
||||
{
|
||||
$make_src_list = "python3 $my_path../share/trick/makefiles/build_trickify_src_list.py" ;
|
||||
print(`$make_src_list`) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
open (fh, ">", "$work_dir"."trickify_src_list") ;
|
||||
close (fh) ;
|
||||
}
|
||||
}
|
||||
|
||||
#Build array of source files
|
||||
@ -149,18 +170,21 @@ while (my $line = <$fh>)
|
||||
close (fh) ;
|
||||
|
||||
#Build object files from source file list
|
||||
print "Building object files\n" ;
|
||||
foreach $src (@src_files)
|
||||
if ($build_trickify_src_list)
|
||||
{
|
||||
$file = $src ;
|
||||
$file =~ s/\Q.cpp\E$// ;
|
||||
$file =~ s/\Q.c$\E$// ;
|
||||
$cmd = "g++ -c $src -o $file.o" ;
|
||||
if($debug)
|
||||
print "Building object files\n" ;
|
||||
foreach $src (@src_files)
|
||||
{
|
||||
print "Building obj file: $cmd\n" ;
|
||||
$file = $src ;
|
||||
$file =~ s/\Q.cpp\E$// ;
|
||||
$file =~ s/\Q.c$\E$// ;
|
||||
$cmd = "g++ -c $src -o $file.o" ;
|
||||
if($debug)
|
||||
{
|
||||
print "Building obj file: $cmd\n" ;
|
||||
}
|
||||
print(`$cmd`) ;
|
||||
}
|
||||
print(`$cmd`) ;
|
||||
}
|
||||
|
||||
#Build object file list, only if trickifying the entire library
|
||||
|
@ -108,10 +108,14 @@ BUILD_DIR := $(dir $(MAKE_OUT))
|
||||
PY_LINK_LIST := $(BUILD_DIR)trickify_py_link_list
|
||||
IO_LINK_LIST := $(BUILD_DIR)trickify_io_link_list
|
||||
OBJ_LINK_LIST := trickify_obj_list
|
||||
LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST)
|
||||
ifdef FULL_TRICKIFY_BUILD
|
||||
LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST)
|
||||
else
|
||||
LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST)
|
||||
endif
|
||||
ifneq ($(wildcard $(BUILD_DIR)),)
|
||||
SWIG_OBJECTS := $(shell cat $(PY_LINK_LIST))
|
||||
IO_OBJECTS := $(shell cat $(IO_LINK_LIST))
|
||||
SWIG_OBJECTS := $(shell cat $(PY_LINK_LIST))
|
||||
IO_OBJECTS := $(shell cat $(IO_LINK_LIST))
|
||||
endif
|
||||
|
||||
TRICK_CFLAGS += $(TRICKIFY_CXX_FLAGS)
|
||||
|
@ -6,10 +6,15 @@ include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
||||
SIM_DIRECTORIES = $(wildcard SIM_*)
|
||||
UNIT_TEST_RESULTS = $(addprefix $(TRICK_HOME)/trick_test/, $(addsuffix .xml, $(SIM_DIRECTORIES)))
|
||||
|
||||
# The auto-generated makefile for each test does not know to call other makefiles the user may have included.
|
||||
# User generated clean calls must be directly called here
|
||||
# Otherwise build artifacts may not be cleaned and give misleading test results
|
||||
clean_trickify:
|
||||
for i in $(SIM_DIRECTORIES) ; do \
|
||||
if [ -f "$$i/trickified_project/trickified/"[Mm]"akefile" ] ; then \
|
||||
$(MAKE) -C $$i/trickified_project/trickified/ clean ; \
|
||||
elif [ -f "$$i/models/trickified/"[Mm]"akefile" ] ; then \
|
||||
$(MAKE) -C $$i/models/trickified/ clean ; \
|
||||
fi \
|
||||
done
|
||||
|
||||
|
@ -10,3 +10,4 @@ clean:
|
||||
@rm -rf $(MYPROJECT_TRICK)
|
||||
@rm -rf trickify_obj_list
|
||||
@rm -rf trickify_src_list
|
||||
@rm -rf S_source.hh
|
||||
|
@ -1,2 +0,0 @@
|
||||
#include "/home/patrick/trick/test/SIM_trickified/trickified_project/trickified/../include/Foo.hh"
|
||||
#include "/home/patrick/trick/test/SIM_trickified/trickified_project/trickified/../include/Bar.hh"
|
@ -12,7 +12,7 @@ TRICK_CFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE)
|
||||
TRICK_CXXFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE)
|
||||
|
||||
export TRICKIFY_BUILD_TYPE := STATIC
|
||||
export TRICKIFY_OBJECT_NAME := trickified_myproject.a
|
||||
export TRICKIFY_OBJECT_NAME := trickified_myproject.o
|
||||
MYPROJECT_TRICK := $(MYPROJECT_HOME)/trickified/$(TRICKIFY_OBJECT_NAME)
|
||||
|
||||
# Tell Trick the headers and source at this location are part of a
|
||||
|
Loading…
Reference in New Issue
Block a user