Skip to content

Commit

Permalink
ecwjp2 sdk 5.5 changes
Browse files Browse the repository at this point in the history
- implementation for API breaking changes.
- handle "newabi" rename to "cpp11abi" in configure and configure.ac
- example information in nmake.opt
  • Loading branch information
christapley committed Oct 17, 2019
1 parent 0cb59e2 commit e5cb540
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 122 deletions.
34 changes: 22 additions & 12 deletions gdal/configure
Original file line number Diff line number Diff line change
Expand Up @@ -33205,18 +33205,23 @@ $as_echo "found libecwj2 in $with_ecw/lib." >&6; }

# ECW SDK 5.0 style and also for the case where license type is included in path i.e. specific license type is requested.
elif test -r $with_ecw/lib/$ECW_ARCH/$ECW_CONF/libNCSEcw.a ; then
# Test if we must use the newabi version (SDK 5.4)
if test -r $with_ecw/lib/newabi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a; then
# Test if we must use the newabi/cpp11abi version (SDK 5.4+)
if test -r $with_ecw/lib/newabi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a || test -r $with_ecw/lib/cpp11abi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a; then
if test -d $with_ecw/lib/newabi; then
ECW_ABIDIR=newabi
else
ECW_ABIDIR=cpp11abi
fi
echo "#include <string>" > testnewabi.cpp
echo "namespace NCS { class CString { public: static std::wstring Utf8Decode (const std::string &sUtf8); }; }" >> testnewabi.cpp
echo "int main() { return static_cast<int>(NCS::CString::Utf8Decode(std::string()).size()); }" >> testnewabi.cpp
if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testnewabi.cpp -L$with_ecw/lib/newabi/$ECW_ARCH/$ECW_CONF -lNCSEcw -o testnewabi 2>&1`" ; then
ECW_LIBDIR=$with_ecw/lib/newabi/$ECW_ARCH/$ECW_CONF
if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testnewabi.cpp -L$with_ecw/lib/$ECW_ABIDIR/$ECW_ARCH/$ECW_CONF -lNCSEcw -o testnewabi 2>&1`" ; then
ECW_LIBDIR=$with_ecw/lib/$ECW_ABIDIR/$ECW_ARCH/$ECW_CONF
ECW_LIBS="-L$ECW_LIBDIR -lNCSEcw $ECW_FRAMEWORK_COCOA"
with_ecw=$with_ecw/$ecw_license_type
ECW_54="yes"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found Intergraph 5.4+ SDK with newabi in ${ECW_LIBDIR}." >&5
$as_echo "found Intergraph 5.4+ SDK with newabi in ${ECW_LIBDIR}." >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found Intergraph 5.4+ SDK with ${ECW_ABIDIR} in ${ECW_LIBDIR}." >&5
$as_echo "found Intergraph 5.4+ SDK with ${ECW_ABIDIR} in ${ECW_LIBDIR}." >&6; }
rm -f testnewabi.*
rm -f testnewabi
break
Expand All @@ -33234,17 +33239,22 @@ $as_echo "found Intergraph 5.x+ SDK in ${ECW_LIBDIR}." >&6; }
elif test -d $with_ecw; then
for ecw_license_type in "Desktop_Read-Write" "Server_Read-Only_EndUser" "Server_Read-Only" "Server_Read-Write" "Desktop_Read-Only"
do
# Test if we must use the newabi version (SDK 5.4)
if test -r $with_ecw/$ecw_license_type/lib/newabi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a; then
# Test if we must use the newabi/cpp11abi version (SDK 5.4+)
if test -r $with_ecw/$ecw_license_type/lib/newabi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a || test -r $with_ecw/$ecw_license_type/lib/cpp11abi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a; then
if test -d $with_ecw/lib/newabi; then
ECW_ABIDIR=newabi
else
ECW_ABIDIR=cpp11abi
fi
echo "#include <string>" > testnewabi.cpp
echo "namespace NCS { class CString { public: static std::wstring Utf8Decode (const std::string &sUtf8); }; }" >> testnewabi.cpp
echo "int main() { return static_cast<int>(NCS::CString::Utf8Decode(std::string()).size()); }" >> testnewabi.cpp
if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testnewabi.cpp -L$with_ecw/$ecw_license_type/lib/newabi/$ECW_ARCH/$ECW_CONF -lNCSEcw -o testnewabi 2>&1`" ; then
ECW_LIBDIR=$with_ecw/$ecw_license_type/lib/newabi/$ECW_ARCH/$ECW_CONF
if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testnewabi.cpp -L$with_ecw/$ecw_license_type/lib/$ECW_ABIDIR/$ECW_ARCH/$ECW_CONF -lNCSEcw -o testnewabi 2>&1`" ; then
ECW_LIBDIR=$with_ecw/$ecw_license_type/lib/$ECW_ABIDIR/$ECW_ARCH/$ECW_CONF
ECW_LIBS="-L$ECW_LIBDIR -lNCSEcw $ECW_FRAMEWORK_COCOA"
with_ecw=$with_ecw/$ecw_license_type
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found Intergraph 5.4+ SDK with newabi in ${ECW_LIBDIR}." >&5
$as_echo "found Intergraph 5.4+ SDK with newabi in ${ECW_LIBDIR}." >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found Intergraph 5.4+ SDK with ${ECW_ABIDIR} in ${ECW_LIBDIR}." >&5
$as_echo "found Intergraph 5.4+ SDK with ${ECW_ABIDIR} in ${ECW_LIBDIR}." >&6; }
ECW_54="yes"
rm -f testnewabi.*
rm -f testnewabi
Expand Down
30 changes: 20 additions & 10 deletions gdal/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3244,17 +3244,22 @@ else

# ECW SDK 5.0 style and also for the case where license type is included in path i.e. specific license type is requested.
elif test -r $with_ecw/lib/$ECW_ARCH/$ECW_CONF/libNCSEcw.a ; then
# Test if we must use the newabi version (SDK 5.4)
if test -r $with_ecw/lib/newabi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a; then
# Test if we must use the newabi/cpp11abi version (SDK 5.4+)
if test -r $with_ecw/lib/newabi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a || test -r $with_ecw/lib/cpp11abi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a; then
if test -d $with_ecw/lib/newabi; then
ECW_ABIDIR=newabi
else
ECW_ABIDIR=cpp11abi
fi
echo "#include <string>" > testnewabi.cpp
echo "namespace NCS { class CString { public: static std::wstring Utf8Decode (const std::string &sUtf8); }; }" >> testnewabi.cpp
echo "int main() { return static_cast<int>(NCS::CString::Utf8Decode(std::string()).size()); }" >> testnewabi.cpp
if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testnewabi.cpp -L$with_ecw/lib/newabi/$ECW_ARCH/$ECW_CONF -lNCSEcw -o testnewabi 2>&1`" ; then
ECW_LIBDIR=$with_ecw/lib/newabi/$ECW_ARCH/$ECW_CONF
if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testnewabi.cpp -L$with_ecw/lib/$ECW_ABIDIR/$ECW_ARCH/$ECW_CONF -lNCSEcw -o testnewabi 2>&1`" ; then
ECW_LIBDIR=$with_ecw/lib/$ECW_ABIDIR/$ECW_ARCH/$ECW_CONF
ECW_LIBS="-L$ECW_LIBDIR -lNCSEcw $ECW_FRAMEWORK_COCOA"
with_ecw=$with_ecw/$ecw_license_type
ECW_54="yes"
AC_MSG_RESULT([found Intergraph 5.4+ SDK with newabi in ${ECW_LIBDIR}.])
AC_MSG_RESULT([found Intergraph 5.4+ SDK with ${ECW_ABIDIR} in ${ECW_LIBDIR}.])
rm -f testnewabi.*
rm -f testnewabi
break
Expand All @@ -3271,16 +3276,21 @@ else
elif test -d $with_ecw; then
for ecw_license_type in "Desktop_Read-Write" "Server_Read-Only_EndUser" "Server_Read-Only" "Server_Read-Write" "Desktop_Read-Only"
do
# Test if we must use the newabi version (SDK 5.4)
if test -r $with_ecw/$ecw_license_type/lib/newabi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a; then
# Test if we must use the newabi/cpp11abi version (SDK 5.4+)
if test -r $with_ecw/$ecw_license_type/lib/newabi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a || test -r $with_ecw/$ecw_license_type/lib/cpp11abi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a; then
if test -d $with_ecw/lib/newabi; then
ECW_ABIDIR=newabi
else
ECW_ABIDIR=cpp11abi
fi
echo "#include <string>" > testnewabi.cpp
echo "namespace NCS { class CString { public: static std::wstring Utf8Decode (const std::string &sUtf8); }; }" >> testnewabi.cpp
echo "int main() { return static_cast<int>(NCS::CString::Utf8Decode(std::string()).size()); }" >> testnewabi.cpp
if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testnewabi.cpp -L$with_ecw/$ecw_license_type/lib/newabi/$ECW_ARCH/$ECW_CONF -lNCSEcw -o testnewabi 2>&1`" ; then
ECW_LIBDIR=$with_ecw/$ecw_license_type/lib/newabi/$ECW_ARCH/$ECW_CONF
if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testnewabi.cpp -L$with_ecw/$ecw_license_type/lib/$ECW_ABIDIR/$ECW_ARCH/$ECW_CONF -lNCSEcw -o testnewabi 2>&1`" ; then
ECW_LIBDIR=$with_ecw/$ecw_license_type/lib/$ECW_ABIDIR/$ECW_ARCH/$ECW_CONF
ECW_LIBS="-L$ECW_LIBDIR -lNCSEcw $ECW_FRAMEWORK_COCOA"
with_ecw=$with_ecw/$ecw_license_type
AC_MSG_RESULT([found Intergraph 5.4+ SDK with newabi in ${ECW_LIBDIR}.])
AC_MSG_RESULT([found Intergraph 5.4+ SDK with ${ECW_ABIDIR} in ${ECW_LIBDIR}.])
ECW_54="yes"
rm -f testnewabi.*
rm -f testnewabi
Expand Down
17 changes: 11 additions & 6 deletions gdal/frmts/ecw/ecwcreatecopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class GDALECWCompressor final: public CNCSFile {

GDALDataset *m_poSrcDS;

VSIIOStream m_OStream;
std::shared_ptr<VSIIOStream> m_OStream;
int m_nPercentComplete;

int m_bCancelled;
Expand Down Expand Up @@ -143,7 +143,7 @@ class GDALECWCompressor final: public CNCSFile {
/************************************************************************/

GDALECWCompressor::GDALECWCompressor() :
eWorkDT(GDT_Unknown)
m_OStream(std::make_shared<VSIIOStream>()), eWorkDT(GDT_Unknown)
{
m_poSrcDS = nullptr;
m_nPercentComplete = -1;
Expand Down Expand Up @@ -186,7 +186,7 @@ CPLErr GDALECWCompressor::CloseDown()

{
Close( true );
m_OStream.Close();
m_OStream->Close();

return CE_None;
}
Expand Down Expand Up @@ -1008,7 +1008,7 @@ CPLErr GDALECWCompressor::Initialize(
return CE_Failure;
}

m_OStream.Access( fpVSIL, TRUE, (BOOLEAN) bSeekable, pszFilename,
m_OStream->Access( fpVSIL, TRUE, (BOOLEAN) bSeekable, pszFilename,
0, -1 );
}
else
Expand Down Expand Up @@ -1114,8 +1114,13 @@ CPLErr GDALECWCompressor::Initialize(
oError = GetCNCSError(Open( (char *) pszFilename, false, true ));
}
}
else
oError = CNCSJP2FileView::Open( &(m_OStream) );
else {
#if ECWSDK_VERSION>=55
oError = CNCSJP2FileView::Open(m_OStream);
#else
oError = CNCSJP2FileView::Open(m_OStream.get());
#endif
}
}

if( oError.GetErrorNumber() == NCS_SUCCESS )
Expand Down
Loading

0 comments on commit e5cb540

Please sign in to comment.