Checkpoint

This commit is contained in:
Patrick Herrington 2024-11-11 16:30:14 -06:00
parent 0a54ffa32d
commit a6fb41dcf0
6 changed files with 23 additions and 19 deletions

View File

@ -14,6 +14,7 @@ $build_type = "o" ; # Type
$debug = 0 ; # Debug info flag $debug = 0 ; # Debug info flag
#$work_dir = "./trickify/" ; # Directory to dump work artifacts #$work_dir = "./trickify/" ; # Directory to dump work artifacts
$work_dir = "./" ; # Directory to dump work artifacts $work_dir = "./" ; # Directory to dump work artifacts
$trick_home = $my_path . ".." ; # Trick directory to use for building
$skip_arg = 0 ; $skip_arg = 0 ;
foreach $argnum (0 .. $#ARGV) foreach $argnum (0 .. $#ARGV)
@ -73,7 +74,8 @@ foreach $argnum (0 .. $#ARGV)
} }
else else
{ {
print "Invalid build type {$val}, valid build types are {o, a, so}\n" print "Invalid build type {$val}, valid build types are {o, a, so}\n" ;
exit 1 ;
} }
$skip_arg = 1 ; $skip_arg = 1 ;
} }
@ -86,6 +88,11 @@ foreach $argnum (0 .. $#ARGV)
#$work_dir = $ARGV[$argnum + 1] . "/trickify/" ; #$work_dir = $ARGV[$argnum + 1] . "/trickify/" ;
$skip_arg = 1 ; $skip_arg = 1 ;
} }
elsif($arg eq "-th") # Set trick home directory
{
$trick_home = $ARGV[$argnum + 1] ;
$skip_arg = 1 ;
}
else else
{ {
print "Unrecognized argument: $arg\n" ; print "Unrecognized argument: $arg\n" ;
@ -94,7 +101,7 @@ foreach $argnum (0 .. $#ARGV)
} }
#Set Environment Variables #Set Environment Variables
$ENV{'TRICKIFY_CXX_FLAGS'} = "-I $source_dir" ; #TODO: Test with multiple dirs passed in at once $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_OBJECT_NAME'} = "$name.$build_type" ;
$ENV{'TRICKIFY_SOURCE'} = "$source_dir" ; $ENV{'TRICKIFY_SOURCE'} = "$source_dir" ;
$ENV{'TRICKIFY_HEADER'} = "$header_dir" ; $ENV{'TRICKIFY_HEADER'} = "$header_dir" ;
@ -146,9 +153,8 @@ print "Building object files\n" ;
foreach $src (@src_files) foreach $src (@src_files)
{ {
$file = $src ; $file = $src ;
#TODO double check this works on different boxes $file =~ s/\Q.cpp\E$// ;
$file =~ s/$\Q.cpp\E// ; $file =~ s/\Q.c$\E$// ;
$file =~ s/$\Q.c\E// ;
$cmd = "g++ -c $src -o $file.o" ; $cmd = "g++ -c $src -o $file.o" ;
if($debug) if($debug)
{ {
@ -186,7 +192,8 @@ if($debug) {
full_build = $full_build full_build = $full_build
name = $name name = $name
build_type = $build_type build_type = $build_type
work_dir = $work_dir\n" ; work_dir = $work_dir
trick_home = $trick_home\n" ;
} }
#TODO: Can't run trickify neutrally, must set source dir/output dir or conflicts will occur. Should fix or just document? #TODO: Can't run trickify neutrally, must set source dir/output dir or conflicts will occur. Should fix or just document?

View File

@ -13,16 +13,12 @@ def build_S_source():
loc = "" loc = ""
if "TRICKIFY_HEADER" in os.environ: if "TRICKIFY_HEADER" in os.environ:
loc = os.getenv("TRICKIFY_HEADER") loc = os.getenv("TRICKIFY_HEADER")
work_dir = ""
if "TRICKIFY_WORK_DIR" in os.environ:
work_dir = os.getenv("TRICKIFY_WORK_DIR")
s_source = open(work_dir + "S_source.hh", 'w') s_source = open("S_source.hh", 'w')
for ext in def_header_ext: for ext in def_header_ext:
files = find_files_by_extension(loc, ext) files = find_files_by_extension(loc, ext)
for i in range(len(files)): for i in range(len(files)):
#s_source.write('#include "' + work_dir + "/../" + str(files[i]) + '"\n') s_source.write('#include "' + str(files[i]) + '"\n')
s_source.write('#include "' + work_dir + str(files[i]) + '"\n')
def build_obj_list(): def build_obj_list():
loc = "" loc = ""

View File

@ -17,3 +17,5 @@ class test_class
int b; int b;
int c; int c;
}; };
int some_function();

View File

@ -1,6 +1,6 @@
#include "testing.hh" #include "testing.hh"
int main() int some_function()
{ {
test_class test ; test_class test ;
std::cout << test.a << ", " << test.b << ", " << test.c << std::endl ; std::cout << test.a << ", " << test.b << ", " << test.c << std::endl ;

View File

@ -2,13 +2,11 @@ LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
include $(LOCAL_DIR)/myproject_vars.mk include $(LOCAL_DIR)/myproject_vars.mk
all: all:
#@$(MAKE) -s -f $(TRICK_HOME)/share/trick/makefiles/trickify.mk @echo MAKE LOCAL_DIR $(LOCAL_DIR)
#@trick-ify -d "/users/plherrin/trick/test/SIM_trickified/trickified_project/include" -b a -n trickified_myproject @trick-ify -d "$(LOCAL_DIR)/../include" -b o -n trickified_myproject -v
@trick-ify -d "/users/plherrin/trick/test/SIM_trickified/trickified_project/testing" -b a -n trickified_myproject
clean: clean:
@rm -rf build python trick $(TRICKIFY_OBJECT_NAME) @rm -rf build python trick $(TRICKIFY_OBJECT_NAME)
@rm -rf $(MYPROJECT_TRICK) @rm -rf $(MYPROJECT_TRICK)
@rm -rf trickify_obj_list @rm -rf trickify_obj_list
@rm -rf trickify_src_list @rm -rf trickify_src_list
@rm -rf /users/plherrin/trick/test/SIM_trickified/trickified_project/testing/*.o

View File

@ -1 +1,2 @@
#include "/users/plherrin/trick/test/SIM_trickified/trickified_project/testing/testing.hh" #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"