Skip to content

Commit

Permalink
Squashed 'externals/coda-oss/' changes from cf6c4249a..aba8366d8
Browse files Browse the repository at this point in the history
aba8366d8 CODA_OSS_LIBRARY_SHARED=1
52e067ec7 Merge branch 'main' into cpp17
df4e0fc1f changes to build SIX DLLs (#757)
faf5d0521 allow CMake to switch between building SHARED (DLLs) or STATIC libraires
d15173f38 export symbols used by NITRO (#756)
6ed3c048b use Debug DLL library in Debug

git-subtree-dir: externals/coda-oss
git-subtree-split: aba8366d8b11467d9986344c68947c04748e5911
  • Loading branch information
Dan Smith committed Nov 29, 2023
1 parent 6f8d6ae commit 5ce3b6e
Show file tree
Hide file tree
Showing 28 changed files with 115 additions and 87 deletions.
4 changes: 2 additions & 2 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>$(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 +88,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 Down
4 changes: 4 additions & 0 deletions 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
5 changes: 3 additions & 2 deletions modules/c++/coda-oss.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,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 +601,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 +617,7 @@
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<WarningLevel>Level3</WarningLevel>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<SubSystem>
Expand Down
34 changes: 20 additions & 14 deletions modules/c++/config/include/config/Exports.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
#ifndef CODA_OSS_config_Exports_h_INCLUDED_
#define CODA_OSS_config_Exports_h_INCLUDED_
#pragma once

#include "config/compiler_extensions.h"

// Need to specify how this code will be consumed, either CODA_OSS_LIB (static library)
// or CODA_OSS_DLL (aka "shared" library). For DLLs, it needs to be set for BOTH
// Need to specify how this code will be consumed, either CODA_OSS_LIB_ (static library)
// or CODA_OSS_DLL_ (aka "shared" library). For DLLs, it needs to be set for BOTH
// "exporting" (building this code) and "importing" (consuming).
//
// Use Windows naming conventions (DLL, LIB) because this really only matters for _MSC_VER, see below.
#if !defined(CODA_OSS_LIB) && !defined(CODA_OSS_DLL)
#define CODA_OSS_LIB 1
//#define CODA_OSS_DLL 1
#if !defined(CODA_OSS_LIB_) && !defined(CODA_OSS_DLL_)
#if CODA_OSS_LIBRARY_SHARED
#if CODA_OSS_LIBRARY_STATIC
#error "CODA_OSS_LIBRARY_SHARED already #define'd'"
#endif
#define CODA_OSS_DLL_ 1 // Symbols must be exported and imported (see below).
#else
// CODA_OSS_LIBRARY_STATIC doesn't have to be defined
#define CODA_OSS_LIB_ 1 // Static library, all symbols visible.
#endif
#endif
#if defined(CODA_OSS_LIB) && defined(CODA_OSS_DLL)
#error "Both CODA_OSS_LIB and CODA_OSS_DLL are #define'd'"
#if !defined(CODA_OSS_LIB_) && !defined(CODA_OSS_DLL_)
#error "One of CODA_OSS_LIB_ pr CODA_OSS_DLL_ must be #define'd'"
#endif
#if defined(CODA_OSS_EXPORTS) && defined(CODA_OSS_LIB)
#if defined(CODA_OSS_LIB_) && defined(CODA_OSS_DLL_)
#error "Both CODA_OSS_LIB_ and CODA_OSS_DLL_ are #define'd'"
#endif
#if defined(CODA_OSS_EXPORTS) && defined(CODA_OSS_LIB_)
#error "Can't export from a LIB'"
#endif

Expand All @@ -35,10 +43,10 @@

// We need to know whether we're consuming (importing) a DLL or static LIB
// The default is a static LIB as that's what existing code/builds expect.
#ifdef CODA_OSS_DLL
#ifdef CODA_OSS_DLL_
// Actually, it seems that the linker is able to figure this out from the .LIB, so
// there doesn't seem to be a need for __declspec(dllimport). Clients don't
// need to #define CODA_OSS_DLL ... ? Well, almost ... it looks
// need to #define CODA_OSS_DLL_ ... ? Well, almost ... it looks
// like __declspec(dllimport) is needed to get virtual "inline"s (e.g.,
// destructors) correct.
#define CODA_OSS_API CODA_OSS_library_import
Expand All @@ -50,5 +58,3 @@
#if defined(_MSC_VER)
#pragma warning(disable: 4251) // '...' : class '...' needs to have dll-interface to be used by clients of struct '...'
#endif

#endif // CODA_OSS_config_Exports_h_INCLUDED_
6 changes: 4 additions & 2 deletions modules/c++/io/include/io/Serializable.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
* see <http://www.gnu.org/licenses/>.
*
*/

#pragma once
#ifndef __IO_SERIALIZABLE_H__
#define __IO_SERIALIZABLE_H__

#include "config/Exports.h"

#include "io/InputStream.h"
#include "io/OutputStream.h"

Expand All @@ -46,7 +48,7 @@ namespace io
* This object has a known derived type SOAPMessage, which is concretely
* defined to handle SOAP objects
*/
struct Serializable
struct CODA_OSS_API Serializable
{
Serializable() = default;
virtual ~Serializable() noexcept(false) {}
Expand Down
4 changes: 3 additions & 1 deletion modules/c++/logging/include/logging/Setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*
*/

#pragma once
#ifndef CODA_OSS_logging_Setup_h_INCLUDED_
#define CODA_OSS_logging_Setup_h_INCLUDED_

Expand All @@ -29,6 +30,7 @@
#include "mem/SharedPtr.h"
#include "logging/Logger.h"
#include "sys/filesystem.h"
#include "config/Exports.h"

namespace logging
{
Expand All @@ -48,7 +50,7 @@ using path = coda_oss::filesystem::path; // still used in SWIG bindings
* \param logCount - number of rotating logs to keep (default: 0 no rotation)
* \param logBytes - number of bytes per rotating log (default: 0 no rotation)
*/
std::unique_ptr<logging::Logger> setupLogger(
CODA_OSS_API std::unique_ptr<logging::Logger> setupLogger(
const path& program,
const std::string& logLevel = "warning",
const path& logFile = "console",
Expand Down
10 changes: 7 additions & 3 deletions modules/c++/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
// Do not add files here that you will be updating frequently as this negates the performance advantage.

#pragma once
#ifndef CODA_OSS_pch_h_INCLUDED_
#define CODA_OSS_pch_h_INCLUDED_

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

#include "coda_oss/CPlusPlus.h"
#include "config/disable_compiler_warnings.h"
Expand Down Expand Up @@ -114,4 +119,3 @@ CODA_OSS_disable_warning_pop
#include "hdf5/lite/H5_.h"
#pragma comment(lib, "hdf5-c++.lib")

#endif //CODA_OSS_pch_h_INCLUDED_
8 changes: 5 additions & 3 deletions modules/c++/plugin/include/plugin/ErrorHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@
* see <http://www.gnu.org/licenses/>.
*
*/

#pragma once
#ifndef __PLUGIN_ERROR_HANDLER_H__
#define __PLUGIN_ERROR_HANDLER_H__

#include <import/except.h>
#include <import/sys.h>
#include <import/logging.h>

#include "config/Exports.h"

namespace plugin
{
class ErrorHandler
class CODA_OSS_API ErrorHandler
{
public:
ErrorHandler() {}
Expand All @@ -47,7 +49,7 @@ class ErrorHandler
virtual void onPluginError(except::Context& c) = 0;
};

class DefaultErrorHandler : public ErrorHandler
class CODA_OSS_API DefaultErrorHandler final : public ErrorHandler
{
public:
DefaultErrorHandler(logging::LoggerPtr logger = logging::LoggerPtr());
Expand Down
4 changes: 3 additions & 1 deletion modules/c++/sio.lite/include/sio/lite/FileHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifndef __SIO_LITE_FILE_HEADER_H__
#define __SIO_LITE_FILE_HEADER_H__

Expand All @@ -28,6 +29,7 @@
#include <import/except.h>
#include <import/sys.h>
#include <import/io.h>
#include "config/Exports.h"
#include "sio/lite/UserDataDictionary.h"
#include "sio/lite/InvalidHeaderException.h"
#include "sio/lite/UnsupportedDataTypeException.h"
Expand All @@ -37,7 +39,7 @@ namespace sio
namespace lite
{

class FileHeader
class CODA_OSS_API FileHeader
{
public:
/** Unsigned byte data */
Expand Down
4 changes: 0 additions & 4 deletions modules/c++/sio.lite/include/sio/lite/FileReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* see <http://www.gnu.org/licenses/>.
*
*/
#ifndef CODA_OSS_sio_lite_FileReader_h_INCLUDED_
#define CODA_OSS_sio_lite_FileReader_h_INCLUDED_
#pragma once

#include "sio/lite/SioFileReader.h"

#endif // CODA_OSS_sio_lite_FileReader_h_INCLUDED_
7 changes: 3 additions & 4 deletions modules/c++/sio.lite/include/sio/lite/SioFileReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
* see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifndef __SIO_LITE_FILE_READER_H__
#define __SIO_LITE_FILE_READER_H__

#include <import/sys.h>
#include <io/Seekable.h>
#include <io/FileInputStream.h>
#include "config/Exports.h"
#include "sio/lite/InvalidHeaderException.h"
#include "sio/lite/StreamReader.h"

Expand Down Expand Up @@ -80,12 +82,9 @@ namespace lite
\endcode
*/

class FileReader : public StreamReader, public io::Seekable
class CODA_OSS_API FileReader : public StreamReader, public io::Seekable
{


public:

/** Constructor */
FileReader() : StreamReader() {}

Expand Down
4 changes: 3 additions & 1 deletion modules/c++/sio.lite/include/sio/lite/StreamReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
* see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifndef __SIO_LITE_STREAM_READER_H__
#define __SIO_LITE_STREAM_READER_H__

#include <io/InputStream.h>
#include "config/Exports.h"
#include "sio/lite/FileHeader.h"

namespace sio
Expand Down Expand Up @@ -87,7 +89,7 @@ namespace lite
\endcode
*
*/
class StreamReader : public io::InputStream
class CODA_OSS_API StreamReader : public io::InputStream
{
public:
/** Constructor */
Expand Down
5 changes: 3 additions & 2 deletions modules/c++/sys/include/sys/DLL.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/


#pragma once
#ifndef __SYS_DLL_H__
#define __SYS_DLL_H__

Expand Down Expand Up @@ -52,6 +52,7 @@ typedef void* DLL_FUNCTION_PTR;

#include "except/Exception.h"
#include "sys/Err.h"
#include "config/Exports.h"


namespace sys
Expand Down Expand Up @@ -124,7 +125,7 @@ struct DLLException : public except::Exception
*/


struct DLL
struct CODA_OSS_API DLL
{
/*!
* Construct a library object, but dont populate or load it
Expand Down
15 changes: 8 additions & 7 deletions modules/c++/sys/include/sys/FileFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*
*/

#pragma once
#ifndef __SYS_FILE_FINDER_H__
#define __SYS_FILE_FINDER_H__

Expand All @@ -37,7 +38,7 @@ namespace sys
/**
* Predicate interface for all entries
*/
struct FilePredicate
struct CODA_OSS_API FilePredicate
{
using argument_type = std::string;
using result_type = bool;
Expand All @@ -58,7 +59,7 @@ struct ExistsPredicate : FilePredicate
/**
* Predicate that matches files only (no directories)
*/
struct FileOnlyPredicate: public FilePredicate
struct CODA_OSS_API FileOnlyPredicate : public FilePredicate
{
virtual ~FileOnlyPredicate() = default;
virtual bool operator()(const std::string& entry) const override;
Expand Down Expand Up @@ -147,7 +148,7 @@ struct LogicalPredicate : public FilePredicate
* The FileFinder class allows you to search for
* files/directories in a clean way.
*/
struct FileFinder final
struct CODA_OSS_API FileFinder final
{
FileFinder() = default;
~FileFinder() = default;
Expand All @@ -167,19 +168,19 @@ struct FileFinder final
// until either the file is found or we stop at a ".git" directory.
//
// This (obviously) might take a while, so consider whether the result should be cached.
coda_oss::filesystem::path findFirstFile(const coda_oss::filesystem::path& startingDirectory, const coda_oss::filesystem::path& filename);
CODA_OSS_API coda_oss::filesystem::path findFirstFile(const coda_oss::filesystem::path& startingDirectory, const coda_oss::filesystem::path& filename);
coda_oss::filesystem::path findFirstDirectory(const coda_oss::filesystem::path& startingDirectory, const coda_oss::filesystem::path& dir);

// This is here most to avoid creating a new module for a few utility routines
namespace test // i.e., sys::test
{
// Try to find the specified "root" directory starting at the given path.
// Used by unittest to find sample files.
coda_oss::filesystem::path findRootDirectory(const coda_oss::filesystem::path& p, const std::string& rootName,
CODA_OSS_API coda_oss::filesystem::path findRootDirectory(const coda_oss::filesystem::path& p, const std::string& rootName,
std::function<bool(const coda_oss::filesystem::path&)> isRoot);

coda_oss::filesystem::path findCMakeBuildRoot(const coda_oss::filesystem::path& p);
bool isCMakeBuild(const coda_oss::filesystem::path& p);
CODA_OSS_API coda_oss::filesystem::path findCMakeBuildRoot(const coda_oss::filesystem::path& p);
bool CODA_OSS_API isCMakeBuild(const coda_oss::filesystem::path& p);

coda_oss::filesystem::path findCMakeInstallRoot(const coda_oss::filesystem::path& p);
bool isCMakeInstall(const coda_oss::filesystem::path& p);
Expand Down
1 change: 1 addition & 0 deletions modules/c++/sys/include/sys/sys_filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct CODA_OSS_API path final // N.B. this is an INCOMPLETE and NON-STANDARD im
{
*this = source;
}
~path() = default;

path& operator=(const path&) = default;
path& operator=(path&&) = default;
Expand Down
Loading

0 comments on commit 5ce3b6e

Please sign in to comment.