Skip to content

Commit

Permalink
Squashed 'externals/nitro/' changes from 56a24484b..b4ac1ee10
Browse files Browse the repository at this point in the history
b4ac1ee10 fix build error
a6d9d002f build with C++20
38b4a673b ToString() specialization already defined
e3f8ae709 Merge commit 'b087bb776d7eff263baeb5f196dde216e33c6aca' into cpp20
b087bb776 Squashed 'externals/coda-oss/' changes from 47c8051958..679725800b
d938973d5 latest from CODA-OSS
79fbd2ec8 copy from cpp20
87752f2e3 Merge branch 'cpp17' into cpp20
777f35b72 only --std=c++20
839434124 Merge commit 'f161cda5539c508cbd83c23b210361483c610898' into cpp20
f161cda55 Squashed 'externals/coda-oss/' changes from b8d501278..21fd7c4c0
d18109903 copy from cpp20
c78fd72e3 Merge branch 'cpp17' into cpp20
bc0e54cc2 Merge commit '2e63b9199e3715707d5421101589776445e13084' into cpp20
2e63b9199 Squashed 'externals/coda-oss/' changes from c800b56478..905bed5f16
4959f54ed latest from coda-oss
8a8b27af4 sync with cpp20
25f560b26 Merge branch 'cpp17' into cpp20
63a694e4e turning "main" into C++14, not C++20

git-subtree-dir: externals/nitro
git-subtree-split: b4ac1ee1000379ea0a56be6341040002deee477d
  • Loading branch information
Dan Smith authored and Dan Smith committed Jun 15, 2023
1 parent d346b1a commit d4519f7
Show file tree
Hide file tree
Showing 53 changed files with 198 additions and 836 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/frequent_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
run: |
mkdir build
cd build
export CC=gcc-10
export CXX=g++-10
cmake -DCMAKE_INSTALL_PREFIX=installLinux-Github -DPYTHON_VERSION=3.7 ..
- name: make
run: |
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.14)
project(nitro)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 99)
set(C_STANDARD_REQUIRED true)
set(CMAKE_CXX_STANDARD 20)
set(CXX_STANDARD_REQUIRED true)

if (${CMAKE_PROJECT_NAME} STREQUAL nitro)
Expand Down
7 changes: 4 additions & 3 deletions Test++/Test++.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<TreatWarningAsError>true</TreatWarningAsError>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ControlFlowGuard>Guard</ControlFlowGuard>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<ConformanceMode>true</ConformanceMode>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -90,7 +90,8 @@
<ControlFlowGuard>Guard</ControlFlowGuard>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
1 change: 1 addition & 0 deletions Test++/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#pragma warning(push)
#pragma warning(disable: 4464) // relative include path contains '..'
#pragma warning(disable: 4365) // '...': conversion from '...' to '...', signed/unsigned mismatch
#include "../modules/c++/cpp.h"
#pragma warning(pop)
#pragma comment(lib, "ws2_32")
Expand Down
4 changes: 2 additions & 2 deletions Test/Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "CppUnitTest.h"

#define TEST_ASSERT(X) Assert::IsTrue(X)
#define TEST_ASSERT(X) Assert::IsTrue((X) ? true : false)

template<typename T, typename U>
inline void test_assert_eq_(T&& t, U&& u)
Expand Down Expand Up @@ -37,7 +37,7 @@ inline void test_assert_greater_(T&& t, U&& u)
}
#define TEST_ASSERT_GREATER(X1, X2) test_assert_greater_(X1, X2)

#define TEST_ASSERT_ALMOST_EQ_EPS(X1, X2, EPS) { Assert:AreEqual(X1, X2, EPS); Assert:AreEqual(X2, X1, EPS); }
#define TEST_ASSERT_ALMOST_EQ_EPS(X1, X2, EPS) { Microsoft::VisualStudio::CppUnitTestFramework::Assert:AreEqual(X1, X2, EPS); Microsoft::VisualStudio::CppUnitTestFramework::Assert:AreEqual(X2, X1, EPS); }
#define TEST_ASSERT_ALMOST_EQ(X1, X2) TEST_ASSERT_ALMOST_EQ_EPS(X1, X2, 0.0001)

#define TEST_ASSERT_EQ_MSG(msg, X1, X2) Logger::WriteMessage(msg.c_str()); TEST_ASSERT_EQ(X1, X2)
Expand Down
6 changes: 4 additions & 2 deletions Test/Test.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<ConformanceMode>true</ConformanceMode>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -90,7 +91,8 @@
<ControlFlowGuard>Guard</ControlFlowGuard>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
1 change: 1 addition & 0 deletions Test/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#pragma warning(push)
#pragma warning(disable: 4464) // relative include path contains '..'
#pragma warning(disable: 4365) // '...': conversion from '...' to '...', signed/unsigned mismatch
#include "../modules/c++/cpp.h"
#pragma warning(pop)
#pragma comment(lib, "ws2_32")
Expand Down
2 changes: 1 addition & 1 deletion copy_externals.csh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/csh -f

rm -r -f tmp && mkdir tmp && cd tmp
git clone --depth 1 -b cpp17 [email protected]:mdaus/coda-oss.git
git clone --depth 1 -b cpp20 [email protected]:mdaus/coda-oss.git
rm -r -f coda-oss/.git

cd ..
Expand Down
29 changes: 15 additions & 14 deletions externals/coda-oss/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
cmake_minimum_required(VERSION 3.14)
project(coda-oss)

set(CMAKE_CXX_STANDARD 17)
project(coda-oss)

set(CMAKE_CXX_STANDARD 20)
set(CXX_STANDARD_REQUIRED true)

if (EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
Expand All @@ -22,20 +24,19 @@ if (${CMAKE_PROJECT_NAME} STREQUAL coda-oss)
# Always turn on "warnings as errors" to avoid lots of (meaningless?) build output;
# we'll dial-back warnings as necessary.
if (MSVC)
add_compile_options(/WX) # warnings as errors
add_compile_options(/MP) # multi-processor compile

if (ENABLE_ASAN)
# https://docs.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-160
add_compile_options(/fsanitize=address)
endif()
# set warning level to /W3
string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
add_compile_options(/std:c++20)
elseif (UNIX)
add_compile_options(-Werror) # warnings as errors
if (ENABLE_ASAN)
# https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()
set(CMAKE_C_COMPILER gcc-10)
set(CMAKE_CXX_COMPILER g++-10)
add_compile_options(
-Wno-deprecated
-Wno-unused-value
-Wno-unused-but-set-variable
)
add_compile_options(-std=c++20)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
Expand Down
13 changes: 2 additions & 11 deletions externals/coda-oss/UnitTest/UnitTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,7 @@
<ControlFlowGuard>Guard</ControlFlowGuard>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<TranslateIncludes>true</TranslateIncludes>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<ConformanceMode>true</ConformanceMode>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -92,12 +87,8 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ControlFlowGuard>Guard</ControlFlowGuard>
<TranslateIncludes>true</TranslateIncludes>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp20</LanguageStandard>
<ConformanceMode>true</ConformanceMode>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
52 changes: 28 additions & 24 deletions externals/coda-oss/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ def options(opt):
'results. NOOP if junit_xml cannot be imported')


def ensureCpp17Support(self):
def ensureCpp20Support(self):
# DEPRECATED.
# Keeping for now in case downstream code is still looking for it
self.env['cpp11support'] = True
Expand All @@ -830,6 +830,14 @@ def configureCompilerOptions(self):

if ccCompiler == 'msvc':
cxxCompiler = ccCompiler
else:
if ccCompiler == 'gcc':
ccCompiler = 'gcc-10'
self.env['COMPILER_CC'] =ccCompiler

if cxxCompiler == 'g++':
cxxCompiler = 'g++-10'
self.env['COMPILER_CXX'] = cxxCompiler

if not cxxCompiler or not ccCompiler:
self.fatal('Unable to find C/C++ compiler')
Expand Down Expand Up @@ -873,7 +881,7 @@ def configureCompilerOptions(self):
self.env.append_value('CFLAGS', '-fPIC -dynamiclib'.split())

# GCC / ICC (for Linux or Solaris)
elif ccCompiler == 'gcc' or ccCompiler == 'icc':
elif ccCompiler == 'gcc' or ccCompiler == 'gcc-10' or ccCompiler == 'icc':
if not re.match(winRegex, sys_platform):
self.env.append_value('LIB_DL', 'dl')
if not re.match(osxRegex, sys_platform):
Expand All @@ -883,7 +891,7 @@ def configureCompilerOptions(self):
self.check_cc(lib='pthread', mandatory=True)

warningFlags = '-Wall'
if ccCompiler == 'gcc':
if ccCompiler == 'gcc' or ccCompiler == 'gcc-10':
#warningFlags += ' -Wno-deprecated-declarations -Wold-style-cast'
warningFlags += ' -Wno-deprecated-declarations'
else:
Expand All @@ -897,7 +905,13 @@ def configureCompilerOptions(self):
# If you want the plugins to not depend on Intel libraries,
# configure with:
# --with-cflags=-static-intel --with-cxxflags=-static-intel --with-linkflags=-static-intel
if cxxCompiler == 'g++' or cxxCompiler == 'icpc':
if cxxCompiler == 'gcc' or cxxCompiler == 'gcc-10':
config['cxx']['debug'] = '-ggdb3'
config['cxx']['optz_debug'] = '-Og'
elif cxxCompiler == 'icpc':
config['cxx']['debug'] = '-g'
config['cxx']['optz_debug'] = ''
if cxxCompiler == 'g++' or cxxCompiler == 'g++-10' or cxxCompiler == 'icpc':
config['cxx']['warn'] = warningFlags.split()
config['cxx']['verbose'] = '-v'
config['cxx']['64'] = '-m64'
Expand All @@ -912,8 +926,7 @@ def configureCompilerOptions(self):
# The "fastest-possible" option is new; see comments above.
config['cxx']['optz_fastest-possible'] = [ config['cxx']['optz_fastest'], '-march=native' ]

self.env.append_value('CXXFLAGS', '-fPIC'.split())
gxxCompileFlags='-std=c++17'
gxxCompileFlags='-fPIC -std=c++2a'
self.env.append_value('CXXFLAGS', gxxCompileFlags.split())

# DEFINES and LINKFLAGS will apply to both gcc and g++
Expand All @@ -928,22 +941,13 @@ def configureCompilerOptions(self):

self.env.append_value('LINKFLAGS', linkFlags.split())

if Options.options.debugging:
if cxxCompiler == 'g++':
config['cxx']['debug'] = '-ggdb3'
config['cxx']['optz_debug'] = '-Og'
elif cxxCompiler == 'icpc':
config['cxx']['debug'] = '-g'
config['cxx']['optz_debug'] = ''

if ccCompiler == 'gcc':
config['cc']['debug'] = '-ggdb3'
config['cc']['optz_debug'] = '-Og'
elif ccCompiler == 'icc':
config['cc']['debug'] = '-g'
config['cc']['optz_debug'] = ''

if ccCompiler == 'gcc' or ccCompiler == 'icc':
if ccCompiler == 'gcc' or ccCompiler == 'gcc-10':
config['cc']['debug'] = '-ggdb3'
config['cc']['optz_debug'] = '-Og'
elif ccCompiler == 'icc':
config['cc']['debug'] = '-g'
config['cc']['optz_debug'] = ''
if ccCompiler == 'gcc' or ccCompiler == 'gcc-10' or ccCompiler == 'icc':
config['cc']['warn'] = warningFlags.split()
config['cc']['verbose'] = '-v'
config['cc']['64'] = '-m64'
Expand Down Expand Up @@ -1022,7 +1026,7 @@ def configureCompilerOptions(self):
'_LARGEFILE_SOURCE WIN32 _USE_MATH_DEFINES NOMINMAX WIN32_LEAN_AND_MEAN'.split()
flags = '/UUNICODE /U_UNICODE /EHs /GR'.split()

flags.append('/std:c++17')
flags.append('/std:c++20')

self.env.append_value('DEFINES', defines)
self.env.append_value('CXXFLAGS', flags)
Expand Down Expand Up @@ -1243,7 +1247,7 @@ def configure(self):
if Options.options._defs:
env.append_unique('DEFINES', Options.options._defs.split(','))
configureCompilerOptions(self)
ensureCpp17Support(self)
ensureCpp20Support(self)

env['PLATFORM'] = sys_platform

Expand Down
2 changes: 1 addition & 1 deletion externals/coda-oss/build/config.guess
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
for c in gcc-10 gcc c99 c89 cc; do
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
Expand Down
4 changes: 0 additions & 4 deletions externals/coda-oss/modules/c++/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ set(TARGET_LANGUAGE c++)

# turn on maximum warnings
if (MSVC)
add_compile_options(/std:c++17)

# By default, there is a /W3 on the command-line from somewhere (?); adding
# /Wn results in a compiler warning.
#add_compile_options(/W4) # /Wall
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # /Wall

elseif (UNIX)
add_compile_options(-std=c++17)

add_compile_options(-Wall -pedantic -Wextra)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wregister") # -Wvolatile
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weffc++")
Expand Down
17 changes: 3 additions & 14 deletions externals/coda-oss/modules/c++/coda-oss-lite.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<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\memory.h" />
<ClInclude Include="coda_oss\include\coda_oss\namespace_.h" />
<ClInclude Include="coda_oss\include\coda_oss\optional.h" />
<ClInclude Include="coda_oss\include\coda_oss\span.h" />
<ClInclude Include="coda_oss\include\coda_oss\span_.h" />
<ClInclude Include="coda_oss\include\coda_oss\string.h" />
<ClInclude Include="coda_oss\include\coda_oss\type_traits.h" />
<ClInclude Include="config\include\config\compiler_extensions.h" />
Expand Down Expand Up @@ -465,13 +465,7 @@
<ControlFlowGuard>Guard</ControlFlowGuard>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<TranslateIncludes>true</TranslateIncludes>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<ConformanceMode>true</ConformanceMode>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<EnablePREfast>true</EnablePREfast>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>
Expand All @@ -493,12 +487,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ControlFlowGuard>Guard</ControlFlowGuard>
<TranslateIncludes>true</TranslateIncludes>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<ConformanceMode>true</ConformanceMode>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>
Expand Down
5 changes: 2 additions & 3 deletions externals/coda-oss/modules/c++/coda-oss-lite.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
<ClInclude Include="coda_oss\include\coda_oss\span.h">
<Filter>coda_oss</Filter>
</ClInclude>
<ClInclude Include="coda_oss\include\coda_oss\span_.h">
<Filter>coda_oss</Filter>
</ClInclude>
<ClInclude Include="coda_oss\include\coda_oss\string.h">
<Filter>coda_oss</Filter>
</ClInclude>
Expand Down Expand Up @@ -747,6 +744,8 @@
<ClInclude Include="types\include\types\complex.h">
<Filter>types</Filter>
</ClInclude>
<ClInclude Include="coda_oss\include\coda_oss\memory.h" />
<ClInclude Include="coda_oss\include\coda_oss\optional_.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
#define CODA_OSS_cpp20 (CODA_OSS_cplusplus >= 202002L)
#define CODA_OSS_cpp23 (CODA_OSS_cplusplus >= 202302L)

#if !CODA_OSS_cpp17
#error "Must compile with C++17 or greater."
#if !CODA_OSS_cpp20
#error "Must compile with C++20 or greater."
#endif

#endif // CODA_OSS_coda_oss_CPlusPlus_h_INCLUDED_
Loading

0 comments on commit d4519f7

Please sign in to comment.