Skip to content

Commit

Permalink
Squashed 'externals/coda-oss/' changes from 1582c6ac9..e87c32b4d
Browse files Browse the repository at this point in the history
e87c32b4d Merge branch 'master'
cbfb20ce2 update release notes for C++11/master release (#658)
605d24898 duplicate existing HDF5 unittests using HighFive (#657)
134233279 add 'override'; fix ASAN-detected memory leaks (#656)
4c68fa0d3 fix directory names
5ee2f039a poor-man's version of "import module std;" (#655)
fad02842c Add HighFive library (#654)
b31f5b6ab have Python 3.6 on a build server
ba8547621 don't put 'struct' in the macro
bd79aa11f require Python 3.7, do MD5 check
ecfa687c5 use std::filesystem (instead of sys::filesystem) where possible (#652)
243bc9991 add 'override'
c0fd2124d wrap common "file open" routines to support sys::expandEnviromentVariables() (#651)
0657f3297 adjust compiler flags for clean CMake builds (#650)
81285872f build cleanly with all G++ warnings enabled (#649)
b9ea37bbf xml::lite::Validator can be moved (#648)
9cfe9a4a8 Merge branch 'master'
e989b0910 createElement() needs to be virtual (#646)
4bdaf10d9 Change xml lite function to virtual (#645)
d17b57a54 Merge branch 'master'
fa00a5430 move debug -g flags to be turned on only if debugging (#644)
6be8f0a2e move debug -g flags to be turned on only if debugging (#644)
44ab72854 routines for simple writing to HDF5 files (#643)
aabc5818e remove more C++11 work-arounds (#642)
b04ccca17 remove more C++11 work-arounds (#641)
e460970a7 increase GCC warnings (#640)
91284249b provide ComplexView iterator support (#639)
453b7ec68 try to get std::make_unique working with old Intel compiler (#638)
5736cfd4d is_trivially_copyable for old Intel compiler (#637)
7c2aea38f use H5 SDK naming conventions (#636)
fc3008b8d use 'modern' C pre-processor
b44709a95 added ComplexSpansView utility (#635)
986307c9c Merge branch 'master'
e1b0fa349 commit (but not build) HDF5 source code (#634)
3fd5ddae5 Merge branch 'main' into develop/remove-cpp11-workarounds
37d7ec76e restore C++14 workarounds for older compilers (#632)
244dfdb3d Merge branch 'develop/main' into develop/remove-cpp11-workarounds
714ca4ed7 restore C++14 workarounds for older compilers
640f2247c Delete hdf5-hdf5-1_13_2.tar.gz
eb365cbfb Merge branch 'master' into develop/remove-cpp11-workarounds
57b938eeb don't need __INTEL_COMPILER work-around with C++14
65779f3b1 build C code with -std=gnu99
94dc9280f C++14 work-arounds for an old version of the Intel compiler
3744d05e2 slam-in "main"
82b2fd63b restore some C++14 work-arounds for old compilers that only have partial C++14 support
94f6950a2 Merge branch 'main' into develop/remove-cpp11-workarounds
1ac97fe48 add HDF5 source code (not built) (#612)
8ab982820 Squashed commit of the following:
31781a14a remove C++17 work-arounds
c15f6930c Revert "<filesystem> is in C++17"
0fe38c16f restore recent buld.py changes
0c75411ee <filesystem> is in C++17
bbbcd562a remove C++11 work-arounds
c1e15e9d9 Merge branch 'main' into main-cpp17
bea818fb0 must use C++17 in this branch
91653a096 another place where C++17 is set
7d555f2be back to C++17
b1969d996 merge main
0792c77bf Merge branch 'main' into develop/remove-cpp11-workarounds
e49f273c1 Merge branch 'main' into develop/remove-cpp11-workarounds
240b61044 allow sys::Mutex references, instead of pointers, to be passed to sys::ConditionVar
9500d6f4b Merge branch 'main' into develop/remove-cpp11-workarounds
f1529942f std::make_unique instead of new
be9b6a71c Squashed commit of the following:
62a2ec4e1 Revert "remove our GSL work-around for C++11"
1db082c21 Revert "try the current "main" of GSL"
44b70edde try the current "main" of GSL
4edbf6bad Revert ""There is no warning 4814""
bcd7458be "There is no warning 4814"
c185bf3f1 starting working on MutexCpp11
313bdd1d9 AtomicCounter* files have been removed
c1c448051 remove our GSL work-around for C++11
37ae1193e remove our mem::SharedPtr, it's now always std::shared_ptr
71f3c1299 remove no-longer-used NSPR code
8e77cb210 removed no-longer-used Irix and Solaris files
fabef6966 use std::atomic for all AtomicCounter implementations
ace5b6d5a TEST_FAIL -> TEST_FAIL_MSG
30076c1d1 turns out there was already a TEST_FAIL macro
d73ee16fb need "::" to find global test
ba01c48df remove C++11 workarounds for C++14 features
cbd4a31ae Squashed commit of the following:
b21c203b8 Squashed commit of the following:
5b542c60f Squashed commit of the following:
cb0cf94ff ByteStream.cpp is now warning-free
f5daa37fc cast to DWORD; "const" correctness
bfaf644ff #pragma-away compiler warnings from standard headers
72d202dbe Merge branch 'master' into develop/reduce-compiler-warnings
b076580cd trying to fix GCC compiler warning
1687dc7fc Merge branch 'master' into develop/reduce-compiler-warnings
2c5db86db Merge branch 'master' into develop/reduce-compiler-warnings
6f76c2e3e Update CMakeLists.txt
c3ca4a538 do in-line initialization
8e6733618 remove G++ compiler warning
a0eff51cf Merge branch 'master' into develop/reduce-compiler-warnings
af19d88a6 Merge branch 'master' into develop/reduce-compiler-warnings
ba31cbaa9 use "void*" to avoid reinterpret_cast<>
08da1f8a1 Merge branch 'master' into develop/reduce-compiler-warnings
d1d453a2e Merge branch 'master' into develop/reduce-compiler-warnings
f5074a996 CODA_OSS_NDEBUG is extra gunk and not used; omit for now.
22de48858 don't even bother compiling our own versions of localtime_s() and gmtime_s() if we're not going to use them (compiler warning about "unused static funtion.")
0c92eba58 tweak NDEBUG/CODA_OSS_NDEBUG; update comments
544604775 Don't need to expose our own versions of localtime_s() and gmtime_s()
a050796c1 Merge branch 'develop/reduce-compiler-warnings' of github.com:mdaus/coda-oss into develop/reduce-compiler-warnings
fed604617 older compilers want std::string() as argument to std::logic_error()
cf2c502a6 do more debug & release builds on GitHub
d4aa99256 build some debug targets on Gitlab
368245258 tweak CODA_OSS_DEBUG again for G++
24ba64f71 tweak how CODA_OSS_DEBUG is set
9680e8f0e add check for _GLIBCXX_DEBUG
943218f83 Merge branch 'master' into develop/reduce-compiler-warnings
01c68e705 %#@*@%)*%@ fix RowCol::cast() again! :-(
b8472b457 oops ... gsl::narrow<> should be gsl::narrow_cast<> so that int/double conversion doesn't throw
109255ca8 "final" breaks SWIG; wrap RowCol use of gsl::narrow
e51e4c2ad no need to create local just to return
e546f2510 Merge branch 'master' into develop/reduce-compiler-warnings
d1391f989 use template for to_std_string() overloading
566942680 fix std::char8_t when building with C++20
cf604b1ab fix C++17 build errors
48a0fbedb get rid of coda_oss namespace; use CODA_OSS_cpp17 instead
9706a4336 remove code-analysis diagnostics
50592e4f8 G++ complains about an unneeded call to std::move()
9c7643c3f Merge branch 'master' into develop/reduce-compiler-warnings
ecfe1f8a7 more "noexcept"
b7ac50fb9 Merge branch 'master' into develop/reduce-compiler-warnings
eaecf46ed tweak CODA_OSS_cplusplus from "main"
5773b1ec1 trying to get C++17 WAF build working on Windows
a048a00a1 unique names for waf & CMake
7a5a0d5b2 do a better job of setting CODA_OSS_DEBUG
4355aae92 Merge branch 'master' into develop/reduce-compiler-warnings
1fd8cede2 cleanup for VS 2019 16.10
4dffa1394 explicitly =delete copy/assignment
df8f8920a Merge branch 'master' into develop/reduce-compiler-warnings
42b4e99b6 remove code-analysis diagnostics
70ce322c9 reduce compiler warnings/code-analysis diagnostics when building six
20eac2f49 Merge branch 'master' into develop/reduce-compiler-warnings
ff3ded56d get rid of more compiler warnings/code-analysis diagnostics
669dd51ff Merge branch 'master' into develop/reduce-compiler-warnings
623b65ab9 Merge branch 'master' into develop/reduce-compiler-warnings
11c75df53 fix release build errors
66f048b92 turn on more compiler warnings where possible
eb615e315 consolidate calls to mem::make::unique
a6f5eb690 reduce use of explicit new
84d5e1b01 use mem::make::unique instead of explicit new
019d726ea = default for default constructors
86ab5d8f3 use std::unique_ptr and "const noexcept"
b071972d7 another batch of =default for default constructors
98276da94 more =default for default .ctor()s
ceb7bc596 do default constructors with =default
7bed51750 more code-analysis cleanup
f9c04b117 "noexcept" code-analysis warnings
6586ae390 need gsl::make_span from gsl/span_ext
722089774 remove gsl/mem dependency cycle
d741a0761 use gsl::narrow<> instead of static_cast
99eb4b36e get rid of signed/unsigned mismatch compiler warning
814450522 remove more code-analysis diagnostics
c8441b309 Merge branch 'master' into develop/reduce-compiler-warnings
e6d70a9ff last of "const" from code-analysis
b8445814a mark a few more things as "const" per code-analysis
d18544ec7 don't need to create temporary std::strings
ee7faa979 still more code-analysis cleanup
5cd6f864d cleanup more code-analysis diagnostics
492fb0a86 one more compiler warning about implicitly deleted copy/assignment
b8f782c88 remove compiler warnings about implicitly deleted copy/assignment/move
14d1d1cb8 #pragma-away warnings from GSL
86c40ea6c assert() to prevent some code-analysis diagnostics
7204517a9 make copy/assignment explicit
3ce824079 reduce code-analysis diagnostics
01e367a56 Merge branch 'master' into develop/reduce-compiler-warnings
03f3ddde9 proper printf format
877d7dc93 Merge branch 'master' into develop/reduce-compiler-warnings
5a4a3d575 code-analysis doesn't like C-style casts
a3fdae416 code-analysis doesn't like NULL
6309baedc Merge branch 'master' into develop/reduce-compiler-warnings
d1194a2fe Merge branch 'master' into develop/reduce-compiler-warnings
535b4757d Merge branch 'develop/reduce-compiler-warnings' of github.com:mdaus/coda-oss into develop/reduce-compiler-warnings
a60b95d60 "constexpr" can be hard to get right with older C++11 compilers; don't even try
c07b5303e Merge branch 'master' into develop/reduce-compiler-warnings
04306bbee need at least VS2017 to use the real GSL
796ad820b Merge branch 'master' into develop/reduce-compiler-warnings
16c240cd6 Merge branch 'master' into develop/reduce-compiler-warnings
e07e89f0c turn on "warnings as errors" for CMAKE builds
5c019f891 complex "constexpr" functions not available with our version of g++
4ab074a58 fix a few more compiler warnings ... nearing the end! :-)
dea7ea41b And still more compiler warnings ... almost done 🤞🏻
fbe3bbb20 remove assorted compiler warnings
e60b7fd3c Merge branch 'master' into develop/reduce-compiler-warnings
e9df212c6 Arguments should be "const&" to prevent C4866
94e75cbed Merge branch 'master' into develop/reduce-compiler-warnings
d3130414a Merge branch 'master' into develop/reduce-compiler-warnings
9a5e71f31 Merge branch 'master' into develop/reduce-compiler-warnings
bd27c0232 Merge branch 'master' into develop/reduce-compiler-warnings
c053362d2 remove still more compiler warnings
9f133b85a remove some more compiler warnings
0883c729c Merge branch 'master' into develop/reduce-compiler-warnings
f4b766880 avoid comparision between signed/unsigned to prevent compiler warning
1e6564a6e eliminate more compiler warnings
85a7b8ad0 remove a few compiler warnings
09c82049f Merge branch 'master' into develop/reduce-compiler-warnings
31f1662fa Merge branch 'master' into develop/reduce-compiler-warnings
a313562a3 Merge branch 'feature/fix-compiler-warnings' into develop/reduce-compiler-warnings
8547cdd24 eliminiate GCC warnings from Filesystem.h
b5044b2a2 fix several compiler warnings/code-analysis diagnostics
9d2f90b8c GetEnvironmentVariable() and getenv() aren't quite the same
6faa3666f remove more compiler warnings

git-subtree-dir: externals/coda-oss
git-subtree-split: e87c32b4def7c535b57acd69d18ee3b2c8128207
  • Loading branch information
Dan Smith authored and Dan Smith committed Mar 13, 2023
1 parent 7548f8d commit 694c551
Show file tree
Hide file tree
Showing 450 changed files with 38,698 additions and 965 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
*~
*.pyc
__pycache__/
# Build artifacts

# Build artifacts
install/
install-*/
target/
Expand All @@ -20,6 +20,7 @@ CMakeFiles/
Makefile
modules/**/Makefile
out/
CMakeSettings.json

# Waf
.waf-*
Expand Down Expand Up @@ -51,4 +52,5 @@ project.sln
**/x64/
*.vcxproj.user

CMakeSettings.json
# Unit-tests
TEST_*_TMP.*
30 changes: 16 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
# Author: Scott A. Colcord

cmake_minimum_required(VERSION 3.14)
project(coda-oss)

set(TARGET_LANGUAGE c++)
set(CMAKE_CXX_STANDARD 14)
set(CXX_STANDARD_REQUIRED true)

project(coda-oss)

if (EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
# build and package with conan
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
Expand All @@ -21,19 +19,23 @@ endif()
if (${CMAKE_PROJECT_NAME} STREQUAL coda-oss)
# this is the top level project

# set up warnings
# Always turn on "warnings as errors" to avoid lots of (meaningless?) build output;
# we'll dial-back warnings as necessary.
if (MSVC)
# 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++14)
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()
elseif (UNIX)
add_compile_options(
-Wno-deprecated
-Wno-unused-value
-Wno-unused-but-set-variable
)
add_compile_options(-std=c++14)
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()
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
Expand Down
15 changes: 11 additions & 4 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@
```
# coda-oss Release Notes

## [Release 2023-??-??](https://github.com/mdaus/coda-oss/releases/tag/2023-??-??)
* *zlib* updated to [1.2.13](https://github.com/madler/zlib/releases/tag/v1.2.13).
* new `mem::ComplexView` class to make it easier to process complex data stored in parallel.
* adjust compiler flags for clean *CMake* builds.
* wrap common "file open" routines (e.g., `fopen()`) to support `sys::expandEnvironmentVariables()`.
* add header-only [HighFive](https://github.com/BlueBrain/HighFive) HDF5-wrapper library.

## [Release 2022-12-14](https://github.com/mdaus/coda-oss/releases/tag/2022-12-14)
* removed remaining vestigates of `std::auto_ptr`, provide `mem::AutoPtr` for the tiny handful of
* removed remaining vestiges of `std::auto_ptr`, provide `mem::AutoPtr` for the tiny handful of
places (e.g., SWIG bindings) that still need copying.
* `xml::lite::Element` overloads to make creting new XML documents easier; see unittests for examples.
* try even harder to find unittest files in various scenarios.
Expand All @@ -30,16 +37,16 @@
* Utilitiy routines for finding various files when unit-testing.
* Removed C++14 work-arounds needed in C++11. Legacy C++ exception specificatons removed.
* Rebuild `waf` for FIPS error; added more debug options.

## [Release 2022-08-30](https://github.com/mdaus/coda-oss/releases/tag/2022-08-30)
* XML is now always written as UTF-8; the code will still try to read Windows-1252.
* `Uri`s are no longer validated by default.
* Minor tweaks from other projects.
* Final C++11 release 🤞🏻; future releases will be C++14 from [main](https://github.com/mdaus/coda-oss/tree/main).
* ~~Final C++11 release 🤞🏻; future releases will be C++14 from [main](https://github.com/mdaus/coda-oss/tree/main).~~

## [Release 2022-08-02](https://github.com/mdaus/coda-oss/releases/tag/2022-08-02)
* remove *Expat* and *libXML* modules and support in **xml.lite**; only *Xerces* was actively used.
* fix `waf` to work-around FIPS warning because of insecure *md5* hashing.
* ~~fix `waf` to work-around FIPS warning because of insecure *md5* hashing.~~
* tweak `str::EncodedStringView` and `str::EncodedString` for
[future XML changes](https://github.com/mdaus/coda-oss/tree/feature/always-write-xml-as-utf8).

Expand Down
18 changes: 14 additions & 4 deletions UnitTest/UnitTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<EnableASAN>true</EnableASAN>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<EnableASAN>true</EnableASAN>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down Expand Up @@ -64,10 +66,13 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<TreatWarningAsError>true</TreatWarningAsError>
<ControlFlowGuard>Guard</ControlFlowGuard>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<ConformanceMode>true</ConformanceMode>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<TranslateIncludes>true</TranslateIncludes>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<ConformanceMode>true</ConformanceMode>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -88,6 +93,11 @@
<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>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
29 changes: 9 additions & 20 deletions UnitTest/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,32 @@
// add headers that you want to pre-compile here

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#pragma warning(push)
#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior
#include <WinSock.h>
#include <windows.h>
#include <comdef.h>
#pragma warning(pop)
#undef min
#undef max

#define _USE_MATH_DEFINES
#include <math.h>
#include <assert.h>

#include <typeinfo>
#include <locale>
#include <limits>
#include <iterator>
#include <array>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <fstream>
#include <sstream>
#include "import/std.h"

#include <std/string>
#include <std/span>
#include <std/optional>
#include <std/cstddef>
#include <std/bit>
#include <algorithm>
#include <std/bit> // std::endian
#include <std/cstddef>
#include <numeric> // std::accumulate
#include <std/filesystem>
#include <future>
#include <cassert>
#include <tuple>
#include <std/bit> // std::endian

#include "CppUnitTest.h"

#include "coda_oss/span.h"
#include "gsl/gsl.h"
#include "import/sys.h"
#include "import/math.h"
Expand All @@ -58,6 +45,7 @@
#include "import/mem.h"
#include <mem/SharedPtr.h>
#include <mem/AutoPtr.h>
#include <mem/ComplexView.h>
#include "import/cli.h"
#include "polygon/DrawPolygon.h"
#include "polygon/PolygonMask.h"
Expand Down Expand Up @@ -104,6 +92,7 @@
#include <logging/ExceptionLogger.h>
#include <import/logging.h>
#include <import/re.h>
#include "io/StringStream.h"

#include "TestCase.h"

Expand Down
44 changes: 28 additions & 16 deletions build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
from makewheel import makewheel
from package import package

try:
import hashlib
hashlib.md5()
except ValueError:
Logs.error('MD5 error - you are likely trying to use an old python on a new machine to run waf. '
'If you run into a fatal FIPS error try finding a newer version of python.')

COMMON_EXCLUDES = '.bzr .bzrignore .git .gitignore .svn CVS .cvsignore .arch-ids {arch} SCCS BitKeeper .hg _MTN _darcs Makefile Makefile.in config.log'.split()
COMMON_EXCLUDES_EXT ='~ .rej .orig .pyc .pyo .bak .tar.bz2 tar.gz .zip .swp'.split()
Expand All @@ -29,8 +35,8 @@
for ext in COMMON_EXCLUDES_EXT:
TaskGen.extension(ext)(Utils.nada)

if sys.version_info < (2,6,0):
raise Errors.WafError('Build system requires at least Python 2.6')
if sys.version_info < (3,6,0):
raise Errors.WafError('Build system requires at least Python 3.6')

# provide a partial function if we don't have one
try:
Expand Down Expand Up @@ -891,12 +897,6 @@ 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 == 'gcc':
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 == 'icpc':
config['cxx']['warn'] = warningFlags.split()
config['cxx']['verbose'] = '-v'
Expand All @@ -912,10 +912,11 @@ 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())
if not Options.options.enablecpp17:
gxxCompileFlags='-fPIC -std=c++14'
gxxCompileFlags='-std=c++14'
else:
gxxCompileFlags='-fPIC -std=c++17'
gxxCompileFlags='-std=c++17'
self.env.append_value('CXXFLAGS', gxxCompileFlags.split())

# DEFINES and LINKFLAGS will apply to both gcc and g++
Expand All @@ -930,12 +931,21 @@ def configureCompilerOptions(self):

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

if ccCompiler == 'gcc':
config['cc']['debug'] = '-ggdb3'
config['cc']['optz_debug'] = '-Og'
elif ccCompiler == 'icc':
config['cc']['debug'] = '-g'
config['cc']['optz_debug'] = ''
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':
config['cc']['warn'] = warningFlags.split()
config['cc']['verbose'] = '-v'
Expand All @@ -952,6 +962,8 @@ def configureCompilerOptions(self):
config['cc']['optz_fastest-possible'] = [ config['cc']['optz_fastest'], '-march=native' ]

self.env.append_value('CFLAGS', '-fPIC'.split())
# "gnu99" enables POSIX and BSD
self.env.append_value('CFLAGS', '-std=gnu99'.split())

elif re.match(winRegex, sys_platform):
crtFlag = '/%s' % Options.options.crt
Expand Down
24 changes: 18 additions & 6 deletions modules/c++/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
set(TARGET_LANGUAGE c++)
set(CMAKE_CXX_STANDARD 14)
set(CXX_STANDARD_REQUIRED true)

# turn on warnings as errors
# turn on maximum warnings
if (MSVC)
add_compile_options(/WX)
add_compile_options(/W4)
add_compile_options(/std:c++14)

# 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(-Werror)
add_compile_options(-std=c++14)

add_compile_options(-Wall -pedantic -Wextra)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wregister") # -Wvolatile
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weffc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wzero-as-null-pointer-constant")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-final-types -Wsuggest-final-methods")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override")
endif()

# add an interface library for unittests
Expand Down
8 changes: 4 additions & 4 deletions modules/c++/cli/unittests/test_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ TEST_CASE(testRequired)
parser.addArgument("-v --verbose", "Toggle verbose", cli::STORE_TRUE);
parser.addArgument("-c --config", "Specify a config file", cli::STORE)->setRequired(true);

std::unique_ptr<cli::Results> results;
TEST_EXCEPTION(results.reset(parser.parse(str::split(""))));
TEST_EXCEPTION(results.reset(parser.parse(str::split("-c"))));
results.reset(parser.parse(str::split("-c configFile")));
const std::string program(testName);
TEST_EXCEPTION(parser.parse(program, str::split("")));
TEST_EXCEPTION(parser.parse(program, str::split("-c")));
const auto results = parser.parse(program, str::split("-c configFile"));
TEST_ASSERT_EQ(results->get<std::string>("config"), "configFile");
}

Expand Down
Loading

0 comments on commit 694c551

Please sign in to comment.