Skip to content

Commit

Permalink
Merge pull request #8 from asfadmin/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
rudigens committed Oct 28, 2013
2 parents 54a3e73 + 0d299a2 commit 4972239
Show file tree
Hide file tree
Showing 336 changed files with 6,287 additions and 8,147 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@
*.out
*.app

# scons stuff
.sconsign.dblite

4 changes: 4 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ MAPREADY_MODULES = \
src/libasf_ardop \
src/libasf_terrcorr \
src/libasf_insar \
src/libasf_remap \
src/asf_import \
src/asf_export \
src/asf_geocode \
Expand All @@ -47,6 +48,7 @@ MAPREADY_MODULES = \
src/gr2sr \
src/to_sr \
src/deskew \
src/libasf_metadata \
src/metadata \
src/resample \
src/fill_holes \
Expand All @@ -63,6 +65,8 @@ MAPREADY_MODULES = \
src/plan \
src/brs2jpg \
src/add_aux_band \
src/fit_warp \
src/remap \
src/update_state \
src/clm \
src/populate_meta_field \
Expand Down
34 changes: 30 additions & 4 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,20 @@ src_subs = [
"add_aux_band",
"asf_view",
"asf_convert_gui",
"addapole",
"accum_offset",
"dspddr",

"adjust_bands",
"asf_import",
"asf_export",
"asf_geocode",
"asf_terrcorr",
"asf_convert",
"asf_calpol",
"asf_calibrate",
"asf_gamma_import",
"asf_airsar_import",
"asf_polsarpro_import",
"brs2jpg",
"diffimage",
"diffmeta",
"libasf_import",
"libasf_terrcorr",
"libasf_ardop",
Expand All @@ -85,6 +95,22 @@ src_subs = [
"asf_meta",
"sgpsdp",
"libasf_export",
"trim",
"make_overlay",
"asf_kml_overlay",
"sample_plugin",
"metadata_gui",
"proj2proj",
"libasf_metadata",
"refine_geolocation",
"shift_geolocation",
"flip",
"write_ppf",
"analyze_yaw",
"fftMatch",
"fit_warp",
"libasf_remap",
"remap",
]

# do the actual building
Expand Down
37 changes: 22 additions & 15 deletions site_scons/site_init.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
def _runUnitTest(target, source, env):
"""Function to run a unit test."""
def _unit_test_pseudo_builder(env, source, extra_depends, **kwargs):
"""Pseudo builder to execute unit test programs after they're built, and to set their dependencies."""

cur_dir = env["src_dir"]
test_binary = env.Program("test_binary", source, **kwargs)
test_result = env.Command(target = "test.semaphore",
source = test_binary[0].abspath,
action = run_test)

if not source:
sys.stderr.write("Warning: no unit test for " + cur_dir + "\n")
return 0
env.Depends(test_result, extra_depends)

def add_UnitTest(env):
"""Function to make the UnitTest builder."""
env.AddMethod(_unit_test_pseudo_builder, "UnitTest")

def run_test(target, source, env):
"""Run an external program and get its return code."""

target_file = target[0].abspath
test_binary = source[0].abspath

import subprocess
test_program = str(source[0].abspath)
if not subprocess.call(test_program):
open(str(target[0]), "w").write("passed\n")
retcode = subprocess.call(test_binary)

if retcode == 0:
open(target_file, "w").write("test passed")
return 0
else:
sys.stderr.write("Unit test failed for " + cur_dir + "\n")
sys.stderr.write("warning: unit test failed")
return 1

def add_UnitTest(env):
"""Function to make the UnitTest builder."""
utbuild = Builder(action = _runUnitTest)
env.Append(BUILDERS = {"UnitTest": utbuild})

def checkEndian(env):
"""Endianness test function. Python already knows what endian it is, just ask Python. This code was tested on Intel, AMD 64, and Cell (Playstation 3)."""
Expand Down
3 changes: 0 additions & 3 deletions src/accum_offset/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,3 @@ mans = localenv.File(["accum_offset.1"])

globalenv.Install(globalenv["inst_dirs"]["mans"], mans)

# run the unit test, and set its dependencies
test_result = localenv.UnitTest("test.semaphore", None)
localenv.Depends(test_result, [bins, mans])
3 changes: 0 additions & 3 deletions src/add_aux_band/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,3 @@ bins = localenv.Program("add_aux_band", Glob("*.c"))

globalenv.Install(globalenv["inst_dirs"]["bins"], bins)

# run the unit test, and set its dependencies
test_result = localenv.UnitTest("test.semaphore", None)
localenv.Depends(test_result, [bins])
23 changes: 21 additions & 2 deletions src/add_aux_band/add_aux_band.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ void add_aux_band(const char *inFile, const char *outFile, const char *type)
#define ADD_LAT 6
#define ADD_LON 7
#define ADD_YAW 8
#define ADD_LINE 9
#define ADD_SAMPLE 10

const char *band_str=MAGIC_UNSET_STRING;

int what=0;
Expand Down Expand Up @@ -230,16 +233,26 @@ void add_aux_band(const char *inFile, const char *outFile, const char *type)
what=ADD_TIME;
band_str = "TIME";
}
else if (strcmp_case(type, "time") == 0) {
else if (strcmp_case(type, "lat") == 0 || strcmp_case(type, "latitude") == 0) {
asfPrintStatus("Adding Latitude (degrees)\n");
what=ADD_LAT;
band_str = "LAT";
}
else if (strcmp_case(type, "time") == 0) {
else if (strcmp_case(type, "long") == 0 || strcmp_case(type, "longitude") == 0) {
asfPrintStatus("Adding Longitude (degrees)\n");
what=ADD_LON;
band_str = "LON";
}
else if (strcmp_case(type, "line") == 0) {
asfPrintStatus("Adding line number\n");
what=ADD_LINE;
band_str = "LINE_ORIG";
}
else if (strcmp_case(type, "sample") == 0) {
asfPrintStatus("Adding sample number\n");
what=ADD_SAMPLE;
band_str = "SAMPLE_ORIG";
}
else {
asfPrintError("Unknown band type: %s\n", type);
}
Expand Down Expand Up @@ -334,6 +347,12 @@ void add_aux_band(const char *inFile, const char *outFile, const char *type)
buf[jj] = lon;
break;
}
case ADD_LINE:
buf[jj] = ii;
break;
case ADD_SAMPLE:
buf[jj] = jj;
break;
default:
asfPrintError("add_aux_band - Internal Error %d\n", what);
}
Expand Down
3 changes: 0 additions & 3 deletions src/addapole/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,3 @@ bins = localenv.Program("addapole", Glob("*.c"))

globalenv.Install(globalenv["inst_dirs"]["bins"], bins)

# run the unit test, and set its dependencies
test_result = localenv.UnitTest("test.semaphore", None)
localenv.Depends(test_result, [bins])
40 changes: 40 additions & 0 deletions src/adjust_bands/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import os.path

Import("globalenv")
localenv = globalenv.Clone()

localenv.AppendUnique(CPPPATH = [
"#include",
"#src/asf",
"#src/asf_meta",
"#src/libasf_proj",
"#src/libasf_sar",
"#src/libasf_raster",
])

localenv.ParseConfig("pkg-config --cflags --libs libgeotiff")
localenv.ParseConfig("pkg-config --cflags --libs gsl")
localenv.ParseConfig("pkg-config --cflags --libs glib-2.0")
localenv.ParseConfig("pkg-config --cflags --libs libpng")

localenv.AppendUnique(LIBS = ["asf",
"asf_meta",
"asf_proj",
"asf_raster",
"asf_fft",
])

head_build_dir, tail_build_dir = os.path.split(Dir(".").path)

localenv.AppendUnique(LIBPATH = [
"#" + os.path.join(head_build_dir, "asf"),
"#" + os.path.join(head_build_dir, "asf_meta"),
"#" + os.path.join(head_build_dir, "libasf_proj"),
"#" + os.path.join(head_build_dir, "libasf_raster"),
"#" + os.path.join(head_build_dir, "asf_fft"),
])

bins = localenv.Program("adjust_bands", Glob("*.c"))

globalenv.Install(globalenv["inst_dirs"]["bins"], bins)

42 changes: 42 additions & 0 deletions src/airsarin/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import os.path

Import("globalenv")
localenv = globalenv.Clone()

localenv.AppendUnique(CPPPATH = [
"#include",
"#src/asf",
"#src/asf_meta",
"#src/libasf_proj",
])

localenv.ParseConfig("pkg-config --cflags --libs libgeotiff")
localenv.ParseConfig("pkg-config --cflags --libs gsl")
localenv.ParseConfig("pkg-config --cflags --libs glib-2.0")

localenv.AppendUnique(LIBS = [
"asf",
"asf_meta",
"asf_proj",
])

head_build_dir, tail_build_dir = os.path.split(Dir(".").path)

localenv.AppendUnique(LIBPATH = [
"#" + os.path.join(head_build_dir, "asf"),
"#" + os.path.join(head_build_dir, "asf_meta"),
"#" + os.path.join(head_build_dir, "libasf_proj"),
])

bins = localenv.Program("airsarin", [
"airsarin.c",
"airsar2ddr.c",
"airsar_io.c",
])

globalenv.Install(globalenv["inst_dirs"]["bins"], bins)

mans = localenv.File(["airsarin.1"])

globalenv.Install(globalenv["inst_dirs"]["mans"], mans)

36 changes: 36 additions & 0 deletions src/analyze_yaw/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os.path

Import("globalenv")
localenv = globalenv.Clone()

localenv.AppendUnique(CPPPATH = [
"#src/asf/",
"#include/",
"#src/asf_meta/",
"#src/libasf_proj/",
"#src/libasf_raster/",
"#src/libasf_sar",
])

localenv.ParseConfig("pkg-config --cflags --libs libgeotiff")
localenv.ParseConfig("pkg-config --cflags --libs gsl")
localenv.ParseConfig("pkg-config --cflags --libs glib-2.0")

localenv.AppendUnique(LIBS = [
"asf",
"asf_proj",
"asf_meta",
])

head_build_dir, tail_build_dir = os.path.split(Dir(".").path)

localenv.AppendUnique(LIBPATH = [
"#" + os.path.join(head_build_dir, "asf"),
"#" + os.path.join(head_build_dir, "libasf_proj"),
"#" + os.path.join(head_build_dir, "asf_meta"),
])


bins = localenv.Program("analyze_yaw", Glob("*.c"))

globalenv.Install(globalenv["inst_dirs"]["bins"], bins)
33 changes: 33 additions & 0 deletions src/ardop/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
include ../../make_support/system_rules

LIBS = \
$(LIBDIR)/libasf_ardop.a \
$(LIBDIR)/libasf_sar.a \
$(LIBDIR)/libasf_export.a \
$(LIBDIR)/libasf_raster.a \
$(LIBDIR)/asf_fft.a \
$(LIBDIR)/asf_meta.a \
$(LIBDIR)/libasf_proj.a \
$(LIBDIR)/asf.a \
$(PROJ_LIBS) \
$(JPEG_LIBS) \
$(GEOTIFF_LIBS) \
$(TIFF_LIBS) \
$(PNG_LIBS) \
$(GSL_LIBS) \
$(GLIB_LIBS) \
$(ZLIB_LIBS)

LIBC = $(LIBS) -lm

OBJS = ardop.o parse_cla.o

all: ardop

ardop: $(OBJS)
$(CC) $(CFLAGS) -o ardop $(OBJS) $(LIBC) $(LDFLAGS)
mv ardop$(BIN_POSTFIX) $(BINDIR)
cp ardop.1 ../../man/cat1/ardop.1

clean:
rm -f core *.o
Loading

0 comments on commit 4972239

Please sign in to comment.