Skip to content

Commit

Permalink
Squashed 'externals/nitro/' changes from b5612a7df..f6179b4e1
Browse files Browse the repository at this point in the history
f6179b4e1 Merge branch 'main' into cpp17
09f2f458f use $(SolutionDir) to get to externals
19b260009 Merge branch 'main' into cpp17
3de4c5059 latest from CODA-OSS (#605)
b5d609a0a need #pragma warning(disable) outside push/pop
185f02f14 Merge commit '5efbb0c81357a6ee4da4209e42668c942cb915da' into cpp17
5efbb0c81 Squashed 'externals/coda-oss/' changes from aba8366d8b..0ed92d85a7
0678478cb latest from CODA-OSS
3afd90921 develop/sync_externals
d0d99025d Squashed 'externals/coda-oss/' changes from 1ec9a072c4..aba8366d8b
c16779d74 Merge commit 'd0d99025d060792e63273741fab6e4a99700b49a' into cpp17
2f4fef813 latest from CODA-OSS
261f3752f Merge branch 'main' into cpp17
dc3a8ecf0 export more symbols (#604)
22f11f42b build as a DLL in Visual Studio (#603)
8d8184c27 NITRO can now build DLLs (#602)
d3f58f038 added environment variable to enable pre-loading of TREs (#601)
4f1a05b23 /guard:cf
85a113021 Merge branch 'main' of https://github.com/mdaus/nitro
a1cec9cf6 Merge branch 'main' of https://github.com/mdaus/nitro
6801fa735 Merge branch 'main' of https://github.com/mdaus/nitro
eca918471 /guard:cf
5d540334b /guard:cf

git-subtree-dir: externals/nitro
git-subtree-split: f6179b4e11c0b236b0838ad9bd17c9591194b09a
  • Loading branch information
Dan Smith committed Dec 1, 2023
1 parent 9188104 commit 1c6328b
Show file tree
Hide file tree
Showing 75 changed files with 781 additions and 335 deletions.
4 changes: 3 additions & 1 deletion UnitTest/UnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
TEST_MODULE_INITIALIZE(methodName)
{
// module initialization code
nitf_PluginRegistry_PreloadedTREHandlersEnable(NRT_TRUE);
//nitf_PluginRegistry_PreloadedTREHandlersEnable(NRT_TRUE);
_putenv("NITF_PRELOADED_TRE_HANDLERS_ENABLE=default");

nitf::Test::j2kSetNitfPluginPath();
}
13 changes: 8 additions & 5 deletions UnitTest/UnitTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<WarningLevel>Level4</WarningLevel>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir);$(SolutionDir)modules\c\nrt\include;$(SolutionDir)modules\c\nitf\include;$(SolutionDir)modules\c++\nitf\include;$(SolutionDir)modules\c\j2k\include;$(SolutionDir)modules\c;$(SolutionDir)modules\c++;$(SolutionDir)externals\coda-oss\modules\c++;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions);CODA_OSS_LIBRARY_SHARED=1</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
Expand All @@ -71,6 +71,8 @@
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<TreatWarningAsError>true</TreatWarningAsError>
<ControlFlowGuard>Guard</ControlFlowGuard>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -85,7 +87,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir);$(SolutionDir)modules\c\nrt\include;$(SolutionDir)modules\c\nitf\include;$(SolutionDir)modules\c++\nitf\include;$(SolutionDir)modules\c\j2k\include;$(SolutionDir)modules\c;$(SolutionDir)modules\c++;$(SolutionDir)externals\coda-oss\modules\c++;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions);CODA_OSS_LIBRARY_SHARED=1</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
Expand All @@ -96,6 +98,7 @@
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<ControlFlowGuard>Guard</ControlFlowGuard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down Expand Up @@ -257,15 +260,15 @@
<ClInclude Include="TestCase.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\externals\coda-oss\modules\c++\coda-oss.vcxproj">
<Project>{9997e895-5161-4ddf-8f3f-099894cb2f21}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c++\nitf-c++.vcxproj">
<Project>{8f357a19-799e-4971-850e-3f28485c130b}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf-c.vcxproj">
<Project>{f06550ad-cfc7-40b8-8727-6c82c69a8982}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\XML_DATA_CONTENT.vcxproj">
<Project>{78849481-d356-4cc7-b182-31c21f857ed1}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
11 changes: 3 additions & 8 deletions UnitTest/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,15 @@

// We're building in Visual Studio ... used to control where we get a little bit of config info
#define NITRO_PCH 1
#ifndef CODA_OSS_LIBRARY_SHARED
#define CODA_OSS_LIBRARY_SHARED 1
#endif

#include <import/nrt.h>
#include <import/nitf.h>
#include <nitf/TestingTest.h>

#include <nitf/coda-oss.hpp>
#pragma comment(lib, "io-c++")
#pragma comment(lib, "io-c++")
#pragma comment(lib, "except-c++")
#pragma comment(lib, "sys-c++")
#pragma comment(lib, "str-c++")
#pragma comment(lib, "sio.lite-c++.lib")
#pragma comment(lib, "math-c++")
#pragma comment(lib, "mt-c++")

#include <import/nitf.hpp>
#include <nitf/UnitTests.hpp>
Expand Down
8 changes: 3 additions & 5 deletions externals/coda-oss/UnitTest/UnitTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
Expand All @@ -58,7 +55,7 @@
<WarningLevel>Level4</WarningLevel>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;$(ProjectDir);$(SolutionDir)modules\c++;$(SolutionDir)modules\c++\avx\include;$(SolutionDir)modules\c++\cli\include;$(SolutionDir)modules\c++\config\include;$(SolutionDir)modules\c++\coda_oss\include;$(SolutionDir)modules\c++\gsl\include;$(SolutionDir)modules\c++\hdf5.lite\include;$(SolutionDir)modules\c++\io\include;$(SolutionDir)modules\c++\std\include;$(SolutionDir)modules\c++\str\include;$(SolutionDir)modules\c++\sys\include;$(SolutionDir)modules\c++\except\include;$(SolutionDir)modules\c++\logging\include;$(SolutionDir)modules\c++\math\include;$(SolutionDir)modules\c++\math.linear\include;$(SolutionDir)modules\c++\math.poly\include;$(SolutionDir)modules\c++\mem\include;$(SolutionDir)modules\c++\mt\include;$(SolutionDir)modules\c++\polygon\include;$(SolutionDir)modules\c++\re\include;$(SolutionDir)modules\c++\types\include;$(SolutionDir)modules\c++\units\include;$(SolutionDir)modules\c++\xml.lite\include;$(SolutionDir)modules\c++\zip\include;$(SolutionDir)modules\drivers;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions);MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions);MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1;CODA_OSS_LIBRARY_SHARED=1</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand Down Expand Up @@ -88,7 +85,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;$(ProjectDir);$(SolutionDir)modules\c++;$(SolutionDir)modules\c++\avx\include;$(SolutionDir)modules\c++\cli\include;$(SolutionDir)modules\c++\config\include;$(SolutionDir)modules\c++\coda_oss\include;$(SolutionDir)modules\c++\gsl\include;$(SolutionDir)modules\c++\hdf5.lite\include;$(SolutionDir)modules\c++\io\include;$(SolutionDir)modules\c++\std\include;$(SolutionDir)modules\c++\str\include;$(SolutionDir)modules\c++\sys\include;$(SolutionDir)modules\c++\except\include;$(SolutionDir)modules\c++\logging\include;$(SolutionDir)modules\c++\math\include;$(SolutionDir)modules\c++\math.linear\include;$(SolutionDir)modules\c++\math.poly\include;$(SolutionDir)modules\c++\mem\include;$(SolutionDir)modules\c++\mt\include;$(SolutionDir)modules\c++\polygon\include;$(SolutionDir)modules\c++\re\include;$(SolutionDir)modules\c++\types\include;$(SolutionDir)modules\c++\units\include;$(SolutionDir)modules\c++\xml.lite\include;$(SolutionDir)modules\c++\zip\include;$(SolutionDir)modules\drivers;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions);MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions);MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1;CODA_OSS_LIBRARY_SHARED=1</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -101,6 +98,7 @@
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
4 changes: 4 additions & 0 deletions externals/coda-oss/cmake/CodaBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,12 @@ macro(coda_initialize_build)
option(BUILD_SHARED_LIBS "Build shared libraries instead of static." OFF)
if(BUILD_SHARED_LIBS)
set(CODA_LIBRARY_TYPE "shared")
add_definitions(-DCODA_OSS_LIBRARY_SHARED=1)
add_definitions(-UCODA_OSS_LIBRARY_STATIC)
else()
set(CODA_LIBRARY_TYPE "static")
add_definitions(-DCODA_OSS_LIBRARY_STATIC=1)
add_definitions(-UCODA_OSS_LIBRARY_SHARED)
endif()

option(CODA_BUILD_TESTS "build tests" ON)
Expand Down
9 changes: 6 additions & 3 deletions externals/coda-oss/modules/c++/coda-oss.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<ClInclude Include="coda_oss\include\coda_oss\bit.h" />
<ClInclude Include="coda_oss\include\coda_oss\CPlusPlus.h" />
<ClInclude Include="coda_oss\include\coda_oss\cstddef.h" />
<ClInclude Include="coda_oss\include\coda_oss\mdspan.h" />
<ClInclude Include="coda_oss\include\coda_oss\mdspan_.h" />
<ClInclude Include="coda_oss\include\coda_oss\namespace_.h" />
<ClInclude Include="coda_oss\include\coda_oss\numbers.h" />
<ClInclude Include="coda_oss\include\coda_oss\optional.h" />
Expand Down Expand Up @@ -511,6 +513,7 @@
<None Include="std\include\std\bit" />
<None Include="std\include\std\cstddef" />
<None Include="std\include\std\filesystem" />
<None Include="std\include\std\mdspan" />
<None Include="std\include\std\memory" />
<None Include="std\include\std\numbers" />
<None Include="std\include\std\optional" />
Expand Down Expand Up @@ -539,7 +542,6 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
Expand Down Expand Up @@ -568,7 +570,7 @@
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions);CODA_OSS_EXPORTS;CODA_OSS_DLL;MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions);MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1;CODA_OSS_EXPORTS;CODA_OSS_LIBRARY_SHARED=1</PreprocessorDefinitions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>cli\include;coda_oss\include;config\include;dbi\include;except\include;gsl\include;hdf5.lite\include;io\include;logging\include;math\include;math.linear\include;math.poly\include;mem\include;mt\include;net\include;net.ssl\include;plugin\include;polygon\include;re\include;sio.lite\include;std\include;str\include;sys\include;tiff\include;types\include;unique\include;units\include;xml.lite\include;zip\include;$(ProjectDir)include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\$(ProjectName)\out\install\$(Platform)-$(Configuration)\include</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -601,7 +603,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions);CODA_OSS_EXPORTS;CODA_OSS_DLL;MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions);MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1;CODA_OSS_EXPORTS;CODA_OSS_LIBRARY_SHARED=1</PreprocessorDefinitions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>cli\include;coda_oss\include;config\include;dbi\include;except\include;gsl\include;hdf5.lite\include;io\include;logging\include;math\include;math.linear\include;math.poly\include;mem\include;mt\include;net\include;net.ssl\include;plugin\include;polygon\include;re\include;sio.lite\include;std\include;str\include;sys\include;tiff\include;types\include;unique\include;units\include;xml.lite\include;zip\include;$(ProjectDir)include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\$(ProjectName)\out\install\$(Platform)-$(Configuration)\include</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand All @@ -617,6 +619,7 @@
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<WarningLevel>Level3</WarningLevel>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<SubSystem>
Expand Down
5 changes: 5 additions & 0 deletions externals/coda-oss/modules/c++/coda-oss.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,8 @@
<ClInclude Include="tiff\include\tiff\TiffUtils.h">
<Filter>tiff</Filter>
</ClInclude>
<ClInclude Include="coda_oss\include\coda_oss\mdspan.h" />
<ClInclude Include="coda_oss\include\coda_oss\mdspan_.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp" />
Expand Down Expand Up @@ -1563,5 +1565,8 @@
<None Include="sys\source\CppUnitTestAssert_.cpp_">
<Filter>sys</Filter>
</None>
<None Include="std\include\std\mdspan">
<Filter>std</Filter>
</None>
</ItemGroup>
</Project>
73 changes: 73 additions & 0 deletions externals/coda-oss/modules/c++/coda_oss/include/coda_oss/mdspan.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* =========================================================================
* This file is part of coda_oss-c++
* =========================================================================
*
* (C) Copyright 2004 - 2014, MDA Information Systems LLC
* © Copyright 2023, Maxar Technologies, Inc.
*
* coda_oss-c++ is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; If not,
* see <http://www.gnu.org/licenses/>.
*
*/
#pragma once

#include "coda_oss/CPlusPlus.h"

// This should always work ... it's in a `details` namespace
#include "coda_oss/mdspan_.h"

// This logic needs to be here rather than <std/mdspan> so that `coda_oss::mdspan` will
// be the same as `std::mdspan`.
#ifndef CODA_OSS_HAVE_std_mdspan_
#define CODA_OSS_HAVE_std_mdspan_ 0 // assume no <mdspan>
#endif
#ifndef CODA_OSS_HAVE_experimental_mdspan_
#define CODA_OSS_HAVE_experimental_mdspan_ 0 // assume no std::experimental::mdspan
#endif
#if CODA_OSS_cpp17 // __has_include
#if __has_include(<mdspan>) // <mdspan> not until C++23
#include <mdspan>
#undef CODA_OSS_HAVE_std_mdspan_
#define CODA_OSS_HAVE_std_mdspan_ 1 // provided by the implementation, probably C++23
#endif

#if CODA_OSS_cpp20 // Can't even #include this file with older C++14/17 compilers! :-(
// Put this in a __has_include so that it's optional. Our simple implemtnation works
// for our needs, and this brings along a lot of code that our older compilers don't
// like. By the time we need more functionality, maybe we'll be using C++23?
//
// Until then, having this available allows checking our implementation against
// something much more real. https://github.com/kokkos/mdspan
#if __has_include("coda_oss/experimental/mdspan")
#include "coda_oss/experimental/mdspan"
#undef CODA_OSS_HAVE_experimental_mdspan_
#define CODA_OSS_HAVE_experimental_mdspan_ 1 // provided coda_oss/experimental/mdspan
#endif
#endif
#endif // CODA_OSS_cpp17

namespace coda_oss
{
#if CODA_OSS_HAVE_std_mdspan_
using std::mdspan;
using std::dextents;
#elif CODA_OSS_HAVE_experimental_mdspan_
using std::experimental::mdspan;
using std::experimental::dextents;
#else
using details::mdspan;
using details::dextents;
#endif
}

Loading

0 comments on commit 1c6328b

Please sign in to comment.