From be8a77236296823a197864c2d924ce3a161829c7 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 25 Nov 2024 13:21:25 -0600 Subject: [PATCH 01/31] Implmented trick-ify --- bin/trick-ify | 238 ++++++++++++++++++ share/trick/makefiles/build_trickify.py | 51 ++++ .../makefiles/build_trickify_S_source_hh.py | 10 + .../makefiles/build_trickify_obj_list.py | 10 + .../makefiles/build_trickify_src_list.py | 10 + share/trick/makefiles/trickify.mk | 15 +- test/Makefile | 13 +- test/SIM_trickified/S_overrides.mk | 2 - .../trickified_project/trickified/Makefile | 11 - .../trickified_project/trickified/S_source.hh | 2 - .../RUN_test/unit_test.py | 0 .../S_define | 0 test/SIM_trickified_archive/S_overrides.mk | 4 + .../models/Baz.hh | 0 .../trickified_project/include_bar/Bar.cpp | 9 + .../trickified_project/include_bar}/Bar.hh | 6 +- .../trickified_project/include_foo/Foo.cpp | 9 + .../trickified_project/include_foo}/Foo.hh | 4 +- .../trickified_project/trickified/.gitignore | 0 .../trickified_project/trickified/Makefile | 15 ++ .../trickified/myproject.mk | 14 ++ .../trickified/myproject_vars.mk} | 16 +- .../RUN_test/unit_test.py | 4 + test/SIM_trickified_object/S_define | 21 ++ test/SIM_trickified_object/S_overrides.mk | 4 + test/SIM_trickified_object/models/Baz.hh | 9 + .../trickified_project/include_bar/Bar.cpp | 9 + .../trickified_project/include_bar/Bar.hh | 17 ++ .../trickified_project/include_foo/Foo.cpp | 9 + .../trickified_project/include_foo/Foo.hh | 13 + .../trickified_project/trickified/.gitignore | 4 + .../trickified_project/trickified/Makefile | 15 ++ .../trickified/myproject.mk | 14 ++ .../trickified/myproject_vars.mk | 28 +++ .../RUN_test/unit_test.py | 4 + test/SIM_trickified_shared/S_define | 21 ++ test/SIM_trickified_shared/S_overrides.mk | 4 + test/SIM_trickified_shared/models/Baz.hh | 9 + .../trickified_project/include_bar/Bar.cpp | 9 + .../trickified_project/include_bar/Bar.hh | 17 ++ .../trickified_project/include_foo/Foo.cpp | 9 + .../trickified_project/include_foo/Foo.hh | 13 + .../trickified_project/trickified/.gitignore | 4 + .../trickified_project/trickified/Makefile | 15 ++ .../trickified/myproject.mk | 14 ++ .../trickified/myproject_vars.mk | 28 +++ test_sims.yml | 20 +- 47 files changed, 710 insertions(+), 43 deletions(-) create mode 100755 bin/trick-ify create mode 100644 share/trick/makefiles/build_trickify.py create mode 100644 share/trick/makefiles/build_trickify_S_source_hh.py create mode 100644 share/trick/makefiles/build_trickify_obj_list.py create mode 100644 share/trick/makefiles/build_trickify_src_list.py delete mode 100644 test/SIM_trickified/S_overrides.mk delete mode 100644 test/SIM_trickified/trickified_project/trickified/Makefile delete mode 100644 test/SIM_trickified/trickified_project/trickified/S_source.hh rename test/{SIM_trickified => SIM_trickified_archive}/RUN_test/unit_test.py (100%) rename test/{SIM_trickified => SIM_trickified_archive}/S_define (100%) create mode 100644 test/SIM_trickified_archive/S_overrides.mk rename test/{SIM_trickified => SIM_trickified_archive}/models/Baz.hh (100%) create mode 100644 test/SIM_trickified_archive/trickified_project/include_bar/Bar.cpp rename test/{SIM_trickified/trickified_project/include => SIM_trickified_archive/trickified_project/include_bar}/Bar.hh (87%) create mode 100644 test/SIM_trickified_archive/trickified_project/include_foo/Foo.cpp rename test/{SIM_trickified/trickified_project/include => SIM_trickified_archive/trickified_project/include_foo}/Foo.hh (61%) rename test/{SIM_trickified => SIM_trickified_archive}/trickified_project/trickified/.gitignore (100%) create mode 100644 test/SIM_trickified_archive/trickified_project/trickified/Makefile create mode 100644 test/SIM_trickified_archive/trickified_project/trickified/myproject.mk rename test/{SIM_trickified/trickified_project/trickified/myproject.mk => SIM_trickified_archive/trickified_project/trickified/myproject_vars.mk} (59%) create mode 100644 test/SIM_trickified_object/RUN_test/unit_test.py create mode 100644 test/SIM_trickified_object/S_define create mode 100644 test/SIM_trickified_object/S_overrides.mk create mode 100644 test/SIM_trickified_object/models/Baz.hh create mode 100644 test/SIM_trickified_object/trickified_project/include_bar/Bar.cpp create mode 100644 test/SIM_trickified_object/trickified_project/include_bar/Bar.hh create mode 100644 test/SIM_trickified_object/trickified_project/include_foo/Foo.cpp create mode 100644 test/SIM_trickified_object/trickified_project/include_foo/Foo.hh create mode 100644 test/SIM_trickified_object/trickified_project/trickified/.gitignore create mode 100644 test/SIM_trickified_object/trickified_project/trickified/Makefile create mode 100644 test/SIM_trickified_object/trickified_project/trickified/myproject.mk create mode 100644 test/SIM_trickified_object/trickified_project/trickified/myproject_vars.mk create mode 100644 test/SIM_trickified_shared/RUN_test/unit_test.py create mode 100644 test/SIM_trickified_shared/S_define create mode 100644 test/SIM_trickified_shared/S_overrides.mk create mode 100644 test/SIM_trickified_shared/models/Baz.hh create mode 100644 test/SIM_trickified_shared/trickified_project/include_bar/Bar.cpp create mode 100644 test/SIM_trickified_shared/trickified_project/include_bar/Bar.hh create mode 100644 test/SIM_trickified_shared/trickified_project/include_foo/Foo.cpp create mode 100644 test/SIM_trickified_shared/trickified_project/include_foo/Foo.hh create mode 100644 test/SIM_trickified_shared/trickified_project/trickified/.gitignore create mode 100644 test/SIM_trickified_shared/trickified_project/trickified/Makefile create mode 100644 test/SIM_trickified_shared/trickified_project/trickified/myproject.mk create mode 100644 test/SIM_trickified_shared/trickified_project/trickified/myproject_vars.mk diff --git a/bin/trick-ify b/bin/trick-ify new file mode 100755 index 000000000..9e503fc32 --- /dev/null +++ b/bin/trick-ify @@ -0,0 +1,238 @@ +#!/usr/bin/perl + +$my_path = $0 ; +$my_path =~ s/trick-ify// ; + +$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 +$source_make_args = "" ; # Args to pass into default object make +$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 = 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) +$debug = 0 ; # Debug info flag +$trick_home = $my_path . ".." ; # Trick directory to use for building + +$skip_arg = 0 ; +foreach $argnum (0 .. $#ARGV) +{ + if($skip_arg) + { + $skip_arg = 0 ; + next ; + } + + $arg = $ARGV[$argnum] ; + if($arg eq "-d") # Set both source and header directory + { + $source_dir = $ARGV[$argnum + 1] ; + $header_dir = $source_dir ; + $skip_arg = 1 ; + } + elsif($arg eq "-s") # Set source directory + { + $source_dir = $ARGV[$argnum + 1] ; + $skip_arg = 1 ; + } + elsif($arg eq "-h") # Set header directory + { + $header_dir = $ARGV[$argnum + 1] ; + $skip_arg = 1 ; + } + elsif($arg eq "-ph") # Preserve S_source.hh + { + $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 + { + $full_build = 0 ; + } + elsif($arg eq "-m") # Make call to build object files + { + $source_make_call = $ARGV[$argnum + 1] ; + $skip_arg = 1 ; + } + elsif($arg eq "-ma") # Default make call args to build object files + { + $source_make_args = $ARGV[$argnum + 1] ; + $skip_arg = 1 ; + } + elsif($arg eq "-tm") # Trickify make args + { + $trickify_make_args = $ARGV[$argnum + 1] ; + $skip_arg = 1 ; + } + elsif($arg eq "-tp") # Set trickify make path + { + $trickify_make_path = $ARGV[$argnum + 1] ; + $skip_arg = 1 ; + } + elsif($arg eq "-n") # Set the library name + { + $name = $ARGV[$argnum + 1] ; + $skip_arg = 1 ; + } + elsif($arg eq "-b") # Set library build type + { + $val = $ARGV[$argnum + 1] ; + if( ($val eq "o") or ($val eq "a") or ($val eq "so") ) + { + $build_type = $ARGV[$argnum + 1] ; + } + else + { + print "Invalid build type {$val}, valid build types are {o, a, so}\n" ; + exit 1 ; + } + $skip_arg = 1 ; + } + elsif($arg eq "-v") # Verbose, print debug info + { + $debug = 1 ; + } + elsif($arg eq "-th") # Set trick home directory + { + $trick_home = $ARGV[$argnum + 1] ; + $skip_arg = 1 ; + } + else + { + print "Unrecognized argument: $arg\n" ; + exit 1 ; + } +} + +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) +{ + $ENV{'FULL_TRICKIFY_BUILD'} = "1" ; +} +my @src_dirs = split ' ', $source_dir ; +$source_dir_arg = "" ; +foreach $dir (@src_dirs) +{ + $source_dir_arg .= "-I " . $dir . " "; +} +$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" ; +if ( $build_type eq o ) +{ + $ENV{'TRICKIFY_BUILD_TYPE'} = PLO ; +} +elsif ( $build_type eq a ) +{ + $ENV{'TRICKIFY_BUILD_TYPE'} = STATIC ; +} +elsif ( $build_type eq so ) +{ + $ENV{'TRICKIFY_BUILD_TYPE'} = SHARED ; +} + +#Build the S_source.hh +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 +if ($build_trickify_src_list and $full_build) +{ + print "Building trickify_src_list\n" ; + $make_src_list = "python3 $my_path../share/trick/makefiles/build_trickify_src_list.py" ; + print(`$make_src_list`) ; +} + +#Build array of source files +if ($full_build) +{ + open ($fh, "trickify_src_list") or die "Could not open trickify_src_list: $!" ; + @src_files ; + while (my $line = <$fh>) + { + chomp $line ; + push @src_files, $line ; + } + close (fh) ; +} + +#Build object files from source file list +if ($full_build) +{ + print "Building object files\n" ; + if($source_make_call eq "") + { + foreach $src (@src_files) + { + $file = $src ; + $file =~ s/\Q.cpp\E$// ; + $file =~ s/\Q.c$\E$// ; + $cmd = "g++ $source_make_args -I $trick_home" . "/include -c $src -o $file.o" ; + if($debug) + { + print "Building obj file: $cmd\n" ; + } + print(`$cmd`) ; + } + } + else + { + print(`$source_make_call`) ; + } +} + +#Build object file list, only if trickifying the entire library +if($build_trickify_obj_list and $full_build) +{ + print "Building trickify_obj_list\n" ; + $make_obj_list = "python3 $my_path../share/trick/makefiles/build_trickify_obj_list.py" ; + print(`$make_obj_list`) ; +} + +#Build trickify call +print "Begin Trickification...\n" ; +$trickify_make_call = "make $trickify_make_args -f $trickify_make_path" ; +print(`$trickify_make_call`) ; + +if($debug) { + print + "TRICKIFY BUILD INFO: + header_dir = $header_dir + source_dir = $source_dir_arg + source_make_call = $source_make_call + trickify_make_args = $trickify_make_args + trickify_make_path = $trickify_make_path + build_s_source = $build_s_source + full_build = $full_build + name = $name + build_type = $build_type + trick_home = $trick_home\n" ; +} diff --git a/share/trick/makefiles/build_trickify.py b/share/trick/makefiles/build_trickify.py new file mode 100644 index 000000000..897b5932c --- /dev/null +++ b/share/trick/makefiles/build_trickify.py @@ -0,0 +1,51 @@ +from pathlib import Path +import os + +def_header_ext = ["h", "hh", "hpp", "H", "hxx", "h++"] +def_src_ext = ["cpp", "c"] + +def find_files_by_extension(loc, ext): + path = Path(loc) + files = list(path.rglob(f'*.{ext}')) + return files + +def build_S_source(): + loc = "" + if "TRICKIFY_HEADER" in os.environ: + loc = os.getenv("TRICKIFY_HEADER") + dirs = loc.split() + + s_source = open("S_source.hh", 'w') + + for path in dirs: + for ext in def_header_ext: + files = find_files_by_extension(path, ext) + for i in range(len(files)): + s_source.write('#include "' + str(files[i]) + '"\n') + +def build_obj_list(): + loc = "" + if "TRICKIFY_SOURCE" in os.environ: + loc = os.getenv("TRICKIFY_SOURCE") + dirs = loc.split() + + obj_list = open("trickify_obj_list", 'w') + + for path in dirs: + files = find_files_by_extension(path, "o") + for i in range(len(files)): + obj_list.write(str(files[i]) + '\n') + +def build_src_list(): + loc = "" + if "TRICKIFY_SOURCE" in os.environ: + loc = os.getenv("TRICKIFY_SOURCE") + dirs = loc.split() + + src_list = open("trickify_src_list", 'w') + + for path in dirs: + for ext in def_src_ext: + files = find_files_by_extension(path, ext) + for i in range(len(files)): + src_list.write(str(files[i]) + '\n') diff --git a/share/trick/makefiles/build_trickify_S_source_hh.py b/share/trick/makefiles/build_trickify_S_source_hh.py new file mode 100644 index 000000000..92242d433 --- /dev/null +++ b/share/trick/makefiles/build_trickify_S_source_hh.py @@ -0,0 +1,10 @@ +import os + +path = "" +if "TRICK_HOME" in os.environ: + path = os.getenv("TRICK_HOME") +path += "/share/trick/makefiles/build_trickify.py" + +exec(open(path).read()) + +build_S_source() diff --git a/share/trick/makefiles/build_trickify_obj_list.py b/share/trick/makefiles/build_trickify_obj_list.py new file mode 100644 index 000000000..0fa24786b --- /dev/null +++ b/share/trick/makefiles/build_trickify_obj_list.py @@ -0,0 +1,10 @@ +import os + +path = "" +if "TRICK_HOME" in os.environ: + path = os.getenv("TRICK_HOME") +path += "/share/trick/makefiles/build_trickify.py" + +exec(open(path).read()) + +build_obj_list() diff --git a/share/trick/makefiles/build_trickify_src_list.py b/share/trick/makefiles/build_trickify_src_list.py new file mode 100644 index 000000000..164733d65 --- /dev/null +++ b/share/trick/makefiles/build_trickify_src_list.py @@ -0,0 +1,10 @@ +import os + +path = "" +if "TRICK_HOME" in os.environ: + path = os.getenv("TRICK_HOME") +path += "/share/trick/makefiles/build_trickify.py" + +exec(open(path).read()) + +build_src_list() diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index 68aa90e87..74c9fdcbe 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -50,6 +50,8 @@ # The file into which generated Python modules are zipped. The default # value is python (in the current directory). # +# TRICKIFY_SOURCE +# # ----------------------------------------------------------------------------- # # EXAMPLE: @@ -105,17 +107,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))Makefile.common BUILD_DIR := $(dir $(MAKE_OUT)) PY_LINK_LIST := $(BUILD_DIR)trickify_py_link_list IO_LINK_LIST := $(BUILD_DIR)trickify_io_link_list -LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) +OBJ_LINK_LIST := trickify_obj_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) TRICK_CXXFLAGS += $(TRICKIFY_CXX_FLAGS) # Ensure we can process all headers -TRICK_EXT_LIB_DIRS := $(TRICKIFY_EXT_LIB_DIRS) +TRICK_EXT_LIB_DIRS := .PHONY: all all: $(TRICKIFY_OBJECT_NAME) $(TRICKIFY_PYTHON_DIR) diff --git a/test/Makefile b/test/Makefile index f60dd2730..5f15e1e60 100644 --- a/test/Makefile +++ b/test/Makefile @@ -6,8 +6,19 @@ 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 -clean: +clean: clean_trickify rm -f $(UNIT_TEST_RESULTS) - for i in $(SIM_DIRECTORIES) ; do \ if [ -f "$$i/"[Mm]"akefile" ] ; then \ diff --git a/test/SIM_trickified/S_overrides.mk b/test/SIM_trickified/S_overrides.mk deleted file mode 100644 index ad3448327..000000000 --- a/test/SIM_trickified/S_overrides.mk +++ /dev/null @@ -1,2 +0,0 @@ -include trickified_project/trickified/myproject.mk -TRICK_CXXFLAGS += -I$(CURDIR)/models diff --git a/test/SIM_trickified/trickified_project/trickified/Makefile b/test/SIM_trickified/trickified_project/trickified/Makefile deleted file mode 100644 index ae6eb3103..000000000 --- a/test/SIM_trickified/trickified_project/trickified/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PROJECT_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..) -TRICK_HOME := $(abspath $(PROJECT_HOME)/../../..) - -export TRICKIFY_OBJECT_NAME := trickified_myproject.o -export TRICKIFY_CXX_FLAGS := -I$(PROJECT_HOME)/include -I$(TRICK_HOME)/include - -all: - @$(MAKE) -s -f $(TRICK_HOME)/share/trick/makefiles/trickify.mk - -clean: - @rm -rf build python trick $(TRICKIFY_OBJECT_NAME) diff --git a/test/SIM_trickified/trickified_project/trickified/S_source.hh b/test/SIM_trickified/trickified_project/trickified/S_source.hh deleted file mode 100644 index a6dab172f..000000000 --- a/test/SIM_trickified/trickified_project/trickified/S_source.hh +++ /dev/null @@ -1,2 +0,0 @@ -#include "Foo.hh" -#include "Bar.hh" diff --git a/test/SIM_trickified/RUN_test/unit_test.py b/test/SIM_trickified_archive/RUN_test/unit_test.py similarity index 100% rename from test/SIM_trickified/RUN_test/unit_test.py rename to test/SIM_trickified_archive/RUN_test/unit_test.py diff --git a/test/SIM_trickified/S_define b/test/SIM_trickified_archive/S_define similarity index 100% rename from test/SIM_trickified/S_define rename to test/SIM_trickified_archive/S_define diff --git a/test/SIM_trickified_archive/S_overrides.mk b/test/SIM_trickified_archive/S_overrides.mk new file mode 100644 index 000000000..e17d8690e --- /dev/null +++ b/test/SIM_trickified_archive/S_overrides.mk @@ -0,0 +1,4 @@ +LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) + +TRICK_CXXFLAGS += -I$(LOCAL_DIR)/models +include $(CURDIR)/trickified_project/trickified/myproject.mk diff --git a/test/SIM_trickified/models/Baz.hh b/test/SIM_trickified_archive/models/Baz.hh similarity index 100% rename from test/SIM_trickified/models/Baz.hh rename to test/SIM_trickified_archive/models/Baz.hh diff --git a/test/SIM_trickified_archive/trickified_project/include_bar/Bar.cpp b/test/SIM_trickified_archive/trickified_project/include_bar/Bar.cpp new file mode 100644 index 000000000..55a07a844 --- /dev/null +++ b/test/SIM_trickified_archive/trickified_project/include_bar/Bar.cpp @@ -0,0 +1,9 @@ +// @trick_parse{everything} + +#include "Bar.hh" + + +void Bar::add() {} +void Bar::remove() {} +void Bar::restart() {} + diff --git a/test/SIM_trickified/trickified_project/include/Bar.hh b/test/SIM_trickified_archive/trickified_project/include_bar/Bar.hh similarity index 87% rename from test/SIM_trickified/trickified_project/include/Bar.hh rename to test/SIM_trickified_archive/trickified_project/include_bar/Bar.hh index 5640bfb02..5c4972624 100644 --- a/test/SIM_trickified/trickified_project/include/Bar.hh +++ b/test/SIM_trickified_archive/trickified_project/include_bar/Bar.hh @@ -10,8 +10,8 @@ class Bar : public Trick::Event { int process(long long) {return 0;} - void add() {} - void remove() {} - void restart() {} + void add(); + void remove(); + void restart(); }; diff --git a/test/SIM_trickified_archive/trickified_project/include_foo/Foo.cpp b/test/SIM_trickified_archive/trickified_project/include_foo/Foo.cpp new file mode 100644 index 000000000..f8c4fe602 --- /dev/null +++ b/test/SIM_trickified_archive/trickified_project/include_foo/Foo.cpp @@ -0,0 +1,9 @@ +// @trick_parse{everything} + +#include "Foo.hh" + + + +void Foo::foo() { + std::cout << i++ << '\n'; +} diff --git a/test/SIM_trickified/trickified_project/include/Foo.hh b/test/SIM_trickified_archive/trickified_project/include_foo/Foo.hh similarity index 61% rename from test/SIM_trickified/trickified_project/include/Foo.hh rename to test/SIM_trickified_archive/trickified_project/include_foo/Foo.hh index be7e761a2..a29d07194 100644 --- a/test/SIM_trickified/trickified_project/include/Foo.hh +++ b/test/SIM_trickified_archive/trickified_project/include_foo/Foo.hh @@ -8,8 +8,6 @@ class Foo { int i; - void foo() { - std::cout << i++ << '\n'; - } + void foo(); }; diff --git a/test/SIM_trickified/trickified_project/trickified/.gitignore b/test/SIM_trickified_archive/trickified_project/trickified/.gitignore similarity index 100% rename from test/SIM_trickified/trickified_project/trickified/.gitignore rename to test/SIM_trickified_archive/trickified_project/trickified/.gitignore diff --git a/test/SIM_trickified_archive/trickified_project/trickified/Makefile b/test/SIM_trickified_archive/trickified_project/trickified/Makefile new file mode 100644 index 000000000..4cf635735 --- /dev/null +++ b/test/SIM_trickified_archive/trickified_project/trickified/Makefile @@ -0,0 +1,15 @@ +LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +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 + +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 S_source.hh + @rm -rf ../include_foo/*.o + @rm -rf ../include_bar/*.o diff --git a/test/SIM_trickified_archive/trickified_project/trickified/myproject.mk b/test/SIM_trickified_archive/trickified_project/trickified/myproject.mk new file mode 100644 index 000000000..f2f61e8f9 --- /dev/null +++ b/test/SIM_trickified_archive/trickified_project/trickified/myproject.mk @@ -0,0 +1,14 @@ +LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) + +include $(LOCAL_DIR)/myproject_vars.mk + +# Append a prerequisite to the $(SWIG_SRC) target. This will build the +# Trickified library along with the sim if it does not already exist. Using +# $(SWIG_SRC) ensures that all Trickified .i files are created before SWIG is +# run on any simulation .i files, which may %import them. Note that this does +# NOT cause the Trickified library to be rebuilt if it already exists, even if +# the Trickified source code has changed. +$(SWIG_SRC): $(MYPROJECT_TRICK) + +$(MYPROJECT_TRICK): + @$(MAKE) -s -C $(MYPROJECT_HOME)/trickified diff --git a/test/SIM_trickified/trickified_project/trickified/myproject.mk b/test/SIM_trickified_archive/trickified_project/trickified/myproject_vars.mk similarity index 59% rename from test/SIM_trickified/trickified_project/trickified/myproject.mk rename to test/SIM_trickified_archive/trickified_project/trickified/myproject_vars.mk index 7abe9af1e..4454d8a71 100644 --- a/test/SIM_trickified/trickified_project/trickified/myproject.mk +++ b/test/SIM_trickified_archive/trickified_project/trickified/myproject_vars.mk @@ -4,14 +4,15 @@ 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) -MYPROJECT_TRICK := $(MYPROJECT_HOME)/trickified/trickified_myproject.o +export TRICKIFY_OBJECT_NAME := trickified_myproject.a +MYPROJECT_TRICK := $(MYPROJECT_HOME)/trickified/$(TRICKIFY_OBJECT_NAME) # Tell Trick the headers and source at this location are part of a # Trickified project @@ -25,14 +26,3 @@ TRICK_SWIG_FLAGS += -I$(MYPROJECT_HOME)/trickified # Link in the Trickified object TRICK_LDFLAGS += $(MYPROJECT_TRICK) - -# Append a prerequisite to the $(SWIG_SRC) target. This will build the -# Trickified library along with the sim if it does not already exist. Using -# $(SWIG_SRC) ensures that all Trickified .i files are created before SWIG is -# run on any simulation .i files, which may %import them. Note that this does -# NOT cause the Trickified library to be rebuilt if it already exists, even if -# the Trickified source code has changed. -$(SWIG_SRC): $(MYPROJECT_TRICK) - -$(MYPROJECT_TRICK): - @$(MAKE) -s -C $(MYPROJECT_HOME)/trickified diff --git a/test/SIM_trickified_object/RUN_test/unit_test.py b/test/SIM_trickified_object/RUN_test/unit_test.py new file mode 100644 index 000000000..f74fee0bf --- /dev/null +++ b/test/SIM_trickified_object/RUN_test/unit_test.py @@ -0,0 +1,4 @@ +sandbox.foo.i = 5 +assert sandbox.foo.i == 5 +foo = trick.Foo() +trick.stop(10) diff --git a/test/SIM_trickified_object/S_define b/test/SIM_trickified_object/S_define new file mode 100644 index 000000000..f770e2a73 --- /dev/null +++ b/test/SIM_trickified_object/S_define @@ -0,0 +1,21 @@ +#include "sim_objects/default_trick_sys.sm" +##include "Foo.hh" +##include "Bar.hh" +##include "Baz.hh" + +class Sandbox : public Trick::SimObject { + + public: + + Foo foo; + Bar bar; + Baz baz; + + Sandbox() { + (1, "scheduled") foo.foo(); + } + +}; + + +Sandbox sandbox; diff --git a/test/SIM_trickified_object/S_overrides.mk b/test/SIM_trickified_object/S_overrides.mk new file mode 100644 index 000000000..e17d8690e --- /dev/null +++ b/test/SIM_trickified_object/S_overrides.mk @@ -0,0 +1,4 @@ +LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) + +TRICK_CXXFLAGS += -I$(LOCAL_DIR)/models +include $(CURDIR)/trickified_project/trickified/myproject.mk diff --git a/test/SIM_trickified_object/models/Baz.hh b/test/SIM_trickified_object/models/Baz.hh new file mode 100644 index 000000000..fc91c1b21 --- /dev/null +++ b/test/SIM_trickified_object/models/Baz.hh @@ -0,0 +1,9 @@ +// @trick_parse{everything} + +class Baz { + + public: + int i; + int j; + +}; diff --git a/test/SIM_trickified_object/trickified_project/include_bar/Bar.cpp b/test/SIM_trickified_object/trickified_project/include_bar/Bar.cpp new file mode 100644 index 000000000..55a07a844 --- /dev/null +++ b/test/SIM_trickified_object/trickified_project/include_bar/Bar.cpp @@ -0,0 +1,9 @@ +// @trick_parse{everything} + +#include "Bar.hh" + + +void Bar::add() {} +void Bar::remove() {} +void Bar::restart() {} + diff --git a/test/SIM_trickified_object/trickified_project/include_bar/Bar.hh b/test/SIM_trickified_object/trickified_project/include_bar/Bar.hh new file mode 100644 index 000000000..5c4972624 --- /dev/null +++ b/test/SIM_trickified_object/trickified_project/include_bar/Bar.hh @@ -0,0 +1,17 @@ +// @trick_parse{everything} + +#include "trick/Event.hh" + +/** + * Induce an `%import sim_services` statement in this class's Python module by inheriting from a + * Trick class. This allows us to test if `sys.path` contains the correct path to `sim_services.py` + * (and other modules generated during a sim build) for Trickified projects. + */ +class Bar : public Trick::Event { + + int process(long long) {return 0;} + void add(); + void remove(); + void restart(); + +}; diff --git a/test/SIM_trickified_object/trickified_project/include_foo/Foo.cpp b/test/SIM_trickified_object/trickified_project/include_foo/Foo.cpp new file mode 100644 index 000000000..f8c4fe602 --- /dev/null +++ b/test/SIM_trickified_object/trickified_project/include_foo/Foo.cpp @@ -0,0 +1,9 @@ +// @trick_parse{everything} + +#include "Foo.hh" + + + +void Foo::foo() { + std::cout << i++ << '\n'; +} diff --git a/test/SIM_trickified_object/trickified_project/include_foo/Foo.hh b/test/SIM_trickified_object/trickified_project/include_foo/Foo.hh new file mode 100644 index 000000000..a29d07194 --- /dev/null +++ b/test/SIM_trickified_object/trickified_project/include_foo/Foo.hh @@ -0,0 +1,13 @@ +// @trick_parse{everything} + +#include + +class Foo { + + public: + + int i; + + void foo(); + +}; diff --git a/test/SIM_trickified_object/trickified_project/trickified/.gitignore b/test/SIM_trickified_object/trickified_project/trickified/.gitignore new file mode 100644 index 000000000..0259157ce --- /dev/null +++ b/test/SIM_trickified_object/trickified_project/trickified/.gitignore @@ -0,0 +1,4 @@ +build +python +trick +*.o diff --git a/test/SIM_trickified_object/trickified_project/trickified/Makefile b/test/SIM_trickified_object/trickified_project/trickified/Makefile new file mode 100644 index 000000000..f087848ed --- /dev/null +++ b/test/SIM_trickified_object/trickified_project/trickified/Makefile @@ -0,0 +1,15 @@ +LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +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 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 S_source.hh + @rm -rf ../include_foo/*.o + @rm -rf ../include_bar/*.o diff --git a/test/SIM_trickified_object/trickified_project/trickified/myproject.mk b/test/SIM_trickified_object/trickified_project/trickified/myproject.mk new file mode 100644 index 000000000..f2f61e8f9 --- /dev/null +++ b/test/SIM_trickified_object/trickified_project/trickified/myproject.mk @@ -0,0 +1,14 @@ +LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) + +include $(LOCAL_DIR)/myproject_vars.mk + +# Append a prerequisite to the $(SWIG_SRC) target. This will build the +# Trickified library along with the sim if it does not already exist. Using +# $(SWIG_SRC) ensures that all Trickified .i files are created before SWIG is +# run on any simulation .i files, which may %import them. Note that this does +# NOT cause the Trickified library to be rebuilt if it already exists, even if +# the Trickified source code has changed. +$(SWIG_SRC): $(MYPROJECT_TRICK) + +$(MYPROJECT_TRICK): + @$(MAKE) -s -C $(MYPROJECT_HOME)/trickified diff --git a/test/SIM_trickified_object/trickified_project/trickified/myproject_vars.mk b/test/SIM_trickified_object/trickified_project/trickified/myproject_vars.mk new file mode 100644 index 000000000..3f5624226 --- /dev/null +++ b/test/SIM_trickified_object/trickified_project/trickified/myproject_vars.mk @@ -0,0 +1,28 @@ +# We know this file's position relative to the root directory of the project, +# and MAKEFILE_LIST will give us the full path to this file no matter where the +# user has installed this project. +export MYPROJECT_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..) + +# Specify include paths for your headers. +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_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 +# Trickified project +TRICK_EXT_LIB_DIRS += :$(MYPROJECT_HOME) + +# Tell Trick where to find the Python modules generated by SWIG +TRICK_PYTHON_PATH += :$(MYPROJECT_HOME)/trickified/python + +# Tell SWIG where to find py_*.i files +TRICK_SWIG_FLAGS += -I$(MYPROJECT_HOME)/trickified + +# Link in the Trickified object +TRICK_LDFLAGS += $(MYPROJECT_TRICK) diff --git a/test/SIM_trickified_shared/RUN_test/unit_test.py b/test/SIM_trickified_shared/RUN_test/unit_test.py new file mode 100644 index 000000000..f74fee0bf --- /dev/null +++ b/test/SIM_trickified_shared/RUN_test/unit_test.py @@ -0,0 +1,4 @@ +sandbox.foo.i = 5 +assert sandbox.foo.i == 5 +foo = trick.Foo() +trick.stop(10) diff --git a/test/SIM_trickified_shared/S_define b/test/SIM_trickified_shared/S_define new file mode 100644 index 000000000..f770e2a73 --- /dev/null +++ b/test/SIM_trickified_shared/S_define @@ -0,0 +1,21 @@ +#include "sim_objects/default_trick_sys.sm" +##include "Foo.hh" +##include "Bar.hh" +##include "Baz.hh" + +class Sandbox : public Trick::SimObject { + + public: + + Foo foo; + Bar bar; + Baz baz; + + Sandbox() { + (1, "scheduled") foo.foo(); + } + +}; + + +Sandbox sandbox; diff --git a/test/SIM_trickified_shared/S_overrides.mk b/test/SIM_trickified_shared/S_overrides.mk new file mode 100644 index 000000000..e17d8690e --- /dev/null +++ b/test/SIM_trickified_shared/S_overrides.mk @@ -0,0 +1,4 @@ +LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) + +TRICK_CXXFLAGS += -I$(LOCAL_DIR)/models +include $(CURDIR)/trickified_project/trickified/myproject.mk diff --git a/test/SIM_trickified_shared/models/Baz.hh b/test/SIM_trickified_shared/models/Baz.hh new file mode 100644 index 000000000..fc91c1b21 --- /dev/null +++ b/test/SIM_trickified_shared/models/Baz.hh @@ -0,0 +1,9 @@ +// @trick_parse{everything} + +class Baz { + + public: + int i; + int j; + +}; diff --git a/test/SIM_trickified_shared/trickified_project/include_bar/Bar.cpp b/test/SIM_trickified_shared/trickified_project/include_bar/Bar.cpp new file mode 100644 index 000000000..55a07a844 --- /dev/null +++ b/test/SIM_trickified_shared/trickified_project/include_bar/Bar.cpp @@ -0,0 +1,9 @@ +// @trick_parse{everything} + +#include "Bar.hh" + + +void Bar::add() {} +void Bar::remove() {} +void Bar::restart() {} + diff --git a/test/SIM_trickified_shared/trickified_project/include_bar/Bar.hh b/test/SIM_trickified_shared/trickified_project/include_bar/Bar.hh new file mode 100644 index 000000000..5c4972624 --- /dev/null +++ b/test/SIM_trickified_shared/trickified_project/include_bar/Bar.hh @@ -0,0 +1,17 @@ +// @trick_parse{everything} + +#include "trick/Event.hh" + +/** + * Induce an `%import sim_services` statement in this class's Python module by inheriting from a + * Trick class. This allows us to test if `sys.path` contains the correct path to `sim_services.py` + * (and other modules generated during a sim build) for Trickified projects. + */ +class Bar : public Trick::Event { + + int process(long long) {return 0;} + void add(); + void remove(); + void restart(); + +}; diff --git a/test/SIM_trickified_shared/trickified_project/include_foo/Foo.cpp b/test/SIM_trickified_shared/trickified_project/include_foo/Foo.cpp new file mode 100644 index 000000000..f8c4fe602 --- /dev/null +++ b/test/SIM_trickified_shared/trickified_project/include_foo/Foo.cpp @@ -0,0 +1,9 @@ +// @trick_parse{everything} + +#include "Foo.hh" + + + +void Foo::foo() { + std::cout << i++ << '\n'; +} diff --git a/test/SIM_trickified_shared/trickified_project/include_foo/Foo.hh b/test/SIM_trickified_shared/trickified_project/include_foo/Foo.hh new file mode 100644 index 000000000..a29d07194 --- /dev/null +++ b/test/SIM_trickified_shared/trickified_project/include_foo/Foo.hh @@ -0,0 +1,13 @@ +// @trick_parse{everything} + +#include + +class Foo { + + public: + + int i; + + void foo(); + +}; diff --git a/test/SIM_trickified_shared/trickified_project/trickified/.gitignore b/test/SIM_trickified_shared/trickified_project/trickified/.gitignore new file mode 100644 index 000000000..0259157ce --- /dev/null +++ b/test/SIM_trickified_shared/trickified_project/trickified/.gitignore @@ -0,0 +1,4 @@ +build +python +trick +*.o diff --git a/test/SIM_trickified_shared/trickified_project/trickified/Makefile b/test/SIM_trickified_shared/trickified_project/trickified/Makefile new file mode 100644 index 000000000..f40134411 --- /dev/null +++ b/test/SIM_trickified_shared/trickified_project/trickified/Makefile @@ -0,0 +1,15 @@ +LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +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 so -n trickified_myproject -v -ma "-fPIC" + +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 S_source.hh + @rm -rf ../include_foo/*.o + @rm -rf ../include_bar/*.o diff --git a/test/SIM_trickified_shared/trickified_project/trickified/myproject.mk b/test/SIM_trickified_shared/trickified_project/trickified/myproject.mk new file mode 100644 index 000000000..f2f61e8f9 --- /dev/null +++ b/test/SIM_trickified_shared/trickified_project/trickified/myproject.mk @@ -0,0 +1,14 @@ +LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) + +include $(LOCAL_DIR)/myproject_vars.mk + +# Append a prerequisite to the $(SWIG_SRC) target. This will build the +# Trickified library along with the sim if it does not already exist. Using +# $(SWIG_SRC) ensures that all Trickified .i files are created before SWIG is +# run on any simulation .i files, which may %import them. Note that this does +# NOT cause the Trickified library to be rebuilt if it already exists, even if +# the Trickified source code has changed. +$(SWIG_SRC): $(MYPROJECT_TRICK) + +$(MYPROJECT_TRICK): + @$(MAKE) -s -C $(MYPROJECT_HOME)/trickified diff --git a/test/SIM_trickified_shared/trickified_project/trickified/myproject_vars.mk b/test/SIM_trickified_shared/trickified_project/trickified/myproject_vars.mk new file mode 100644 index 000000000..8f3a556b0 --- /dev/null +++ b/test/SIM_trickified_shared/trickified_project/trickified/myproject_vars.mk @@ -0,0 +1,28 @@ +# We know this file's position relative to the root directory of the project, +# and MAKEFILE_LIST will give us the full path to this file no matter where the +# user has installed this project. +export MYPROJECT_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..) + +# Specify include paths for your headers. +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_OBJECT_NAME := trickified_myproject.so +MYPROJECT_TRICK := $(MYPROJECT_HOME)/trickified/$(TRICKIFY_OBJECT_NAME) + +# Tell Trick the headers and source at this location are part of a +# Trickified project +TRICK_EXT_LIB_DIRS += :$(MYPROJECT_HOME) + +# Tell Trick where to find the Python modules generated by SWIG +TRICK_PYTHON_PATH += :$(MYPROJECT_HOME)/trickified/python + +# Tell SWIG where to find py_*.i files +TRICK_SWIG_FLAGS += -I$(MYPROJECT_HOME)/trickified + +# Link in the Trickified object +TRICK_LDFLAGS += $(MYPROJECT_TRICK) diff --git a/test_sims.yml b/test_sims.yml index a6f56dea9..cefeeceac 100644 --- a/test_sims.yml +++ b/test_sims.yml @@ -21,8 +21,6 @@ SIM_parse_s_define: path: test/SIM_parse_s_define SIM_target_specific_variables: path: test/SIM_target_specific_variables -SIM_swig_template_scoping: - path: test/SIM_swig_template_scoping SIM_test_abstract: path: test/SIM_test_abstract SIM_test_inherit: @@ -114,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: From ba693dc6426141bbdf69887d9066a977f708ba16 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 25 Nov 2024 13:46:03 -0600 Subject: [PATCH 02/31] Cleaning up code --- bin/trick-ify | 2 +- share/trick/makefiles/trickify.mk | 4 +--- test/Makefile | 6 +++--- .../trickified_project/include_bar/Bar.cpp | 2 -- .../trickified_project/include_foo/Foo.cpp | 2 -- .../trickified_project/include_bar/Bar.cpp | 2 -- .../trickified_project/include_foo/Foo.cpp | 2 -- .../trickified_project/include_bar/Bar.cpp | 2 -- .../trickified_project/include_foo/Foo.cpp | 2 -- test_sims.yml | 2 ++ 10 files changed, 7 insertions(+), 19 deletions(-) diff --git a/bin/trick-ify b/bin/trick-ify index 9e503fc32..039c18d92 100755 --- a/bin/trick-ify +++ b/bin/trick-ify @@ -3,7 +3,7 @@ $my_path = $0 ; $my_path =~ s/trick-ify// ; -$source_dir = "" ; # Base path to build header from +$source_dir = "" ; # Base path to build source from $header_dir = "" ; # Base path to find header files $source_make_call = "" ; # Make call to build object files $source_make_args = "" ; # Args to pass into default object make diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index 74c9fdcbe..a0de4be6d 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -50,8 +50,6 @@ # The file into which generated Python modules are zipped. The default # value is python (in the current directory). # -# TRICKIFY_SOURCE -# # ----------------------------------------------------------------------------- # # EXAMPLE: @@ -122,7 +120,7 @@ TRICK_CFLAGS += $(TRICKIFY_CXX_FLAGS) TRICK_CXXFLAGS += $(TRICKIFY_CXX_FLAGS) # Ensure we can process all headers -TRICK_EXT_LIB_DIRS := +TRICK_EXT_LIB_DIRS := $(TRICKIFY_EXT_LIB_DIRS) .PHONY: all all: $(TRICKIFY_OBJECT_NAME) $(TRICKIFY_PYTHON_DIR) diff --git a/test/Makefile b/test/Makefile index 5f15e1e60..da0b999fd 100644 --- a/test/Makefile +++ b/test/Makefile @@ -6,9 +6,9 @@ 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 +# The auto-generated makefile for each test does not know to call other makefiles the developer may have included. +# Developer 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 \ diff --git a/test/SIM_trickified_archive/trickified_project/include_bar/Bar.cpp b/test/SIM_trickified_archive/trickified_project/include_bar/Bar.cpp index 55a07a844..b46af6616 100644 --- a/test/SIM_trickified_archive/trickified_project/include_bar/Bar.cpp +++ b/test/SIM_trickified_archive/trickified_project/include_bar/Bar.cpp @@ -1,5 +1,3 @@ -// @trick_parse{everything} - #include "Bar.hh" diff --git a/test/SIM_trickified_archive/trickified_project/include_foo/Foo.cpp b/test/SIM_trickified_archive/trickified_project/include_foo/Foo.cpp index f8c4fe602..115138369 100644 --- a/test/SIM_trickified_archive/trickified_project/include_foo/Foo.cpp +++ b/test/SIM_trickified_archive/trickified_project/include_foo/Foo.cpp @@ -1,5 +1,3 @@ -// @trick_parse{everything} - #include "Foo.hh" diff --git a/test/SIM_trickified_object/trickified_project/include_bar/Bar.cpp b/test/SIM_trickified_object/trickified_project/include_bar/Bar.cpp index 55a07a844..b46af6616 100644 --- a/test/SIM_trickified_object/trickified_project/include_bar/Bar.cpp +++ b/test/SIM_trickified_object/trickified_project/include_bar/Bar.cpp @@ -1,5 +1,3 @@ -// @trick_parse{everything} - #include "Bar.hh" diff --git a/test/SIM_trickified_object/trickified_project/include_foo/Foo.cpp b/test/SIM_trickified_object/trickified_project/include_foo/Foo.cpp index f8c4fe602..115138369 100644 --- a/test/SIM_trickified_object/trickified_project/include_foo/Foo.cpp +++ b/test/SIM_trickified_object/trickified_project/include_foo/Foo.cpp @@ -1,5 +1,3 @@ -// @trick_parse{everything} - #include "Foo.hh" diff --git a/test/SIM_trickified_shared/trickified_project/include_bar/Bar.cpp b/test/SIM_trickified_shared/trickified_project/include_bar/Bar.cpp index 55a07a844..b46af6616 100644 --- a/test/SIM_trickified_shared/trickified_project/include_bar/Bar.cpp +++ b/test/SIM_trickified_shared/trickified_project/include_bar/Bar.cpp @@ -1,5 +1,3 @@ -// @trick_parse{everything} - #include "Bar.hh" diff --git a/test/SIM_trickified_shared/trickified_project/include_foo/Foo.cpp b/test/SIM_trickified_shared/trickified_project/include_foo/Foo.cpp index f8c4fe602..115138369 100644 --- a/test/SIM_trickified_shared/trickified_project/include_foo/Foo.cpp +++ b/test/SIM_trickified_shared/trickified_project/include_foo/Foo.cpp @@ -1,5 +1,3 @@ -// @trick_parse{everything} - #include "Foo.hh" diff --git a/test_sims.yml b/test_sims.yml index cefeeceac..d0ec3077d 100644 --- a/test_sims.yml +++ b/test_sims.yml @@ -21,6 +21,8 @@ SIM_parse_s_define: path: test/SIM_parse_s_define SIM_target_specific_variables: path: test/SIM_target_specific_variables +SIM_swig_template_scoping: + path: test/SIM_swig_template_scoping SIM_test_abstract: path: test/SIM_test_abstract SIM_test_inherit: From 1e7f5db6390ad31cd3cb1371893b8942a37ddd84 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 25 Nov 2024 14:31:01 -0600 Subject: [PATCH 03/31] CI Fix --- .../trickified_project/trickified/Makefile | 3 ++- .../trickified_project/trickified/Makefile | 3 ++- .../trickified_project/trickified/Makefile | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/SIM_trickified_archive/trickified_project/trickified/Makefile b/test/SIM_trickified_archive/trickified_project/trickified/Makefile index 4cf635735..d7f088015 100644 --- a/test/SIM_trickified_archive/trickified_project/trickified/Makefile +++ b/test/SIM_trickified_archive/trickified_project/trickified/Makefile @@ -1,9 +1,10 @@ LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +TRICK_HOME := $(abspath $(LOCAL_DIR)/../../../..) 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_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b a -n trickified_myproject -v clean: @rm -rf build python trick $(TRICKIFY_OBJECT_NAME) diff --git a/test/SIM_trickified_object/trickified_project/trickified/Makefile b/test/SIM_trickified_object/trickified_project/trickified/Makefile index f087848ed..5a1c7c56d 100644 --- a/test/SIM_trickified_object/trickified_project/trickified/Makefile +++ b/test/SIM_trickified_object/trickified_project/trickified/Makefile @@ -1,9 +1,10 @@ LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +TRICK_HOME := $(abspath $(LOCAL_DIR)/../../../..) 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 o -n trickified_myproject -v + @$(TRICK_HOME)/bin/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_shared/trickified_project/trickified/Makefile b/test/SIM_trickified_shared/trickified_project/trickified/Makefile index f40134411..227112b17 100644 --- a/test/SIM_trickified_shared/trickified_project/trickified/Makefile +++ b/test/SIM_trickified_shared/trickified_project/trickified/Makefile @@ -1,9 +1,10 @@ LOCAL_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +TRICK_HOME := $(abspath $(LOCAL_DIR)/../../../..) 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 so -n trickified_myproject -v -ma "-fPIC" + @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b so -n trickified_myproject -v -ma "-fPIC" clean: @rm -rf build python trick $(TRICKIFY_OBJECT_NAME) From 377e8c8647d6e44d59513e52a5ed175942b08717 Mon Sep 17 00:00:00 2001 From: Patrick Herrington Date: Tue, 26 Nov 2024 12:23:10 -0600 Subject: [PATCH 04/31] Shared library test fix --- .../trickified_project/trickified/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/SIM_trickified_shared/trickified_project/trickified/Makefile b/test/SIM_trickified_shared/trickified_project/trickified/Makefile index 227112b17..95d9d2500 100644 --- a/test/SIM_trickified_shared/trickified_project/trickified/Makefile +++ b/test/SIM_trickified_shared/trickified_project/trickified/Makefile @@ -4,7 +4,7 @@ include $(LOCAL_DIR)/myproject_vars.mk all: @echo MAKE LOCAL_DIR $(LOCAL_DIR) - @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b so -n trickified_myproject -v -ma "-fPIC" + @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b so -n trickified_myproject -v -ma "-fPIC -fvisibility=default" clean: @rm -rf build python trick $(TRICKIFY_OBJECT_NAME) From d290eebdd6e879abfcb1faf18113b7b8886a8ac8 Mon Sep 17 00:00:00 2001 From: Patrick Herrington Date: Tue, 26 Nov 2024 15:00:06 -0600 Subject: [PATCH 05/31] CI Fix --- .../trickified_project/trickified/Makefile | 2 +- .../trickified_project/trickified/myproject_vars.mk | 2 +- .../trickified_project/trickified/Makefile | 2 +- .../trickified_project/trickified/myproject_vars.mk | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/SIM_trickified_archive/trickified_project/trickified/Makefile b/test/SIM_trickified_archive/trickified_project/trickified/Makefile index d7f088015..5a1c7c56d 100644 --- a/test/SIM_trickified_archive/trickified_project/trickified/Makefile +++ b/test/SIM_trickified_archive/trickified_project/trickified/Makefile @@ -4,7 +4,7 @@ include $(LOCAL_DIR)/myproject_vars.mk all: @echo MAKE LOCAL_DIR $(LOCAL_DIR) - @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b a -n trickified_myproject -v + @$(TRICK_HOME)/bin/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_archive/trickified_project/trickified/myproject_vars.mk b/test/SIM_trickified_archive/trickified_project/trickified/myproject_vars.mk index 4454d8a71..3f5624226 100644 --- a/test/SIM_trickified_archive/trickified_project/trickified/myproject_vars.mk +++ b/test/SIM_trickified_archive/trickified_project/trickified/myproject_vars.mk @@ -11,7 +11,7 @@ MYPROJECT_INCLUDE := -I$(MYPROJECT_HOME)/include_bar -I$(MYPROJECT_HOME)/include TRICK_CFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE) TRICK_CXXFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE) -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/SIM_trickified_shared/trickified_project/trickified/Makefile b/test/SIM_trickified_shared/trickified_project/trickified/Makefile index 95d9d2500..e5341c6e4 100644 --- a/test/SIM_trickified_shared/trickified_project/trickified/Makefile +++ b/test/SIM_trickified_shared/trickified_project/trickified/Makefile @@ -4,7 +4,7 @@ include $(LOCAL_DIR)/myproject_vars.mk all: @echo MAKE LOCAL_DIR $(LOCAL_DIR) - @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b so -n trickified_myproject -v -ma "-fPIC -fvisibility=default" + @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b o -n trickified_myproject -v -ma "-fPIC -fvisibility=default" clean: @rm -rf build python trick $(TRICKIFY_OBJECT_NAME) diff --git a/test/SIM_trickified_shared/trickified_project/trickified/myproject_vars.mk b/test/SIM_trickified_shared/trickified_project/trickified/myproject_vars.mk index 8f3a556b0..3f5624226 100644 --- a/test/SIM_trickified_shared/trickified_project/trickified/myproject_vars.mk +++ b/test/SIM_trickified_shared/trickified_project/trickified/myproject_vars.mk @@ -11,7 +11,7 @@ MYPROJECT_INCLUDE := -I$(MYPROJECT_HOME)/include_bar -I$(MYPROJECT_HOME)/include TRICK_CFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE) TRICK_CXXFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE) -export TRICKIFY_OBJECT_NAME := trickified_myproject.so +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 From 8afa83a60eb6edddcbdd353c1c59b6c3ed6e4527 Mon Sep 17 00:00:00 2001 From: Patrick Herrington Date: Tue, 26 Nov 2024 15:44:16 -0600 Subject: [PATCH 06/31] CI Fix --- .../trickified_project/trickified/Makefile | 2 +- .../trickified_project/trickified/myproject_vars.mk | 2 +- .../trickified_project/trickified/Makefile | 2 +- .../trickified_project/trickified/myproject_vars.mk | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/SIM_trickified_archive/trickified_project/trickified/Makefile b/test/SIM_trickified_archive/trickified_project/trickified/Makefile index 5a1c7c56d..d7f088015 100644 --- a/test/SIM_trickified_archive/trickified_project/trickified/Makefile +++ b/test/SIM_trickified_archive/trickified_project/trickified/Makefile @@ -4,7 +4,7 @@ include $(LOCAL_DIR)/myproject_vars.mk all: @echo MAKE LOCAL_DIR $(LOCAL_DIR) - @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b o -n trickified_myproject -v + @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b a -n trickified_myproject -v clean: @rm -rf build python trick $(TRICKIFY_OBJECT_NAME) diff --git a/test/SIM_trickified_archive/trickified_project/trickified/myproject_vars.mk b/test/SIM_trickified_archive/trickified_project/trickified/myproject_vars.mk index 3f5624226..4454d8a71 100644 --- a/test/SIM_trickified_archive/trickified_project/trickified/myproject_vars.mk +++ b/test/SIM_trickified_archive/trickified_project/trickified/myproject_vars.mk @@ -11,7 +11,7 @@ MYPROJECT_INCLUDE := -I$(MYPROJECT_HOME)/include_bar -I$(MYPROJECT_HOME)/include TRICK_CFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE) TRICK_CXXFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE) -export TRICKIFY_OBJECT_NAME := trickified_myproject.o +export TRICKIFY_OBJECT_NAME := trickified_myproject.a 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/SIM_trickified_shared/trickified_project/trickified/Makefile b/test/SIM_trickified_shared/trickified_project/trickified/Makefile index e5341c6e4..95d9d2500 100644 --- a/test/SIM_trickified_shared/trickified_project/trickified/Makefile +++ b/test/SIM_trickified_shared/trickified_project/trickified/Makefile @@ -4,7 +4,7 @@ include $(LOCAL_DIR)/myproject_vars.mk all: @echo MAKE LOCAL_DIR $(LOCAL_DIR) - @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b o -n trickified_myproject -v -ma "-fPIC -fvisibility=default" + @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b so -n trickified_myproject -v -ma "-fPIC -fvisibility=default" clean: @rm -rf build python trick $(TRICKIFY_OBJECT_NAME) diff --git a/test/SIM_trickified_shared/trickified_project/trickified/myproject_vars.mk b/test/SIM_trickified_shared/trickified_project/trickified/myproject_vars.mk index 3f5624226..8f3a556b0 100644 --- a/test/SIM_trickified_shared/trickified_project/trickified/myproject_vars.mk +++ b/test/SIM_trickified_shared/trickified_project/trickified/myproject_vars.mk @@ -11,7 +11,7 @@ MYPROJECT_INCLUDE := -I$(MYPROJECT_HOME)/include_bar -I$(MYPROJECT_HOME)/include TRICK_CFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE) TRICK_CXXFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE) -export TRICKIFY_OBJECT_NAME := trickified_myproject.o +export TRICKIFY_OBJECT_NAME := trickified_myproject.so MYPROJECT_TRICK := $(MYPROJECT_HOME)/trickified/$(TRICKIFY_OBJECT_NAME) # Tell Trick the headers and source at this location are part of a From 973a473c0ea135c0bf922e2c0fb0f80877d7091a Mon Sep 17 00:00:00 2001 From: Patrick Herrington Date: Tue, 26 Nov 2024 17:18:58 -0600 Subject: [PATCH 07/31] Added old trickify test --- test/SIM_trickified/RUN_test/unit_test.py | 4 ++ test/SIM_trickified/S_define | 21 ++++++++++ test/SIM_trickified/S_overrides.mk | 2 + test/SIM_trickified/models/Baz.hh | 9 +++++ .../trickified_project/include/Bar.hh | 17 +++++++++ .../trickified_project/include/Foo.hh | 15 ++++++++ .../trickified_project/trickified/.gitignore | 4 ++ .../trickified_project/trickified/Makefile | 11 ++++++ .../trickified/myproject.mk | 38 +++++++++++++++++++ test_sims.yml | 7 ++++ 10 files changed, 128 insertions(+) create mode 100644 test/SIM_trickified/RUN_test/unit_test.py create mode 100644 test/SIM_trickified/S_define create mode 100644 test/SIM_trickified/S_overrides.mk create mode 100644 test/SIM_trickified/models/Baz.hh create mode 100644 test/SIM_trickified/trickified_project/include/Bar.hh create mode 100644 test/SIM_trickified/trickified_project/include/Foo.hh create mode 100644 test/SIM_trickified/trickified_project/trickified/.gitignore create mode 100644 test/SIM_trickified/trickified_project/trickified/Makefile create mode 100644 test/SIM_trickified/trickified_project/trickified/myproject.mk diff --git a/test/SIM_trickified/RUN_test/unit_test.py b/test/SIM_trickified/RUN_test/unit_test.py new file mode 100644 index 000000000..f74fee0bf --- /dev/null +++ b/test/SIM_trickified/RUN_test/unit_test.py @@ -0,0 +1,4 @@ +sandbox.foo.i = 5 +assert sandbox.foo.i == 5 +foo = trick.Foo() +trick.stop(10) diff --git a/test/SIM_trickified/S_define b/test/SIM_trickified/S_define new file mode 100644 index 000000000..f770e2a73 --- /dev/null +++ b/test/SIM_trickified/S_define @@ -0,0 +1,21 @@ +#include "sim_objects/default_trick_sys.sm" +##include "Foo.hh" +##include "Bar.hh" +##include "Baz.hh" + +class Sandbox : public Trick::SimObject { + + public: + + Foo foo; + Bar bar; + Baz baz; + + Sandbox() { + (1, "scheduled") foo.foo(); + } + +}; + + +Sandbox sandbox; diff --git a/test/SIM_trickified/S_overrides.mk b/test/SIM_trickified/S_overrides.mk new file mode 100644 index 000000000..ad3448327 --- /dev/null +++ b/test/SIM_trickified/S_overrides.mk @@ -0,0 +1,2 @@ +include trickified_project/trickified/myproject.mk +TRICK_CXXFLAGS += -I$(CURDIR)/models diff --git a/test/SIM_trickified/models/Baz.hh b/test/SIM_trickified/models/Baz.hh new file mode 100644 index 000000000..fc91c1b21 --- /dev/null +++ b/test/SIM_trickified/models/Baz.hh @@ -0,0 +1,9 @@ +// @trick_parse{everything} + +class Baz { + + public: + int i; + int j; + +}; diff --git a/test/SIM_trickified/trickified_project/include/Bar.hh b/test/SIM_trickified/trickified_project/include/Bar.hh new file mode 100644 index 000000000..5640bfb02 --- /dev/null +++ b/test/SIM_trickified/trickified_project/include/Bar.hh @@ -0,0 +1,17 @@ +// @trick_parse{everything} + +#include "trick/Event.hh" + +/** + * Induce an `%import sim_services` statement in this class's Python module by inheriting from a + * Trick class. This allows us to test if `sys.path` contains the correct path to `sim_services.py` + * (and other modules generated during a sim build) for Trickified projects. + */ +class Bar : public Trick::Event { + + int process(long long) {return 0;} + void add() {} + void remove() {} + void restart() {} + +}; diff --git a/test/SIM_trickified/trickified_project/include/Foo.hh b/test/SIM_trickified/trickified_project/include/Foo.hh new file mode 100644 index 000000000..be7e761a2 --- /dev/null +++ b/test/SIM_trickified/trickified_project/include/Foo.hh @@ -0,0 +1,15 @@ +// @trick_parse{everything} + +#include + +class Foo { + + public: + + int i; + + void foo() { + std::cout << i++ << '\n'; + } + +}; diff --git a/test/SIM_trickified/trickified_project/trickified/.gitignore b/test/SIM_trickified/trickified_project/trickified/.gitignore new file mode 100644 index 000000000..0259157ce --- /dev/null +++ b/test/SIM_trickified/trickified_project/trickified/.gitignore @@ -0,0 +1,4 @@ +build +python +trick +*.o diff --git a/test/SIM_trickified/trickified_project/trickified/Makefile b/test/SIM_trickified/trickified_project/trickified/Makefile new file mode 100644 index 000000000..ae6eb3103 --- /dev/null +++ b/test/SIM_trickified/trickified_project/trickified/Makefile @@ -0,0 +1,11 @@ +PROJECT_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..) +TRICK_HOME := $(abspath $(PROJECT_HOME)/../../..) + +export TRICKIFY_OBJECT_NAME := trickified_myproject.o +export TRICKIFY_CXX_FLAGS := -I$(PROJECT_HOME)/include -I$(TRICK_HOME)/include + +all: + @$(MAKE) -s -f $(TRICK_HOME)/share/trick/makefiles/trickify.mk + +clean: + @rm -rf build python trick $(TRICKIFY_OBJECT_NAME) diff --git a/test/SIM_trickified/trickified_project/trickified/myproject.mk b/test/SIM_trickified/trickified_project/trickified/myproject.mk new file mode 100644 index 000000000..7abe9af1e --- /dev/null +++ b/test/SIM_trickified/trickified_project/trickified/myproject.mk @@ -0,0 +1,38 @@ +# We know this file's position relative to the root directory of the project, +# and MAKEFILE_LIST will give us the full path to this file no matter where the +# user has installed this project. +export MYPROJECT_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..) + +# Specify include paths for your headers. +MYPROJECT_INCLUDE := -I$(MYPROJECT_HOME)/include + +# 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) + +MYPROJECT_TRICK := $(MYPROJECT_HOME)/trickified/trickified_myproject.o + +# Tell Trick the headers and source at this location are part of a +# Trickified project +TRICK_EXT_LIB_DIRS += :$(MYPROJECT_HOME) + +# Tell Trick where to find the Python modules generated by SWIG +TRICK_PYTHON_PATH += :$(MYPROJECT_HOME)/trickified/python + +# Tell SWIG where to find py_*.i files +TRICK_SWIG_FLAGS += -I$(MYPROJECT_HOME)/trickified + +# Link in the Trickified object +TRICK_LDFLAGS += $(MYPROJECT_TRICK) + +# Append a prerequisite to the $(SWIG_SRC) target. This will build the +# Trickified library along with the sim if it does not already exist. Using +# $(SWIG_SRC) ensures that all Trickified .i files are created before SWIG is +# run on any simulation .i files, which may %import them. Note that this does +# NOT cause the Trickified library to be rebuilt if it already exists, even if +# the Trickified source code has changed. +$(SWIG_SRC): $(MYPROJECT_TRICK) + +$(MYPROJECT_TRICK): + @$(MAKE) -s -C $(MYPROJECT_HOME)/trickified diff --git a/test_sims.yml b/test_sims.yml index d0ec3077d..e30d9cf5c 100644 --- a/test_sims.yml +++ b/test_sims.yml @@ -114,6 +114,13 @@ SIM_threads: runs: RUN_test/unit_test.py: returns: 0 +SIM_trickified: + path: test/SIM_trickified + build_args: "-t" + binary: "T_main_{cpu}_test.exe" + runs: + RUN_test/unit_test.py: + returns: 0 SIM_trickified_object: path: test/SIM_trickified_object build_args: "-t" From f285e2a1fa41b0d1ff7f34ed70ca2d6d971e7417 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 2 Dec 2024 10:10:57 -0600 Subject: [PATCH 08/31] Added S_source.hh --- test/SIM_trickified/trickified_project/trickified/S_source.hh | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 test/SIM_trickified/trickified_project/trickified/S_source.hh diff --git a/test/SIM_trickified/trickified_project/trickified/S_source.hh b/test/SIM_trickified/trickified_project/trickified/S_source.hh new file mode 100644 index 000000000..a6dab172f --- /dev/null +++ b/test/SIM_trickified/trickified_project/trickified/S_source.hh @@ -0,0 +1,2 @@ +#include "Foo.hh" +#include "Bar.hh" From df19738cad7b94b129e62049ca66fca98c7630eb Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 2 Dec 2024 12:29:08 -0600 Subject: [PATCH 09/31] Changed old trickified test to generate an archive --- test/SIM_trickified/trickified_project/trickified/Makefile | 3 ++- test/SIM_trickified/trickified_project/trickified/myproject.mk | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/SIM_trickified/trickified_project/trickified/Makefile b/test/SIM_trickified/trickified_project/trickified/Makefile index ae6eb3103..459c4c0ca 100644 --- a/test/SIM_trickified/trickified_project/trickified/Makefile +++ b/test/SIM_trickified/trickified_project/trickified/Makefile @@ -1,7 +1,8 @@ PROJECT_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..) TRICK_HOME := $(abspath $(PROJECT_HOME)/../../..) -export TRICKIFY_OBJECT_NAME := trickified_myproject.o +export TRICKIFY_BUILD_TYPE := STATIC +export TRICKIFY_OBJECT_NAME := trickified_myproject.a export TRICKIFY_CXX_FLAGS := -I$(PROJECT_HOME)/include -I$(TRICK_HOME)/include all: diff --git a/test/SIM_trickified/trickified_project/trickified/myproject.mk b/test/SIM_trickified/trickified_project/trickified/myproject.mk index 7abe9af1e..f08a541ca 100644 --- a/test/SIM_trickified/trickified_project/trickified/myproject.mk +++ b/test/SIM_trickified/trickified_project/trickified/myproject.mk @@ -11,7 +11,7 @@ MYPROJECT_INCLUDE := -I$(MYPROJECT_HOME)/include TRICK_CFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE) TRICK_CXXFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE) -MYPROJECT_TRICK := $(MYPROJECT_HOME)/trickified/trickified_myproject.o +MYPROJECT_TRICK := $(MYPROJECT_HOME)/trickified/trickified_myproject.a # Tell Trick the headers and source at this location are part of a # Trickified project From 59605006305d7122989a72985b8a598115f11a43 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 2 Dec 2024 13:43:48 -0600 Subject: [PATCH 10/31] Added support for archive trickify builds on mac --- share/trick/makefiles/trickify.mk | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index a0de4be6d..50349c29f 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -122,6 +122,15 @@ TRICK_CXXFLAGS += $(TRICKIFY_CXX_FLAGS) # Ensure we can process all headers TRICK_EXT_LIB_DIRS := $(TRICKIFY_EXT_LIB_DIRS) +UNAME := $(shell uname) +ifeq ($(UNAME), Linux) + SHARED_OPTIONS := -shared +else ifeq ($(UNAME), Darwin) + SHARED_OPTIONS := -dynamiclib +else + SHARED_OPTIONS := -shared +endif + .PHONY: all all: $(TRICKIFY_OBJECT_NAME) $(TRICKIFY_PYTHON_DIR) @@ -130,7 +139,7 @@ $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT ifeq ($(TRICKIFY_BUILD_TYPE),PLO) $(call ECHO_AND_LOG,$(LD) $(LD_PARTIAL) -o $@ $(LINK_LISTS)) else ifeq ($(TRICKIFY_BUILD_TYPE),SHARED) - $(call ECHO_AND_LOG,$(TRICK_CXX) -shared -o $@ $(LINK_LISTS)) + $(call ECHO_AND_LOG,$(TRICK_CXX) $(SHARED_OPTIONS) -o $@ $(LINK_LISTS)) else ifeq ($(TRICKIFY_BUILD_TYPE),STATIC) $(call ECHO_AND_LOG,ar rcs $@ $(LINK_LISTS)) endif From ffb2e342404884b9e486d244e12cbe8a0e89e903 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Tue, 3 Dec 2024 10:51:03 -0600 Subject: [PATCH 11/31] Trickify MAC fixes --- share/trick/makefiles/trickify.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index 50349c29f..d364a7bbf 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -126,7 +126,7 @@ UNAME := $(shell uname) ifeq ($(UNAME), Linux) SHARED_OPTIONS := -shared else ifeq ($(UNAME), Darwin) - SHARED_OPTIONS := -dynamiclib + SHARED_OPTIONS := -dynamiclib -fPIC else SHARED_OPTIONS := -shared endif @@ -135,12 +135,16 @@ endif all: $(TRICKIFY_OBJECT_NAME) $(TRICKIFY_PYTHON_DIR) $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT_NAME)) + echo "Enterting trickify.mk" $(info $(call COLOR,Linking) $@) ifeq ($(TRICKIFY_BUILD_TYPE),PLO) + echo "Building PLO" $(call ECHO_AND_LOG,$(LD) $(LD_PARTIAL) -o $@ $(LINK_LISTS)) else ifeq ($(TRICKIFY_BUILD_TYPE),SHARED) + echo "Building SHARED" $(call ECHO_AND_LOG,$(TRICK_CXX) $(SHARED_OPTIONS) -o $@ $(LINK_LISTS)) else ifeq ($(TRICKIFY_BUILD_TYPE),STATIC) + echo "Building STATIC" $(call ECHO_AND_LOG,ar rcs $@ $(LINK_LISTS)) endif From 573211e09c1088d0185a0e8a54d1d40fb20afbe6 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Tue, 3 Dec 2024 12:49:04 -0600 Subject: [PATCH 12/31] Trickify shared on mac fix --- share/trick/makefiles/trickify.mk | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index d364a7bbf..b092529b6 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -135,16 +135,12 @@ endif all: $(TRICKIFY_OBJECT_NAME) $(TRICKIFY_PYTHON_DIR) $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT_NAME)) - echo "Enterting trickify.mk" $(info $(call COLOR,Linking) $@) ifeq ($(TRICKIFY_BUILD_TYPE),PLO) - echo "Building PLO" $(call ECHO_AND_LOG,$(LD) $(LD_PARTIAL) -o $@ $(LINK_LISTS)) else ifeq ($(TRICKIFY_BUILD_TYPE),SHARED) - echo "Building SHARED" - $(call ECHO_AND_LOG,$(TRICK_CXX) $(SHARED_OPTIONS) -o $@ $(LINK_LISTS)) + $(call ECHO_AND_LOG,$(TRICK_CXX) $(SHARED_LIB_OPT) -o $@ $(LINK_LISTS)) else ifeq ($(TRICKIFY_BUILD_TYPE),STATIC) - echo "Building STATIC" $(call ECHO_AND_LOG,ar rcs $@ $(LINK_LISTS)) endif From d0316b5688106add2cf2a459e8c42d9b19befa10 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 9 Dec 2024 14:59:29 -0600 Subject: [PATCH 13/31] Moved the py files to their appropriate directory --- bin/trick-ify | 6 +++--- share/trick/{makefiles => pymods/trick}/build_trickify.py | 0 .../trick}/build_trickify_S_source_hh.py | 2 +- .../{makefiles => pymods/trick}/build_trickify_obj_list.py | 2 +- .../{makefiles => pymods/trick}/build_trickify_src_list.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename share/trick/{makefiles => pymods/trick}/build_trickify.py (100%) rename share/trick/{makefiles => pymods/trick}/build_trickify_S_source_hh.py (70%) rename share/trick/{makefiles => pymods/trick}/build_trickify_obj_list.py (70%) rename share/trick/{makefiles => pymods/trick}/build_trickify_src_list.py (70%) diff --git a/bin/trick-ify b/bin/trick-ify index 039c18d92..cc8ae71cb 100755 --- a/bin/trick-ify +++ b/bin/trick-ify @@ -159,7 +159,7 @@ elsif ( $build_type eq so ) 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" ; + $make_s_source = "python3 $my_path../share/trick/pymods/trick/build_trickify_S_source_hh.py" ; print(`$make_s_source`) ; } @@ -167,7 +167,7 @@ if ($build_s_source) if ($build_trickify_src_list and $full_build) { print "Building trickify_src_list\n" ; - $make_src_list = "python3 $my_path../share/trick/makefiles/build_trickify_src_list.py" ; + $make_src_list = "python3 $my_path../share/trick/pymods/trick/build_trickify_src_list.py" ; print(`$make_src_list`) ; } @@ -213,7 +213,7 @@ if ($full_build) if($build_trickify_obj_list and $full_build) { print "Building trickify_obj_list\n" ; - $make_obj_list = "python3 $my_path../share/trick/makefiles/build_trickify_obj_list.py" ; + $make_obj_list = "python3 $my_path../share/trick/pymods/trick/build_trickify_obj_list.py" ; print(`$make_obj_list`) ; } diff --git a/share/trick/makefiles/build_trickify.py b/share/trick/pymods/trick/build_trickify.py similarity index 100% rename from share/trick/makefiles/build_trickify.py rename to share/trick/pymods/trick/build_trickify.py diff --git a/share/trick/makefiles/build_trickify_S_source_hh.py b/share/trick/pymods/trick/build_trickify_S_source_hh.py similarity index 70% rename from share/trick/makefiles/build_trickify_S_source_hh.py rename to share/trick/pymods/trick/build_trickify_S_source_hh.py index 92242d433..fb9316b61 100644 --- a/share/trick/makefiles/build_trickify_S_source_hh.py +++ b/share/trick/pymods/trick/build_trickify_S_source_hh.py @@ -3,7 +3,7 @@ path = "" if "TRICK_HOME" in os.environ: path = os.getenv("TRICK_HOME") -path += "/share/trick/makefiles/build_trickify.py" +path += "/share/trick/pymods/trick/build_trickify.py" exec(open(path).read()) diff --git a/share/trick/makefiles/build_trickify_obj_list.py b/share/trick/pymods/trick/build_trickify_obj_list.py similarity index 70% rename from share/trick/makefiles/build_trickify_obj_list.py rename to share/trick/pymods/trick/build_trickify_obj_list.py index 0fa24786b..6a878671b 100644 --- a/share/trick/makefiles/build_trickify_obj_list.py +++ b/share/trick/pymods/trick/build_trickify_obj_list.py @@ -3,7 +3,7 @@ path = "" if "TRICK_HOME" in os.environ: path = os.getenv("TRICK_HOME") -path += "/share/trick/makefiles/build_trickify.py" +path += "/share/trick/pymods/trick/build_trickify.py" exec(open(path).read()) diff --git a/share/trick/makefiles/build_trickify_src_list.py b/share/trick/pymods/trick/build_trickify_src_list.py similarity index 70% rename from share/trick/makefiles/build_trickify_src_list.py rename to share/trick/pymods/trick/build_trickify_src_list.py index 164733d65..f79903be1 100644 --- a/share/trick/makefiles/build_trickify_src_list.py +++ b/share/trick/pymods/trick/build_trickify_src_list.py @@ -3,7 +3,7 @@ path = "" if "TRICK_HOME" in os.environ: path = os.getenv("TRICK_HOME") -path += "/share/trick/makefiles/build_trickify.py" +path += "/share/trick/pymods/trick/build_trickify.py" exec(open(path).read()) From c5e044a0a8b4ebe938aa1241d2b4806dc8892c44 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Thu, 2 Jan 2025 10:27:35 -0600 Subject: [PATCH 14/31] CI fix --- share/trick/makefiles/trickify.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index b092529b6..08db4bc6f 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -139,7 +139,7 @@ $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT ifeq ($(TRICKIFY_BUILD_TYPE),PLO) $(call ECHO_AND_LOG,$(LD) $(LD_PARTIAL) -o $@ $(LINK_LISTS)) else ifeq ($(TRICKIFY_BUILD_TYPE),SHARED) - $(call ECHO_AND_LOG,$(TRICK_CXX) $(SHARED_LIB_OPT) -o $@ $(LINK_LISTS)) + $(call ECHO_AND_LOG,$(TRICK_CXX) $(SHARED_LIB_OPT) -fPIC -o $@ $(LINK_LISTS)) else ifeq ($(TRICKIFY_BUILD_TYPE),STATIC) $(call ECHO_AND_LOG,ar rcs $@ $(LINK_LISTS)) endif From 2b4054f73c0ddef56dcded5a8b1fee7f6f7af3c7 Mon Sep 17 00:00:00 2001 From: Patrick Herrington Date: Fri, 3 Jan 2025 17:17:10 -0600 Subject: [PATCH 15/31] Improved trick-ify arguments --- bin/trick-ify | 141 +++++------------- share/trick/makefiles/trickify.mk | 8 +- .../trickified_project/trickified/Makefile | 2 +- 3 files changed, 46 insertions(+), 105 deletions(-) diff --git a/bin/trick-ify b/bin/trick-ify index cc8ae71cb..0871598b3 100755 --- a/bin/trick-ify +++ b/bin/trick-ify @@ -1,118 +1,59 @@ #!/usr/bin/perl +use Getopt::Long; + $my_path = $0 ; $my_path =~ s/trick-ify// ; +$dirs = "" ; # If set, use for both source and header files $source_dir = "" ; # Base path to build source from $header_dir = "" ; # Base path to find header files $source_make_call = "" ; # Make call to build object files $source_make_args = "" ; # Args to pass into default object make $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 = 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) $debug = 0 ; # Debug info flag $trick_home = $my_path . ".." ; # Trick directory to use for building +$no_source_build = 0 ; # Arg to disable building source files +$no_clean_obj = 0 ; # Don't rebuild trickify_obj_list +$no_clean_src = 0 ; # Don't rebuild trickify_src_list +$no_clean_s_source = 0 ; # Don't rebuild S_source.hh + +GetOptions +( + "d=s" => \$dirs, # Set source and header directory + "s=s" => \$source_dir, # Set source directory + "h=s" => \$header_dir, # Set header directory + "no_clean_s_source" => \$no_clean_s_source, # Don't rebuild S_source.hh + "no_clean_src_list" => \$no_clean_src, # Don't rebuild trickify_src_list + "no_clean_obj_list" => \$no_clean_obj, # Don't rebuild trickify_obj_list + "no_source" => \$no_source_build, # Arg to disable building source files + "source_make=s" => \$source_make_call, # Make call to build object files + "source_args=s" => \$source_make_args, # Default make call args to build object files + "trickify_args=s" => \$trickify_make_args, # Trickify make args + "trickify_make=s" => \$trickify_make_path, # Set trickify make path + "n=s" => \$name, # Set the library name + "b=s" => \$build_type, # Set library build type + "v" => \$debug, # Verbose, print debug info + "trick_home=s" => \$trick_home # Set trick home directory +) ; + +$full_build = !$no_source_build ; -$skip_arg = 0 ; -foreach $argnum (0 .. $#ARGV) +$val = $ARGV[$argnum + 1] ; +if( !(($build_type eq "o") or ($build_type eq "a") or ($build_type eq "so")) ) { - if($skip_arg) - { - $skip_arg = 0 ; - next ; - } - - $arg = $ARGV[$argnum] ; - if($arg eq "-d") # Set both source and header directory - { - $source_dir = $ARGV[$argnum + 1] ; - $header_dir = $source_dir ; - $skip_arg = 1 ; - } - elsif($arg eq "-s") # Set source directory - { - $source_dir = $ARGV[$argnum + 1] ; - $skip_arg = 1 ; - } - elsif($arg eq "-h") # Set header directory - { - $header_dir = $ARGV[$argnum + 1] ; - $skip_arg = 1 ; - } - elsif($arg eq "-ph") # Preserve S_source.hh - { - $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 - { - $full_build = 0 ; - } - elsif($arg eq "-m") # Make call to build object files - { - $source_make_call = $ARGV[$argnum + 1] ; - $skip_arg = 1 ; - } - elsif($arg eq "-ma") # Default make call args to build object files - { - $source_make_args = $ARGV[$argnum + 1] ; - $skip_arg = 1 ; - } - elsif($arg eq "-tm") # Trickify make args - { - $trickify_make_args = $ARGV[$argnum + 1] ; - $skip_arg = 1 ; - } - elsif($arg eq "-tp") # Set trickify make path - { - $trickify_make_path = $ARGV[$argnum + 1] ; - $skip_arg = 1 ; - } - elsif($arg eq "-n") # Set the library name - { - $name = $ARGV[$argnum + 1] ; - $skip_arg = 1 ; - } - elsif($arg eq "-b") # Set library build type - { - $val = $ARGV[$argnum + 1] ; - if( ($val eq "o") or ($val eq "a") or ($val eq "so") ) - { - $build_type = $ARGV[$argnum + 1] ; - } - else - { - print "Invalid build type {$val}, valid build types are {o, a, so}\n" ; - exit 1 ; - } - $skip_arg = 1 ; - } - elsif($arg eq "-v") # Verbose, print debug info - { - $debug = 1 ; - } - elsif($arg eq "-th") # Set trick home directory - { - $trick_home = $ARGV[$argnum + 1] ; - $skip_arg = 1 ; - } - else - { - print "Unrecognized argument: $arg\n" ; - exit 1 ; - } + print "Invalid build type {$build_type}, valid build types are {o, a, so}\n" ; + exit 1 ; +} + +if($dirs ne "") +{ + $header_dir = $dirs ; + $source_dir = $dirs ; } if($header_dir eq "") @@ -156,7 +97,7 @@ elsif ( $build_type eq so ) } #Build the S_source.hh -if ($build_s_source) +if (!$no_clean_s_source) { print "Building S_source.hh\n" ; $make_s_source = "python3 $my_path../share/trick/pymods/trick/build_trickify_S_source_hh.py" ; @@ -164,7 +105,7 @@ if ($build_s_source) } #Build source file list, only if trickifying the entire library -if ($build_trickify_src_list and $full_build) +if (!$no_clean_src and $full_build) { print "Building trickify_src_list\n" ; $make_src_list = "python3 $my_path../share/trick/pymods/trick/build_trickify_src_list.py" ; @@ -210,7 +151,7 @@ if ($full_build) } #Build object file list, only if trickifying the entire library -if($build_trickify_obj_list and $full_build) +if(!$no_clean_obj and $full_build) { print "Building trickify_obj_list\n" ; $make_obj_list = "python3 $my_path../share/trick/pymods/trick/build_trickify_obj_list.py" ; diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index 08db4bc6f..5b39dc661 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -124,11 +124,11 @@ TRICK_EXT_LIB_DIRS := $(TRICKIFY_EXT_LIB_DIRS) UNAME := $(shell uname) ifeq ($(UNAME), Linux) - SHARED_OPTIONS := -shared + SHARED_OPTIONS := -fPIC else ifeq ($(UNAME), Darwin) - SHARED_OPTIONS := -dynamiclib -fPIC + SHARED_OPTIONS := -fPIC else - SHARED_OPTIONS := -shared + SHARED_OPTIONS := endif .PHONY: all @@ -139,7 +139,7 @@ $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT ifeq ($(TRICKIFY_BUILD_TYPE),PLO) $(call ECHO_AND_LOG,$(LD) $(LD_PARTIAL) -o $@ $(LINK_LISTS)) else ifeq ($(TRICKIFY_BUILD_TYPE),SHARED) - $(call ECHO_AND_LOG,$(TRICK_CXX) $(SHARED_LIB_OPT) -fPIC -o $@ $(LINK_LISTS)) + $(call ECHO_AND_LOG,$(TRICK_CXX) $(SHARED_LIB_OPT) $(SHARED_OPTIONS) -o $@ $(LINK_LISTS)) else ifeq ($(TRICKIFY_BUILD_TYPE),STATIC) $(call ECHO_AND_LOG,ar rcs $@ $(LINK_LISTS)) endif diff --git a/test/SIM_trickified_shared/trickified_project/trickified/Makefile b/test/SIM_trickified_shared/trickified_project/trickified/Makefile index 95d9d2500..9cb1723e2 100644 --- a/test/SIM_trickified_shared/trickified_project/trickified/Makefile +++ b/test/SIM_trickified_shared/trickified_project/trickified/Makefile @@ -4,7 +4,7 @@ include $(LOCAL_DIR)/myproject_vars.mk all: @echo MAKE LOCAL_DIR $(LOCAL_DIR) - @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b so -n trickified_myproject -v -ma "-fPIC -fvisibility=default" + @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b so -n trickified_myproject -v --source_args -fPIC clean: @rm -rf build python trick $(TRICKIFY_OBJECT_NAME) From fc964811b95ae3891385df00dc77c4aa1d5da74f Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 6 Jan 2025 12:44:05 -0600 Subject: [PATCH 16/31] CI --- share/trick/makefiles/trickify.mk | 5 +++++ test/SIM_trickified/trickified_project/trickified/Makefile | 4 ++-- .../trickified_project/trickified/myproject.mk | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index 5b39dc661..421ca5184 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -141,6 +141,11 @@ ifeq ($(TRICKIFY_BUILD_TYPE),PLO) else ifeq ($(TRICKIFY_BUILD_TYPE),SHARED) $(call ECHO_AND_LOG,$(TRICK_CXX) $(SHARED_LIB_OPT) $(SHARED_OPTIONS) -o $@ $(LINK_LISTS)) else ifeq ($(TRICKIFY_BUILD_TYPE),STATIC) + @echo "-----Printing LS-----" + @ls + @echo "-----Printing LS build-----" + @ls build + @echo "-----Ending LS-----" $(call ECHO_AND_LOG,ar rcs $@ $(LINK_LISTS)) endif diff --git a/test/SIM_trickified/trickified_project/trickified/Makefile b/test/SIM_trickified/trickified_project/trickified/Makefile index 459c4c0ca..ed9a8dd12 100644 --- a/test/SIM_trickified/trickified_project/trickified/Makefile +++ b/test/SIM_trickified/trickified_project/trickified/Makefile @@ -1,8 +1,8 @@ PROJECT_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..) TRICK_HOME := $(abspath $(PROJECT_HOME)/../../..) -export TRICKIFY_BUILD_TYPE := STATIC -export TRICKIFY_OBJECT_NAME := trickified_myproject.a +export TRICKIFY_BUILD_TYPE := PLO +export TRICKIFY_OBJECT_NAME := trickified_myproject.o export TRICKIFY_CXX_FLAGS := -I$(PROJECT_HOME)/include -I$(TRICK_HOME)/include all: diff --git a/test/SIM_trickified/trickified_project/trickified/myproject.mk b/test/SIM_trickified/trickified_project/trickified/myproject.mk index f08a541ca..7abe9af1e 100644 --- a/test/SIM_trickified/trickified_project/trickified/myproject.mk +++ b/test/SIM_trickified/trickified_project/trickified/myproject.mk @@ -11,7 +11,7 @@ MYPROJECT_INCLUDE := -I$(MYPROJECT_HOME)/include TRICK_CFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE) TRICK_CXXFLAGS += $(MYPROJECT_INCLUDE) $(MYPROJECT_SOURCE) -MYPROJECT_TRICK := $(MYPROJECT_HOME)/trickified/trickified_myproject.a +MYPROJECT_TRICK := $(MYPROJECT_HOME)/trickified/trickified_myproject.o # Tell Trick the headers and source at this location are part of a # Trickified project From 1e9a2e1e0ca3659608af1778068cf78a212e9573 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 6 Jan 2025 15:31:56 -0600 Subject: [PATCH 17/31] CI --- share/trick/makefiles/trickify.mk | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index 421ca5184..a56fd85de 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -106,10 +106,23 @@ 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 +UNAME := $(shell uname) ifdef FULL_TRICKIFY_BUILD - LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) + ifeq ($(UNAME), Linux) + LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) + else ifeq ($(UNAME), Darwin) + LINK_LISTS := $(IO_LINK_LIST) $(PY_LINK_LIST) $(OBJ_LINK_LIST) + else + LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) + endif else - LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) + ifeq ($(UNAME), Linux) + LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) + else ifeq ($(UNAME), Darwin) + LINK_LISTS := $(IO_LINK_LIST) $(PY_LINK_LIST) + else + LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) + endif endif ifneq ($(wildcard $(BUILD_DIR)),) SWIG_OBJECTS := $(shell cat $(PY_LINK_LIST)) @@ -122,7 +135,6 @@ TRICK_CXXFLAGS += $(TRICKIFY_CXX_FLAGS) # Ensure we can process all headers TRICK_EXT_LIB_DIRS := $(TRICKIFY_EXT_LIB_DIRS) -UNAME := $(shell uname) ifeq ($(UNAME), Linux) SHARED_OPTIONS := -fPIC else ifeq ($(UNAME), Darwin) From f420dcafdf7d8e9a7f14f8dc81df315734ac15e5 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Tue, 7 Jan 2025 09:34:11 -0600 Subject: [PATCH 18/31] CI --- share/trick/makefiles/trickify.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index a56fd85de..f34ae8a8d 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -111,7 +111,7 @@ ifdef FULL_TRICKIFY_BUILD ifeq ($(UNAME), Linux) LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) else ifeq ($(UNAME), Darwin) - LINK_LISTS := $(IO_LINK_LIST) $(PY_LINK_LIST) $(OBJ_LINK_LIST) + LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) else LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) endif @@ -119,7 +119,7 @@ else ifeq ($(UNAME), Linux) LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) else ifeq ($(UNAME), Darwin) - LINK_LISTS := $(IO_LINK_LIST) $(PY_LINK_LIST) + LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) else LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) endif From e25aaa30aad74b89bc4f4b91dd2477321ffc5ebc Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Tue, 7 Jan 2025 12:38:47 -0600 Subject: [PATCH 19/31] CI --- share/trick/makefiles/trickify.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index f34ae8a8d..0a8195a77 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -111,7 +111,11 @@ ifdef FULL_TRICKIFY_BUILD ifeq ($(UNAME), Linux) LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) else ifeq ($(UNAME), Darwin) - LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) + ifeq ($(TRICKIFY_BUILD_TYPE),STATIC) + LINK_LISTS := $(IO_LINK_LIST) $(PY_LINK_LIST) $(OBJ_LINK_LIST) + else + LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) + endif else LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) endif @@ -119,7 +123,11 @@ else ifeq ($(UNAME), Linux) LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) else ifeq ($(UNAME), Darwin) - LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) + ifeq ($(TRICKIFY_BUILD_TYPE),STATIC) + LINK_LISTS := $(IO_LINK_LIST) $(PY_LINK_LIST) + else + LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) + endif else LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) endif From c3cd94ea994685e30e5453960eac4d21ae26533c Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Thu, 9 Jan 2025 09:39:42 -0600 Subject: [PATCH 20/31] CI --- share/trick/makefiles/trickify.mk | 54 +++++++++++-------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index 0a8195a77..cae9e9863 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -108,29 +108,9 @@ IO_LINK_LIST := $(BUILD_DIR)trickify_io_link_list OBJ_LINK_LIST := trickify_obj_list UNAME := $(shell uname) ifdef FULL_TRICKIFY_BUILD - ifeq ($(UNAME), Linux) - LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) - else ifeq ($(UNAME), Darwin) - ifeq ($(TRICKIFY_BUILD_TYPE),STATIC) - LINK_LISTS := $(IO_LINK_LIST) $(PY_LINK_LIST) $(OBJ_LINK_LIST) - else - LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) - endif - else - LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) - endif + LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) else - ifeq ($(UNAME), Linux) - LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) - else ifeq ($(UNAME), Darwin) - ifeq ($(TRICKIFY_BUILD_TYPE),STATIC) - LINK_LISTS := $(IO_LINK_LIST) $(PY_LINK_LIST) - else - LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) - endif - else - LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) - endif + LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) endif ifneq ($(wildcard $(BUILD_DIR)),) SWIG_OBJECTS := $(shell cat $(PY_LINK_LIST)) @@ -155,19 +135,23 @@ endif all: $(TRICKIFY_OBJECT_NAME) $(TRICKIFY_PYTHON_DIR) $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT_NAME)) - $(info $(call COLOR,Linking) $@) -ifeq ($(TRICKIFY_BUILD_TYPE),PLO) - $(call ECHO_AND_LOG,$(LD) $(LD_PARTIAL) -o $@ $(LINK_LISTS)) -else ifeq ($(TRICKIFY_BUILD_TYPE),SHARED) - $(call ECHO_AND_LOG,$(TRICK_CXX) $(SHARED_LIB_OPT) $(SHARED_OPTIONS) -o $@ $(LINK_LISTS)) -else ifeq ($(TRICKIFY_BUILD_TYPE),STATIC) - @echo "-----Printing LS-----" - @ls - @echo "-----Printing LS build-----" - @ls build - @echo "-----Ending LS-----" - $(call ECHO_AND_LOG,ar rcs $@ $(LINK_LISTS)) -endif + @if [ "$(TRICKIFY_BUILD_TYPE)" = "PLO" ] ; then \ + $(LD) $(LD_PARTIAL) -o $@ $(LINK_LISTS) ; \ + elif [ "$(TRICKIFY_BUILD_TYPE)" = "SHARED" ] ; then \ + $(TRICK_CXX) $(SHARED_LIB_OPT) $(SHARED_OPTIONS) -o $@ $(LINK_LISTS) ; \ + elif [ "$(TRICKIFY_BUILD_TYPE)" = "STATIC" ] ; then \ + export FILES= ; \ + while read -r line ; do \ + export FILES="$$FILES $$line" ; \ + done < $(PY_LINK_LIST) ; \ + while read -r line ; do \ + export FILES="$$FILES $$line" ; \ + done < $(IO_LINK_LIST) ; \ + while read -r line ; do \ + export FILES="$$FILES $$line" ; \ + done < $(OBJ_LINK_LIST) ; \ + ar rcs $@ $ $$FILES ; \ + fi $(dir $(TRICKIFY_OBJECT_NAME)) $(BUILD_DIR) $(dir $(TRICKIFY_PYTHON_DIR)) .trick: @mkdir -p $@ From a2d445548006b190734fc5246740edd2141405c6 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 13 Jan 2025 11:28:26 -0600 Subject: [PATCH 21/31] CI --- share/trick/makefiles/trickify.mk | 32 ++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index cae9e9863..61ea9adda 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -106,11 +106,10 @@ 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 -UNAME := $(shell uname) ifdef FULL_TRICKIFY_BUILD - LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST) + FULL_TRICKIFY_BUILD = "1" else - LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) + FULL_TRICKIFY_BUILD = "0" endif ifneq ($(wildcard $(BUILD_DIR)),) SWIG_OBJECTS := $(shell cat $(PY_LINK_LIST)) @@ -123,6 +122,7 @@ TRICK_CXXFLAGS += $(TRICKIFY_CXX_FLAGS) # Ensure we can process all headers TRICK_EXT_LIB_DIRS := $(TRICKIFY_EXT_LIB_DIRS) +UNAME := $(shell uname) ifeq ($(UNAME), Linux) SHARED_OPTIONS := -fPIC else ifeq ($(UNAME), Darwin) @@ -134,22 +134,24 @@ endif .PHONY: all all: $(TRICKIFY_OBJECT_NAME) $(TRICKIFY_PYTHON_DIR) +.ONESHELL: $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT_NAME)) + @while read -r line ; do \ + export FILES="$$FILES $$line" ; \ + done < $(PY_LINK_LIST) + @while read -r line ; do \ + export FILES="$$FILES $$line" ; \ + done < $(IO_LINK_LIST) + @if [ "$(FULL_TRICKIFY_BUILD)" = "1" ] ; then \ + while read -r line ; do \ + export FILES="$$FILES $$line" ; \ + done < $(OBJ_LINK_LIST) + fi @if [ "$(TRICKIFY_BUILD_TYPE)" = "PLO" ] ; then \ - $(LD) $(LD_PARTIAL) -o $@ $(LINK_LISTS) ; \ + $(LD) $(LD_PARTIAL) -o $@ $$FILES ; \ elif [ "$(TRICKIFY_BUILD_TYPE)" = "SHARED" ] ; then \ - $(TRICK_CXX) $(SHARED_LIB_OPT) $(SHARED_OPTIONS) -o $@ $(LINK_LISTS) ; \ + $(TRICK_CXX) $(SHARED_LIB_OPT) $(SHARED_OPTIONS) -o $@ $$FILES ; \ elif [ "$(TRICKIFY_BUILD_TYPE)" = "STATIC" ] ; then \ - export FILES= ; \ - while read -r line ; do \ - export FILES="$$FILES $$line" ; \ - done < $(PY_LINK_LIST) ; \ - while read -r line ; do \ - export FILES="$$FILES $$line" ; \ - done < $(IO_LINK_LIST) ; \ - while read -r line ; do \ - export FILES="$$FILES $$line" ; \ - done < $(OBJ_LINK_LIST) ; \ ar rcs $@ $ $$FILES ; \ fi From 04c0fea046b563a0975b390364d2df840e7faa6d Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 13 Jan 2025 12:09:13 -0600 Subject: [PATCH 22/31] CI --- share/trick/makefiles/trickify.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index 61ea9adda..056fa8568 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -126,7 +126,7 @@ UNAME := $(shell uname) ifeq ($(UNAME), Linux) SHARED_OPTIONS := -fPIC else ifeq ($(UNAME), Darwin) - SHARED_OPTIONS := -fPIC + SHARED_OPTIONS := -fPIC -lgcov else SHARED_OPTIONS := endif From 74c75123aa424c28fe6baf1b64360d7c1bf9f397 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Tue, 14 Jan 2025 13:19:55 -0600 Subject: [PATCH 23/31] Added C support --- bin/trick-ify | 13 ++++++++++--- test/SIM_trickified_archive/S_define | 3 +-- .../trickified_project/include_bar/Bar.c | 6 ++++++ .../trickified_project/include_bar/Bar.cpp | 7 ------- .../trickified_project/include_bar/Bar.h | 16 ++++++++++++++++ .../trickified_project/include_bar/Bar.hh | 17 ----------------- test/SIM_trickified_object/S_define | 3 +-- .../trickified_project/include_bar/Bar.c | 6 ++++++ .../trickified_project/include_bar/Bar.cpp | 7 ------- .../trickified_project/include_bar/Bar.h | 16 ++++++++++++++++ .../trickified_project/include_bar/Bar.hh | 17 ----------------- test/SIM_trickified_shared/S_define | 3 +-- .../trickified_project/include_bar/Bar.c | 6 ++++++ .../trickified_project/include_bar/Bar.cpp | 7 ------- .../trickified_project/include_bar/Bar.h | 16 ++++++++++++++++ .../trickified_project/include_bar/Bar.hh | 17 ----------------- 16 files changed, 79 insertions(+), 81 deletions(-) create mode 100644 test/SIM_trickified_archive/trickified_project/include_bar/Bar.c delete mode 100644 test/SIM_trickified_archive/trickified_project/include_bar/Bar.cpp create mode 100644 test/SIM_trickified_archive/trickified_project/include_bar/Bar.h delete mode 100644 test/SIM_trickified_archive/trickified_project/include_bar/Bar.hh create mode 100644 test/SIM_trickified_object/trickified_project/include_bar/Bar.c delete mode 100644 test/SIM_trickified_object/trickified_project/include_bar/Bar.cpp create mode 100644 test/SIM_trickified_object/trickified_project/include_bar/Bar.h delete mode 100644 test/SIM_trickified_object/trickified_project/include_bar/Bar.hh create mode 100644 test/SIM_trickified_shared/trickified_project/include_bar/Bar.c delete mode 100644 test/SIM_trickified_shared/trickified_project/include_bar/Bar.cpp create mode 100644 test/SIM_trickified_shared/trickified_project/include_bar/Bar.h delete mode 100644 test/SIM_trickified_shared/trickified_project/include_bar/Bar.hh diff --git a/bin/trick-ify b/bin/trick-ify index 0871598b3..d5c7d2b7d 100755 --- a/bin/trick-ify +++ b/bin/trick-ify @@ -134,9 +134,16 @@ if ($full_build) foreach $src (@src_files) { $file = $src ; - $file =~ s/\Q.cpp\E$// ; - $file =~ s/\Q.c$\E$// ; - $cmd = "g++ $source_make_args -I $trick_home" . "/include -c $src -o $file.o" ; + if($file =~ /\S*(\Q.c\E)$/) + { + $file =~ s/\Q.c\E$// ; + $cmd = "gcc $source_make_args -I $trick_home" . "/include -c $src -o $file.o" ; + } + else + { + $file =~ s/\Q.cpp\E$// ; + $cmd = "g++ $source_make_args -I $trick_home" . "/include -c $src -o $file.o" ; + } if($debug) { print "Building obj file: $cmd\n" ; diff --git a/test/SIM_trickified_archive/S_define b/test/SIM_trickified_archive/S_define index f770e2a73..1c86251ed 100644 --- a/test/SIM_trickified_archive/S_define +++ b/test/SIM_trickified_archive/S_define @@ -1,6 +1,6 @@ #include "sim_objects/default_trick_sys.sm" ##include "Foo.hh" -##include "Bar.hh" +##include "Bar.h" ##include "Baz.hh" class Sandbox : public Trick::SimObject { @@ -8,7 +8,6 @@ class Sandbox : public Trick::SimObject { public: Foo foo; - Bar bar; Baz baz; Sandbox() { diff --git a/test/SIM_trickified_archive/trickified_project/include_bar/Bar.c b/test/SIM_trickified_archive/trickified_project/include_bar/Bar.c new file mode 100644 index 000000000..cf5649184 --- /dev/null +++ b/test/SIM_trickified_archive/trickified_project/include_bar/Bar.c @@ -0,0 +1,6 @@ +#include "Bar.h" + +int process(long long x) {return 0;} +void add() {} +void remove_Bar() {} +void restart() {} diff --git a/test/SIM_trickified_archive/trickified_project/include_bar/Bar.cpp b/test/SIM_trickified_archive/trickified_project/include_bar/Bar.cpp deleted file mode 100644 index b46af6616..000000000 --- a/test/SIM_trickified_archive/trickified_project/include_bar/Bar.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "Bar.hh" - - -void Bar::add() {} -void Bar::remove() {} -void Bar::restart() {} - diff --git a/test/SIM_trickified_archive/trickified_project/include_bar/Bar.h b/test/SIM_trickified_archive/trickified_project/include_bar/Bar.h new file mode 100644 index 000000000..b8c3677c6 --- /dev/null +++ b/test/SIM_trickified_archive/trickified_project/include_bar/Bar.h @@ -0,0 +1,16 @@ +// @trick_parse{everything} + +#include "trick/exec_proto.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +void add(); +void remove_Bar(); +void restart(); + +#ifdef __cplusplus +} +#endif diff --git a/test/SIM_trickified_archive/trickified_project/include_bar/Bar.hh b/test/SIM_trickified_archive/trickified_project/include_bar/Bar.hh deleted file mode 100644 index 5c4972624..000000000 --- a/test/SIM_trickified_archive/trickified_project/include_bar/Bar.hh +++ /dev/null @@ -1,17 +0,0 @@ -// @trick_parse{everything} - -#include "trick/Event.hh" - -/** - * Induce an `%import sim_services` statement in this class's Python module by inheriting from a - * Trick class. This allows us to test if `sys.path` contains the correct path to `sim_services.py` - * (and other modules generated during a sim build) for Trickified projects. - */ -class Bar : public Trick::Event { - - int process(long long) {return 0;} - void add(); - void remove(); - void restart(); - -}; diff --git a/test/SIM_trickified_object/S_define b/test/SIM_trickified_object/S_define index f770e2a73..1c86251ed 100644 --- a/test/SIM_trickified_object/S_define +++ b/test/SIM_trickified_object/S_define @@ -1,6 +1,6 @@ #include "sim_objects/default_trick_sys.sm" ##include "Foo.hh" -##include "Bar.hh" +##include "Bar.h" ##include "Baz.hh" class Sandbox : public Trick::SimObject { @@ -8,7 +8,6 @@ class Sandbox : public Trick::SimObject { public: Foo foo; - Bar bar; Baz baz; Sandbox() { diff --git a/test/SIM_trickified_object/trickified_project/include_bar/Bar.c b/test/SIM_trickified_object/trickified_project/include_bar/Bar.c new file mode 100644 index 000000000..cf5649184 --- /dev/null +++ b/test/SIM_trickified_object/trickified_project/include_bar/Bar.c @@ -0,0 +1,6 @@ +#include "Bar.h" + +int process(long long x) {return 0;} +void add() {} +void remove_Bar() {} +void restart() {} diff --git a/test/SIM_trickified_object/trickified_project/include_bar/Bar.cpp b/test/SIM_trickified_object/trickified_project/include_bar/Bar.cpp deleted file mode 100644 index b46af6616..000000000 --- a/test/SIM_trickified_object/trickified_project/include_bar/Bar.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "Bar.hh" - - -void Bar::add() {} -void Bar::remove() {} -void Bar::restart() {} - diff --git a/test/SIM_trickified_object/trickified_project/include_bar/Bar.h b/test/SIM_trickified_object/trickified_project/include_bar/Bar.h new file mode 100644 index 000000000..b8c3677c6 --- /dev/null +++ b/test/SIM_trickified_object/trickified_project/include_bar/Bar.h @@ -0,0 +1,16 @@ +// @trick_parse{everything} + +#include "trick/exec_proto.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +void add(); +void remove_Bar(); +void restart(); + +#ifdef __cplusplus +} +#endif diff --git a/test/SIM_trickified_object/trickified_project/include_bar/Bar.hh b/test/SIM_trickified_object/trickified_project/include_bar/Bar.hh deleted file mode 100644 index 5c4972624..000000000 --- a/test/SIM_trickified_object/trickified_project/include_bar/Bar.hh +++ /dev/null @@ -1,17 +0,0 @@ -// @trick_parse{everything} - -#include "trick/Event.hh" - -/** - * Induce an `%import sim_services` statement in this class's Python module by inheriting from a - * Trick class. This allows us to test if `sys.path` contains the correct path to `sim_services.py` - * (and other modules generated during a sim build) for Trickified projects. - */ -class Bar : public Trick::Event { - - int process(long long) {return 0;} - void add(); - void remove(); - void restart(); - -}; diff --git a/test/SIM_trickified_shared/S_define b/test/SIM_trickified_shared/S_define index f770e2a73..1c86251ed 100644 --- a/test/SIM_trickified_shared/S_define +++ b/test/SIM_trickified_shared/S_define @@ -1,6 +1,6 @@ #include "sim_objects/default_trick_sys.sm" ##include "Foo.hh" -##include "Bar.hh" +##include "Bar.h" ##include "Baz.hh" class Sandbox : public Trick::SimObject { @@ -8,7 +8,6 @@ class Sandbox : public Trick::SimObject { public: Foo foo; - Bar bar; Baz baz; Sandbox() { diff --git a/test/SIM_trickified_shared/trickified_project/include_bar/Bar.c b/test/SIM_trickified_shared/trickified_project/include_bar/Bar.c new file mode 100644 index 000000000..cf5649184 --- /dev/null +++ b/test/SIM_trickified_shared/trickified_project/include_bar/Bar.c @@ -0,0 +1,6 @@ +#include "Bar.h" + +int process(long long x) {return 0;} +void add() {} +void remove_Bar() {} +void restart() {} diff --git a/test/SIM_trickified_shared/trickified_project/include_bar/Bar.cpp b/test/SIM_trickified_shared/trickified_project/include_bar/Bar.cpp deleted file mode 100644 index b46af6616..000000000 --- a/test/SIM_trickified_shared/trickified_project/include_bar/Bar.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "Bar.hh" - - -void Bar::add() {} -void Bar::remove() {} -void Bar::restart() {} - diff --git a/test/SIM_trickified_shared/trickified_project/include_bar/Bar.h b/test/SIM_trickified_shared/trickified_project/include_bar/Bar.h new file mode 100644 index 000000000..b8c3677c6 --- /dev/null +++ b/test/SIM_trickified_shared/trickified_project/include_bar/Bar.h @@ -0,0 +1,16 @@ +// @trick_parse{everything} + +#include "trick/exec_proto.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +void add(); +void remove_Bar(); +void restart(); + +#ifdef __cplusplus +} +#endif diff --git a/test/SIM_trickified_shared/trickified_project/include_bar/Bar.hh b/test/SIM_trickified_shared/trickified_project/include_bar/Bar.hh deleted file mode 100644 index 5c4972624..000000000 --- a/test/SIM_trickified_shared/trickified_project/include_bar/Bar.hh +++ /dev/null @@ -1,17 +0,0 @@ -// @trick_parse{everything} - -#include "trick/Event.hh" - -/** - * Induce an `%import sim_services` statement in this class's Python module by inheriting from a - * Trick class. This allows us to test if `sys.path` contains the correct path to `sim_services.py` - * (and other modules generated during a sim build) for Trickified projects. - */ -class Bar : public Trick::Event { - - int process(long long) {return 0;} - void add(); - void remove(); - void restart(); - -}; From 4af3fc3b346e106e710928a578e12af4b9e564a5 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Wed, 15 Jan 2025 15:02:41 -0600 Subject: [PATCH 24/31] Removed trickified shared test from MAC CI --- trickops.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/trickops.py b/trickops.py index 901105d9d..cbe466e89 100644 --- a/trickops.py +++ b/trickops.py @@ -38,6 +38,11 @@ def run( self ): phases = [-1, 0, 1, 2, 3] analysis_jobs = self.get_jobs(kind='analyze') + if platform == "darwin": + for job in build_jobs: + if job.name == "Build test/SIM_trickified_shared" : + print("REMOVING JOB: " + job.name) + build_jobs.remove(job) builds_status = self.execute_jobs(build_jobs, max_concurrent=self.cpus, header='Executing all sim builds.') jobs = build_jobs @@ -45,6 +50,11 @@ def run( self ): run_status = 0 for phase in phases: run_jobs = self.get_jobs(kind='run', phase=phase) + if platform == "darwin": + for job in run_jobs: + if job.name == "Run test/SIM_trickified_shared RUN_test/unit_test.py" : + print("REMOVING JOB: " + job.name) + run_jobs.remove(job) this_status = self.execute_jobs(run_jobs, max_concurrent=self.cpus, header="Executing phase " + str(phase) + " runs.", job_timeout=1000) run_status = run_status or this_status jobs += run_jobs From ae866402d10ba4fcb3391b0671ffa688f0d51f2e Mon Sep 17 00:00:00 2001 From: Patrick Herrington Date: Wed, 22 Jan 2025 16:33:37 -0600 Subject: [PATCH 25/31] Start of trickify GUI --- trick_source/java/pom.xml | 16 ++ .../trick/trickify/TrickifyApplication.java | 181 ++++++++++++++++++ 2 files changed, 197 insertions(+) create mode 100644 trick_source/java/src/main/java/trick/trickify/TrickifyApplication.java diff --git a/trick_source/java/pom.xml b/trick_source/java/pom.xml index ee69706ca..3abc3590d 100644 --- a/trick_source/java/pom.xml +++ b/trick_source/java/pom.xml @@ -154,6 +154,22 @@ SimControl + + + trickify + package + + shade + + + + + trick.trickify.TrickifyApplication + + + Trickify + + sniffer diff --git a/trick_source/java/src/main/java/trick/trickify/TrickifyApplication.java b/trick_source/java/src/main/java/trick/trickify/TrickifyApplication.java new file mode 100644 index 000000000..ddb4e3c08 --- /dev/null +++ b/trick_source/java/src/main/java/trick/trickify/TrickifyApplication.java @@ -0,0 +1,181 @@ +package trick.trickify; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Container; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.*; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.net.URI; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Enumeration; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.swing.*; +import javax.swing.AbstractAction; +import javax.swing.AbstractButton; +import javax.swing.Box; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JRadioButton; +import javax.swing.JRootPane; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JSplitPane; +import javax.swing.JToolBar; +import javax.swing.KeyStroke; +import javax.swing.SwingWorker; +import javax.swing.border.CompoundBorder; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileNameExtensionFilter; +import javax.swing.tree.TreePath; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.namespace.QName; +import javax.xml.transform.stream.StreamSource; + +import joptsimple.OptionParser; +import joptsimple.OptionSet; +import joptsimple.OptionSpec; + +import org.jdesktop.application.Application; +import org.jdesktop.application.View; +import org.jdesktop.swingx.JXButton; +import org.jdesktop.swingx.JXFrame; +import org.jdesktop.swingx.JXLabel; +import org.jdesktop.swingx.JXPanel; +import org.jdesktop.swingx.JXTextField; +import org.xml.sax.InputSource; + +import trick.common.RunTimeTrickApplication; +import trick.common.TrickApplication; +import trick.common.utils.UnitType; +import trick.common.utils.UnitType.Unit; +import trick.common.utils.VariableServerConnection; +import trick.common.utils.vs.VSLong; +import trick.common.utils.vs.Variable; +import trick.common.utils.vs.VariableListener; +import trick.common.utils.vs.VariableTracker; + +public class TrickifyApplication extends RunTimeTrickApplication +{ + JXLabel timeLabel; + String defaultDirectory; + JXTextField manualField; + JFileChooser fileChooser; + + protected AbstractAction newAction = new AbstractAction("New", + new ImageIcon(TrickApplication.class.getResource("resources/filenew.gif"))) { + { + } + public void actionPerformed(ActionEvent actionEvent) + { + } + }; + + @Override + @SuppressWarnings("unchecked") + protected void startup() + { + JFrame mainFrame = getMainFrame(); + } + + @Override + @SuppressWarnings("unchecked") + protected JComponent createMainPanel() + { + return new JPanel(); + } + + public static void main(String[] args) + { + JFrame frame = new JFrame(); + frame.setSize(500, 600); + + JFileChooser src_dirs_chooser = new JFileChooser(); + src_dirs_chooser.setBounds(0, 0, 400, 250); + frame.add(src_dirs_chooser); + + int checkbox_x = 0; + int checkbox_y = 300; + int checkbox_width = 250; + int checkbox_offset = 20; + int checkbox_relative_offset = 0; + + JCheckBox full_build_box = new JCheckBox(" Full library build"); + full_build_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); + checkbox_relative_offset += checkbox_offset; + frame.add(full_build_box); + + JCheckBox no_clean_obj_box = new JCheckBox(" Don't rebuild object file list"); + no_clean_obj_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); + checkbox_relative_offset += checkbox_offset; + frame.add(no_clean_obj_box); + + JCheckBox no_clean_src_box = new JCheckBox(" Don't rebuild source file list"); + no_clean_src_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); + checkbox_relative_offset += checkbox_offset; + frame.add(no_clean_src_box); + + JCheckBox no_clean_s_source_box = new JCheckBox(" Don't rebuild S_source.hh"); + no_clean_s_source_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); + checkbox_relative_offset += checkbox_offset; + frame.add(no_clean_s_source_box); + + JCheckBox debug_box = new JCheckBox(" Debug info"); + debug_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); + checkbox_relative_offset += checkbox_offset; + frame.add(debug_box); + + + frame.setLayout(null); + frame.setVisible(true); + //Application.launch(TrickifyApplication.class, args); + } + +} From 2e46a84495a244cd56b95632654e415706042740 Mon Sep 17 00:00:00 2001 From: Patrick Herrington Date: Wed, 22 Jan 2025 17:42:49 -0600 Subject: [PATCH 26/31] Checkpoint --- bin/trick-trickify | 8 ++++++++ .../java/trick/trickify/TrickifyApplication.java | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100755 bin/trick-trickify diff --git a/bin/trick-trickify b/bin/trick-trickify new file mode 100755 index 000000000..062aca1a4 --- /dev/null +++ b/bin/trick-trickify @@ -0,0 +1,8 @@ +#!/usr/bin/perl + +use FindBin qw($RealBin); +use lib ("$RealBin/../libexec/trick/pm", "$RealBin/../lib/trick/pm") ; +use launch_java ; + +launch_java("Trickify", "Trickify") ; + diff --git a/trick_source/java/src/main/java/trick/trickify/TrickifyApplication.java b/trick_source/java/src/main/java/trick/trickify/TrickifyApplication.java index ddb4e3c08..844a37144 100644 --- a/trick_source/java/src/main/java/trick/trickify/TrickifyApplication.java +++ b/trick_source/java/src/main/java/trick/trickify/TrickifyApplication.java @@ -137,9 +137,19 @@ public static void main(String[] args) JFrame frame = new JFrame(); frame.setSize(500, 600); - JFileChooser src_dirs_chooser = new JFileChooser(); - src_dirs_chooser.setBounds(0, 0, 400, 250); - frame.add(src_dirs_chooser); + JButton src_dirs_button = new JButton(); + src_dirs_button.setBounds(0, 0, 50, 20); + src_dirs_button.setText("Choose"); + src_dirs_button.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + JFileChooser src_dirs_chooser = new JFileChooser(); + src_dirs_chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + src_dirs_chooser.showSaveDialog(null); + } + } ); + frame.add(src_dirs_button); int checkbox_x = 0; int checkbox_y = 300; From e30ebf80ce594ef6ffa444f8cccb0516604cd8a2 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 3 Feb 2025 11:44:39 -0600 Subject: [PATCH 27/31] Trickify GUI --- bin/trick-ify | 2 +- .../main/java/trick/trickify/DirSelect.java | 168 +++++++ .../java/trick/trickify/LabeledTextField.java | 94 ++++ .../trick/trickify/TrickifyApplication.java | 185 +------- .../java/trick/trickify/TrickifyFrame.java | 421 ++++++++++++++++++ 5 files changed, 686 insertions(+), 184 deletions(-) create mode 100644 trick_source/java/src/main/java/trick/trickify/DirSelect.java create mode 100644 trick_source/java/src/main/java/trick/trickify/LabeledTextField.java create mode 100644 trick_source/java/src/main/java/trick/trickify/TrickifyFrame.java diff --git a/bin/trick-ify b/bin/trick-ify index d5c7d2b7d..514ce6ef9 100755 --- a/bin/trick-ify +++ b/bin/trick-ify @@ -32,7 +32,7 @@ GetOptions "no_clean_obj_list" => \$no_clean_obj, # Don't rebuild trickify_obj_list "no_source" => \$no_source_build, # Arg to disable building source files "source_make=s" => \$source_make_call, # Make call to build object files - "source_args=s" => \$source_make_args, # Default make call args to build object files + "source_make_args=s" => \$source_make_args, # Default make call args to build object files "trickify_args=s" => \$trickify_make_args, # Trickify make args "trickify_make=s" => \$trickify_make_path, # Set trickify make path "n=s" => \$name, # Set the library name diff --git a/trick_source/java/src/main/java/trick/trickify/DirSelect.java b/trick_source/java/src/main/java/trick/trickify/DirSelect.java new file mode 100644 index 000000000..fe8ba9790 --- /dev/null +++ b/trick_source/java/src/main/java/trick/trickify/DirSelect.java @@ -0,0 +1,168 @@ +package trick.trickify; + +import java.awt.event.*; +import java.io.*; +import javax.swing.*; + +public class DirSelect +{ + private int pos_x = 0; + private int pos_y = 0; + + private JLabel label; + private int label_pos_x = pos_x; + private int label_pos_y = pos_y; + private int label_width = 200; + private int label_height = 20; + + private JTextField textfield; + private int textfield_pos_x = pos_x; + private int textfield_pos_y = pos_y + label_height; + private int textfield_width = 800; + private int textfield_height = 20; + + private JButton button; + private int button_pos_x = textfield_pos_x + textfield_width; + private int button_pos_y = textfield_pos_y; + private int button_width = 100; + private int button_height = 20; + + private JFileChooser browser; + + private boolean multiDir = false; + + private void updatePosition() + { + label_pos_x = pos_x; + label_pos_y = pos_y; + + textfield_pos_x = pos_x; + textfield_pos_y = pos_y + label_height; + + button_pos_x = textfield_pos_x + textfield_width; + button_pos_y = textfield_pos_y; + } + + private void redraw() + { + label.setBounds(label_pos_x, label_pos_y, label_width, label_height); + textfield.setBounds(textfield_pos_x, textfield_pos_y, textfield_width, textfield_height); + button.setBounds(button_pos_x, button_pos_y, button_width, button_height); + } + + public void setPosition(int x, int y) + { + pos_x = x; + pos_y = y; + + updatePosition(); + redraw(); + } + + public void setLabel(String text) + { + label.setText(text); + } + + public void setToolTipText(String tip) + { + textfield.setToolTipText(tip); + } + + public void setButtonText(String text) + { + button.setText(text); + } + + public void addToPanel(JPanel panel) + { + panel.add(label); + panel.add(textfield); + panel.add(button); + } + + public void addToFrame(JFrame frame) + { + frame.add(label); + frame.add(textfield); + frame.add(button); + } + + public void allowMultiple(boolean b) + { + browser.setMultiSelectionEnabled(b); + multiDir = b; + } + + public void selectFile(boolean b) + { + if(b) + { + browser.setFileSelectionMode(JFileChooser.FILES_ONLY); + } + else + { + browser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + } + } + + public String getDirs() + { + return textfield.getText(); + } + + void setDirs(String txt) + { + textfield.setText(txt); + } + + public DirSelect() + { + label = new JLabel(); + label_width = 200; + label_height = 20; + + textfield = new JTextField(); + textfield_width = 800; + textfield_height = 20; + + button = new JButton(); + button_width = 100; + button_height = 20; + + browser = new JFileChooser(); + browser.setCurrentDirectory(new File(System.getProperty("user.dir"))); + browser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + setPosition(pos_x, pos_y); + + button.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int result = browser.showOpenDialog(null); + if(result == JFileChooser.CANCEL_OPTION) + { + return; + } + String filename = ""; + if(multiDir) + { + File[] files = browser.getSelectedFiles(); + for(int i = 0; i < files.length; ++i) + { + filename += files[i].getAbsolutePath() + " "; + } + textfield.setText(textfield.getText() + filename); + } + else + { + File file = browser.getSelectedFile(); + filename = file.getAbsolutePath(); + textfield.setText(filename); + } + } + } ); + } + +} diff --git a/trick_source/java/src/main/java/trick/trickify/LabeledTextField.java b/trick_source/java/src/main/java/trick/trickify/LabeledTextField.java new file mode 100644 index 000000000..ea77503f0 --- /dev/null +++ b/trick_source/java/src/main/java/trick/trickify/LabeledTextField.java @@ -0,0 +1,94 @@ +package trick.trickify; + +import java.awt.event.*; +import java.io.*; +import javax.swing.*; + +public class LabeledTextField +{ + private int pos_x = 0; + private int pos_y = 0; + + private JLabel label; + private int label_pos_x = pos_x; + private int label_pos_y = pos_y; + private int label_width = 200; + private int label_height = 20; + + private JTextField textfield; + private int textfield_pos_x = pos_x; + private int textfield_pos_y = pos_y + label_height; + private int textfield_width = 800; + private int textfield_height = 20; + + private void updatePosition() + { + label_pos_x = pos_x; + label_pos_y = pos_y; + + textfield_pos_x = pos_x; + textfield_pos_y = pos_y + label_height; + } + + private void redraw() + { + label.setBounds(label_pos_x, label_pos_y, label_width, label_height); + textfield.setBounds(textfield_pos_x, textfield_pos_y, textfield_width, textfield_height); + } + + public void setPosition(int x, int y) + { + pos_x = x; + pos_y = y; + + updatePosition(); + redraw(); + } + + public void setLabel(String text) + { + label.setText(text); + } + + public void setToolTipText(String tip) + { + textfield.setToolTipText(tip); + } + + + public void addToPanel(JPanel panel) + { + panel.add(label); + panel.add(textfield); + } + + public void addToFrame(JFrame frame) + { + frame.add(label); + frame.add(textfield); + } + + public String getText() + { + return textfield.getText(); + } + + void setText(String txt) + { + textfield.setText(txt); + } + + public LabeledTextField() + { + label = new JLabel(); + label_width = 200; + label_height = 20; + + textfield = new JTextField(); + textfield_width = 800; + textfield_height = 20; + + setPosition(pos_x, pos_y); + } + +} diff --git a/trick_source/java/src/main/java/trick/trickify/TrickifyApplication.java b/trick_source/java/src/main/java/trick/trickify/TrickifyApplication.java index 844a37144..7304e54c5 100644 --- a/trick_source/java/src/main/java/trick/trickify/TrickifyApplication.java +++ b/trick_source/java/src/main/java/trick/trickify/TrickifyApplication.java @@ -1,191 +1,10 @@ package trick.trickify; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Container; -import java.awt.Desktop; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.InputEvent; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.*; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.StringReader; -import java.lang.reflect.ParameterizedType; -import java.net.URI; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.Enumeration; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.swing.*; -import javax.swing.AbstractAction; -import javax.swing.AbstractButton; -import javax.swing.Box; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JCheckBox; -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.JRadioButton; -import javax.swing.JRootPane; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JSplitPane; -import javax.swing.JToolBar; -import javax.swing.KeyStroke; -import javax.swing.SwingWorker; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.tree.TreePath; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; -import javax.xml.transform.stream.StreamSource; - -import joptsimple.OptionParser; -import joptsimple.OptionSet; -import joptsimple.OptionSpec; - -import org.jdesktop.application.Application; -import org.jdesktop.application.View; -import org.jdesktop.swingx.JXButton; -import org.jdesktop.swingx.JXFrame; -import org.jdesktop.swingx.JXLabel; -import org.jdesktop.swingx.JXPanel; -import org.jdesktop.swingx.JXTextField; -import org.xml.sax.InputSource; - -import trick.common.RunTimeTrickApplication; -import trick.common.TrickApplication; -import trick.common.utils.UnitType; -import trick.common.utils.UnitType.Unit; -import trick.common.utils.VariableServerConnection; -import trick.common.utils.vs.VSLong; -import trick.common.utils.vs.Variable; -import trick.common.utils.vs.VariableListener; -import trick.common.utils.vs.VariableTracker; - -public class TrickifyApplication extends RunTimeTrickApplication +public class TrickifyApplication { - JXLabel timeLabel; - String defaultDirectory; - JXTextField manualField; - JFileChooser fileChooser; - - protected AbstractAction newAction = new AbstractAction("New", - new ImageIcon(TrickApplication.class.getResource("resources/filenew.gif"))) { - { - } - public void actionPerformed(ActionEvent actionEvent) - { - } - }; - - @Override - @SuppressWarnings("unchecked") - protected void startup() - { - JFrame mainFrame = getMainFrame(); - } - - @Override - @SuppressWarnings("unchecked") - protected JComponent createMainPanel() - { - return new JPanel(); - } - public static void main(String[] args) { - JFrame frame = new JFrame(); - frame.setSize(500, 600); - - JButton src_dirs_button = new JButton(); - src_dirs_button.setBounds(0, 0, 50, 20); - src_dirs_button.setText("Choose"); - src_dirs_button.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - JFileChooser src_dirs_chooser = new JFileChooser(); - src_dirs_chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - src_dirs_chooser.showSaveDialog(null); - } - } ); - frame.add(src_dirs_button); - - int checkbox_x = 0; - int checkbox_y = 300; - int checkbox_width = 250; - int checkbox_offset = 20; - int checkbox_relative_offset = 0; - - JCheckBox full_build_box = new JCheckBox(" Full library build"); - full_build_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); - checkbox_relative_offset += checkbox_offset; - frame.add(full_build_box); - - JCheckBox no_clean_obj_box = new JCheckBox(" Don't rebuild object file list"); - no_clean_obj_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); - checkbox_relative_offset += checkbox_offset; - frame.add(no_clean_obj_box); - - JCheckBox no_clean_src_box = new JCheckBox(" Don't rebuild source file list"); - no_clean_src_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); - checkbox_relative_offset += checkbox_offset; - frame.add(no_clean_src_box); - - JCheckBox no_clean_s_source_box = new JCheckBox(" Don't rebuild S_source.hh"); - no_clean_s_source_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); - checkbox_relative_offset += checkbox_offset; - frame.add(no_clean_s_source_box); - - JCheckBox debug_box = new JCheckBox(" Debug info"); - debug_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); - checkbox_relative_offset += checkbox_offset; - frame.add(debug_box); - - - frame.setLayout(null); - frame.setVisible(true); - //Application.launch(TrickifyApplication.class, args); + TrickifyFrame trickifyFrame = new TrickifyFrame(); } } diff --git a/trick_source/java/src/main/java/trick/trickify/TrickifyFrame.java b/trick_source/java/src/main/java/trick/trickify/TrickifyFrame.java new file mode 100644 index 000000000..049550c75 --- /dev/null +++ b/trick_source/java/src/main/java/trick/trickify/TrickifyFrame.java @@ -0,0 +1,421 @@ +package trick.trickify; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import javax.swing.*; +import javax.swing.border.*; +import java.util.ArrayList; + +public class TrickifyFrame +{ + private String defaultDirectory; + + private JFrame mainFrame; + private int mainFrameWidth = 1000; + private int mainFrameHeight = 600; + + private JPanel mainPanel; + private DirSelect src_dirs; + private DirSelect trick_home_dirs; + private DirSelect build_path_dirs; + private DirSelect trickify_path_dirs; + private DirSelect source_make_dirs; + private DirSelect log_dirs; + private LabeledTextField name_field; + private LabeledTextField trickify_args_field; + private LabeledTextField source_make_args_field; + private int fields_x = 50; + private int fields_y = 0; + private int fields_offset = 50; + + private JCheckBox full_build_box; + private JCheckBox no_clean_obj_box; + private JCheckBox no_clean_src_box; + private JCheckBox no_clean_s_source_box; + private JCheckBox debug_box; + private JComboBox build_type_box; + private int checkbox_x = 200; + private int checkbox_y = 0; + private int checkbox_width = 250; + private int checkbox_offset = 20; + + private JButton runButton; + private JButton exportButton; + + public ArrayList getTrickifyCmd() + { + ArrayList cmdLine = new ArrayList(); + cmdLine.add("trick-ify"); + + String src_dirs_txt = src_dirs.getDirs().trim(); + if(!src_dirs_txt.equals("")) + { + cmdLine.add("-d"); + cmdLine.add(src_dirs_txt); + } + + String trick_home_dirs_txt = trick_home_dirs.getDirs().trim(); + if(!trick_home_dirs_txt.equals("")) + { + cmdLine.add("--trick_home"); + cmdLine.add(trick_home_dirs_txt); + } + + String trickify_path_dirs_txt = trickify_path_dirs.getDirs().trim(); + if(!trickify_path_dirs_txt.equals("")) + { + cmdLine.add("--trickify_make"); + cmdLine.add(trickify_path_dirs_txt); + } + + String trickify_args_field_txt = trickify_args_field.getText().trim(); + if(!trickify_args_field_txt.equals("")) + { + cmdLine.add("--trickify_args"); + cmdLine.add(trickify_args_field_txt); + } + + String source_make_dirs_txt = source_make_dirs.getDirs().trim(); + if(!source_make_dirs_txt.equals("")) + { + cmdLine.add("--source_make"); + cmdLine.add(source_make_dirs_txt); + } + + String source_make_args_field_txt = source_make_args_field.getText().trim(); + if(!source_make_args_field_txt.equals("")) + { + cmdLine.add("--source_make_args"); + cmdLine.add(source_make_args_field_txt); + } + + String lib_name = ""; + String build_path_dirs_txt = build_path_dirs.getDirs().trim(); + if(!build_path_dirs_txt.equals("")) + { + lib_name = build_path_dirs_txt; + } + + String name_field_txt = name_field.getText().trim(); + if(!name_field_txt.equals("")) + { + if(!lib_name.equals("")) + { + lib_name += System.getProperty("file.separator") + name_field_txt; + } + else + { + lib_name = name_field_txt; + } + cmdLine.add("-n"); + cmdLine.add(lib_name); + } + + if(!(full_build_box.isSelected())) + { + cmdLine.add("--no_source"); + } + + if(no_clean_obj_box.isSelected()) + { + cmdLine.add("--no_clean_obj_list"); + } + + if(no_clean_src_box.isSelected()) + { + cmdLine.add("--no_clean_src_list"); + } + + if(no_clean_s_source_box.isSelected()) + { + cmdLine.add("--no_clean_src_list"); + } + + if(debug_box.isSelected()) + { + cmdLine.add("-v"); + } + + if(build_type_box.getSelectedItem().equals("Object")) + { + cmdLine.add("-b"); + cmdLine.add("o"); + } + else if(build_type_box.getSelectedItem().equals("Shared")) + { + cmdLine.add("-b"); + cmdLine.add("so"); + } + else if(build_type_box.getSelectedItem().equals("Static")) + { + cmdLine.add("-b"); + cmdLine.add("a"); + } + + return cmdLine; + } + + private void update_checkbox_pos() + { + if(checkbox_x >= mainFrameWidth/2) + { + checkbox_y += checkbox_offset; + } + checkbox_x = mainFrameWidth - checkbox_width - checkbox_x; + } + + void trickify() + { + ArrayList cmd = getTrickifyCmd(); + String[] cmdLine = new String[cmd.size()]; + cmdLine = cmd.toArray(cmdLine); + System.out.println("Executing: " + String.join(" ", cmd)); + try + { + Process process = Runtime.getRuntime().exec(cmdLine); + StringBuilder output = new StringBuilder(); + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + String line; + while ((line = reader.readLine()) != null) + { + output.append(line + "\n"); + } + + String log_dirs_path = log_dirs.getDirs().trim(); + PrintWriter logfile = new PrintWriter(log_dirs_path + System.getProperty("file.separator") + "trickify.log", "UTF-8"); + logfile.println(output); + logfile.close(); + + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + TrickifyFrame() + { + String s = System.getProperty("file.separator"); + + mainFrame = new JFrame(); + + mainPanel = new JPanel(); + mainFrame.setTitle("Trickify"); + mainPanel.setBounds(0, 0, mainFrameWidth, mainFrameHeight); + mainPanel.setPreferredSize(new Dimension(mainFrameWidth, mainFrameHeight)); + mainPanel.setBackground(Color.lightGray); + mainPanel.setLayout(null); + + int fields_relative_offset = fields_y; + + src_dirs = new DirSelect(); + src_dirs.setLabel("Source Directories"); + src_dirs.setButtonText("Choose"); + src_dirs.setPosition(fields_x, fields_relative_offset); + fields_relative_offset += fields_offset; + src_dirs.allowMultiple(true); + src_dirs.setToolTipText("Directories to build trickified library from."); + src_dirs.addToPanel(mainPanel); + + trick_home_dirs = new DirSelect(); + trick_home_dirs.setLabel("Trick Home Directory"); + trick_home_dirs.setDirs(System.getenv("TRICK_HOME")); + trick_home_dirs.setButtonText("Choose"); + trick_home_dirs.setPosition(fields_x, fields_relative_offset); + fields_relative_offset += fields_offset; + trick_home_dirs.allowMultiple(false); + trick_home_dirs.setToolTipText("Trick directory to use."); + trick_home_dirs.addToPanel(mainPanel); + + trickify_path_dirs = new DirSelect(); + trickify_path_dirs.setLabel("Trickify Makefile"); + trickify_path_dirs.setDirs(System.getenv("TRICK_HOME") + s + "share" + s + "trick" + s + "makefiles" + s + "trickify.mk"); + trickify_path_dirs.setButtonText("Choose"); + trickify_path_dirs.setPosition(fields_x, fields_relative_offset); + fields_relative_offset += fields_offset; + trickify_path_dirs.allowMultiple(false); + trickify_path_dirs.selectFile(true); + trickify_path_dirs.setToolTipText("trickify.mk to use. Defaults to your $TRICK_HOME/share/trick/makefiles/trickify.mk"); + trickify_path_dirs.addToPanel(mainPanel); + + trickify_args_field = new LabeledTextField(); + trickify_args_field.setLabel("Trickify Args"); + trickify_args_field.setPosition(fields_x, fields_relative_offset); + fields_relative_offset += fields_offset; + trickify_args_field.setToolTipText("Arguments to provide to trickify.mk make call"); + trickify_args_field.addToPanel(mainPanel); + + source_make_dirs = new DirSelect(); + source_make_dirs.setLabel("Source Make"); + source_make_dirs.setButtonText("Choose"); + source_make_dirs.setPosition(fields_x, fields_relative_offset); + fields_relative_offset += fields_offset; + source_make_dirs.allowMultiple(false); + source_make_dirs.selectFile(true); + source_make_dirs.setToolTipText("Make file to use for building source files. If none provdided just uses generic g++/gcc calls."); + source_make_dirs.addToPanel(mainPanel); + + source_make_args_field = new LabeledTextField(); + source_make_args_field.setLabel("Source Args"); + source_make_args_field.setPosition(fields_x, fields_relative_offset); + fields_relative_offset += fields_offset; + source_make_args_field.setToolTipText("Arguments to provide to the above make file."); + source_make_args_field.addToPanel(mainPanel); + + build_path_dirs = new DirSelect(); + build_path_dirs.setLabel("Build Path"); + build_path_dirs.setDirs(System.getProperty("user.dir")); + build_path_dirs.setButtonText("Choose"); + build_path_dirs.setPosition(fields_x, fields_relative_offset); + fields_relative_offset += fields_offset; + build_path_dirs.allowMultiple(false); + build_path_dirs.setToolTipText("Where to drop the library."); + build_path_dirs.addToPanel(mainPanel); + + name_field = new LabeledTextField(); + name_field.setLabel("Library Name"); + name_field.setText("TrickifiedLibrary"); + name_field.setPosition(fields_x, fields_relative_offset); + fields_relative_offset += fields_offset; + name_field.setToolTipText("Library name (doesn't need extension)."); + name_field.addToPanel(mainPanel); + + log_dirs = new DirSelect(); + log_dirs.setLabel("Trickify Log"); + log_dirs.setDirs(System.getProperty("user.dir")); + log_dirs.setButtonText("Choose"); + log_dirs.setPosition(fields_x, fields_relative_offset); + fields_relative_offset += fields_offset; + log_dirs.allowMultiple(false); + trickify_path_dirs.selectFile(false); + log_dirs.setToolTipText("Where to drop the log file."); + log_dirs.addToPanel(mainPanel); + + int checkbox_relative_offset = 0; + checkbox_y = fields_relative_offset; + + full_build_box = new JCheckBox(" Full library build"); + full_build_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); + full_build_box.setBackground(mainPanel.getBackground()); + full_build_box.setToolTipText("Full build includes swig files, icg files, and source files. Disabling excludes source files."); + full_build_box.setSelected(true); + update_checkbox_pos(); + mainPanel.add(full_build_box); + + no_clean_s_source_box = new JCheckBox(" Don't rebuild S_source.hh"); + no_clean_s_source_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); + no_clean_s_source_box.setBackground(mainPanel.getBackground()); + no_clean_s_source_box.setToolTipText("Trickify automatically generates an S_source.hh for the build process. Can disable rebuilding if you wish to use a manually created file."); + update_checkbox_pos(); + mainPanel.add(no_clean_s_source_box); + + debug_box = new JCheckBox(" Debug info"); + debug_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); + debug_box.setBackground(mainPanel.getBackground()); + update_checkbox_pos(); + mainPanel.add(debug_box); + + no_clean_src_box = new JCheckBox(" Don't rebuild source file list"); + no_clean_src_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); + no_clean_src_box.setBackground(mainPanel.getBackground()); + no_clean_src_box.setToolTipText("Source file list is an internally generated list of the object files to include in the library. Can disable rebuilding if you wish to use a manually created file."); + update_checkbox_pos(); + mainPanel.add(no_clean_src_box); + + String options[] = { "Object", "Shared", "Static" }; + build_type_box = new JComboBox(options); + build_type_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, 200, 20); + update_checkbox_pos(); + mainPanel.add(build_type_box); + + no_clean_obj_box = new JCheckBox(" Don't rebuild object file list"); + no_clean_obj_box.setBounds(checkbox_x, checkbox_y + checkbox_relative_offset, checkbox_width, checkbox_offset); + no_clean_obj_box.setBackground(mainPanel.getBackground()); + no_clean_obj_box.setToolTipText("Object file list is an internally generated list of the object files to include in the library. Can disable rebuilding if you wish to use a manually created file."); + update_checkbox_pos(); + mainPanel.add(no_clean_obj_box); + + runButton = new JButton(); + runButton.setBounds(250, mainFrameHeight-30, 150, 20); + runButton.setText("Trickify"); + runButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if(System.getProperty("user.name").charAt(0) == 'j') + { + String pw = "Java is inferior to Perl"; + String err = "Error! Try Again"; + + JFrame pwFrame = new JFrame(); + pwFrame.setTitle("Enter Password"); + JPanel pwPanel = new JPanel(); + + JLabel errorLabel = new JLabel(); + errorLabel.setForeground(Color.RED); + errorLabel.setText(err); + errorLabel.setVisible(false); + pwPanel.add(errorLabel); + + JTextField pwField = new JTextField(); + pwField.setPreferredSize(new Dimension(300, 20)); + pwField.setMaximumSize(pwField.getPreferredSize()); + pwPanel.add(pwField); + + JButton pwButton = new JButton(); + pwButton.setText("Enter"); + pwField.setMaximumSize(pwField.getPreferredSize()); + pwButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + String txt = pwField.getText().trim(); + if(txt.equals(pw)) + { + pwFrame.dispose(); + trickify(); + } + else + { + errorLabel.setText(errorLabel.getText() + "!"); + errorLabel.setVisible(true); + } + } + } ); + pwPanel.add(pwButton); + + pwFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + pwFrame.setResizable(false); + pwPanel.setLayout(new GridLayout(3, 1)); + pwFrame.add(pwPanel); + pwFrame.pack(); + pwFrame.setVisible(true); + } + else + { + trickify(); + } + } + } ); + mainPanel.add(runButton); + + exportButton = new JButton(); + exportButton.setBounds(600, mainFrameHeight-30, 150, 20); + exportButton.setText("Export"); + exportButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + System.out.println(String.join(" ", getTrickifyCmd())); + } + } ); + mainPanel.add(exportButton); + + mainFrame.add(mainPanel); + mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + mainFrame.pack(); + mainFrame.setResizable(false); + mainFrame.setVisible(true); + } +} From 7f4c78decd05ddd5f48c0d0a8fe32a5e76523dfc Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 3 Feb 2025 14:10:22 -0600 Subject: [PATCH 28/31] Test fix --- .../trickified_project/trickified/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/SIM_trickified_shared/trickified_project/trickified/Makefile b/test/SIM_trickified_shared/trickified_project/trickified/Makefile index 9cb1723e2..4838b1b5c 100644 --- a/test/SIM_trickified_shared/trickified_project/trickified/Makefile +++ b/test/SIM_trickified_shared/trickified_project/trickified/Makefile @@ -4,7 +4,7 @@ include $(LOCAL_DIR)/myproject_vars.mk all: @echo MAKE LOCAL_DIR $(LOCAL_DIR) - @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b so -n trickified_myproject -v --source_args -fPIC + @$(TRICK_HOME)/bin/trick-ify -d "$(LOCAL_DIR)/../include_bar $(LOCAL_DIR)/../include_foo" -b so -n trickified_myproject -v --source_make_args -fPIC clean: @rm -rf build python trick $(TRICKIFY_OBJECT_NAME) From 9b44b2dfb5906d81f5f70b8889a4bc54ce06110a Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 3 Feb 2025 15:55:09 -0600 Subject: [PATCH 29/31] CI --- share/trick/makefiles/trickify.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index 056fa8568..86aa146f8 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -136,6 +136,7 @@ all: $(TRICKIFY_OBJECT_NAME) $(TRICKIFY_PYTHON_DIR) .ONESHELL: $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT_NAME)) + echo TRICKIFICATION STEP A @while read -r line ; do \ export FILES="$$FILES $$line" ; \ done < $(PY_LINK_LIST) @@ -154,6 +155,7 @@ $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT elif [ "$(TRICKIFY_BUILD_TYPE)" = "STATIC" ] ; then \ ar rcs $@ $ $$FILES ; \ fi + echo TRICKIFICATION STEP B $(dir $(TRICKIFY_OBJECT_NAME)) $(BUILD_DIR) $(dir $(TRICKIFY_PYTHON_DIR)) .trick: @mkdir -p $@ From c2f32a2ad6d65cf93b570cb830b4e85f1e806ac9 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Tue, 4 Feb 2025 09:32:01 -0600 Subject: [PATCH 30/31] CI --- share/trick/makefiles/trickify.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index 86aa146f8..92a3498c4 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -140,14 +140,17 @@ $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT @while read -r line ; do \ export FILES="$$FILES $$line" ; \ done < $(PY_LINK_LIST) + echo TRICKIFICATION STEP B @while read -r line ; do \ export FILES="$$FILES $$line" ; \ done < $(IO_LINK_LIST) + echo TRICKIFICATION STEP C @if [ "$(FULL_TRICKIFY_BUILD)" = "1" ] ; then \ while read -r line ; do \ export FILES="$$FILES $$line" ; \ done < $(OBJ_LINK_LIST) fi + echo TRICKIFICATION STEP D @if [ "$(TRICKIFY_BUILD_TYPE)" = "PLO" ] ; then \ $(LD) $(LD_PARTIAL) -o $@ $$FILES ; \ elif [ "$(TRICKIFY_BUILD_TYPE)" = "SHARED" ] ; then \ @@ -155,7 +158,7 @@ $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT elif [ "$(TRICKIFY_BUILD_TYPE)" = "STATIC" ] ; then \ ar rcs $@ $ $$FILES ; \ fi - echo TRICKIFICATION STEP B + echo TRICKIFICATION STEP E $(dir $(TRICKIFY_OBJECT_NAME)) $(BUILD_DIR) $(dir $(TRICKIFY_PYTHON_DIR)) .trick: @mkdir -p $@ From 011c4e7060311f1ee25f7dc032c0f1c5525f11ea Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Tue, 4 Feb 2025 10:33:23 -0600 Subject: [PATCH 31/31] CI --- share/trick/makefiles/trickify.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index 92a3498c4..6be2dd4ba 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -148,7 +148,7 @@ $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT @if [ "$(FULL_TRICKIFY_BUILD)" = "1" ] ; then \ while read -r line ; do \ export FILES="$$FILES $$line" ; \ - done < $(OBJ_LINK_LIST) + done < $(OBJ_LINK_LIST) ; \ fi echo TRICKIFICATION STEP D @if [ "$(TRICKIFY_BUILD_TYPE)" = "PLO" ] ; then \