Skip to content

Commit

Permalink
adjust compiler flags for clean CMake builds (#629)
Browse files Browse the repository at this point in the history
* some projects get <six/Utilities.h> indirectrly

* trying to build with VS2022 17.2

* scene doesn't use XML

* move #pragma warning(disable) to import/xml/lite.h

* slam-in "main"

* fix compiler diagnostic about "possibly uninitialized result"

* update "externals" to remove compiler warnings

* cmake -j 8 seems to work

* remove more compiler warnings

* setAttribute*() overloads

* getISMUri() utility routine

* double -> float warnings

* latest from coda-oss and NITRO

* Squashed 'externals/coda-oss/' changes from 1582c6ac9..0657f3297

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: 0657f3297a806dba9312355b3231bac38f50b5d4

* Squashed 'externals/nitro/' changes from e1a64da1f..e2f038e45

e2f038e45 adjust compiler flags for clean CMake builds (#533)
b871d2b9c latest from coda-oss (#532)
e8ff6b444 apps: fix display of TREs from file extended header section (#529)
463c9e418 latest from coda-oss (#531)
24ff32863 -j 6 seems to work for SIX, how about NITRO?
713ee8538 -j 6 seems to work for SIX, how about NITRO?
4ccdf5b37 latest from coda-oss (#527)
c71acc492 latest from coda-oss (#526)
08cbb96f9 build with older C++14 compilers (#524)

git-subtree-dir: externals/nitro
git-subtree-split: e2f038e4572376c73fd63e5b35a6b58f6a75fba7

* latest from coda-oss and NITRO

* build SIX cleanly with CMake using GCC

* build SIX cleanly with CMake using GCC

* get closer to a clean build with MSVC

* clean CMake build with MSVC
  • Loading branch information
J. Daniel Smith authored Feb 10, 2023
1 parent 0cf2829 commit 1fec0d3
Show file tree
Hide file tree
Showing 42 changed files with 243 additions and 113 deletions.
18 changes: 5 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@ set(CXX_STANDARD_REQUIRED true)
if (${CMAKE_PROJECT_NAME} STREQUAL six-library)
# we are the top-level project and are responsible for configuration

# 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(/W3 /wd4290 /wd4512)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
add_compile_options(/std:c++14)
add_compile_options(/WX) # warnings as errors
add_compile_options(/MP) # multi-processor build
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
endif()

if (EXISTS "${CMAKE_BINARY_DIR}/conan_paths.cmake")
Expand Down
14 changes: 5 additions & 9 deletions externals/coda-oss/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,14 +19,12 @@ 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
elseif (UNIX)
add_compile_options(-std=c++14)
add_compile_options(-Werror) # warnings as errors
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
Expand Down
16 changes: 11 additions & 5 deletions externals/coda-oss/modules/c++/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
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 /W4) # /Wall
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 -Wall -Wpedantic -Wextra)
add_compile_options(-std=c++14)

add_compile_options(-Wall -pedantic -Wextra)
endif()

# add an interface library for unittests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "compiler_extensions.h"

#if _MSC_VER
#if defined(_MSC_VER)
// We don't care about any padding added to structs
#pragma warning(disable: 4820) // '...': '...' bytes padding added after data member '...'

Expand All @@ -38,6 +38,12 @@
// ???
#pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified


#elif defined(__GNUC__) || defined(__clang__)

// don't care about compatibility between different -std=c++nn values
CODA_OSS_disable_warning(-Wnoexcept-type)

#endif // _MSC_VER

#endif // CODA_OSS_config_disable_compiler_warnings_h_INCLUDED_
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <iterator>

#include "coda_oss/span.h"
#include "config/disable_compiler_warnings.h"

namespace mem
{
Expand Down
12 changes: 9 additions & 3 deletions externals/coda-oss/modules/drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Turn off all warnings; this is code we don't control.
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
add_compile_options(/W3)
add_compile_options(/wd4267) # '...': conversion from '...' to '...', possible loss of data
add_compile_options(/wd4244) # '...': conversion from '...' to '...', possible loss of data

# By default, there is a /W3 on the command-line from somewhere (?); adding
# /Wn results in a compiler warning.
#add_compile_options(/W0)
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
elseif (UNIX)
add_compile_options(-w) # "Inhibit all warning messages"
endif()

#add_subdirectory("curl") # this is handled in coda_find_system_dependencies
Expand Down
1 change: 1 addition & 0 deletions externals/coda-oss/modules/drivers/hdf5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
set(MODULE_NAME hdf5)
set(TARGET_LANGUAGE c++)

if(CODA_ENABLE_HDF5)
# set up warnings
Expand Down
4 changes: 0 additions & 4 deletions externals/coda-oss/modules/drivers/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ elseif(ENABLE_ZIP)
ARCHIVE "zlib-1.2.13.tar"
HASH "SHA256=A47CDCD8863424356B893B259CB57081EFDCC7FA3C2EB56CA1E881324958A2A9")

if (MSVC)
add_compile_options(/wd4996) # '...': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: .... See online help for details.
endif()

set(SOURCE_DIR "${${CMAKE_PROJECT_NAME}_${TARGET_NAME}_SOURCE_DIR}")
# remove crypt.h due to name clash with glibc
file(REMOVE "${SOURCE_DIR}/contrib/minizip/crypt.h")
Expand Down
12 changes: 12 additions & 0 deletions externals/coda-oss/modules/python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
set(TARGET_LANGUAGE c++)

# Turn off all warnings; this is code we don't control.
if (MSVC)
# By default, there is a /W3 on the command-line from somewhere (?); adding
# /Wn results in a compiler warning.
#add_compile_options(/W0)
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
elseif (UNIX)
add_compile_options(-w) # "Inhibit all warning messages"
endif()

add_subdirectory("config")
add_subdirectory("except")
add_subdirectory("sys")
Expand Down
2 changes: 1 addition & 1 deletion externals/nitro/.github/workflows/frequent_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: make
run: |
cd build
cmake --build . --config Release -j 2
cmake --build . --config Release -j
cmake --build . --config Release --target install
- name: test
run: |
Expand Down
38 changes: 15 additions & 23 deletions externals/nitro/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,23 @@ set(CXX_STANDARD_REQUIRED true)
if (${CMAKE_PROJECT_NAME} STREQUAL nitro)
# we are the top-level project and are responsible for configuration

# 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 /W4
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(/W4)
add_compile_options(/wd4100) # '...': unreferenced formal parameter
add_compile_options(/wd4127) # conditional expression is constant
if (ENABLE_ASAN)
# https://docs.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-160
add_compile_options(/fsanitize=address)
endif()
add_compile_options(/std:c++14)
add_compile_options(/WX) # warnings as errors

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(
-Wall
-Wno-deprecated
-Wno-unused-value
-Wno-unused-but-set-variable
)
if (ENABLE_ASAN)
# https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
add_compile_options(-fsanitize=address)
endif()
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)
endif()
endif()

if (EXISTS "${CMAKE_BINARY_DIR}/conan_paths.cmake")
Expand Down
16 changes: 16 additions & 0 deletions externals/nitro/modules/c++/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
set(TARGET_LANGUAGE c++)

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

# By default, there is a /W3 on the command-line from somewhere (?); adding
# /W4 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++14)

#add_compile_options(-Wall -pedantic -Wextra)
add_compile_options(-Wall -Wextra)
endif()

add_subdirectory(nitf)
3 changes: 3 additions & 0 deletions externals/nitro/modules/c++/nitf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ set(MODULE_NAME nitf)
set(MODULE_DEPS nitf-c j2k-c except-c++ sio.lite-c++ io-c++ mt-c++ sys-c++ str-c++ gsl-c++ std-c++)
if (MSVC)
list(APPEND MODULE_DEPS wsock32 ws2_32)

add_compile_options(/wd4996) # '...': This function or variable may be unsafe.
add_compile_options(/wd4459) # declaration of '...' hides global declaration
endif()

coda_add_module(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace nitf
M3, /*! \def NITF_IMAGE_IO_COMPRESSION_M3 - JPEG compression, blocking */
M4, /*! \def NITF_IMAGE_IO_COMPRESSION_M4 - Vector quantization compression, blocking */
M5, /*! \def NITF_IMAGE_IO_COMPRESSION_M5 - Lossless JPEG compression, blocking */
M8); /*! \def NITF_IMAGE_IO_COMPRESSION_M8 - JPEG 2000 */
M8) /*! \def NITF_IMAGE_IO_COMPRESSION_M8 - JPEG 2000 */

/*!
* \class ImageSubheader
Expand Down
2 changes: 1 addition & 1 deletion externals/nitro/modules/c++/nitf/include/nitf/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace Utils
const char* file, int line, const char* func, int level);
extern NITRO_NITFCPP_API void error_init(nrt_Error* error, const std::exception&,
const char* file, int line, const char* func, int level);
};
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ TEST_CASE(constructValidImageWriter)
subheader.setPixelInformation(nitf::PixelValueType::Integer, 8, 8, "R", nitf::ImageRepresentation::MONO, "VIS", bands);
subheader.setBlocking(100, 200, 10, 10, nitf::BlockingMode::Pixel);
nitf::ImageWriter writer(subheader);

TEST_ASSERT_TRUE(true); // need to reference hidden "testName" parameter
}

TEST_CASE(changeFileHeader)
Expand All @@ -105,7 +107,7 @@ TEST_CASE(changeFileHeader)
}

TEST_MAIN(
(void)argc;
(void)argc;(void)argv;

TEST_CHECK(imageWriterThrowsOnFailedConstruction);
TEST_CHECK(constructValidImageWriter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ TEST_CASE(j2k_compress_tile)

const size_t numThreads = sys::OS().getNumCPUs() - 1;

{
// be sure equals() is used to avoid compiler warnings
static const std::vector<std::byte> lhs, rhs;
TEST_ASSERT_TRUE(equals(lhs, rhs));
}

Image source;
generateTestImage(source);

Expand Down
14 changes: 10 additions & 4 deletions externals/nitro/modules/c++/nitf/unittests/test_j2k_loading++.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ TEST_CASE(test_j2k_loading)
//test_image_loading_(input_file, false /*optz*/);
//input_file = findInputFile("xxxx_MSI.nitf").string();
//test_image_loading_(input_file, false /*optz*/);

TEST_ASSERT_TRUE(true); // be sure hidden "testName" parameter is used
}

static void test_j2k_nitf_(const std::string& fname)
Expand Down Expand Up @@ -281,15 +283,17 @@ TEST_CASE(test_j2k_nitf_read_region)
// This is a JP2 file, not J2K; see OpenJPEG_setup_()
const auto input_file = findInputFile("j2k_compressed_file1_jp2.ntf");
test_j2k_nitf_read_region_(input_file);

TEST_ASSERT_TRUE(true); // be sure hidden "testName" parameter is used
}

static std::vector<std::byte> readImage(nitf::ImageReader& imageReader, const nitf::ImageSubheader& imageSubheader)
{
const auto numBlocks = imageSubheader.numBlocksPerRow() * imageSubheader.numBlocksPerCol();
TEST_ASSERT_GREATER(numBlocks, static_cast<size_t>(0));
const int64_t numBlocks = imageSubheader.numBlocksPerRow() * imageSubheader.numBlocksPerCol();
TEST_ASSERT_GREATER(numBlocks, 0);

const auto imageLength = imageSubheader.getNumBytesOfImageData();
TEST_ASSERT_GREATER(imageLength, static_cast<size_t>(0));
const int64_t imageLength = imageSubheader.getNumBytesOfImageData();
TEST_ASSERT_GREATER(imageLength, 0);

// This assumes vertical blocking.
// Interleaving would be required for horizontal blocks
Expand Down Expand Up @@ -326,6 +330,8 @@ TEST_CASE(test_j2k_decompress_nitf_to_sio)

const auto inputPathname = findInputFile("j2k_compressed_file1_jp2.ntf"); // This is a JP2 file, not J2K; see OpenJPEG_setup_()
test_decompress_nitf_to_sio_(inputPathname, "test_decompress_nitf.sio");

TEST_ASSERT_TRUE(true); // be sure hidden "testName" parameter is used
}

TEST_CASE(test_j2k_compress_raw_image)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
TEST_CASE(j2k_read_tile)
{
/* placeholder */
TEST_ASSERT_TRUE(true);
}

TEST_MAIN(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ TEST_CASE(test_tre_clone_329)
}

TEST_MAIN(
(void)argv; (void)argc;
TEST_CHECK(test_tre_create_329);
TEST_CHECK(test_tre_clone_329);
)
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ TEST_CASE(use_ENGRDA)
engrda.setField("ENGDATC[0]", 1); // count
engrda.updateFields();
engrda.setField("ENGDATA[0]", "ABC");

TEST_ASSERT_TRUE(true); // need to reference hidden "testName" parameter
}

TEST_CASE(use_ENGRDA_typed_fields)
Expand Down Expand Up @@ -416,6 +418,8 @@ TEST_CASE(overflowingNumericFields)
}

TEST_MAIN(
(void)argv; (void)argc;

TEST_CHECK(setFields);
TEST_CHECK(setBinaryFields);
TEST_CHECK(cloneTRE);
Expand Down
Loading

0 comments on commit 1fec0d3

Please sign in to comment.