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

@ -13,7 +13,8 @@ $name = "trickified" ; # Name
$build_type = "o" ; # Type of library to be built (o, a , so)
$debug = 0 ; # Debug info flag
#$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 ;
foreach $argnum (0 .. $#ARGV)
@ -73,7 +74,8 @@ foreach $argnum (0 .. $#ARGV)
}
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 ;
}
@ -86,6 +88,11 @@ foreach $argnum (0 .. $#ARGV)
#$work_dir = $ARGV[$argnum + 1] . "/trickify/" ;
$skip_arg = 1 ;
}
elsif($arg eq "-th") # Set trick home directory
{
$trick_home = $ARGV[$argnum + 1] ;
$skip_arg = 1 ;
}
else
{
print "Unrecognized argument: $arg\n" ;
@ -94,7 +101,7 @@ foreach $argnum (0 .. $#ARGV)
}
#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_SOURCE'} = "$source_dir" ;
$ENV{'TRICKIFY_HEADER'} = "$header_dir" ;
@ -146,9 +153,8 @@ print "Building object files\n" ;
foreach $src (@src_files)
{
$file = $src ;
#TODO double check this works on different boxes
$file =~ s/$\Q.cpp\E// ;
$file =~ s/$\Q.c\E// ;
$file =~ s/\Q.cpp\E$// ;
$file =~ s/\Q.c$\E$// ;
$cmd = "g++ -c $src -o $file.o" ;
if($debug)
{
@ -186,7 +192,8 @@ if($debug) {
full_build = $full_build
name = $name
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?

View File

@ -13,16 +13,12 @@ def build_S_source():
loc = ""
if "TRICKIFY_HEADER" in os.environ:
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:
files = find_files_by_extension(loc, ext)
for i in range(len(files)):
#s_source.write('#include "' + work_dir + "/../" + str(files[i]) + '"\n')
s_source.write('#include "' + work_dir + str(files[i]) + '"\n')
s_source.write('#include "' + str(files[i]) + '"\n')
def build_obj_list():
loc = ""

View File

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

View File

@ -1,6 +1,6 @@
#include "testing.hh"
int main()
int some_function()
{
test_class test ;
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
all:
#@$(MAKE) -s -f $(TRICK_HOME)/share/trick/makefiles/trickify.mk
#@trick-ify -d "/users/plherrin/trick/test/SIM_trickified/trickified_project/include" -b a -n trickified_myproject
@trick-ify -d "/users/plherrin/trick/test/SIM_trickified/trickified_project/testing" -b a -n trickified_myproject
@echo MAKE LOCAL_DIR $(LOCAL_DIR)
@trick-ify -d "$(LOCAL_DIR)/../include" -b o -n trickified_myproject -v
clean:
@rm -rf build python trick $(TRICKIFY_OBJECT_NAME)
@rm -rf $(MYPROJECT_TRICK)
@rm -rf trickify_obj_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"