Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #118 from GameAnalytics/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Martin Treacy-Schwartz authored May 17, 2022
2 parents 20570a8 + c49a5ef commit 1167ff8
Show file tree
Hide file tree
Showing 7 changed files with 326 additions and 21 deletions.
80 changes: 80 additions & 0 deletions build/cmake/gameanalytics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ 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(WIN64_GCC_SHARED "${PLATFORM}" STREQUAL "win64-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}")
EVAL_CONDITION(UWP_STATIC "${UWP_X86_VC140_STATIC}" OR "${UWP_X64_VC140_STATIC}" OR "${UWP_ARM_VC140_STATIC}")
Expand Down Expand Up @@ -150,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}")
Expand All @@ -168,6 +197,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")

Expand Down Expand Up @@ -299,6 +332,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

Expand Down
236 changes: 228 additions & 8 deletions build/jenkins/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -731,6 +735,209 @@ 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"

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(
Config.CMAKE_ROOT,
'bin',
'cmake'
),
'../../../cmake/gameanalytics/',
'-DPLATFORM:STRING=' + self.name,
'-DNO_SQLITE_SRC:STRING=' + noSqliteSrc,
'-DCMAKE_BUILD_TYPE=RELEASE',
'-DCMAKE_CXX_FLAGS=' + self.architecture,
'-G',
self.generator
],
self.build_dir()
)

call_process(
[
'mingw32-make',
'clean'
],
self.build_dir(),
silent=silent
)

call_process(
[
'mingw32-make',
'-j4'
],
self.build_dir(),
silent=silent
)

shutil.move(
os.path.join(self.build_dir(), 'Release', 'libGameAnalytics.' + libEnding),
release_file
)

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',
'-DCMAKE_CXX_FLAGS=' + self.architecture,
'-G',
self.generator
],
self.build_dir()
)

call_process(
[
'mingw32-make',
'clean'
],
self.build_dir(),
silent=silent
)

call_process(
[
'mingw32-make',
'-j4'
],
self.build_dir(),
silent=silent
)

shutil.move(
os.path.join(self.build_dir(), 'Debug', 'libGameAnalytics.' + libEnding),
debug_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(
Config.CMAKE_ROOT,
'bin',
'cmake'
),
'../../../../cmake/sqlite/',
'-DPLATFORM:STRING=' + self.name,
'-DCMAKE_BUILD_TYPE=RELEASE',
'-DCMAKE_CXX_FLAGS=' + self.architecture,
'-G',
self.generator
],
self.sqlite_build_dir()
)

call_process(
[
'mingw32-make',
'clean'
],
self.sqlite_build_dir(),
silent=silent
)

call_process(
[
'mingw32-make',
'-j4'
],
self.sqlite_build_dir(),
silent=silent
)

shutil.move(
os.path.join(self.sqlite_build_dir(), 'Release',
'libSqlite.' + libEnding),
sqlite_release_file
)

call_process(
[
os.path.join(
Config.CMAKE_ROOT,
'bin',
'cmake'
),
'../../../../cmake/sqlite/',
'-DPLATFORM:STRING=' + self.name,
'-DCMAKE_BUILD_TYPE=DEBUG',
'-DCMAKE_CXX_FLAGS=' + self.architecture,
'-G',
self.generator
],
self.sqlite_build_dir()
)

call_process(
[
'mingw32-make',
'clean'
],
self.sqlite_build_dir(),
silent=silent
)

call_process(
[
'mingw32-make',
'-j4'
],
self.sqlite_build_dir(),
silent=silent
)

shutil.move(
os.path.join(self.sqlite_build_dir(), 'Debug',
'libSqlite.' + libEnding),
sqlite_debug_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'),
Expand All @@ -752,17 +959,21 @@ 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'),
'win64-gcc-static': TargetMingW('win64-gcc-static', 'MinGW Makefiles', '-m64'),
# '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'),
'tizen-arm-static': TargetTizen('tizen-arm-static', 'arm'),
'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++'),
Expand Down Expand Up @@ -813,12 +1024,16 @@ 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'],
# 'win64-gcc-shared': all_targets['win64-gcc-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'],
Expand Down Expand Up @@ -872,6 +1087,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:
Expand Down
1 change: 1 addition & 0 deletions build/jenkins/install_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading

0 comments on commit 1167ff8

Please sign in to comment.