From 7152e92d8b1f9bd66b85f54dda1f909c546f7238 Mon Sep 17 00:00:00 2001 From: Patrick Herrington Date: Sun, 24 Nov 2024 22:03:22 -0600 Subject: [PATCH] Checkpoint --- bin/trick-ify | 30 ++++++++++--------- .../trickified_project/testing/testing.cpp | 3 -- .../trickified_project/testing/testing.hh | 21 ------------- .../testing/testing_main.cpp | 11 ------- .../trickified_project/trickified/Makefile | 2 +- .../trickified/myproject_vars.mk | 5 ++-- test_sims.yml | 18 +++++++++-- 7 files changed, 35 insertions(+), 55 deletions(-) delete mode 100644 test/SIM_trickified/trickified_project/testing/testing.cpp delete mode 100644 test/SIM_trickified/trickified_project/testing/testing.hh delete mode 100644 test/SIM_trickified/trickified_project/testing/testing_main.cpp diff --git a/bin/trick-ify b/bin/trick-ify index 35b2bb0d..f852362e 100755 --- a/bin/trick-ify +++ b/bin/trick-ify @@ -3,8 +3,8 @@ $my_path = $0 ; $my_path =~ s/trick-ify// ; -$source_dir = "." ; # Base path to build header from. Default to working directory -$header_dir = "." ; # Base path to build source from. Default to working directory +$source_dir = "" ; # Base path to build header from. +$header_dir = "" ; # Base path to find header files. $source_make_call = "" ; # Make call to build object files $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 @@ -15,8 +15,6 @@ $full_build = 1 ; # Whet $name = "trickified" ; # Name of the library $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 $trick_home = $my_path . ".." ; # Trick directory to use for building $skip_arg = 0 ; @@ -99,11 +97,6 @@ foreach $argnum (0 .. $#ARGV) { $debug = 1 ; } - elsif($arg eq "-w") # Set working directory - { - #$work_dir = $ARGV[$argnum + 1] . "/trickify/" ; - $skip_arg = 1 ; - } elsif($arg eq "-th") # Set trick home directory { $trick_home = $ARGV[$argnum + 1] ; @@ -116,6 +109,18 @@ foreach $argnum (0 .. $#ARGV) } } +if($header_dir eq "") +{ + print "Must set a header directory\n" ; + exit 1 ; +} + +if($source_dir eq "" and $full_build) +{ + print "Must set a source directory\n" ; + exit 1 ; +} + #Set Environment Variables if ($full_build) { @@ -131,8 +136,6 @@ $ENV{'TRICKIFY_CXX_FLAGS'} = "$source_dir_args -I $trick_home" . "/include" ; $ENV{'TRICKIFY_OBJECT_NAME'} = "$name.$build_type" ; $ENV{'TRICKIFY_SOURCE'} = "$source_dir" ; $ENV{'TRICKIFY_HEADER'} = "$header_dir" ; -$ENV{'TRICKIFY_WORK_DIR'} = "$work_dir" ; -mkdir $work_dir ; if ( $build_type eq o ) { $ENV{'TRICKIFY_BUILD_TYPE'} = PLO ; @@ -165,7 +168,7 @@ if ($build_trickify_src_list and $full_build) #Build array of source files if ($full_build) { - open ($fh, "$work_dir"."trickify_src_list") or die "Could not open trickify_src_list: $!" ; + open ($fh, "trickify_src_list") or die "Could not open trickify_src_list: $!" ; @src_files ; while (my $line = <$fh>) { @@ -186,7 +189,7 @@ if ($full_build) $file = $src ; $file =~ s/\Q.cpp\E$// ; $file =~ s/\Q.c$\E$// ; - $cmd = "g++ -c $src -o $file.o" ; + $cmd = "g++ -I $trick_home" . "/include -c $src -o $file.o" ; if($debug) { print "Building obj file: $cmd\n" ; @@ -225,6 +228,5 @@ if($debug) { full_build = $full_build name = $name build_type = $build_type - work_dir = $work_dir trick_home = $trick_home\n" ; } diff --git a/test/SIM_trickified/trickified_project/testing/testing.cpp b/test/SIM_trickified/trickified_project/testing/testing.cpp deleted file mode 100644 index 6d67eb5d..00000000 --- a/test/SIM_trickified/trickified_project/testing/testing.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "testing.hh" - -test_class::test_class() : a(1), b(2), c(3) { print();print();print();print();print(); } diff --git a/test/SIM_trickified/trickified_project/testing/testing.hh b/test/SIM_trickified/trickified_project/testing/testing.hh deleted file mode 100644 index 584c80e5..00000000 --- a/test/SIM_trickified/trickified_project/testing/testing.hh +++ /dev/null @@ -1,21 +0,0 @@ -#include - -class test_class -{ - public: - - test_class(); - - void print() - { - int i = 0 ; - std::cout << "Printing Test Class: " << a+i << ", " << b+i << ", " << c+i << std::endl ; - i++ ; - } - - int a; - int b; - int c; -}; - -int some_function(); \ No newline at end of file diff --git a/test/SIM_trickified/trickified_project/testing/testing_main.cpp b/test/SIM_trickified/trickified_project/testing/testing_main.cpp deleted file mode 100644 index 116715a3..00000000 --- a/test/SIM_trickified/trickified_project/testing/testing_main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "testing.hh" - -int some_function() -{ - test_class test ; - std::cout << test.a << ", " << test.b << ", " << test.c << std::endl ; - test.print() ; - - return 0 ; - -} diff --git a/test/SIM_trickified/trickified_project/trickified/Makefile b/test/SIM_trickified/trickified_project/trickified/Makefile index 4fd5fedf..af59fc55 100644 --- a/test/SIM_trickified/trickified_project/trickified/Makefile +++ b/test/SIM_trickified/trickified_project/trickified/Makefile @@ -3,7 +3,7 @@ include $(LOCAL_DIR)/myproject_vars.mk all: @echo MAKE LOCAL_DIR $(LOCAL_DIR) - @trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b a -n trickified_myproject -v + @trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b o -n trickified_myproject -v clean: @rm -rf build python trick $(TRICKIFY_OBJECT_NAME) diff --git a/test/SIM_trickified/trickified_project/trickified/myproject_vars.mk b/test/SIM_trickified/trickified_project/trickified/myproject_vars.mk index 25e3ae8a..3f562422 100644 --- a/test/SIM_trickified/trickified_project/trickified/myproject_vars.mk +++ b/test/SIM_trickified/trickified_project/trickified/myproject_vars.mk @@ -4,15 +4,14 @@ export MYPROJECT_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..) # Specify include paths for your headers. -MYPROJECT_INCLUDE := -I$(MYPROJECT_HOME)/include +MYPROJECT_INCLUDE := -I$(MYPROJECT_HOME)/include_bar -I$(MYPROJECT_HOME)/include_foo # Users may set different flags for C and C++, so you should really modify both # to be safe. 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 diff --git a/test_sims.yml b/test_sims.yml index 16b89cf5..cefeecea 100644 --- a/test_sims.yml +++ b/test_sims.yml @@ -112,8 +112,22 @@ SIM_threads: runs: RUN_test/unit_test.py: returns: 0 -SIM_trickified: - path: test/SIM_trickified +SIM_trickified_object: + path: test/SIM_trickified_object + build_args: "-t" + binary: "T_main_{cpu}_test.exe" + runs: + RUN_test/unit_test.py: + returns: 0 +SIM_trickified_archive: + path: test/SIM_trickified_archive + build_args: "-t" + binary: "T_main_{cpu}_test.exe" + runs: + RUN_test/unit_test.py: + returns: 0 +SIM_trickified_shared: + path: test/SIM_trickified_shared build_args: "-t" binary: "T_main_{cpu}_test.exe" runs: