Skip to content

Commit

Permalink
match master
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Smith authored and Dan Smith committed Aug 8, 2022
1 parent 285d8ce commit 8cfbf7e
Show file tree
Hide file tree
Showing 63 changed files with 259 additions and 96 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.14)
project(six-library)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 11)
set(CXX_STANDARD_REQUIRED true)

if (${CMAKE_PROJECT_NAME} STREQUAL six-library)
Expand All @@ -14,14 +14,12 @@ if (${CMAKE_PROJECT_NAME} STREQUAL six-library)
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)
elseif (UNIX)
add_compile_options(
-Wno-deprecated
-Wno-unused-value
-Wno-unused-but-set-variable
)
add_compile_options(-std=c++14)
endif()

if (EXISTS "${CMAKE_BINARY_DIR}/conan_paths.cmake")
Expand Down
2 changes: 0 additions & 2 deletions UnitTest/UnitTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -83,7 +82,6 @@
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
4 changes: 1 addition & 3 deletions externals/coda-oss/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.14)

project(coda-oss)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 11)
set(CXX_STANDARD_REQUIRED true)

if (EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
Expand All @@ -25,14 +25,12 @@ if (${CMAKE_PROJECT_NAME} STREQUAL coda-oss)
# 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)
elseif (UNIX)
add_compile_options(
-Wno-deprecated
-Wno-unused-value
-Wno-unused-but-set-variable
)
add_compile_options(-std=c++14)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
Expand Down
2 changes: 0 additions & 2 deletions externals/coda-oss/UnitTest/UnitTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
<ConformanceMode>true</ConformanceMode>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<TranslateIncludes>true</TranslateIncludes>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -89,7 +88,6 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ControlFlowGuard>Guard</ControlFlowGuard>
<TranslateIncludes>true</TranslateIncludes>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
87 changes: 81 additions & 6 deletions externals/coda-oss/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,23 @@ def options(opt):
default=True, help='Allow swig to print memory leaks it detects')


def ensureCpp14Support(self):
def ensureCpp11Support(self):
# Visual Studio 2013 has nullptr but not constexpr. Need to check for
# both in here to make sure we have full C++11 support... otherwise,
# long-term we may need multiple separate configure checks and
# corresponding defines

cpp11_str = '''
int main()
{
constexpr void* FOO = nullptr;
}
'''
self.check_cxx(fragment=cpp11_str,
execute=0,
msg='Checking for C++11 support',
mandatory=True)

# DEPRECATED.
# Keeping for now in case downstream code is still looking for it
self.env['cpp11support'] = True
Expand All @@ -802,6 +818,7 @@ def configureCompilerOptions(self):
sys_platform = getPlatform(default=Options.platform)
appleRegex = r'i.86-apple-.*'
linuxRegex = r'.*-.*-linux-.*|i686-pc-.*|linux'
solarisRegex = r'sparc-sun.*|i.86-pc-solaris.*|sunos'
winRegex = r'win32'
osxRegex = r'darwin'

Expand Down Expand Up @@ -856,6 +873,9 @@ def configureCompilerOptions(self):
self.env.append_value('LINKFLAGS_THREAD', '-pthread')
self.check_cc(lib='pthread', mandatory=True)

if re.match(solarisRegex, sys_platform):
self.env.append_value('LIB_SOCKET', 'socket')

warningFlags = '-Wall'
if ccCompiler == 'gcc':
#warningFlags += ' -Wno-deprecated-declarations -Wold-style-cast'
Expand All @@ -882,7 +902,7 @@ def configureCompilerOptions(self):
config['cxx']['optz_fastest'] = '-O3'

if not Options.options.enablecpp17:
gxxCompileFlags='-fPIC -std=c++14'
gxxCompileFlags='-fPIC -std=c++11'
else:
gxxCompileFlags='-fPIC -std=c++17'
self.env.append_value('CXXFLAGS', gxxCompileFlags.split())
Expand All @@ -894,7 +914,7 @@ def configureCompilerOptions(self):
# Is there an equivalent to get the same functionality or
# is this an OS limitation?
linkFlags = '-fPIC'
if (not re.match(osxRegex, sys_platform)):
if (not re.match(osxRegex, sys_platform)) and (not re.match(solarisRegex, sys_platform)):
linkFlags += ' -Wl,-E'

self.env.append_value('LINKFLAGS', linkFlags.split())
Expand All @@ -911,6 +931,56 @@ def configureCompilerOptions(self):

self.env.append_value('CFLAGS', '-fPIC'.split())

# Solaris (Studio compiler)
elif re.match(solarisRegex, sys_platform):
self.env.append_value('LIB_DL', 'dl')
self.env.append_value('LIB_NSL', 'nsl')
self.env.append_value('LIB_SOCKET', 'socket')
self.env.append_value('LIB_THREAD', 'thread')
self.env.append_value('LIB_MATH', 'm')
self.env.append_value('LIB_CRUN', 'Crun')
self.env.append_value('LIB_CSTD', 'Cstd')
self.check_cc(lib='thread', mandatory=True)

warningFlags = ''
if Options.options.warningsAsErrors:
warningFlags = '-errwarn=%all'

if cxxCompiler == 'sunc++':
bitFlag64 = getSolarisFlags(self.env['CXX'][0])
config['cxx']['debug'] = '-g'
config['cxx']['warn'] = warningFlags.split()
config['cxx']['nowarn'] = '-erroff=%all'
config['cxx']['verbose'] = '-v'
config['cxx']['64'] = bitFlag64
config['cxx']['optz_med'] = '-xO3'
config['cxx']['optz_fast'] = '-xO4'
config['cxx']['optz_fastest'] = '-xO5'
self.env['CXXFLAGS_cxxshlib'] = ['-KPIC', '-DPIC']

# DEFINES apply to both suncc and sunc++
self.env.append_value('DEFINES', '_FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE'.split())
self.env.append_value('CXXFLAGS', '-KPIC -instances=global'.split())
self.env.append_value('CXXFLAGS_THREAD', '-mt')

if ccCompiler == 'suncc':
bitFlag64 = getSolarisFlags(self.env['CC'][0])
config['cc']['debug'] = '-g'
config['cc']['warn'] = warningFlags.split()
config['cc']['nowarn'] = '-erroff=%all'
config['cc']['verbose'] = '-v'
config['cc']['64'] = bitFlag64
config['cc']['linkflags_64'] = bitFlag64
config['cc']['optz_med'] = '-xO3'
config['cc']['optz_fast'] = '-xO4'
config['cc']['optz_fastest'] = '-xO5'
self.env['CFLAGS_cshlib'] = ['-KPIC', '-DPIC']

# C99 is required for Solaris to be compatible with
# macros that openjpeg sets
self.env.append_value('CFLAGS', ['-KPIC', '-xc99=all'])
self.env.append_value('CFLAGS_THREAD', '-mt')

elif re.match(winRegex, sys_platform):
crtFlag = '/%s' % Options.options.crt
crtDebug = '%sd' % crtFlag
Expand Down Expand Up @@ -971,8 +1041,6 @@ def configureCompilerOptions(self):
#If building with cpp17 add flags/defines to enable auto_ptr
if Options.options.enablecpp17:
flags.append('/std:c++17')
else:
flags.append('/std:c++14')

self.env.append_value('DEFINES', defines)
self.env.append_value('CXXFLAGS', flags)
Expand Down Expand Up @@ -1190,7 +1258,7 @@ def configure(self):
if Options.options._defs:
env.append_unique('DEFINES', Options.options._defs.split(','))
configureCompilerOptions(self)
ensureCpp14Support(self)
ensureCpp11Support(self)

env['PLATFORM'] = sys_platform

Expand Down Expand Up @@ -1239,6 +1307,7 @@ def process_swig_linkage(tsk):
# options for specifying soname and passing linker
# flags

solarisRegex = r'sparc-sun.*|i.86-pc-solaris.*|sunos'
darwinRegex = r'i.86-apple-.*'
osxRegex = r'darwin'

Expand All @@ -1261,6 +1330,12 @@ def process_swig_linkage(tsk):
rpath_pattern = '-Wl,-rpath=%s'
soname_pattern = '-soname=%s'

# overrides for solaris's cc and ld
if re.match(solarisRegex,platform) and compiler != 'g++' and compiler != 'icpc':
linkarg_pattern = '%s'
soname_pattern = '-h%s'
rpath_pattern = '-Rpath%s'

# overrides for osx
if re.match(darwinRegex,platform) or re.match(osxRegex,platform):
while '-bundle' in tsk.env.LINKFLAGS:
Expand Down
Empty file modified externals/coda-oss/build/config.sub
100755 → 100644
Empty file.
Empty file modified externals/coda-oss/build/scripts/jenkins.py
100755 → 100644
Empty file.
Empty file modified externals/coda-oss/build/scripts/makeEnums.py
100755 → 100644
Empty file.
Empty file modified externals/coda-oss/build/waf
100755 → 100644
Empty file.
12 changes: 12 additions & 0 deletions externals/coda-oss/cmake/CodaFindSystemDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ macro(coda_find_system_dependencies)
# creates imported target Boost::serialization, if found
# see https://cmake.org/cmake/help/latest/module/FindBoost.html
set(ENABLE_BOOST OFF CACHE BOOL "Enable building modules dependent on Boost")
set(BOOST_HOME "" CACHE PATH "path to boost installation")
if (ENABLE_BOOST OR BOOST_HOME)
if (BOOST_HOME)
set(BOOST_ROOT ${BOOST_HOME})
endif()
find_package(Boost COMPONENTS serialization)
if (NOT Boost_FOUND)
message(FATAL_ERROR "Unable to find Boost. Set BOOST_HOME to help \
locate it, or set ENABLE_BOOST=OFF.")
endif()
set(HAVE_BOOST ${Boost_FOUND})
endif()

# sets the following variables if Python installation found:
# Python_FOUND - flag indicating system has the requested components
Expand Down
27 changes: 27 additions & 0 deletions externals/coda-oss/modules/c++/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,34 @@ install(FILES "include/TestCase.h" DESTINATION "${CODA_STD_PROJECT_INCLUDE_DIR}"
install(TARGETS TestCase EXPORT ${CODA_EXPORT_SET_NAME})

# common configuration checks, used by config and sys modules
check_include_file("pthread.h" HAVE_PTHREAD_H)
check_include_file("execinfo.h" HAVE_EXECINFO_H)
check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME)
if (NOT HAVE_CLOCK_GETTIME) # On old systems this was in librt, not libc
unset("HAVE_CLOCK_GETTIME" CACHE) # check_xxx_exists set CACHE variables, which cannot be re-used without being unset.
find_library(RT_LIB rt)
if (RT_LIB)
check_library_exists(rt clock_gettime ${RT_LIB} HAVE_CLOCK_GETTIME)
if (HAVE_CLOCK_GETTIME) # Record the necessary extra link library
set(CLOCK_GETTIME_EXTRALIBS "rt" CACHE INTERNAL "")
endif()
endif()
endif()
check_include_file("atomic.h" HAVE_ATOMIC_H)
check_include_file("sys/time.h" HAVE_SYS_TIME_H)
check_symbol_exists("localtime_r" "time.h" HAVE_LOCALTIME_R)
check_symbol_exists("gmtime_r" "time.h" HAVE_GMTIME_R)
check_symbol_exists("setenv" "stdlib.h" HAVE_SETENV)
check_symbol_exists("posix_memalign" "stdlib.h" HAVE_POSIX_MEMALIGN)
check_symbol_exists("memalign" "stdlib.h" HAVE_MEMALIGN)
test_big_endian(BIGENDIAN)
check_type_size("size_t" SIZEOF_SIZE_T)
check_cxx_source_compiles(
"int __attribute__((noinline)) fn() { return 0; } int main() { return fn(); }"
HAVE_ATTRIBUTE_NOINLINE)
check_cxx_source_compiles(
"int main() { int var __attribute__((aligned (32))); return var; }"
HAVE_ATTRIBUTE_ALIGNED)

add_subdirectory("config")
add_subdirectory("coda_oss")
Expand Down
2 changes: 0 additions & 2 deletions externals/coda-oss/modules/c++/coda-oss-lite.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<TranslateIncludes>true</TranslateIncludes>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>
Expand All @@ -505,7 +504,6 @@
<ControlFlowGuard>Guard</ControlFlowGuard>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<TranslateIncludes>true</TranslateIncludes>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
#define CODA_OSS_cpp20 (CODA_OSS_cplusplus >= 202002L)
#define CODA_OSS_cpp23 0

#if !CODA_OSS_cpp14
#error "Must compile with C++14 or greater."
#if !CODA_OSS_cpp11
#error "Must compile with C++11 or greater."
#endif

#endif // CODA_OSS_coda_oss_CPlusPlus_h_INCLUDED_
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
#ifndef _CODA_OSS_CONFIG_H_
#define _CODA_OSS_CONFIG_H_

/* these should no longer be needed */
#cmakedefine HAVE_PTHREAD_H @HAVE_PTHREAD_H@
#cmakedefine HAVE_EXECINFO_H @HAVE_EXECINFO_H@
#cmakedefine HAVE_CLOCK_GETTIME @HAVE_CLOCK_GETTIME@
#cmakedefine HAVE_ATOMIC_H @HAVE_ATOMIC_H@
#cmakedefine HAVE_SYS_TIME_H @HAVE_SYS_TIME_H@
#cmakedefine HAVE_LOCALTIME_R @HAVE_LOCALTIME_R@
#cmakedefine HAVE_GMTIME_R @HAVE_GMTIME_R@
#cmakedefine HAVE_SETENV @HAVE_SETENV@
#ifndef BIGENDIAN
#cmakedefine01 BIGENDIAN
#else
Expand All @@ -14,6 +23,11 @@
#endif
#undef CODA_OSS_CHECK_BIGENDIAN
#endif
#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@
#cmakedefine HAVE_POSIX_MEMALIGN @HAVE_POSIX_MEMALIGN@
#cmakedefine HAVE_MEMALIGN @HAVE_MEMALIGN@
#cmakedefine HAVE_ATTRIBUTE_ALIGNED @HAVE_ATTRIBUTE_ALIGNED@
#cmakedefine HAVE_ATTRIBUTE_NOINLINE @HAVE_ATTRIBUTE_NOINLINE@

/* still might need these ... for now */
#cmakedefine CODA_EXPORT @CODA_EXPORT@
Expand Down
Loading

0 comments on commit 8cfbf7e

Please sign in to comment.