Checkpoint

This commit is contained in:
Patrick Herrington 2024-11-24 22:03:22 -06:00
parent f2dfa218a2
commit 7152e92d8b
7 changed files with 35 additions and 55 deletions

View File

@ -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" ;
}

View File

@ -1,3 +0,0 @@
#include "testing.hh"
test_class::test_class() : a(1), b(2), c(3) { print();print();print();print();print(); }

View File

@ -1,21 +0,0 @@
#include <iostream>
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();

View File

@ -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 ;
}

View File

@ -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)

View File

@ -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

View File

@ -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: