mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 21:27:54 +00:00
Checkpoint
This commit is contained in:
parent
094498f0f8
commit
95b3bcf623
@ -1,12 +1,15 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use Cwd qw();
|
||||
$my_path = $0 ;
|
||||
$my_path =~ s/trick-ify// ;
|
||||
|
||||
$source_dir = "" ; # Base path to build lib from. Default to working directory
|
||||
$trickify_make_args = "" ; # Arguments to pass into the trickify make
|
||||
$trickify_make_path = "" ; # Path of the trickify make file
|
||||
$make_S_source = 0 ; # Whether to generate a S_source
|
||||
$full_build = 1 ; # Whether to build only ICG/Swig artifacts or entire source
|
||||
$source_dir = "." ; # Base path to build lib from. Default to working directory
|
||||
$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
|
||||
$make_S_source = 0 ; # Whether to generate a S_source
|
||||
$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)
|
||||
|
||||
$skip_arg = 0 ;
|
||||
foreach $argnum (0 .. $#ARGV)
|
||||
@ -41,17 +44,61 @@ foreach $argnum (0 .. $#ARGV)
|
||||
$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"
|
||||
}
|
||||
$skip_arg = 1 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Unrecognized argument: $arg\n" ;
|
||||
}
|
||||
}
|
||||
|
||||
$trickify_make_call = "make $trickify_make_args -f $trickify_make_path" . "/trickify.mk" ;
|
||||
print $trickify_make_call ;
|
||||
print "\n" ;
|
||||
print Cwd::abs_path() ;
|
||||
print "\n" ;
|
||||
print $0 ;
|
||||
print "\n" ;
|
||||
# print(`make`) ;
|
||||
#Set Environment Variables
|
||||
$ENV{'TRICKIFY_CXX_FLAGS'} = "-I $source_dir" ; #TODO: Test with multiple dirs passed in at once
|
||||
$ENV{'TRICKIFY_OBJECT_NAME'} = "$name.$build_type" ;
|
||||
$ENV{'TRICKIFY_SOURCE'} = "$source_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 ;
|
||||
}
|
||||
|
||||
print "BUILD INFO:
|
||||
$ENV{'TRICKIFY_SOURCE'}
|
||||
source_dir = $source_dir
|
||||
trickify_make_args = $trickify_make_args
|
||||
trickify_make_path = $trickify_make_path
|
||||
make_S_source = $make_S_source
|
||||
full_build = $full_build
|
||||
name = $name
|
||||
build_type = $build_type\n" ;
|
||||
|
||||
#Build the S_source.hh
|
||||
$make_s_source = "python3 $my_path../share/trick/makefiles/build_trickify_S_source_hh.py" ;
|
||||
print(`$make_s_source`) ;
|
||||
|
||||
#Build trickify call
|
||||
$trickify_make_call = "make $trickify_make_args -f $trickify_make_path" ;
|
||||
print(`$trickify_make_call`) ;
|
||||
|
@ -107,7 +107,8 @@ 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)
|
||||
SRC_LINK_LIST :=
|
||||
LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) $(SRC_LINK_LIST)
|
||||
ifneq ($(wildcard $(BUILD_DIR)),)
|
||||
SWIG_OBJECTS := $(shell cat $(PY_LINK_LIST))
|
||||
IO_OBJECTS := $(shell cat $(IO_LINK_LIST))
|
||||
@ -168,9 +169,6 @@ $(TRICKIFY_PYTHON_DIR): $(SWIG_OBJECTS:.o=.cpp) | $(dir $(TRICKIFY_PYTHON_DIR))
|
||||
$(info $(call COLOR,Zipping) Python modules into $@)
|
||||
$(call ECHO_AND_LOG,cd .trick && zip -Arq $@ .)
|
||||
|
||||
S_source.hh :
|
||||
python3 ${TRICK_HOME}/share/trick/makefiles/build_trickify_S_source_hh.py
|
||||
|
||||
# SWIG_OBJECTS and IO_OBJECTS are meant to contain all of the *_py and io_*
|
||||
# object file names, respectively, by looking at products of ICG and
|
||||
# make_makefile_swig. However, we can't run a rule for ICG before those
|
||||
@ -202,7 +200,7 @@ S_source.hh :
|
||||
# dependency list. The method is laid out in more detail here:
|
||||
# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
|
||||
|
||||
$(BUILD_DIR)S_source.d: S_source.hh | $(BUILD_DIR)
|
||||
$(BUILD_DIR)S_source.d: | $(BUILD_DIR)
|
||||
$(call ECHO_AND_LOG,$(TRICK_HOME)/bin/trick-ICG $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(TRICK_ICGFLAGS) S_source.hh)
|
||||
$(call ECHO_AND_LOG,$(TRICK_HOME)/$(LIBEXEC)/trick/make_makefile_swig)
|
||||
$(call ECHO_AND_LOG,$(TRICK_CC) -MM -MP -MT $@ -MF $@ $(TRICKIFY_CXX_FLAGS) S_source.hh)
|
||||
|
@ -5,12 +5,11 @@ TRICK_HOME := $(abspath $(PROJECT_HOME)/../../..)
|
||||
include $(LOCAL_DIR)/myproject_vars.mk
|
||||
|
||||
export TRICKIFY_SOURCE := $(PROJECT_HOME)/include
|
||||
# export TRICKIFY_BUILD_TYPE := PLO
|
||||
# export TRICKIFY_OBJECT_NAME := trickified_myproject.o
|
||||
export TRICKIFY_CXX_FLAGS := -I$(PROJECT_HOME)/include -I$(TRICK_HOME)/include
|
||||
export TRICKIFY_CXX_FLAGS := -I $(PROJECT_HOME)/include -I $(TRICK_HOME)/include
|
||||
|
||||
all:
|
||||
@$(MAKE) -s -f $(TRICK_HOME)/share/trick/makefiles/trickify.mk
|
||||
#@$(MAKE) -s -f $(TRICK_HOME)/share/trick/makefiles/trickify.mk
|
||||
@trick-ify -d "/users/plherrin/trick/test/SIM_trickified/trickified_project/include" -b a -n trickified_myproject
|
||||
|
||||
clean:
|
||||
@rm -rf build python trick $(TRICKIFY_OBJECT_NAME)
|
||||
|
@ -1,2 +1,2 @@
|
||||
#include "Foo.hh"
|
||||
#include "Bar.hh"
|
||||
#include "/users/plherrin/trick/test/SIM_trickified/trickified_project/include/Bar.hh"
|
||||
#include "/users/plherrin/trick/test/SIM_trickified/trickified_project/include/Foo.hh"
|
||||
|
Loading…
Reference in New Issue
Block a user