From 0389b828d6bcce055dfaa2f832e5500c071e818a Mon Sep 17 00:00:00 2001 From: the1schwartz Date: Tue, 17 May 2022 11:38:38 +0200 Subject: [PATCH 1/3] build.py updated --- build/jenkins/build.py | 231 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 223 insertions(+), 8 deletions(-) diff --git a/build/jenkins/build.py b/build/jenkins/build.py index 9e9c99b9..f0527b50 100755 --- a/build/jenkins/build.py +++ b/build/jenkins/build.py @@ -40,6 +40,10 @@ def symlink(source, link_name): os.symlink = symlink +def cmd_exists(cmd): + return shutil.which(cmd) is not None + + def call_process(process_arguments, process_workingdir, silent=False, useOutput=False): print('Call process ' + str(process_arguments) + ' in workingdir ' + process_workingdir) current_workingdir = os.getcwd() @@ -731,6 +735,215 @@ def build(self, silent=False): ) +class TargetMingW(TargetCMake): + def __init__(self, name, generator, architecture): + super(TargetMingW, self).__init__(name, generator) + self.architecture = architecture + + def create_project_file(self, noSqliteSrc="NO"): + print('Skip create_project_file for MingW') + + def build(self, silent=False): + noSqliteSrc = "NO" + if "no-sqlite-src" in self.name: + noSqliteSrc = "YES" + + call_process( + [ + os.path.join( + Config.CMAKE_ROOT, + 'bin', + 'cmake' + ), + '../../../cmake/gameanalytics/', + '-DPLATFORM:STRING=' + self.name, + '-DNO_SQLITE_SRC:STRING=' + noSqliteSrc, + '-DCMAKE_BUILD_TYPE=RELEASE', + '-DTARGET_ARCH:STRING=' + self.architecture, + '-G', + self.generator + ], + self.build_dir() + ) + + call_process( + [ + 'make', + 'clean' + ], + self.build_dir(), + silent=silent + ) + + call_process( + [ + 'make', + '-j4' + ], + self.build_dir(), + silent=silent + ) + + call_process( + [ + os.path.join( + Config.CMAKE_ROOT, + 'bin', + 'cmake' + ), + '../../../cmake/gameanalytics/', + '-DPLATFORM:STRING=' + self.name, + '-DNO_SQLITE_SRC:STRING=' + noSqliteSrc, + '-DCMAKE_BUILD_TYPE=DEBUG', + '-DTARGET_ARCH:STRING=' + self.architecture, + '-DCMAKE_C_COMPILER=' + self.ccompiler, + '-DCMAKE_CXX_COMPILER=' + self.cppcompiler, + '-G', + self.generator + ], + self.build_dir() + ) + + call_process( + [ + 'make', + 'clean' + ], + self.build_dir(), + silent=silent + ) + + call_process( + [ + 'make', + '-j4' + ], + self.build_dir(), + silent=silent + ) + + libEnding = 'a' + if 'shared' in self.name: + libEnding = 'so' + + debug_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'export', self.name, 'Debug', 'libGameAnalytics.' + libEnding)) + release_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'export', self.name, 'Release', 'libGameAnalytics.' + libEnding)) + + if not os.path.exists(os.path.dirname(debug_file)): + os.makedirs(os.path.dirname(debug_file)) + + if not os.path.exists(os.path.dirname(release_file)): + os.makedirs(os.path.dirname(release_file)) + + shutil.move( + os.path.join(self.build_dir(), 'Debug', 'libGameAnalytics.' + libEnding), + debug_file + ) + + shutil.move( + os.path.join(self.build_dir(), 'Release', 'libGameAnalytics.' + libEnding), + release_file + ) + + if "no-sqlite-src" in self.name: + sqlite_debug_file = os.path.abspath(os.path.join( + __file__, '..', '..', '..', 'export', 'sqlite', self.name, 'Debug', 'libSqlite.' + libEnding)) + sqlite_release_file = os.path.abspath(os.path.join( + __file__, '..', '..', '..', 'export', 'sqlite', self.name, 'Release', 'libSqlite.' + libEnding)) + + call_process( + [ + os.path.join( + Config.CMAKE_ROOT, + 'bin', + 'cmake' + ), + '../../../../cmake/sqlite/', + '-DPLATFORM:STRING=' + self.name, + '-DCMAKE_BUILD_TYPE=RELEASE', + '-DTARGET_ARCH:STRING=' + self.architecture, + '-DCMAKE_C_COMPILER=' + self.ccompiler, + '-DCMAKE_CXX_COMPILER=' + self.cppcompiler, + '-G', + self.generator + ], + self.sqlite_build_dir() + ) + + call_process( + [ + 'make', + 'clean' + ], + self.sqlite_build_dir(), + silent=silent + ) + + call_process( + [ + 'make', + '-j4' + ], + self.sqlite_build_dir(), + silent=silent + ) + + call_process( + [ + os.path.join( + Config.CMAKE_ROOT, + 'bin', + 'cmake' + ), + '../../../../cmake/sqlite/', + '-DPLATFORM:STRING=' + self.name, + '-DCMAKE_BUILD_TYPE=DEBUG', + '-DTARGET_ARCH:STRING=' + self.architecture, + '-DCMAKE_C_COMPILER=' + self.ccompiler, + '-DCMAKE_CXX_COMPILER=' + self.cppcompiler, + '-G', + self.generator + ], + self.sqlite_build_dir() + ) + + call_process( + [ + 'make', + 'clean' + ], + self.sqlite_build_dir(), + silent=silent + ) + + call_process( + [ + 'make', + '-j4' + ], + self.sqlite_build_dir(), + silent=silent + ) + + if not os.path.exists(os.path.dirname(sqlite_debug_file)): + os.makedirs(os.path.dirname(sqlite_debug_file)) + + if not os.path.exists(os.path.dirname(sqlite_release_file)): + os.makedirs(os.path.dirname(sqlite_release_file)) + + shutil.move( + os.path.join(self.sqlite_build_dir(), 'Debug', + 'libSqlite.' + libEnding), + sqlite_debug_file + ) + + shutil.move( + os.path.join(self.sqlite_build_dir(), 'Release', + 'libSqlite.' + libEnding), + sqlite_release_file + ) + + all_targets = { 'win32-vc141-static': TargetWin('win32-vc141-static', 'Visual Studio 15 2017'), 'win32-vc141-mt-static': TargetWin('win32-vc141-mt-static', 'Visual Studio 15 2017'), @@ -752,6 +965,7 @@ def build(self, silent=False): 'uwp-x86-vc140-shared': TargetWin10('uwp-x86-vc140-shared', 'Visual Studio 16 2019', 'Win32'), 'uwp-x64-vc140-shared': TargetWin10('uwp-x64-vc140-shared', 'Visual Studio 16 2019', 'x64'), 'uwp-arm-vc140-shared': TargetWin10('uwp-arm-vc140-shared', 'Visual Studio 16 2019', 'ARM'), + 'win32-gcc-static': TargetMingW('win32-gcc-static', 'MinGW Makefiles', '-m32'), 'osx-static': TargetOSX('osx-static', 'Xcode'), 'osx-static-no-sqlite-src': TargetOSX('osx-static-no-sqlite-src', 'Xcode'), 'osx-shared': TargetOSX('osx-shared', 'Xcode'), @@ -759,10 +973,10 @@ def build(self, silent=False): 'tizen-arm-shared': TargetTizen('tizen-arm-shared', 'arm'), 'tizen-x86-static': TargetTizen('tizen-x86-static', 'x86'), 'tizen-x86-shared': TargetTizen('tizen-x86-shared', 'x86'), - #'linux-x86-clang-static': TargetLinux('linux-x86-clang-static', 'Unix Makefiles', '-m32', 'clang', 'clang++'), - #'linux-x86-gcc-static': TargetLinux('linux-x86-gcc-static', 'Unix Makefiles', '-m32', 'gcc', 'g++'), - #'linux-x86-clang-shared': TargetLinux('linux-x86-clang-shared', 'Unix Makefiles', '-m32', 'clang', 'clang++'), - #'linux-x86-gcc-shared': TargetLinux('linux-x86-gcc-shared', 'Unix Makefiles', '-m32', 'gcc', 'g++'), + # 'linux-x86-clang-static': TargetLinux('linux-x86-clang-static', 'Unix Makefiles', '-m32', 'clang', 'clang++'), + # 'linux-x86-gcc-static': TargetLinux('linux-x86-gcc-static', 'Unix Makefiles', '-m32', 'gcc', 'g++'), + # 'linux-x86-clang-shared': TargetLinux('linux-x86-clang-shared', 'Unix Makefiles', '-m32', 'clang', 'clang++'), + # 'linux-x86-gcc-shared': TargetLinux('linux-x86-gcc-shared', 'Unix Makefiles', '-m32', 'gcc', 'g++'), 'linux-x64-clang-static': TargetLinux('linux-x64-clang-static', 'Unix Makefiles', '-m64', 'clang', 'clang++'), 'linux-x64-clang-static-no-sqlite-src': TargetLinux('linux-x64-clang-static-no-sqlite-src', 'Unix Makefiles', '-m64', 'clang', 'clang++'), 'linux-x64-gcc-static': TargetLinux('linux-x64-gcc-static', 'Unix Makefiles', '-m64', 'gcc', 'g++'), @@ -781,6 +995,7 @@ def build(self, silent=False): 'tizen-arm-shared': all_targets['tizen-arm-shared'], 'tizen-x86-static': all_targets['tizen-x86-static'], 'tizen-x86-shared': all_targets['tizen-x86-shared'], + 'win32-gcc-static': all_targets['win32-gcc-static'], }, 'Windows': { # 'win32-vc141-static': all_targets['win32-vc141-static'], @@ -815,10 +1030,10 @@ def build(self, silent=False): 'tizen-x86-shared': all_targets['tizen-x86-shared'], }, 'Linux': { - #'linux-x86-clang-static': all_targets['linux-x86-clang-static'], - #'linux-x86-gcc-static': all_targets['linux-x86-gcc-static'], - #'linux-x86-clang-shared': all_targets['linux-x86-clang-shared'], - #'linux-x86-gcc-shared': all_targets['linux-x86-gcc-shared'], + # 'linux-x86-clang-static': all_targets['linux-x86-clang-static'], + # 'linux-x86-gcc-static': all_targets['linux-x86-gcc-static'], + # 'linux-x86-clang-shared': all_targets['linux-x86-clang-shared'], + # 'linux-x86-gcc-shared': all_targets['linux-x86-gcc-shared'], 'linux-x64-clang-static': all_targets['linux-x64-clang-static'], 'linux-x64-clang-static-no-sqlite-src': all_targets['linux-x64-clang-static-no-sqlite-src'], 'linux-x64-gcc-static': all_targets['linux-x64-gcc-static'], From eb8310c8463c4129db1e263c0fc83b01f4d2a400 Mon Sep 17 00:00:00 2001 From: Martin Treacy-Schwartz <> Date: Tue, 17 May 2022 15:32:59 +0200 Subject: [PATCH 2/3] started on mingw support --- build/cmake/gameanalytics/CMakeLists.txt | 58 ++++++++++ build/jenkins/build.py | 105 +++++++++--------- build/jenkins/install_dependencies.py | 1 + .../rapidjson/rapidjson/msinttypes/inttypes.h | 22 ++-- source/gameanalytics/GADevice.cpp | 4 + .../GAUncaughtExceptionHandler.cpp | 2 +- 6 files changed, 129 insertions(+), 63 deletions(-) diff --git a/build/cmake/gameanalytics/CMakeLists.txt b/build/cmake/gameanalytics/CMakeLists.txt index 492dc337..95a72977 100644 --- a/build/cmake/gameanalytics/CMakeLists.txt +++ b/build/cmake/gameanalytics/CMakeLists.txt @@ -58,6 +58,13 @@ EVAL_CONDITION(WIN64_VC141_STATIC "${PLATFORM}" STREQUAL "win64-vc141-static") EVAL_CONDITION(WIN64_VC141_MT_STATIC "${PLATFORM}" STREQUAL "win64-vc141-mt-static") EVAL_CONDITION(WIN64_VC141_SHARED "${PLATFORM}" STREQUAL "win64-vc141-shared") +# MinGW +EVAL_CONDITION(WIN32_GCC_STATIC "${PLATFORM}" STREQUAL "win32-gcc-static") +EVAL_CONDITION(WIN64_GCC_STATIC "${PLATFORM}" STREQUAL "win64-gcc-static") +EVAL_CONDITION(WIN32_GCC_SHARED "${PLATFORM}" STREQUAL "win32-gcc-shared") + +EVAL_CONDITION(MINGW_ALL "${WIN32_GCC_STATIC}" OR "${WIN64_GCC_STATIC}" OR "${WIN32_GCC_SHARED}") + EVAL_CONDITION(WIN_STATIC "${WIN32_VC120_MT_STATIC}" OR "${WIN64_VC120_MT_STATIC}" OR "${WIN32_VC120_STATIC}" OR "${WIN64_VC120_STATIC}" OR "${WIN32_VC140_STATIC}" OR "${WIN32_VC140_STATIC_NO_SQLITE_SRC}" OR "${WIN32_VC140_MT_STATIC}" OR "${WIN64_VC140_STATIC}" OR "${WIN64_VC140_STATIC_NO_SQLITE_SRC}" OR "${WIN64_VC140_MT_STATIC}" OR "${WIN32_VC141_STATIC}" OR "${WIN32_VC141_MT_STATIC}" OR "${WIN64_VC141_STATIC}" OR "${WIN64_VC141_MT_STATIC}") EVAL_CONDITION(WIN_MT "${WIN32_VC120_MT_STATIC}" OR "${WIN64_VC120_MT_STATIC}" OR "${WIN32_VC140_MT_STATIC}" OR "${WIN64_VC140_MT_STATIC}" OR "${WIN32_VC141_MT_STATIC}" OR "${WIN64_VC141_MT_STATIC}") EVAL_CONDITION(UWP_STATIC "${UWP_X86_VC140_STATIC}" OR "${UWP_X64_VC140_STATIC}" OR "${UWP_ARM_VC140_STATIC}") @@ -168,6 +175,10 @@ if("${LINUX_ALL}") add_definitions("-DGUID_LIBUUID -DUSE_LINUX") endif("${LINUX_ALL}") +if("${MINGW_ALL}") + add_definitions("-D__STDC_FORMAT_MACROS -DUSE_MINGW") +endif("${MINGW_ALL}") + message(STATUS "********************** DEPENDENCIES_DIR is ${DEPENDENCIES_DIR}") add_definitions("-DUSE_OPENSSL -DCURL_STATICLIB") @@ -299,6 +310,53 @@ elseif("${LINUX_ALL}") "${DEPENDENCIES_DIR}/miniz" "${DEPENDENCIES_DIR}/curl/include" ) +elseif("${MINGW_ALL}") + # traverse all the subdirectories of the matched directory + + if("${NO_SQLITE}") + FILE(GLOB_RECURSE CPP_SOURCES + # Add GameAnalytics Sources + "${GA_SOURCE_DIR}/*.cpp" + "${GA_SOURCE_DIR}/*.h" + + # Add dependencies + "${DEPENDENCIES_DIR}/crossguid/*.cpp" + "${DEPENDENCIES_DIR}/sqlite/*.h" + "${DEPENDENCIES_DIR}/crypto/*.c" + "${DEPENDENCIES_DIR}/crypto/*.cpp" + "${DEPENDENCIES_DIR}/zf_log/*.c" + "${DEPENDENCIES_DIR}/zf_log/*.h" + "${DEPENDENCIES_DIR}/miniz/*.c" + ) + else() + FILE(GLOB_RECURSE CPP_SOURCES + # Add GameAnalytics Sources + "${GA_SOURCE_DIR}/*.cpp" + "${GA_SOURCE_DIR}/*.h" + + # Add dependencies + "${DEPENDENCIES_DIR}/crossguid/*.cpp" + "${DEPENDENCIES_DIR}/sqlite/*.c" + "${DEPENDENCIES_DIR}/sqlite/*.h" + "${DEPENDENCIES_DIR}/crypto/*.c" + "${DEPENDENCIES_DIR}/crypto/*.cpp" + "${DEPENDENCIES_DIR}/zf_log/*.c" + "${DEPENDENCIES_DIR}/zf_log/*.h" + "${DEPENDENCIES_DIR}/miniz/*.c" + ) + endif("${NO_SQLITE}") + + add_definitions("-DCRYPTOPP_DISABLE_ASM") + + include_directories( + "${DEPENDENCIES_DIR}/crossguid" + "${DEPENDENCIES_DIR}/rapidjson" + "${DEPENDENCIES_DIR}/zf_log" + "${DEPENDENCIES_DIR}/sqlite" + "${DEPENDENCIES_DIR}/crypto" + "${DEPENDENCIES_DIR}/miniz" + "${DEPENDENCIES_DIR}/curl/include" + ) else() # traverse all the subdirectories of the matched directory diff --git a/build/jenkins/build.py b/build/jenkins/build.py index f0527b50..bb401fef 100755 --- a/build/jenkins/build.py +++ b/build/jenkins/build.py @@ -748,6 +748,19 @@ def build(self, silent=False): if "no-sqlite-src" in self.name: noSqliteSrc = "YES" + libEnding = 'a' + if 'shared' in self.name: + libEnding = 'so' + + debug_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'export', self.name, 'Debug', 'libGameAnalytics.' + libEnding)) + release_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'export', self.name, 'Release', 'libGameAnalytics.' + libEnding)) + + if not os.path.exists(os.path.dirname(debug_file)): + os.makedirs(os.path.dirname(debug_file)) + + if not os.path.exists(os.path.dirname(release_file)): + os.makedirs(os.path.dirname(release_file)) + call_process( [ os.path.join( @@ -759,7 +772,7 @@ def build(self, silent=False): '-DPLATFORM:STRING=' + self.name, '-DNO_SQLITE_SRC:STRING=' + noSqliteSrc, '-DCMAKE_BUILD_TYPE=RELEASE', - '-DTARGET_ARCH:STRING=' + self.architecture, + '-DCMAKE_CXX_FLAGS=' + self.architecture, '-G', self.generator ], @@ -768,7 +781,7 @@ def build(self, silent=False): call_process( [ - 'make', + 'mingw32-make', 'clean' ], self.build_dir(), @@ -777,13 +790,18 @@ def build(self, silent=False): call_process( [ - 'make', + 'mingw32-make', '-j4' ], self.build_dir(), silent=silent ) + shutil.move( + os.path.join(self.build_dir(), 'libGameAnalytics.' + libEnding), + release_file + ) + call_process( [ os.path.join( @@ -795,9 +813,7 @@ def build(self, silent=False): '-DPLATFORM:STRING=' + self.name, '-DNO_SQLITE_SRC:STRING=' + noSqliteSrc, '-DCMAKE_BUILD_TYPE=DEBUG', - '-DTARGET_ARCH:STRING=' + self.architecture, - '-DCMAKE_C_COMPILER=' + self.ccompiler, - '-DCMAKE_CXX_COMPILER=' + self.cppcompiler, + '-DCMAKE_CXX_FLAGS=' + self.architecture, '-G', self.generator ], @@ -806,7 +822,7 @@ def build(self, silent=False): call_process( [ - 'make', + 'mingw32-make', 'clean' ], self.build_dir(), @@ -815,42 +831,30 @@ def build(self, silent=False): call_process( [ - 'make', + 'mingw32-make', '-j4' ], self.build_dir(), silent=silent ) - libEnding = 'a' - if 'shared' in self.name: - libEnding = 'so' - - debug_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'export', self.name, 'Debug', 'libGameAnalytics.' + libEnding)) - release_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'export', self.name, 'Release', 'libGameAnalytics.' + libEnding)) - - if not os.path.exists(os.path.dirname(debug_file)): - os.makedirs(os.path.dirname(debug_file)) - - if not os.path.exists(os.path.dirname(release_file)): - os.makedirs(os.path.dirname(release_file)) - shutil.move( - os.path.join(self.build_dir(), 'Debug', 'libGameAnalytics.' + libEnding), + os.path.join(self.build_dir(), 'libGameAnalytics.' + libEnding), debug_file ) - shutil.move( - os.path.join(self.build_dir(), 'Release', 'libGameAnalytics.' + libEnding), - release_file - ) - if "no-sqlite-src" in self.name: sqlite_debug_file = os.path.abspath(os.path.join( __file__, '..', '..', '..', 'export', 'sqlite', self.name, 'Debug', 'libSqlite.' + libEnding)) sqlite_release_file = os.path.abspath(os.path.join( __file__, '..', '..', '..', 'export', 'sqlite', self.name, 'Release', 'libSqlite.' + libEnding)) + if not os.path.exists(os.path.dirname(sqlite_debug_file)): + os.makedirs(os.path.dirname(sqlite_debug_file)) + + if not os.path.exists(os.path.dirname(sqlite_release_file)): + os.makedirs(os.path.dirname(sqlite_release_file)) + call_process( [ os.path.join( @@ -861,9 +865,7 @@ def build(self, silent=False): '../../../../cmake/sqlite/', '-DPLATFORM:STRING=' + self.name, '-DCMAKE_BUILD_TYPE=RELEASE', - '-DTARGET_ARCH:STRING=' + self.architecture, - '-DCMAKE_C_COMPILER=' + self.ccompiler, - '-DCMAKE_CXX_COMPILER=' + self.cppcompiler, + '-DCMAKE_CXX_FLAGS=' + self.architecture, '-G', self.generator ], @@ -872,7 +874,7 @@ def build(self, silent=False): call_process( [ - 'make', + 'mingw32-make', 'clean' ], self.sqlite_build_dir(), @@ -881,13 +883,19 @@ def build(self, silent=False): call_process( [ - 'make', + 'mingw32-make', '-j4' ], self.sqlite_build_dir(), silent=silent ) + shutil.move( + os.path.join(self.sqlite_build_dir(), + 'libSqlite.' + libEnding), + sqlite_release_file + ) + call_process( [ os.path.join( @@ -898,9 +906,7 @@ def build(self, silent=False): '../../../../cmake/sqlite/', '-DPLATFORM:STRING=' + self.name, '-DCMAKE_BUILD_TYPE=DEBUG', - '-DTARGET_ARCH:STRING=' + self.architecture, - '-DCMAKE_C_COMPILER=' + self.ccompiler, - '-DCMAKE_CXX_COMPILER=' + self.cppcompiler, + '-DCMAKE_CXX_FLAGS=' + self.architecture, '-G', self.generator ], @@ -909,7 +915,7 @@ def build(self, silent=False): call_process( [ - 'make', + 'mingw32-make', 'clean' ], self.sqlite_build_dir(), @@ -918,31 +924,19 @@ def build(self, silent=False): call_process( [ - 'make', + 'mingw32-make', '-j4' ], self.sqlite_build_dir(), silent=silent ) - if not os.path.exists(os.path.dirname(sqlite_debug_file)): - os.makedirs(os.path.dirname(sqlite_debug_file)) - - if not os.path.exists(os.path.dirname(sqlite_release_file)): - os.makedirs(os.path.dirname(sqlite_release_file)) - shutil.move( - os.path.join(self.sqlite_build_dir(), 'Debug', + os.path.join(self.sqlite_build_dir(), 'libSqlite.' + libEnding), sqlite_debug_file ) - shutil.move( - os.path.join(self.sqlite_build_dir(), 'Release', - 'libSqlite.' + libEnding), - sqlite_release_file - ) - all_targets = { 'win32-vc141-static': TargetWin('win32-vc141-static', 'Visual Studio 15 2017'), @@ -966,6 +960,8 @@ def build(self, silent=False): 'uwp-x64-vc140-shared': TargetWin10('uwp-x64-vc140-shared', 'Visual Studio 16 2019', 'x64'), 'uwp-arm-vc140-shared': TargetWin10('uwp-arm-vc140-shared', 'Visual Studio 16 2019', 'ARM'), 'win32-gcc-static': TargetMingW('win32-gcc-static', 'MinGW Makefiles', '-m32'), + 'win64-gcc-static': TargetMingW('win64-gcc-static', 'MinGW Makefiles', '-m64'), + 'win32-gcc-shared': TargetMingW('win32-gcc-shared', 'MinGW Makefiles', '-m32'), 'osx-static': TargetOSX('osx-static', 'Xcode'), 'osx-static-no-sqlite-src': TargetOSX('osx-static-no-sqlite-src', 'Xcode'), 'osx-shared': TargetOSX('osx-shared', 'Xcode'), @@ -995,7 +991,6 @@ def build(self, silent=False): 'tizen-arm-shared': all_targets['tizen-arm-shared'], 'tizen-x86-static': all_targets['tizen-x86-static'], 'tizen-x86-shared': all_targets['tizen-x86-shared'], - 'win32-gcc-static': all_targets['win32-gcc-static'], }, 'Windows': { # 'win32-vc141-static': all_targets['win32-vc141-static'], @@ -1028,6 +1023,9 @@ def build(self, silent=False): 'tizen-arm-shared': all_targets['tizen-arm-shared'], 'tizen-x86-static': all_targets['tizen-x86-static'], 'tizen-x86-shared': all_targets['tizen-x86-shared'], + 'win32-gcc-static': all_targets['win32-gcc-static'], + 'win64-gcc-static': all_targets['win64-gcc-static'], + 'win32-gcc-shared': all_targets['win32-gcc-shared'], }, 'Linux': { # 'linux-x86-clang-static': all_targets['linux-x86-clang-static'], @@ -1087,6 +1085,11 @@ def build(target_name, vs, silent=False): if platform.system() == 'Windows': if 'tizen' in target_name: target.build(silent=silent) + elif 'gcc' in target_name: + if cmd_exists("gcc"): + target.build(silent=silent) + else: + print("MingW is not installed. Skipping target: " + target_name) else: target.build(silent=silent, vs=vs) else: diff --git a/build/jenkins/install_dependencies.py b/build/jenkins/install_dependencies.py index 4200fa6f..6ab2e761 100755 --- a/build/jenkins/install_dependencies.py +++ b/build/jenkins/install_dependencies.py @@ -21,6 +21,7 @@ def is_os_64bit(): if platform == 'win32': # win32 and/or win64 CMAKE_URL = 'https://github.com/Kitware/CMake/releases/download/v3.19.6/cmake-3.19.6-win64-x64.zip' + MINGW_URL = 'https://github.com/Kitware/CMake/releases/download/v3.19.6/cmake-3.19.6-win64-x64.zip' if is_os_64bit(): TIZEN_URL = 'http://download.tizen.org/sdk/Installer/tizen-sdk-2.4-rev8/tizen-web-cli_TizenSDK_2.4.0_Rev8_windows-64.exe' else: diff --git a/source/dependencies/rapidjson/rapidjson/msinttypes/inttypes.h b/source/dependencies/rapidjson/rapidjson/msinttypes/inttypes.h index 18111286..1620402e 100755 --- a/source/dependencies/rapidjson/rapidjson/msinttypes/inttypes.h +++ b/source/dependencies/rapidjson/rapidjson/msinttypes/inttypes.h @@ -1,37 +1,37 @@ // ISO C9x compliant inttypes.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// // Copyright (c) 2006-2013 Alexander Chemeris -// +// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: -// +// // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. -// +// // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. -// +// // 3. Neither the name of the product nor the names of its contributors may // be used to endorse or promote products derived from this software // without specific prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// +// /////////////////////////////////////////////////////////////////////////////// -// The above software in this distribution may have been modified by -// THL A29 Limited ("Tencent Modifications"). +// The above software in this distribution may have been modified by +// THL A29 Limited ("Tencent Modifications"). // All Tencent Modifications are Copyright (C) 2015 THL A29 Limited. #ifndef _MSC_VER // [ diff --git a/source/gameanalytics/GADevice.cpp b/source/gameanalytics/GADevice.cpp index dcaa2875..9d902546 100644 --- a/source/gameanalytics/GADevice.cpp +++ b/source/gameanalytics/GADevice.cpp @@ -58,7 +58,11 @@ namespace gameanalytics { namespace device { +#if USE_MINGW + bool GADevice::_useDeviceInfo = false; +#else bool GADevice::_useDeviceInfo = true; +#endif char GADevice::_writablepath[MAX_PATH_LENGTH] = ""; int GADevice::_writablepathStatus = 0; char GADevice::_buildPlatform[33] = ""; diff --git a/source/gameanalytics/GAUncaughtExceptionHandler.cpp b/source/gameanalytics/GAUncaughtExceptionHandler.cpp index 17940a9c..3db51ce6 100644 --- a/source/gameanalytics/GAUncaughtExceptionHandler.cpp +++ b/source/gameanalytics/GAUncaughtExceptionHandler.cpp @@ -2,7 +2,7 @@ // GA-SDK-CPP // Copyright 2018 GameAnalytics C++ SDK. All rights reserved. // -#if !USE_UWP && !USE_TIZEN +#if !USE_UWP && !USE_TIZEN && !USE_MINGW #include "GAUncaughtExceptionHandler.h" #include "GAState.h" #include "GAEvents.h" From c49a5ef488f0fc3b63550d8cfb2bcbb2f5a46dd1 Mon Sep 17 00:00:00 2001 From: Martin Treacy-Schwartz <> Date: Tue, 17 May 2022 16:10:57 +0200 Subject: [PATCH 3/3] mingw updates --- build/cmake/gameanalytics/CMakeLists.txt | 24 +++++++++++++++++++++++- build/jenkins/build.py | 14 ++++++++------ source/gameanalytics/GameAnalytics.h | 2 +- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/build/cmake/gameanalytics/CMakeLists.txt b/build/cmake/gameanalytics/CMakeLists.txt index 95a72977..1e828dff 100644 --- a/build/cmake/gameanalytics/CMakeLists.txt +++ b/build/cmake/gameanalytics/CMakeLists.txt @@ -62,8 +62,11 @@ EVAL_CONDITION(WIN64_VC141_SHARED "${PLATFORM}" STREQUAL "win64-vc141-shared") EVAL_CONDITION(WIN32_GCC_STATIC "${PLATFORM}" STREQUAL "win32-gcc-static") EVAL_CONDITION(WIN64_GCC_STATIC "${PLATFORM}" STREQUAL "win64-gcc-static") EVAL_CONDITION(WIN32_GCC_SHARED "${PLATFORM}" STREQUAL "win32-gcc-shared") +EVAL_CONDITION(WIN64_GCC_SHARED "${PLATFORM}" STREQUAL "win64-gcc-shared") -EVAL_CONDITION(MINGW_ALL "${WIN32_GCC_STATIC}" OR "${WIN64_GCC_STATIC}" OR "${WIN32_GCC_SHARED}") +EVAL_CONDITION(MINGW_STATIC "${WIN32_GCC_STATIC}" OR "${WIN64_GCC_STATIC}") +EVAL_CONDITION(MINGW_SHARED "${WIN32_GCC_SHARED}" OR "${WIN64_GCC_SHARED}") +EVAL_CONDITION(MINGW_ALL "${MINGW_STATIC}" OR "${MINGW_SHARED}") EVAL_CONDITION(WIN_STATIC "${WIN32_VC120_MT_STATIC}" OR "${WIN64_VC120_MT_STATIC}" OR "${WIN32_VC120_STATIC}" OR "${WIN64_VC120_STATIC}" OR "${WIN32_VC140_STATIC}" OR "${WIN32_VC140_STATIC_NO_SQLITE_SRC}" OR "${WIN32_VC140_MT_STATIC}" OR "${WIN64_VC140_STATIC}" OR "${WIN64_VC140_STATIC_NO_SQLITE_SRC}" OR "${WIN64_VC140_MT_STATIC}" OR "${WIN32_VC141_STATIC}" OR "${WIN32_VC141_MT_STATIC}" OR "${WIN64_VC141_STATIC}" OR "${WIN64_VC141_MT_STATIC}") EVAL_CONDITION(WIN_MT "${WIN32_VC120_MT_STATIC}" OR "${WIN64_VC120_MT_STATIC}" OR "${WIN32_VC140_MT_STATIC}" OR "${WIN64_VC140_MT_STATIC}" OR "${WIN32_VC141_MT_STATIC}" OR "${WIN64_VC141_MT_STATIC}") @@ -157,6 +160,25 @@ elseif("${LINUX_SHARED}") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release") add_definitions("-DGA_SHARED_LIB") #add_definitions("-DGA_SHARED_LIB -D_GLIBCXX_USE_CXX11_ABI=0") +elseif("${MINGW_STATIC}") + set(LIB_EXTENSION "a") + SET (LIB_TYPE STATIC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Debug") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release") + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Debug") + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release") + #add_definitions("-D_GLIBCXX_USE_CXX11_ABI=0") +elseif("${MINGW_SHARED}") + set(LIB_EXTENSION "so") + SET (LIB_TYPE SHARED) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Debug") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release") + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Debug") + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release") + add_definitions("-DGA_SHARED_LIB") + #add_definitions("-DGA_SHARED_LIB -D_GLIBCXX_USE_CXX11_ABI=0") endif("${WIN_UWP_STATIC}") if("${UWP_ALL}") diff --git a/build/jenkins/build.py b/build/jenkins/build.py index bb401fef..ccdcd270 100755 --- a/build/jenkins/build.py +++ b/build/jenkins/build.py @@ -798,7 +798,7 @@ def build(self, silent=False): ) shutil.move( - os.path.join(self.build_dir(), 'libGameAnalytics.' + libEnding), + os.path.join(self.build_dir(), 'Release', 'libGameAnalytics.' + libEnding), release_file ) @@ -839,7 +839,7 @@ def build(self, silent=False): ) shutil.move( - os.path.join(self.build_dir(), 'libGameAnalytics.' + libEnding), + os.path.join(self.build_dir(), 'Debug', 'libGameAnalytics.' + libEnding), debug_file ) @@ -891,7 +891,7 @@ def build(self, silent=False): ) shutil.move( - os.path.join(self.sqlite_build_dir(), + os.path.join(self.sqlite_build_dir(), 'Release', 'libSqlite.' + libEnding), sqlite_release_file ) @@ -932,7 +932,7 @@ def build(self, silent=False): ) shutil.move( - os.path.join(self.sqlite_build_dir(), + os.path.join(self.sqlite_build_dir(), 'Debug', 'libSqlite.' + libEnding), sqlite_debug_file ) @@ -961,7 +961,8 @@ def build(self, silent=False): 'uwp-arm-vc140-shared': TargetWin10('uwp-arm-vc140-shared', 'Visual Studio 16 2019', 'ARM'), 'win32-gcc-static': TargetMingW('win32-gcc-static', 'MinGW Makefiles', '-m32'), 'win64-gcc-static': TargetMingW('win64-gcc-static', 'MinGW Makefiles', '-m64'), - 'win32-gcc-shared': TargetMingW('win32-gcc-shared', 'MinGW Makefiles', '-m32'), + # 'win32-gcc-shared': TargetMingW('win32-gcc-shared', 'MinGW Makefiles', '-m32'), + # 'win64-gcc-shared': TargetMingW('win64-gcc-shared', 'MinGW Makefiles', '-m64'), 'osx-static': TargetOSX('osx-static', 'Xcode'), 'osx-static-no-sqlite-src': TargetOSX('osx-static-no-sqlite-src', 'Xcode'), 'osx-shared': TargetOSX('osx-shared', 'Xcode'), @@ -1025,7 +1026,8 @@ def build(self, silent=False): 'tizen-x86-shared': all_targets['tizen-x86-shared'], 'win32-gcc-static': all_targets['win32-gcc-static'], 'win64-gcc-static': all_targets['win64-gcc-static'], - 'win32-gcc-shared': all_targets['win32-gcc-shared'], + # 'win32-gcc-shared': all_targets['win32-gcc-shared'], + # 'win64-gcc-shared': all_targets['win64-gcc-shared'], }, 'Linux': { # 'linux-x86-clang-static': all_targets['linux-x86-clang-static'], diff --git a/source/gameanalytics/GameAnalytics.h b/source/gameanalytics/GameAnalytics.h index 8f3f2de2..6ae2ecf7 100644 --- a/source/gameanalytics/GameAnalytics.h +++ b/source/gameanalytics/GameAnalytics.h @@ -5,7 +5,7 @@ #pragma once -#if GA_SHARED_LIB && defined(_WIN32) +#if GA_SHARED_LIB && !USE_MINGW && defined(_WIN32) #pragma comment(lib, "Ws2_32.lib") #pragma comment(lib, "gdi32.lib") #pragma comment(lib, "crypt32.lib")