Skip to content

Commit 879f565

Browse files
author
oscarkramer
committed
Created script for sandboxing external dependencies.
1 parent bbc24e5 commit 879f565

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

apps/ossim-header-crawl/ossim-header-crawl.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,21 @@ class CppHeaderCrawler
5858
};
5959

6060

61+
void usage(char* appname)
62+
{
63+
cout<<"\nUsage: " << appname << " <path/to/OSSIM_BUILD_DIR> <path-to-output-dir>\n" << endl;
64+
cout<<" Utility app to copy all external header files on a system that are referenced by the \n"
65+
<<" OSSIM build. The headers are copied into a \"sandbox\" directory (usually appended with \n"
66+
<<" \"include\"), preserving namespaces. This is to enable sandbox builds. See the script in\n"
67+
<<" ossim/scripts/ocpld.sh for copying the external libraries needed.\n"<<endl;
68+
return;
69+
}
70+
6171
int main(int argc, char** argv)
6272
{
6373
if (argc < 3)
6474
{
65-
cout << "\nUsage: " << argv[0] << " <path/to/OSSIM_BUILD_DIR> <path-to-output-dir>\n" << endl;
75+
usage(argv[0]);
6676
return 1;
6777
}
6878

@@ -286,6 +296,7 @@ bool CppHeaderCrawler::copyHeaders(const ossimFilename& outputDir)
286296
existingLocation.copyFileTo(newLocation);
287297
cout << "Copied <" << header.first << ">"<< endl;
288298
}
299+
return true;
289300
}
290301

291302
ossimFilename CppHeaderCrawler::findPath(const ossimFilename &file)

scripts/create-sandbox.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# OCPLD -- Ossim CoPy Library Dependencies
4+
# Adapted from code written by Hemanth.HM
5+
6+
# Uncomment to step/debug
7+
#set -x; trap read debug
8+
pushd `dirname ${BASH_SOURCE[0]}` >/dev/null
9+
export SCRIPT_DIR=`pwd -P`
10+
popd >/dev/null
11+
12+
if [ $# -ne 2 ]
13+
then
14+
echo "Usage: `basename $0` <ossim_build_dir> <sandbox_dir>"
15+
exit 1
16+
fi
17+
18+
OSSIM_BUILD_DIR=$1
19+
SANDBOX_DIR=$2
20+
21+
echo "Copying libraries..."
22+
$SCRIPT_DIR/ocpld.sh $OSSIM_BUILD_DIR/lib $SANDBOX_DIR/lib
23+
if [ $? -ne 0 ]; then
24+
echo; echo "Error encountered during ocpld."
25+
popd>/dev/null
26+
exit 1
27+
fi
28+
29+
echo "Copying headers..."
30+
ossim-header-crawl $OSSIM_BUILD_DIR $SANDBOX_DIR/include
31+
if [ $? -ne 0 ]; then
32+
echo; echo "Error encountered during ossim-header-crawl."
33+
popd>/dev/null
34+
exit 1
35+
fi
36+
37+
echo; echo "Sandbox of dependencies has been successfully created in $SANDBOX_DIR."; echo

0 commit comments

Comments
 (0)