Lots of changes

This commit is contained in:
plherrin 2025-03-18 12:03:48 -05:00
parent 389a3e09e7
commit 28bfdf6d25
9 changed files with 284 additions and 241 deletions

View File

@ -1,27 +1,29 @@
#!/usr/bin/perl
use Getopt::Long;
use strict ;
$my_path = $0 ;
my $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
$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
$s_overrides = "" ; # Directory containing S_override make files
my $dirs = "" ; # If set, use for both source and header files
my $source_dir = "" ; # Base path to build source from
my $header_dir = "" ; # Base path to find header files
my $source_make_call = "" ; # Make call to build object files
my $source_make_args = "" ; # Args to pass into default object make
my $trickify_make_args = "" ; # Arguments to pass into the trickify make
my $trickify_make_path = "$my_path../share/trick/makefiles/trickify.mk" ; # Path of the trickify make file
my $full_build = 1 ; # Whether to build only ICG/Swig artifacts or entire source
my $name = "trickified" ; # Name of the library
my $build_type = "o" ; # Type of library to be built (o, a , so)
my $debug = 0 ; # Debug info flag
my $trick_home = $my_path . ".." ; # Trick directory to use for building
my $no_source_build = 0 ; # Arg to disable building source files
my $no_clean_obj = 0 ; # Don't rebuild trickify_obj_list
my $no_clean_src = 0 ; # Don't rebuild trickify_src_list
my $no_clean_s_source = 0 ; # Don't rebuild S_source.hh
my $s_overrides = "" ; # Directory containing S_override make files
my $include = "" ; # Directories to include when building source/ICG/SWIG files
GetOptions
(
@ -40,12 +42,12 @@ GetOptions
"b=s" => \$build_type, # Set library build type
"v" => \$debug, # Verbose, print debug info
"trick_home=s" => \$trick_home, # Set trick home directory
"s_overrides=s" => \$s_overrides # Directory containing S_override make files
"s_overrides=s" => \$s_overrides, # Directory containing S_override make files
"include=s" => \$include # Directory containing S_override make files
) ;
$full_build = !$no_source_build ;
$val = $ARGV[$argnum + 1] ;
if( !(($build_type eq "o") or ($build_type eq "a") or ($build_type eq "so") or ($build_type eq "dylib")) )
{
print "Invalid build type {$build_type}, valid build types are {o, a, so}\n" ;
@ -70,40 +72,55 @@ if($source_dir eq "" and $full_build)
exit 1 ;
}
#Build list of includes for compilation. Includes:
# trick_home
# trick_home/include
# Header directory
# Additional user provided directories
#$include_arg = "-I $trick_home -I $trick_home" . "/include -I $header_dir ";
my $include_arg = "";
my @incl_dirs = split ' ', $include ;
foreach my $dir (@incl_dirs)
{
$include_arg .= "-I" . $dir . " " ;
}
#Set Environment Variables
if ($full_build)
{
$ENV{'FULL_TRICKIFY_BUILD'} = "1" ;
}
my @src_dirs = split ' ', $source_dir ;
$source_dir_arg = "" ;
foreach $dir (@src_dirs)
my $source_dir_args = "" ;
foreach my $dir (@src_dirs)
{
$source_dir_arg .= "-I " . $dir . " ";
$source_dir_args .= "-I" . $dir . " " ;
}
$ENV{'TRICKIFY_CXX_FLAGS'} = "$source_dir_args -I $trick_home" . "/include" ;
$ENV{'TRICKIFY_CXX_FLAGS'} = "$source_dir_args -I$trick_home -I$trick_home" . "/include $include_arg" ;
$ENV{'TRICKIFY_OBJECT_NAME'} = "$name.$build_type" ;
$ENV{'TRICKIFY_SOURCE'} = "$source_dir" ;
$ENV{'TRICKIFY_HEADER'} = "$header_dir" ;
$ENV{'TRICKIFY_S_OVERRIDES'} = "$s_overrides" ;
if ( $build_type eq o )
$ENV{'TRICKIFY_INCLUDES'} = "$include_arg" ;
#$ENV{'TRICKIFY_INCLUDES'} = "$include" ;
if ( $build_type eq "o" )
{
$ENV{'TRICKIFY_BUILD_TYPE'} = PLO ;
$ENV{'TRICKIFY_BUILD_TYPE'} = "PLO" ;
}
elsif ( $build_type eq a )
elsif ( $build_type eq "a" )
{
$ENV{'TRICKIFY_BUILD_TYPE'} = STATIC ;
$ENV{'TRICKIFY_BUILD_TYPE'} = "STATIC" ;
}
elsif ( $build_type eq so || $build_type eq dylib )
elsif ( $build_type eq "so" || $build_type eq "dylib" )
{
$ENV{'TRICKIFY_BUILD_TYPE'} = SHARED ;
$ENV{'TRICKIFY_BUILD_TYPE'} = "SHARED" ;
}
#Build the S_source.hh
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" ;
my $make_s_source = "python3 $my_path../share/trick/pymods/trick/build_trickify_S_source_hh.py" ;
print(`$make_s_source`) ;
}
@ -111,15 +128,15 @@ if (!$no_clean_s_source)
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" ;
my $make_src_list = "python3 $my_path../share/trick/pymods/trick/build_trickify_src_list.py" ;
print(`$make_src_list`) ;
}
#Build array of source files
my @src_files ;
if ($full_build)
{
open ($fh, "trickify_src_list") or die "Could not open trickify_src_list: $!" ;
@src_files ;
open (my $fh, "trickify_src_list") or die "Could not open trickify_src_list: $!" ;
while (my $line = <$fh>)
{
chomp $line ;
@ -134,18 +151,19 @@ if ($full_build)
print "Building object files\n" ;
if($source_make_call eq "")
{
foreach $src (@src_files)
foreach my $src (@src_files)
{
$file = $src ;
my $cmd = "" ;
my $file = $src ;
if($file =~ /\S\w*(\Q.c\E)$/)
{
$file =~ s/\Q.c\E$// ;
$cmd = "gcc $source_make_args -I $trick_home -I $trick_home" . "/include -I $header_dir -c $src -o $file.o" ;
$cmd = "gcc $source_make_args $ENV{'TRICKIFY_CXX_FLAGS'} -c $src -o $file.o" ;
}
else
{
$file =~ s/\Q.\E\w*$// ;
$cmd = "g++ $source_make_args -I $trick_home -I $trick_home" . "/include -I $header_dir -c $src -o $file.o" ;
$cmd = "g++ $source_make_args $ENV{'TRICKIFY_CXX_FLAGS'} -c $src -o $file.o" ;
}
if($debug)
{
@ -164,26 +182,27 @@ if ($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" ;
my $make_obj_list = "python3 $my_path../share/trick/pymods/trick/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" ;
my $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_dir = $source_dir_args
source_make_call = $source_make_call
trickify_make_args = $trickify_make_args
trickify_make_path = $trickify_make_path
build_s_source = $build_s_source
build_s_source = $no_clean_s_source
full_build = $full_build
name = $name
build_type = $build_type
trick_home = $trick_home\n" ;
trick_home = $trick_home
TRICKIFY_CXX_FLAGS = $ENV{'TRICKIFY_CXX_FLAGS'}\n" ;
}

View File

@ -31,7 +31,7 @@ sub read_files_to_process() {
(my $cc = gte("TRICK_CC")) =~ s/\n// ;
# Prepend -I to each include path before we pass them to the compiler
my @include_paths = map("-I$_", (get_include_paths(), "$ENV{TRICK_HOME}/include", "$ENV{TRICK_HOME}/include/trick/compat", "$ENV{TRICK_HOME}/trick_source", "../include")) ;
my @include_paths = map("-I$_", (get_include_paths(), "$ENV{TRICK_HOME}", "$ENV{TRICK_HOME}/include", "$ENV{TRICK_HOME}/include/trick/compat", "$ENV{TRICK_HOME}/trick_source", "../include")) ;
my @defines = (get_defines(), "-DTRICK_VER=$year", "-DSWIG", "-std=c++11") ;
# get the list of header files from the compiler
@ -181,7 +181,9 @@ SWIG_I =" ;
(my $swig_file = $file) =~ s/(\.[^.]*)?$/_py/ ;
print MAKEFILE " \\\n build$swig_file.i" ;
print PY_LINK_LIST "build$swig_file.o\n" ;
print TRICKIFY_PY_LINK_LIST "build$swig_file.o\n" ;
if ( !($swig_file =~ /(.*)S_source_py$/) ) {
print TRICKIFY_PY_LINK_LIST "build$swig_file.o\n" ;
}
}
print MAKEFILE "

View File

@ -140,7 +140,6 @@ endif
all: $(TRICKIFY_OBJECT_NAME) $(TRICKIFY_PYTHON_DIR)
$(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT_NAME))
@echo TRICKIFICATION
@sh -c '\
FILES=""; \
while IFS= read -r line; do \

View File

@ -495,7 +495,11 @@ void PrintAttributes::printIOMakefile() {
size_t found ;
found = (*mit).second.find_last_of(".") ;
io_link_list << (*mit).second.substr(0,found) << ".o" << std::endl ;
trickify_io_link_list << (*mit).second.substr(0,found) << ".o" << std::endl ;
std::string ssrc = (*mit).second.substr(0,found) ;
if(ssrc.substr( ssrc.length()-11, ssrc.length()) != "io_S_source" )
{
trickify_io_link_list << (*mit).second.substr(0,found) << ".o" << std::endl ;
}
ICG_processed << (*mit).first << std::endl ;
}
makefile_ICG.close() ;

View File

@ -1,46 +1,20 @@
package trick.trickify;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
public class DirSelect extends JPanel
public class DirSelect extends 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 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;
public final static int button_width = 100;
public final static int button_height = 20;
private JFileChooser browser;
private boolean multiDir = false;
public void setLabel(String text)
{
label.setText(text);
}
public void setToolTipText(String tip)
{
textfield.setToolTipText(tip);
}
public void setButtonText(String text)
{
button.setText(text);
@ -64,29 +38,11 @@ public class DirSelect extends JPanel
}
}
public String getText()
{
return textfield.getText();
}
void setText(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;
super();
button = new JButton();
button_width = 100;
button_height = 20;
browser = new JFileChooser();
browser.setCurrentDirectory(new File(System.getProperty("user.dir")));
@ -109,7 +65,7 @@ public class DirSelect extends JPanel
{
filename += files[i].getAbsolutePath() + " ";
}
textfield.setText(textfield.getText() + filename);
textfield.setText(textfield.getText().trim() + " " + filename.trim());
}
else
{
@ -120,10 +76,7 @@ public class DirSelect extends JPanel
}
} );
add(label);
add(textfield);
add(button);
add(button, BorderLayout.EAST);
}
}

View File

@ -1,25 +1,19 @@
package trick.trickify;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
public class LabeledTextField extends JPanel
{
private int pos_x = 0;
private int pos_y = 0;
protected JLabel label;
public final static int label_width = 200;
public final static int label_height = 20;
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;
protected JTextField textfield;
public final static int textfield_width = 1000;
public final static int textfield_height = 20;
public void setLabel(String text)
{
@ -31,16 +25,6 @@ public class LabeledTextField extends JPanel
textfield.setToolTipText(tip);
}
public void addToPanel(JPanel panel)
{
}
public void addToFrame(JFrame frame)
{
frame.add(label);
frame.add(textfield);
}
public String getText()
{
return textfield.getText();
@ -53,16 +37,16 @@ public class LabeledTextField extends JPanel
public LabeledTextField()
{
setLayout(new BorderLayout());
label = new JLabel();
label_width = 200;
label_height = 20;
label.setPreferredSize(new Dimension(label_width, label_height));
textfield = new JTextField();
textfield_width = 800;
textfield_height = 20;
textfield.setPreferredSize(new Dimension(textfield_width, textfield_height));
add(label);
add(textfield);
add(label, BorderLayout.NORTH);
add(textfield, BorderLayout.CENTER);
}
}

View File

@ -18,7 +18,7 @@ public class TrickifyApplication extends TrickApplication
{
if(panel == null)
{
panel = new TrickifyPanel();
panel = new TrickifyPanel(this);
}
return panel;
}
@ -36,7 +36,7 @@ public class TrickifyApplication extends TrickApplication
super.startup();
createMainPanel();
panel.load_properties(trickProperties);
panel.load_properties();
// Build the GUI.
View view = getMainView();
@ -50,7 +50,7 @@ public class TrickifyApplication extends TrickApplication
@Override
protected void shutdown()
{
panel.save_properties(trickProperties);
panel.save_properties();
super.shutdown();
}

View File

@ -10,10 +10,14 @@ import java.io.FileWriter;
import java.io.FileReader;
import java.util.Properties;
import trick.common.TrickApplication;
import org.jdesktop.application.Action;
public class TrickifyPanel extends JPanel
{
private TrickApplication myApp;
private Properties trickProp;
private JPanel fieldPanel;
private JPanel boxPanel;
private JPanel buttonPanel;
@ -22,20 +26,22 @@ public class TrickifyPanel extends JPanel
private JMenu fileMenu = new JMenu();
private JMenuItem saveMenuItem = new JMenuItem();
private JMenuItem loadMenuItem = new JMenuItem();
private JMenuItem loadDefaultMenuItem = new JMenuItem();
private JMenu viewMenu = new JMenu();
private JMenuItem defaultViewMenuItem = new JMenuItem();
private String trick_home;
private int mainFrameWidth = 1000;
private int mainFrameHeight = 600;
private int mainFrameWidth = DirSelect.textfield_width + DirSelect.button_width;
private int mainFrameHeight = 800;
private JPanel mainPanel;
private DirSelect src_dirs;
private DirSelect trick_home_dirs;
private DirSelect build_path_dirs;
private DirSelect trickify_path_dirs;
private DirSelect trickify_include_dirs;
private DirSelect source_make_dirs;
private DirSelect log_dirs;
private DirSelect s_overrides_dirs;
@ -46,15 +52,13 @@ public class TrickifyPanel extends JPanel
private String trick_home_config = "TRICK_HOME";
private String build_path_config = "BUILD_PATH";
private String trickify_path_config = "TRICKIFY_PATH";
private String trickify_include_config = "TRICKIFY_INCLUDE";
private String source_make_config = "SOURCE_MAKE";
private String log_config = "LOG";
private String s_overrides_config = "S_OVERRIDES";
private String name_config = "NAME";
private String trickify_args_config = "TRICKIFY_ARGS";
private String source_make_args_config = "SOURCE_MAKE_ARGS";
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;
@ -68,10 +72,6 @@ public class TrickifyPanel extends JPanel
private String no_clean_s_source_config = "NO_CLEAN_S_SOURCE";
private String debug_config = "DEBUG";
private String build_type_config = "BUILD_TYPE";
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;
@ -114,6 +114,20 @@ public class TrickifyPanel extends JPanel
cmdLine.add(trickify_path_dirs_txt);
}
String trickify_include_dirs_txt = trickify_include_dirs.getText().trim();
if(!trickify_include_dirs_txt.equals(""))
{
cmdLine.add("--include");
if(useQuotes)
{
cmdLine.add("\"" + trickify_include_dirs_txt + "\"");
}
else
{
cmdLine.add(trickify_include_dirs_txt);
}
}
String trickify_args_field_txt = trickify_args_field.getText().trim();
if(!trickify_args_field_txt.equals(""))
{
@ -238,86 +252,104 @@ public class TrickifyPanel extends JPanel
}
}
public void save_properties(Properties p)
public void save_properties()
{
p.setProperty(src_dirs_config, src_dirs.getText().trim());
p.setProperty(trick_home_config, trick_home_dirs.getText().trim());
p.setProperty(trickify_path_config, trickify_path_dirs.getText().trim());
p.setProperty(trickify_args_config, trickify_args_field.getText().trim());
p.setProperty(source_make_config, source_make_dirs.getText().trim());
p.setProperty(source_make_args_config, source_make_args_field.getText().trim());
p.setProperty(build_path_config, build_path_dirs.getText().trim());
p.setProperty(s_overrides_config, s_overrides_dirs.getText().trim());
p.setProperty(name_config, name_field.getText().trim());
p.setProperty(full_build_config, Boolean.toString(full_build_box.isSelected()));
p.setProperty(no_clean_obj_config, Boolean.toString(no_clean_obj_box.isSelected()));
p.setProperty(no_clean_src_config, Boolean.toString(no_clean_src_box.isSelected()));
p.setProperty(no_clean_s_source_config, Boolean.toString(no_clean_s_source_box.isSelected()));
p.setProperty(debug_config, Boolean.toString(debug_box.isSelected()));
p.setProperty(build_type_config, build_type_box.getSelectedItem().toString());
save_properties(trickProp);
}
public void load_properties(Properties p)
public void save_properties(Properties prop)
{
String prop = null;
prop.setProperty(src_dirs_config, src_dirs.getText().trim());
prop.setProperty(trick_home_config, trick_home_dirs.getText().trim());
prop.setProperty(trickify_path_config, trickify_path_dirs.getText().trim());
prop.setProperty(trickify_include_config, trickify_include_dirs.getText().trim());
prop.setProperty(trickify_args_config, trickify_args_field.getText().trim());
prop.setProperty(source_make_config, source_make_dirs.getText().trim());
prop.setProperty(source_make_args_config, source_make_args_field.getText().trim());
prop.setProperty(build_path_config, build_path_dirs.getText().trim());
prop.setProperty(s_overrides_config, s_overrides_dirs.getText().trim());
prop.setProperty(name_config, name_field.getText().trim());
prop.setProperty(full_build_config, Boolean.toString(full_build_box.isSelected()));
prop.setProperty(no_clean_obj_config, Boolean.toString(no_clean_obj_box.isSelected()));
prop.setProperty(no_clean_src_config, Boolean.toString(no_clean_src_box.isSelected()));
prop.setProperty(no_clean_s_source_config, Boolean.toString(no_clean_s_source_box.isSelected()));
prop.setProperty(debug_config, Boolean.toString(debug_box.isSelected()));
prop.setProperty(build_type_config, build_type_box.getSelectedItem().toString());
}
if((prop = p.getProperty(src_dirs_config)) != null)
public void load_properties()
{
load_properties(trickProp);
}
public void load_properties(Properties prop)
{
String propText = null;
if((propText = prop.getProperty(src_dirs_config)) != null)
{
src_dirs.setText(prop);
src_dirs.setText(propText);
}
prop = null;
propText = null;
if((prop = p.getProperty(trick_home_config)) != null)
if((propText = prop.getProperty(trick_home_config)) != null)
{
trick_home_dirs.setText(prop);
trick_home_dirs.setText(propText);
}
prop = null;
propText = null;
if((prop = p.getProperty(trickify_path_config)) != null)
if((propText = prop.getProperty(trickify_path_config)) != null)
{
trickify_path_dirs.setText(prop);
trickify_path_dirs.setText(propText);
}
prop = null;
propText = null;
if((prop = p.getProperty(trickify_args_config)) != null)
if((propText = prop.getProperty(trickify_include_config)) != null)
{
trickify_args_field.setText(prop);
trickify_include_dirs.setText(propText);
}
prop = null;
propText = null;
if((prop = p.getProperty(source_make_config)) != null)
if((propText = prop.getProperty(trickify_args_config)) != null)
{
source_make_dirs.setText(prop);
trickify_args_field.setText(propText);
}
prop = null;
propText = null;
if((prop = p.getProperty(source_make_args_config)) != null)
if((propText = prop.getProperty(source_make_config)) != null)
{
source_make_args_field.setText(prop);
source_make_dirs.setText(propText);
}
prop = null;
propText = null;
if((prop = p.getProperty(build_path_config)) != null)
if((propText = prop.getProperty(source_make_args_config)) != null)
{
build_path_dirs.setText(prop);
source_make_args_field.setText(propText);
}
prop = null;
propText = null;
if((prop = p.getProperty(s_overrides_config)) != null)
if((propText = prop.getProperty(build_path_config)) != null)
{
s_overrides_dirs.setText(prop);
build_path_dirs.setText(propText);
}
prop = null;
propText = null;
if((prop = p.getProperty(name_config)) != null)
if((propText = prop.getProperty(s_overrides_config)) != null)
{
name_field.setText(prop);
s_overrides_dirs.setText(propText);
}
prop = null;
propText = null;
if((prop = p.getProperty(full_build_config)) != null)
if((propText = prop.getProperty(name_config)) != null)
{
if(prop.equals("true"))
name_field.setText(propText);
}
propText = null;
if((propText = prop.getProperty(full_build_config)) != null)
{
if(propText.equals("true"))
{
full_build_box.setSelected(true);
}
@ -326,11 +358,11 @@ public class TrickifyPanel extends JPanel
full_build_box.setSelected(false);
}
}
prop = null;
propText = null;
if((prop = p.getProperty(no_clean_obj_config)) != null)
if((propText = prop.getProperty(no_clean_obj_config)) != null)
{
if(prop.equals("true"))
if(propText.equals("true"))
{
no_clean_obj_box.setSelected(true);
}
@ -339,11 +371,11 @@ public class TrickifyPanel extends JPanel
no_clean_obj_box.setSelected(false);
}
}
prop = null;
propText = null;
if((prop = p.getProperty(no_clean_src_config)) != null)
if((propText = prop.getProperty(no_clean_src_config)) != null)
{
if(prop.equals("true"))
if(propText.equals("true"))
{
no_clean_src_box.setSelected(true);
}
@ -352,11 +384,11 @@ public class TrickifyPanel extends JPanel
no_clean_src_box.setSelected(false);
}
}
prop = null;
propText = null;
if((prop = p.getProperty(no_clean_s_source_config)) != null)
if((propText = prop.getProperty(no_clean_s_source_config)) != null)
{
if(prop.equals("true"))
if(propText.equals("true"))
{
no_clean_s_source_box.setSelected(true);
}
@ -365,11 +397,11 @@ public class TrickifyPanel extends JPanel
no_clean_s_source_box.setSelected(false);
}
}
prop = null;
propText = null;
if((prop = p.getProperty(debug_config)) != null)
if((propText = prop.getProperty(debug_config)) != null)
{
if(prop.equals("true"))
if(propText.equals("true"))
{
debug_box.setSelected(true);
}
@ -378,14 +410,20 @@ public class TrickifyPanel extends JPanel
debug_box.setSelected(false);
}
}
prop = null;
propText = null;
if((prop = p.getProperty(build_type_config)) != null)
if((propText = prop.getProperty(build_type_config)) != null)
{
build_type_box.setSelectedItem(prop);
build_type_box.setSelectedItem(propText);
}
}
@Action
public void loadDefaultPropertiesAction(ActionEvent e)
{
set_default();
}
private void set_default()
{
String s = System.getProperty("file.separator");
@ -393,6 +431,7 @@ public class TrickifyPanel extends JPanel
src_dirs.setText("");
trick_home_dirs.setText(trick_home);
trickify_path_dirs.setText(trick_home + s + "share" + s + "trick" + s + "makefiles" + s + "trickify.mk");
trickify_include_dirs.setText("");
trickify_args_field.setText("");
source_make_dirs.setText("");
source_make_args_field.setText("");
@ -400,7 +439,7 @@ public class TrickifyPanel extends JPanel
build_path_dirs.setText(System.getProperty("user.dir"));
name_field.setText("TrickifiedLibrary");
log_dirs.setText(System.getProperty("user.dir"));
full_build_box.setSelected(false);
full_build_box.setSelected(true);
no_clean_obj_box.setSelected(false);
no_clean_src_box.setSelected(false);
no_clean_s_source_box.setSelected(false);
@ -411,25 +450,77 @@ public class TrickifyPanel extends JPanel
@Action
public void restoreDefaultView(ActionEvent e)
{
setSize(mainFrameWidth, mainFrameHeight);
myApp.getMainFrame().setSize(mainFrameWidth, mainFrameHeight);
}
TrickifyPanel()
@Action
public void savePropertiesAction(ActionEvent e)
{
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File(System.getProperty("user.dir")));
int result = fc.showOpenDialog(null);
if(result == JFileChooser.CANCEL_OPTION)
{
return;
}
String filename = "";
File file = fc.getSelectedFile();
filename = file.getAbsolutePath();
Properties p = new Properties();
save_properties(p);
try
{
p.store(new FileWriter(filename), "Trickify Properties");
}
catch (IOException exp)
{
exp.printStackTrace();
}
}
@Action
public void loadPropertiesAction(ActionEvent e)
{
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File(System.getProperty("user.dir")));
int result = fc.showOpenDialog(null);
if(result == JFileChooser.CANCEL_OPTION)
{
return;
}
String filename = "";
File file = fc.getSelectedFile();
filename = file.getAbsolutePath();
Properties p = new Properties();
try
{
p.load(new FileReader(filename));
}
catch (IOException exp)
{
exp.printStackTrace();
}
load_properties(p);
}
TrickifyPanel(TrickApplication app)
{
myApp = app;
trickProp = myApp.trickProperties;
String s = System.getProperty("file.separator");
trick_home = new File(TrickifyPanel.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile().getParentFile().getParentFile().getParentFile().getParentFile().getAbsolutePath();
setBounds(0, 0, mainFrameWidth, mainFrameHeight);
setPreferredSize(new Dimension(mainFrameWidth, mainFrameHeight));
setBackground(Color.lightGray);
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1;
fieldPanel = new JPanel();
fieldPanel.setPreferredSize(new Dimension(mainFrameWidth, 400));
fieldPanel.setLayout(new GridLayout(10, 1));
fieldPanel.setLayout(new GridLayout(11, 1));
add(fieldPanel, gbc);
boxPanel = new JPanel();
@ -439,26 +530,31 @@ public class TrickifyPanel extends JPanel
buttonPanel = new JPanel();
add(buttonPanel, gbc);
javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance().getContext().getActionMap(TrickifyPanel.class, this);
//Build File Menu
fileMenu.setName("trickify.fileMenu");
saveMenuItem.setName("trickify.saveMenuItem");
saveMenuItem.setAction(actionMap.get("savePropertiesAction"));
fileMenu.add(saveMenuItem);
loadMenuItem.setName("trickify.loadMenuItem");
loadMenuItem.setAction(actionMap.get("loadPropertiesAction"));
fileMenu.add(loadMenuItem);
loadDefaultMenuItem.setName("trickify.loadDefaultMenuItem");
loadDefaultMenuItem.setAction(actionMap.get("loadDefaultPropertiesAction"));
fileMenu.add(loadDefaultMenuItem);
menu.add(fileMenu);
//Build View Menu
viewMenu.setName("trickify.viewMenu");
defaultViewMenuItem.setName("trickify.defaultViewMenuItem");
defaultViewMenuItem.setAction(actionMap.get("restoreDefaultView"));
viewMenu.add(defaultViewMenuItem);
menu.add(viewMenu);
int fields_relative_offset = fields_y;
src_dirs = new DirSelect();
src_dirs.setLabel("Source Directories");
src_dirs.setButtonText("Choose");
fields_relative_offset += fields_offset;
src_dirs.allowMultiple(true);
src_dirs.setToolTipText("Directories to build trickified library from.");
fieldPanel.add(src_dirs);
@ -466,7 +562,6 @@ public class TrickifyPanel extends JPanel
trick_home_dirs = new DirSelect();
trick_home_dirs.setLabel("Trick Home Directory");
trick_home_dirs.setButtonText("Choose");
fields_relative_offset += fields_offset;
trick_home_dirs.allowMultiple(false);
trick_home_dirs.setToolTipText("Trick directory to use.");
fieldPanel.add(trick_home_dirs);
@ -474,22 +569,27 @@ public class TrickifyPanel extends JPanel
trickify_path_dirs = new DirSelect();
trickify_path_dirs.setLabel("Trickify Makefile");
trickify_path_dirs.setButtonText("Choose");
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");
fieldPanel.add(trickify_path_dirs);
trickify_include_dirs = new DirSelect();
trickify_include_dirs.setLabel("Includes");
trickify_include_dirs.setButtonText("Choose");
trickify_include_dirs.allowMultiple(true);
trickify_include_dirs.selectFile(false);
trickify_include_dirs.setToolTipText("Paths to include during compilation.");
fieldPanel.add(trickify_include_dirs);
trickify_args_field = new LabeledTextField();
trickify_args_field.setLabel("Trickify Args");
fields_relative_offset += fields_offset;
trickify_args_field.setToolTipText("Arguments to provide to trickify.mk make call");
fieldPanel.add(trickify_args_field);
source_make_dirs = new DirSelect();
source_make_dirs.setLabel("Source Make");
source_make_dirs.setButtonText("Choose");
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.");
@ -497,14 +597,12 @@ public class TrickifyPanel extends JPanel
source_make_args_field = new LabeledTextField();
source_make_args_field.setLabel("Source Args");
fields_relative_offset += fields_offset;
source_make_args_field.setToolTipText("Arguments to provide to the above make file.");
fieldPanel.add(source_make_args_field);
s_overrides_dirs = new DirSelect();
s_overrides_dirs.setLabel("S_overrides");
s_overrides_dirs.setButtonText("Choose");
fields_relative_offset += fields_offset;
s_overrides_dirs.allowMultiple(false);
s_overrides_dirs.selectFile(true);
s_overrides_dirs.setToolTipText("S_overrides to incorporate");
@ -513,67 +611,50 @@ public class TrickifyPanel extends JPanel
build_path_dirs = new DirSelect();
build_path_dirs.setLabel("Build Path");
build_path_dirs.setButtonText("Choose");
fields_relative_offset += fields_offset;
build_path_dirs.allowMultiple(false);
build_path_dirs.setToolTipText("Where to drop the library.");
fieldPanel.add(build_path_dirs);
name_field = new LabeledTextField();
name_field.setLabel("Library Name");
fields_relative_offset += fields_offset;
name_field.setToolTipText("Library name (doesn't need extension).");
fieldPanel.add(name_field);
log_dirs = new DirSelect();
log_dirs.setLabel("Trickify Log");
log_dirs.setButtonText("Choose");
fields_relative_offset += fields_offset;
log_dirs.allowMultiple(false);
log_dirs.selectFile(false);
log_dirs.setToolTipText("Where to drop the log file.");
fieldPanel.add(log_dirs);
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(getBackground());
full_build_box.setToolTipText("Full build includes swig files, icg files, and source files. Disabling excludes source files.");
boxPanel.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(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.");
boxPanel.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(getBackground());
boxPanel.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(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.");
boxPanel.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);
boxPanel.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(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.");
boxPanel.add(no_clean_obj_box);
set_default();
runButton = new JButton();
runButton.setBounds(250, mainFrameHeight-30, 150, 20);
runButton.setPreferredSize(new Dimension(150, 20));
runButton.setText("Trickify");
runButton.addActionListener(new ActionListener()
{
@ -637,7 +718,7 @@ public class TrickifyPanel extends JPanel
buttonPanel.add(runButton);
exportButton = new JButton();
exportButton.setBounds(600, mainFrameHeight-30, 150, 20);
exportButton.setPreferredSize(new Dimension(150, 20));
exportButton.setText("Print");
exportButton.addActionListener(new ActionListener()
{

View File

@ -13,6 +13,7 @@ Application.lookAndFeel = system
trickify.fileMenu.text = File
trickify.saveMenuItem.text = Save Config
trickify.loadMenuItem.text = Load Config
trickify.loadDefaultMenuItem.text = Load Default
trickify.viewMenu.text = View
trickify.defaultViewMenuItem.text = Restore Default