Skip to content

Commit

Permalink
Merge develop to master for 1.6.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
mjansson authored Jul 26, 2021
2 parents fccf912 + 8d12b57 commit 1cda247
Show file tree
Hide file tree
Showing 188 changed files with 9,595 additions and 8,833 deletions.
47 changes: 47 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
BasedOnStyle: Google
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: 'false'
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakAfterDefinitionReturnType: TopLevel
AlwaysBreakAfterReturnType: TopLevel
AlwaysBreakBeforeMultilineStrings: 'true'
AlwaysBreakTemplateDeclarations: 'true'
BinPackArguments: 'true'
BinPackParameters: 'true'
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: 'false'
ColumnLimit: '120'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
DerivePointerAlignment: 'false'
ExperimentalAutoDetectBinPacking: 'false'
IndentCaseLabels: 'true'
IndentWidth: '4'
IndentWrappedFunctionNames: 'false'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
MaxEmptyLinesToKeep: '1'
NamespaceIndentation: None
ObjCSpaceAfterProperty: 'true'
ObjCSpaceBeforeProtocolList: 'true'
PointerAlignment: Left
SortIncludes: 'false'
SpaceAfterCStyleCast: 'false'
SpaceAfterTemplateKeyword: 'true'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: 'false'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
TabWidth: '4'
UseTab: ForIndentation
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [mjansson]
18 changes: 15 additions & 3 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@ Make radixsort have a dynamic index type based on max size during initialization
data type from radixsort_sort should be cast to the correct type (uint16_t or uint32_t) based
on sort context indextype (RADIXSORT_INDEX16 or RADIXSORT_INDEX32 respectively)

Use clang format for automatic source formatting (many whitespace changes)
Use clang format for automatic source formatting (many whitespace changes), and rename
"num" variables and arguments to "count" for counting items/things, and "size" for byte
size of things.

Add a bucketized array for lower cost growing for large arrays

Add function to query if a thread has finished execution (thread_is_finished)

Added macro for more readable uuid constant declarations (uuid_decl)

Buffer stream path now includes address for end of buffer

Added a compressed flag to stream flag bitfield

Updated ninja build script to support Visual Studio 2022


1.6.1
Expand Down Expand Up @@ -86,8 +100,6 @@ Bump Visual Studio projects to 2017
Moved Android jar signing in ninja builds to separate codesign script to unify with
iOS/macOS and to allow secrets to be stored in separate private codesign JSON

Please consider our Patreon - https://www.patreon.com/rampantpixels


1.5.2

Expand Down
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,19 @@ Platforms and architectures currently supported:
* Android (ARMv6, ARMv7, ARMv8/AArch64, x86, x86-64, MIPS, MIPS64)
* Raspberry Pi (ARMv6)

Discord server for discussions
https://discord.gg/M8BwTQrt6c

Please consider our Patreon - <https://www.patreon.com/rampantpixels>


The latest source code maintained by Rampant Pixels is always available at
<https://github.com/rampantpixels/foundation_lib>

Pre-generated documentation in HTML format for the latest release can be found at
<http://rampantpixels.github.io/foundation_lib/doc>
The latest source code maintained by Mattias Jansson is always available at
<https://github.com/mjansson/foundation_lib>

Master branch is used for stable releases. Development is done in feature branches from the develop branch
<https://github.com/rampantpixels/foundation_lib/tree/develop>
<https://github.com/mjansson/foundation_lib/tree/develop>

Cross-platform build system uses Ninja
<https://ninja-build.org/>

Test suite coverage:
[![codecov.io](http://codecov.io/github/rampantpixels/foundation_lib/coverage.svg?branch=develop)](http://codecov.io/github/rampantpixels/foundation_lib?branch=develop)

This library is put in the public domain; you can redistribute it and/or modify it without any restrictions.


Created by Mattias Jansson / Rampant Pixels - <http://www.rampantpixels.com>
Created by Mattias Jansson ([@maniccoder](https://twitter.com/maniccoder))
2 changes: 1 addition & 1 deletion ROADMAP
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
1.7.0

Nothing planned, suggestions can be added as issues in the foundation library github @ https://github.com/rampantpixels/foundation_lib
Nothing planned, suggestions can be added as issues in the foundation library github @ https://github.com/mjansson/foundation_lib
2 changes: 1 addition & 1 deletion build/ninja/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def initialize_toolchain(self):
else:
self.hostarchname = 'windows-x86'
elif self.host.is_linux():
localarch = subprocess.check_output(['uname', '-m']).strip()
localarch = toolchain.check_output(['uname', '-m'])
if localarch == 'x86_64':
self.hostarchname = 'linux-x86_64'
else:
Expand Down
46 changes: 29 additions & 17 deletions build/ninja/clang.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def initialize(self, project, archs, configs, includepaths, dependlibs, libpaths
'-fno-math-errno','-ffinite-math-only', '-funsafe-math-optimizations',
'-fno-trapping-math', '-ffast-math']
self.cwarnflags = ['-W', '-Werror', '-pedantic', '-Wall', '-Weverything',
'-Wno-padded', '-Wno-documentation-unknown-command',
'-Wno-implicit-fallthrough', '-Wno-static-in-inline', '-Wno-reserved-id-macro']
'-Wno-c++98-compat', '-Wno-padded', '-Wno-documentation-unknown-command',
'-Wno-implicit-fallthrough', '-Wno-static-in-inline', '-Wno-reserved-id-macro', '-Wno-disabled-macro-expansion']
self.cmoreflags = []
self.mflags = []
self.arflags = []
Expand All @@ -70,16 +70,27 @@ def initialize(self, project, archs, configs, includepaths, dependlibs, libpaths
self.parse_default_variables(variables)
self.read_build_prefs()

if self.target.is_linux() or self.target.is_bsd() or self.target.is_raspberrypi():
if self.target.is_linux() or self.target.is_bsd() or self.target.is_raspberrypi() or self.target.is_sunos():
self.cflags += ['-D_GNU_SOURCE=1']
self.linkflags += ['-pthread']
self.oslibs += ['m']
if self.target.is_linux() or self.target.is_raspberrypi():
self.oslibs += ['dl']
if self.target.is_raspberrypi():
self.linkflags += ['-latomic']
if self.target.is_bsd():
self.oslibs += ['execinfo']
if not self.target.is_windows():
if self.target.is_haiku():
self.cflags += ['-D_GNU_SOURCE=1']
self.linkflags += ['-lpthread']
self.oslibs += ['m']
if (not self.target.is_windows()) and (not self.target.is_macos()) and (not self.target.is_ios()):
self.linkflags += ['-fomit-frame-pointer']
if self.target.is_macos() or self.target.is_ios():
# Needed for backtrace() system call (implemented as simple frame pointer walk by Apple)
self.cflags += ['-fno-omit-frame-pointer']
else:
self.cflags += ['-fomit-frame-pointer']

self.includepaths = self.prefix_includepaths((includepaths or []) + ['.'])

Expand All @@ -99,7 +110,7 @@ def initialize(self, project, archs, configs, includepaths, dependlibs, libpaths
if self.target.is_macos() or self.target.is_ios():
self.cxxflags += ['-std=c++14', '-stdlib=libc++']
else:
self.cxxflags += ['-std=gnu++14']
self.cxxflags += ['-std=c++14']

#Overrides
self.objext = '.o'
Expand Down Expand Up @@ -250,15 +261,15 @@ def build_xcode_toolchain(self):
self.linkflags += ['-isysroot', '$sysroot']
self.cflags += ['-fembed-bitcode-marker']

platformpath = subprocess.check_output(['xcrun', '--sdk', sdk, '--show-sdk-platform-path']).strip()
platformpath = toolchain.check_output(['xcrun', '--sdk', sdk, '--show-sdk-platform-path'])
localpath = platformpath + "/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"

self.sysroot = subprocess.check_output(['xcrun', '--sdk', sdk, '--show-sdk-path']).strip()
self.sysroot = toolchain.check_output(['xcrun', '--sdk', sdk, '--show-sdk-path'])

self.ccompiler = "PATH=" + localpath + " " + subprocess.check_output(['xcrun', '--sdk', sdk, '-f', 'clang']).strip()
self.archiver = "PATH=" + localpath + " " + subprocess.check_output(['xcrun', '--sdk', sdk, '-f', 'libtool']).strip()
self.ccompiler = "PATH=" + localpath + " " + toolchain.check_output(['xcrun', '--sdk', sdk, '-f', 'clang'])
self.archiver = "PATH=" + localpath + " " + toolchain.check_output(['xcrun', '--sdk', sdk, '-f', 'libtool'])
self.linker = deploytarget + " " + self.ccompiler
self.lipo = "PATH=" + localpath + " " + subprocess.check_output(['xcrun', '--sdk', sdk, '-f', 'lipo']).strip()
self.lipo = "PATH=" + localpath + " " + toolchain.check_output(['xcrun', '--sdk', sdk, '-f', 'lipo'])

self.mflags += list(self.cflags) + ['-fobjc-arc', '-fno-objc-exceptions', '-x', 'objective-c']
self.cflags += ['-x', 'c']
Expand Down Expand Up @@ -335,7 +346,7 @@ def make_carchflags(self, arch, targettype):
flags = []
if targettype == 'sharedlib':
flags += ['-DBUILD_DYNAMIC_LINK=1']
if self.target.is_linux() or self.target.is_bsd():
if self.target.is_linux() or self.target.is_bsd() or self.target.is_sunos():
flags += ['-fPIC']
flags += self.make_targetarchflags(arch, targettype)
return flags
Expand All @@ -345,13 +356,11 @@ def make_cconfigflags(self, config, targettype):
if config == 'debug':
flags += ['-DBUILD_DEBUG=1']
elif config == 'release':
flags += ['-DBUILD_RELEASE=1']
flags += ['-DBUILD_RELEASE=1', '-O3', '-funroll-loops']
elif config == 'profile':
flags += ['-DBUILD_PROFILE=1']
flags += ['-DBUILD_PROFILE=1', '-O3', '-funroll-loops']
elif config == 'deploy':
flags += ['-DBUILD_DEPLOY=1']
if config != 'debug':
flags += ['-O3', '-fomit-frame-pointer', '-funroll-loops', '-flto']
flags += ['-DBUILD_DEPLOY=1', '-O3', '-funroll-loops']
return flags

def make_ararchflags(self, arch, targettype):
Expand Down Expand Up @@ -392,6 +401,9 @@ def make_linkconfigflags(self, config, targettype, variables):
else:
if targettype == 'sharedlib':
flags += ['-shared', '-fPIC']
if config != 'debug':
if (targettype == 'bin' or targettype == 'sharedlib') and self.use_lto():
flags += ['-flto']
return flags

def make_linkarchlibs(self, arch, targettype):
Expand Down Expand Up @@ -479,7 +491,7 @@ def link_variables(self, config, arch, targettype, variables):
localframeworks += list(variables['frameworks'])
if len(localframeworks) > 0:
localvariables += [('frameworks', self.make_frameworks(list(localframeworks)))]

libpaths = []
if 'libpaths' in variables:
libpaths = variables['libpaths']
Expand Down
9 changes: 7 additions & 2 deletions build/ninja/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ def initialize(self, project, archs, configs, includepaths, dependlibs, libpaths
self.parse_default_variables(variables)
self.read_build_prefs()

if self.target.is_linux() or self.target.is_bsd() or self.target.is_raspberrypi():
if self.target.is_linux() or self.target.is_bsd() or self.target.is_raspberrypi() or self.target.is_sunos():
self.cflags += ['-D_GNU_SOURCE=1']
self.linkflags += ['-pthread']
if self.target.is_linux() or self.target.is_raspberrypi():
self.oslibs += ['dl']
if self.target.is_raspberrypi():
self.linkflags += ['-latomic']
if self.target.is_bsd():
self.oslibs += ['execinfo']
if self.target.is_haiku():
self.cflags += ['-D_GNU_SOURCE=1']
self.linkflags += ['-lpthread']

self.includepaths = self.prefix_includepaths((includepaths or []) + ['.'])

Expand Down Expand Up @@ -186,7 +191,7 @@ def make_carchflags(self, arch, targettype):
flags = []
if targettype == 'sharedlib':
flags += ['-DBUILD_DYNAMIC_LINK=1']
if self.target.is_linux() or self.target.is_bsd():
if self.target.is_linux() or self.target.is_bsd() or self.target.is_sunos():
flags += ['-fPIC']
flags += self.make_targetarchflags(arch, targettype)
return flags
Expand Down
5 changes: 5 additions & 0 deletions build/ninja/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def __init__(self, project, includepaths = [], dependlibs = [], libpaths = [], v
parser.add_argument('--updatebuild', action='store_true',
help = 'Update submodule build scripts',
default = '')
parser.add_argument('--lto', action='store_true',
help = 'Build with Link Time Optimization',
default = False)
options = parser.parse_args()

self.project = project
Expand Down Expand Up @@ -91,6 +94,8 @@ def __init__(self, project, includepaths = [], dependlibs = [], libpaths = [], v
variables['monolithic'] = True
if options.coverage:
variables['coverage'] = True
if options.lto:
variables['lto'] = True
if self.subninja != '':
variables['internal_deps'] = True

Expand Down
39 changes: 16 additions & 23 deletions build/ninja/msvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def initialize(self, project, archs, configs, includepaths, dependlibs, libpaths
self.linkcmd = '$toolchain$link $libpaths $configlibpaths $linkflags $linkarchflags $linkconfigflags /DEBUG /NOLOGO /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT /MANIFEST /MANIFESTUAC:\"level=\'asInvoker\' uiAccess=\'false\'\" /TLBID:1 /PDB:$pdbpath /OUT:$out $in $libs $archlibs $oslibs'
self.dllcmd = self.linkcmd + ' /DLL'

self.cflags = ['/D', '"' + project.upper() + '_COMPILE=1"', '/D', '"_UNICODE"', '/D', '"UNICODE"', '/Zi', '/Oi', '/Oy-', '/GS-', '/Gy-', '/Qpar-', '/fp:fast', '/fp:except-', '/Zc:forScope', '/Zc:wchar_t', '/GR-', '/openmp-']
self.cwarnflags = ['/W4', '/WX']
self.cflags = ['/D', '"' + project.upper() + '_COMPILE=1"', '/D', '"_UNICODE"', '/D', '"UNICODE"', '/std:c17', '/Zi', '/Oi', '/Oy-', '/GS-', '/Gy-', '/Qpar-', '/fp:fast', '/fp:except-', '/Zc:forScope', '/Zc:wchar_t', '/GR-', '/openmp-']
self.cwarnflags = ['/W4', '/WX', '/wd4201'] #Ignore nameless union/struct which is allowed in C11
self.cmoreflags = []
self.arflags = ['/ignore:4221'] #Ignore empty object file warning]
self.linkflags = ['/DEBUG']
Expand Down Expand Up @@ -138,10 +138,11 @@ def build_toolchain(self):
tools_list.sort(key=StrictVersion)
self.toolchain = os.path.join(tools_basepath, tools_list[-1])
self.toolchain_version = major_version + ".0"
break

if self.toolchain == '':
toolchain = ''
versions = ['16.0', '15.0', '14.0', '13.0', '12.0', '11.0', '10.0']
versions = ['17.0', '16.0', '15.0']
keys = [
'HKLM\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7',
'HKCU\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7',
Expand All @@ -161,17 +162,18 @@ def build_toolchain(self):
except:
continue
if not toolchain == '':
if version == '15.0' or version == '16.0':
tools_basepath = os.path.join(toolchain, 'VC', 'Tools', 'MSVC')
tools_list = [item for item in os.listdir(tools_basepath) if os.path.isdir(os.path.join(tools_basepath, item))]
from distutils.version import StrictVersion
tools_list.sort(key=StrictVersion)
toolchain = os.path.join(tools_basepath, tools_list[-1])
tools_basepath = os.path.join(toolchain, 'VC', 'Tools', 'MSVC')
tools_list = [item for item in os.listdir(tools_basepath) if os.path.isdir(os.path.join(tools_basepath, item))]
from distutils.version import StrictVersion
tools_list.sort(key=StrictVersion)
toolchain = os.path.join(tools_basepath, tools_list[-1])
self.toolchain = toolchain
self.toolchain_version = version
break
if not self.toolchain == '':
break
if self.toolchain == '':
raise Exception("Unable to locate any installed Visual Studio toolchain")
self.includepaths += [os.path.join(self.toolchain, 'include')]
if self.sdkpath == '':
versions = ['v10.0', 'v8.1']
Expand Down Expand Up @@ -237,13 +239,10 @@ def make_libpaths(self, libpaths):
return []

def make_arch_toolchain_path(self, arch):
if self.toolchain_version == '15.0' or self.toolchain_version == '16.0':
if arch == 'x86-64':
return os.path.join(self.toolchain, 'bin', 'HostX64', 'x64\\')
elif arch == 'x86':
return os.path.join(self.toolchain, 'bin', 'HostX64', 'x86\\')
if arch == 'x86-64':
return os.path.join(self.toolchain, 'bin', 'amd64\\')
return os.path.join(self.toolchain, 'bin', 'HostX64', 'x64\\')
elif arch == 'x86':
return os.path.join(self.toolchain, 'bin', 'HostX64', 'x86\\')
return os.path.join(self.toolchain, 'bin\\')

def make_carchflags(self, arch, targettype):
Expand Down Expand Up @@ -321,20 +320,14 @@ def make_configlibpaths(self, config, arch, extralibpaths):
libpaths += [os.path.join(libpath, self.libpath, config, arch) for libpath in extralibpaths]
if self.sdkpath != '':
if arch == 'x86':
if self.toolchain_version == '15.0' or self.toolchain_version == '16.0':
libpaths += [os.path.join(self.toolchain, 'lib', 'x86')]
else:
libpaths += [os.path.join(self.toolchain, 'lib')]
libpaths += [os.path.join(self.toolchain, 'lib', 'x86')]
if self.sdkversion == 'v8.1':
libpaths += [os.path.join( self.sdkpath, 'lib', 'winv6.3', 'um', 'x86')]
if self.sdkversion == 'v10.0':
libpaths += [os.path.join(self.sdkpath, 'lib', self.sdkversionpath, 'um', 'x86')]
libpaths += [os.path.join(self.sdkpath, 'lib', self.sdkversionpath, 'ucrt', 'x86')]
else:
if self.toolchain_version == '15.0' or self.toolchain_version == '16.0':
libpaths += [os.path.join( self.toolchain, 'lib', 'x64')]
else:
libpaths += [os.path.join( self.toolchain, 'lib', 'amd64')]
libpaths += [os.path.join( self.toolchain, 'lib', 'x64')]
if self.sdkversion == 'v8.1':
libpaths += [os.path.join( self.sdkpath, 'lib', 'winv6.3', 'um', 'x64')]
if self.sdkversion == 'v10.0':
Expand Down
Loading

0 comments on commit 1cda247

Please sign in to comment.