From 997eb14ddcc25e2975e289b441fc4ad421e6d9a5 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Fri, 7 Feb 2020 19:37:00 +0100 Subject: [PATCH 01/30] release mode proof portfiles --- cmake/ports/polyvox/portfile.cmake | 48 +++++++++++++++++++----------- cmake/ports/vhacd/portfile.cmake | 17 +++++++---- 2 files changed, 42 insertions(+), 23 deletions(-) diff --git a/cmake/ports/polyvox/portfile.cmake b/cmake/ports/polyvox/portfile.cmake index 54cc74d4dd..275a1a940f 100644 --- a/cmake/ports/polyvox/portfile.cmake +++ b/cmake/ports/polyvox/portfile.cmake @@ -23,33 +23,45 @@ vcpkg_install_cmake() file(INSTALL ${SOURCE_PATH}/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/polyvox RENAME copyright) file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/include) -file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib) -file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib) +if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib) +endif() +if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib) +endif() if(WIN32) - file(RENAME ${CURRENT_PACKAGES_DIR}/PolyVoxCore/lib/Release/PolyVoxCore.lib ${CURRENT_PACKAGES_DIR}/lib/PolyVoxCore.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/PolyVoxCore/lib/Debug/PolyVoxCore.lib ${CURRENT_PACKAGES_DIR}/debug/lib/PolyVoxCore.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/PolyVoxUtil/lib/PolyVoxUtil.lib ${CURRENT_PACKAGES_DIR}/lib/PolyVoxUtil.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/PolyVoxUtil/lib/PolyVoxUtil.lib ${CURRENT_PACKAGES_DIR}/debug/lib/PolyVoxUtil.lib) + if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(RENAME ${CURRENT_PACKAGES_DIR}/PolyVoxCore/lib/Release/PolyVoxCore.lib ${CURRENT_PACKAGES_DIR}/lib/PolyVoxCore.lib) + file(RENAME ${CURRENT_PACKAGES_DIR}/PolyVoxUtil/lib/PolyVoxUtil.lib ${CURRENT_PACKAGES_DIR}/lib/PolyVoxUtil.lib) + endif() + if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/PolyVoxCore/lib/Debug/PolyVoxCore.lib ${CURRENT_PACKAGES_DIR}/debug/lib/PolyVoxCore.lib) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/PolyVoxUtil/lib/PolyVoxUtil.lib ${CURRENT_PACKAGES_DIR}/debug/lib/PolyVoxUtil.lib) + endif() file(RENAME ${CURRENT_PACKAGES_DIR}/PolyVoxCore/include/PolyVoxCore ${CURRENT_PACKAGES_DIR}/include/PolyVoxCore) file(RENAME ${CURRENT_PACKAGES_DIR}/PolyVoxUtil/include/PolyVoxUtil ${CURRENT_PACKAGES_DIR}/include/PolyVoxUtil) file(RENAME ${CURRENT_PACKAGES_DIR}/cmake/PolyVoxConfig.cmake ${CURRENT_PACKAGES_DIR}/share/polyvox/polyvoxConfig.cmake) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/PolyVoxCore) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/PolyVoxUtil) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/PolyVoxUtil) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/PolyVoxCore) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/PolyVoxUtil) else() - file(GLOB LIBS ${CURRENT_PACKAGES_DIR}/lib/Release/*) - foreach(_lib ${LIBS}) - file(RELATIVE_PATH _libName ${CURRENT_PACKAGES_DIR}/lib/Release ${_lib}) - file(RENAME ${_lib} ${CURRENT_PACKAGES_DIR}/lib/${_libName}) - endforeach() - file(GLOB LIBS ${CURRENT_PACKAGES_DIR}/debug/lib/Debug/*) - foreach(_lib ${LIBS}) - file(RELATIVE_PATH _libName ${CURRENT_PACKAGES_DIR}/debug/lib/Debug ${_lib}) - file(RENAME ${_lib} ${CURRENT_PACKAGES_DIR}/debug/lib/${_libName}) - endforeach() + if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(GLOB LIBS ${CURRENT_PACKAGES_DIR}/lib/Release/*) + foreach(_lib ${LIBS}) + file(RELATIVE_PATH _libName ${CURRENT_PACKAGES_DIR}/lib/Release ${_lib}) + file(RENAME ${_lib} ${CURRENT_PACKAGES_DIR}/lib/${_libName}) + endforeach() + endif() + if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(GLOB LIBS ${CURRENT_PACKAGES_DIR}/debug/lib/Debug/*) + foreach(_lib ${LIBS}) + file(RELATIVE_PATH _libName ${CURRENT_PACKAGES_DIR}/debug/lib/Debug ${_lib}) + file(RENAME ${_lib} ${CURRENT_PACKAGES_DIR}/debug/lib/${_libName}) + endforeach() + endif() file(RENAME ${CURRENT_PACKAGES_DIR}/include/PolyVoxCore ${CURRENT_PACKAGES_DIR}/include/PolyVoxCore.temp) file(RENAME ${CURRENT_PACKAGES_DIR}/include/PolyVoxCore.temp/PolyVoxCore ${CURRENT_PACKAGES_DIR}/include/PolyVoxCore) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/PolyVoxCore.temp) diff --git a/cmake/ports/vhacd/portfile.cmake b/cmake/ports/vhacd/portfile.cmake index 02d90cab18..3a13e461a6 100644 --- a/cmake/ports/vhacd/portfile.cmake +++ b/cmake/ports/vhacd/portfile.cmake @@ -22,10 +22,17 @@ vcpkg_configure_cmake( vcpkg_install_cmake() file(COPY ${CMAKE_CURRENT_LIST_DIR}/copyright DESTINATION ${CURRENT_PACKAGES_DIR}/share/vhacd) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +endif() + if (WIN32) - file(RENAME ${CURRENT_PACKAGES_DIR}/lib/Release/VHACD_LIB.lib ${CURRENT_PACKAGES_DIR}/lib/VHACD.lib) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/Release) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/Debug/VHACD_LIB.lib ${CURRENT_PACKAGES_DIR}/debug/lib/VHACD.lib) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/Debug) + if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/Release/VHACD_LIB.lib ${CURRENT_PACKAGES_DIR}/lib/VHACD.lib) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/Release) + endif() + if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/Debug/VHACD_LIB.lib ${CURRENT_PACKAGES_DIR}/debug/lib/VHACD.lib) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/Debug) + endif() endif() \ No newline at end of file From 48ee437c00e640849e69da3ddf1608cbde37e48d Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Sat, 8 Feb 2020 15:43:39 +0100 Subject: [PATCH 02/30] cmake -D VCPKG_BUILD_TYPE could be set to either release debug or release in order to build vcpkg in a specific build type, otherwise it will build with debug and release --- .github/workflows/pr_build.yml | 4 +- CMakeLists.txt | 6 ++- cmake/macros/TargetDraco.cmake | 3 +- cmake/macros/TargetOpenEXR.cmake | 2 + cmake/ports/quazip/portfile.cmake | 12 ++++-- hifi_vcpkg.py | 62 ++++++++++++++++++++++++++----- prebuild.py | 8 ++++ 7 files changed, 79 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index d1ecb1bb02..2d603ea6f4 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -79,7 +79,7 @@ jobs: - name: Configure CMake working-directory: ${{runner.workspace}}/build shell: bash - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_EXTRA + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_BUILD_TYPE=release $CMAKE_EXTRA - name: Build Application working-directory: ${{runner.workspace}}/build shell: bash @@ -126,7 +126,7 @@ jobs: - name: Configure CMake working-directory: ${{runner.workspace}}/build shell: bash - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TOOLS:BOOLEAN=FALSE + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_BUILD_TYPE=release -DBUILD_TOOLS:BOOLEAN=FALSE - name: shell: bash working-directory: ${{runner.workspace}}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bf7b8bc56..ecbfd2eed9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,8 +67,12 @@ if (HIFI_ANDROID) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) else() + set(VCPKG_BUILD_TYPE_PARAM "") + if (VCPKG_BUILD_TYPE) + set(VCPKG_BUILD_TYPE_PARAM --vcpkg-build-type ${VCPKG_BUILD_TYPE}) + endif() execute_process( - COMMAND ${HIFI_PYTHON_EXEC} ${CMAKE_CURRENT_SOURCE_DIR}/prebuild.py --release-type ${RELEASE_TYPE} --build-root ${CMAKE_BINARY_DIR} + COMMAND ${HIFI_PYTHON_EXEC} ${CMAKE_CURRENT_SOURCE_DIR}/prebuild.py --release-type ${RELEASE_TYPE} --build-root ${CMAKE_BINARY_DIR} ${VCPKG_BUILD_TYPE_PARAM} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) # squelch the Policy CMP0074 warning without requiring an update to cmake 3.12. diff --git a/cmake/macros/TargetDraco.cmake b/cmake/macros/TargetDraco.cmake index 520786d4c3..e23069d1d3 100755 --- a/cmake/macros/TargetDraco.cmake +++ b/cmake/macros/TargetDraco.cmake @@ -1,6 +1,5 @@ macro(TARGET_DRACO) set(LIBS draco dracodec dracoenc) - find_library(LIBPATH ${LIB} PATHS ) if (ANDROID) set(INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/draco) set(DRACO_INCLUDE_DIRS "${INSTALL_DIR}/include" CACHE STRING INTERNAL) @@ -12,6 +11,8 @@ macro(TARGET_DRACO) else() set(LIB_SEARCH_PATH_RELEASE ${VCPKG_INSTALL_ROOT}/lib/) set(LIB_SEARCH_PATH_DEBUG ${VCPKG_INSTALL_ROOT}/debug/lib/) + set(DRACO_LIBRARY_RELEASE "") + set(DRACO_LIBRARY_DEBUG "") foreach(LIB ${LIBS}) find_library(${LIB}_LIBPATH ${LIB} PATHS ${LIB_SEARCH_PATH_RELEASE} NO_DEFAULT_PATH) list(APPEND DRACO_LIBRARY_RELEASE ${${LIB}_LIBPATH}) diff --git a/cmake/macros/TargetOpenEXR.cmake b/cmake/macros/TargetOpenEXR.cmake index 8d61f216e7..9d63ba3ef4 100644 --- a/cmake/macros/TargetOpenEXR.cmake +++ b/cmake/macros/TargetOpenEXR.cmake @@ -28,6 +28,8 @@ macro(TARGET_OPENEXR) string(REGEX MATCHALL "[0-9]" OPENEXR_MINOR_VERSION ${TMP}) endif() + set(OPENEXR_LIBRARY_RELEASE "") + set(OPENEXR_LIBRARY_DEBUG "") foreach(OPENEXR_LIB IlmImf IlmImfUtil diff --git a/cmake/ports/quazip/portfile.cmake b/cmake/ports/quazip/portfile.cmake index 07a8ebc3c3..7ff2d07173 100644 --- a/cmake/ports/quazip/portfile.cmake +++ b/cmake/ports/quazip/portfile.cmake @@ -24,10 +24,14 @@ vcpkg_configure_cmake( vcpkg_install_cmake() if (WIN32) - file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin) - file(RENAME ${CURRENT_PACKAGES_DIR}/lib/quazip5.dll ${CURRENT_PACKAGES_DIR}/bin/quazip5.dll) - file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/quazip5d.dll ${CURRENT_PACKAGES_DIR}/debug/bin/quazip5.dll) + if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin) + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/quazip5.dll ${CURRENT_PACKAGES_DIR}/bin/quazip5.dll) + endif() + if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/quazip5d.dll ${CURRENT_PACKAGES_DIR}/debug/bin/quazip5.dll) + endif() elseif(DEFINED VCPKG_TARGET_IS_LINUX) # We only want static libs. file(GLOB QUAZIP5_DYNAMIC_LIBS ${CURRENT_PACKAGES_DIR}/lib/libquazip5.so* ${CURRENT_PACKAGES_DIR}/debug/lib/libquazip5d.so*) diff --git a/hifi_vcpkg.py b/hifi_vcpkg.py index 9846d386c4..8aa928f8fe 100644 --- a/hifi_vcpkg.py +++ b/hifi_vcpkg.py @@ -21,6 +21,7 @@ get_filename_component(CMAKE_TOOLCHAIN_FILE "{}" ABSOLUTE CACHE) get_filename_component(CMAKE_TOOLCHAIN_FILE_UNCACHED "{}" ABSOLUTE) set(VCPKG_INSTALL_ROOT "{}") set(VCPKG_TOOLS_DIR "{}") +set(VCPKG_TARGET_TRIPLET "{}") """ CMAKE_TEMPLATE_NON_ANDROID = """ @@ -34,7 +35,11 @@ endif() self.args = args # our custom ports, relative to the script location self.sourcePortsPath = args.ports_path - self.id = hifi_utils.hashFolder(self.sourcePortsPath)[:8] + self.vcpkgBuildType = args.vcpkg_build_type + if (self.vcpkgBuildType): + self.id = hifi_utils.hashFolder(self.sourcePortsPath)[:8] + "-" + self.vcpkgBuildType + else: + self.id = hifi_utils.hashFolder(self.sourcePortsPath)[:8] self.configFilePath = os.path.join(args.build_root, 'vcpkg.cmake') self.assets_url = self.readVar('EXTERNAL_BUILD_ASSETS') @@ -82,15 +87,15 @@ endif() if 'Windows' == system: self.exe = os.path.join(self.path, 'vcpkg.exe') - self.bootstrapCmds = [ os.path.join(self.path, 'bootstrap-vcpkg.bat') ] + self.bootstrapCmds = [ os.path.join(self.path, 'bootstrap-vcpkg.bat'), '-disableMetrics' ] self.vcpkgUrl = self.assets_url + '/dependencies/vcpkg/builds/vcpkg-win32-client.zip%3FversionId=tSFzbw01VkkVFeRQ6YuAY4dro2HxJR9U' self.vcpkgHash = 'a650db47a63ccdc9904b68ddd16af74772e7e78170b513ea8de5a3b47d032751a3b73dcc7526d88bcb500753ea3dd9880639ca842bb176e2bddb1710f9a58cd3' self.hostTriplet = 'x64-windows' if usePrebuilt: - self.prebuiltArchive = self.assets_url + "/dependencies/vcpkg/builds/vcpkg-win32.zip%3FversionId=3SF3mDC8dkQH1JP041m88xnYmWNzZflx" + self.prebuiltArchive = "https://ipfs.io/ipfs/QmcBggttJQb1vYeyz29FXfaxnJ5c1HfZW72xNQepnENude/vcpkg-win32-a2623c6a-release.zip" elif 'Darwin' == system: self.exe = os.path.join(self.path, 'vcpkg') - self.bootstrapCmds = [ os.path.join(self.path, 'bootstrap-vcpkg.sh'), '--allowAppleClang' ] + self.bootstrapCmds = [ os.path.join(self.path, 'bootstrap-vcpkg.sh'), '--allowAppleClang', '-disableMetrics' ] self.vcpkgUrl = self.assets_url + '/dependencies/vcpkg/builds/vcpkg-osx-client.tgz%3FversionId=j0b4azo_zTlH_Q9DElEWOz1UMYZ2nqQw' self.vcpkgHash = '519d666d02ef22b87c793f016ca412e70f92e1d55953c8f9bd4ee40f6d9f78c1df01a6ee293907718f3bbf24075cc35492fb216326dfc50712a95858e9cbcb4d' self.hostTriplet = 'x64-osx' @@ -98,7 +103,7 @@ endif() self.prebuiltArchive = self.assets_url + "/dependencies/vcpkg/builds/vcpkg-osx.tgz%3FversionId=6JrIMTdvpBF3MAsjA92BMkO79Psjzs6Z" else: self.exe = os.path.join(self.path, 'vcpkg') - self.bootstrapCmds = [ os.path.join(self.path, 'bootstrap-vcpkg.sh') ] + self.bootstrapCmds = [ os.path.join(self.path, 'bootstrap-vcpkg.sh'), '-disableMetrics' ] self.vcpkgUrl = self.assets_url + '/dependencies/vcpkg/builds/vcpkg-linux-client.tgz%3FversionId=y7mct0gFicEXz5hJy3KROBugcLR56YWf' self.vcpkgHash = '6a1ce47ef6621e699a4627e8821ad32528c82fce62a6939d35b205da2d299aaa405b5f392df4a9e5343dd6a296516e341105fbb2dd8b48864781d129d7fba10d' self.hostTriplet = 'x64-linux' @@ -206,6 +211,19 @@ endif() print(actualCommands) hifi_utils.executeSubprocess(actualCommands, folder=self.path, env=self.buildEnv) + def copyTripletForBuildType(self, triplet): + print('Copying triplet ' + triplet + ' to have build type ' + self.vcpkgBuildType) + tripletPath = os.path.join(self.path, 'triplets', triplet + '.cmake') + tripletForBuildTypePath = os.path.join(self.path, 'triplets', self.getTripletWithBuildType(triplet) + '.cmake') + shutil.copy(tripletPath, tripletForBuildTypePath) + with open(tripletForBuildTypePath, "a") as tripletForBuildTypeFile: + tripletForBuildTypeFile.write("set(VCPKG_BUILD_TYPE " + self.vcpkgBuildType + ")\n") + + def getTripletWithBuildType(self, triplet): + if (not self.vcpkgBuildType): + return triplet + return triplet + '-' + self.vcpkgBuildType + def setupDependencies(self, qt=None): if self.prebuiltArchive: if not os.path.isfile(self.prebuildTagFile): @@ -224,12 +242,16 @@ endif() self.setupAndroidDependencies() print("Installing host tools") - self.run(['install', '--triplet', self.hostTriplet, 'hifi-host-tools']) + if (self.vcpkgBuildType): + self.copyTripletForBuildType(self.hostTriplet) + self.run(['install', '--triplet', self.getTripletWithBuildType(self.hostTriplet), 'hifi-host-tools']) # If not android, install the hifi-client-deps libraries if not self.args.android: print("Installing build dependencies") - self.run(['install', '--triplet', self.triplet, 'hifi-client-deps']) + if (self.vcpkgBuildType): + self.copyTripletForBuildType(self.triplet) + self.run(['install', '--triplet', self.getTripletWithBuildType(self.triplet), 'hifi-client-deps']) def cleanBuilds(self): if self.noClean: @@ -276,12 +298,32 @@ endif() with open(self.prebuildTagFile, 'w') as f: f.write(self.tagContents) + def fixupCmakeScript(self): + cmakeScript = os.path.join(self.path, 'scripts/buildsystems/vcpkg.cmake') + newCmakeScript = cmakeScript + '.new' + isFileChanged = False + removalPrefix = "set(VCPKG_TARGET_TRIPLET " + # Open original file in read only mode and dummy file in write mode + with open(cmakeScript, 'r') as read_obj, open(newCmakeScript, 'w') as write_obj: + # Line by line copy data from original file to dummy file + for line in read_obj: + if not line.startswith(removalPrefix): + write_obj.write(line) + else: + isFileChanged = True + + if isFileChanged: + shutil.move(newCmakeScript, cmakeScript) + else: + os.remove(newCmakeScript) + + def writeConfig(self): print("Writing cmake config to {}".format(self.configFilePath)) # Write out the configuration for use by CMake cmakeScript = os.path.join(self.path, 'scripts/buildsystems/vcpkg.cmake') - installPath = os.path.join(self.path, 'installed', self.triplet) - toolsPath = os.path.join(self.path, 'installed', self.hostTriplet, 'tools') + installPath = os.path.join(self.path, 'installed', self.getTripletWithBuildType(self.triplet)) + toolsPath = os.path.join(self.path, 'installed', self.getTripletWithBuildType(self.hostTriplet), 'tools') cmakeTemplate = VcpkgRepo.CMAKE_TEMPLATE if self.args.android: @@ -289,7 +331,7 @@ endif() cmakeTemplate += 'set(HIFI_ANDROID_PRECOMPILED "{}")\n'.format(precompiled) else: cmakeTemplate += VcpkgRepo.CMAKE_TEMPLATE_NON_ANDROID - cmakeConfig = cmakeTemplate.format(cmakeScript, cmakeScript, installPath, toolsPath).replace('\\', '/') + cmakeConfig = cmakeTemplate.format(cmakeScript, cmakeScript, installPath, toolsPath, self.getTripletWithBuildType(self.hostTriplet)).replace('\\', '/') with open(self.configFilePath, 'w') as f: f.write(cmakeConfig) diff --git a/prebuild.py b/prebuild.py index 03677f21d7..66c74630e7 100644 --- a/prebuild.py +++ b/prebuild.py @@ -94,6 +94,7 @@ def parse_args(): parser.add_argument('--force-build', action='store_true') parser.add_argument('--release-type', type=str, default="DEV", help="DEV, PR, or PRODUCTION") parser.add_argument('--vcpkg-root', type=str, help='The location of the vcpkg distribution') + parser.add_argument('--vcpkg-build-type', type=str, help='Could be `release` or `debug`. By default it doesn`t set the build-type') parser.add_argument('--build-root', required=True, type=str, help='The location of the cmake build') parser.add_argument('--ports-path', type=str, default=defaultPortsPath) parser.add_argument('--ci-build', action='store_true', default=os.getenv('CI_BUILD') is not None) @@ -142,6 +143,10 @@ def main(): pm.writeVar('QT_CMAKE_PREFIX_PATH', qtInstallPath) # Only allow one instance of the program to run at a time + + if qtInstallPath != '': + pm.writeVar('QT_CMAKE_PREFIX_PATH', qtInstallPath) + with hifi_singleton.Singleton(pm.lockFile) as lock: with timer('Bootstraping'): @@ -175,6 +180,9 @@ def main(): qtPath = os.path.join(pm.androidPackagePath, 'qt') hifi_android.QtPackager(appPath, qtPath).bundle() + # Fixup the vcpkg cmake to not reset VCPKG_TARGET_TRIPLET + pm.fixupCmakeScript() + # Write the vcpkg config to the build directory last with timer('Writing configuration'): pm.writeConfig() From 98e79fd698c5e95b894616283d70a03ae9851513 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Thu, 13 Feb 2020 19:27:59 +0100 Subject: [PATCH 03/30] update zlib port --- cmake/ports/zlib/CONTROL | 2 +- .../cmake_dont_build_more_than_needed.patch | 58 ++++++++++++++----- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/cmake/ports/zlib/CONTROL b/cmake/ports/zlib/CONTROL index aa7c7b6e92..601fb1bc0e 100644 --- a/cmake/ports/zlib/CONTROL +++ b/cmake/ports/zlib/CONTROL @@ -1,4 +1,4 @@ Source: zlib -Version: 1.2.11-5 +Version: 1.2.11-6 Homepage: https://www.zlib.net/ Description: A compression library diff --git a/cmake/ports/zlib/cmake_dont_build_more_than_needed.patch b/cmake/ports/zlib/cmake_dont_build_more_than_needed.patch index 229a2d055b..a374f76d62 100644 --- a/cmake/ports/zlib/cmake_dont_build_more_than_needed.patch +++ b/cmake/ports/zlib/cmake_dont_build_more_than_needed.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0fe939d..8d2f5f1 100644 +index 0fe939d..a1291d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ set(VERSION "1.2.11") @@ -10,24 +10,56 @@ index 0fe939d..8d2f5f1 100644 set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") -@@ -211,7 +212,15 @@ elseif(BUILD_SHARED_LIBS AND WIN32) +@@ -124,9 +125,11 @@ set(ZLIB_SRCS + ) + + if(NOT MINGW) +- set(ZLIB_DLL_SRCS +- win32/zlib1.rc # If present will override custom build rule below. +- ) ++ if(BUILD_SHARED_LIBS) ++ set(ZLIB_DLL_SRCS ++ win32/zlib1.rc # If present will override custom build rule below. ++ ) ++ endif() + endif() + + if(CMAKE_COMPILER_IS_GNUCC) +@@ -180,11 +183,12 @@ if(MINGW) + -I ${CMAKE_CURRENT_BINARY_DIR} + -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj + -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) +- set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) ++ if(BUILD_SHARED_LIBS) ++ set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) ++ endif() + endif(MINGW) + +-add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) ++add_library(zlib ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) + set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) + set_target_properties(zlib PROPERTIES SOVERSION 1) + +@@ -201,7 +205,7 @@ endif() + + if(UNIX) + # On unix-like platforms the library is almost always called libz +- set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) ++ set_target_properties(zlib PROPERTIES OUTPUT_NAME z) + if(NOT APPLE) + set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") + endif() +@@ -211,7 +215,7 @@ elseif(BUILD_SHARED_LIBS AND WIN32) endif() if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) - install(TARGETS zlib zlibstatic -+ if (BUILD_SHARED_LIBS) -+ set(ZLIB_TARGETS zlib) -+ set_target_properties(zlibstatic PROPERTIES EXCLUDE_FROM_ALL ON) -+ else() -+ set(ZLIB_TARGETS zlibstatic) -+ set_target_properties(zlib PROPERTIES EXCLUDE_FROM_ALL ON) -+ endif() -+ -+ install(TARGETS ${ZLIB_TARGETS} ++ install(TARGETS zlib RUNTIME DESTINATION "${INSTALL_BIN_DIR}" ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) -@@ -230,6 +239,7 @@ endif() +@@ -230,6 +234,7 @@ endif() # Example binaries #============================================================================ @@ -35,7 +67,7 @@ index 0fe939d..8d2f5f1 100644 add_executable(example test/example.c) target_link_libraries(example zlib) add_test(example example) -@@ -247,3 +257,4 @@ if(HAVE_OFF64_T) +@@ -247,3 +252,4 @@ if(HAVE_OFF64_T) target_link_libraries(minigzip64 zlib) set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") endif() From 3ea3330beaf8fce6ed258fc8c6d2baa3bb5b43a9 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Thu, 13 Feb 2020 20:11:14 +0100 Subject: [PATCH 04/30] enable tbb for osx --- cmake/ports/hifi-deps/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/ports/hifi-deps/CONTROL b/cmake/ports/hifi-deps/CONTROL index d4b4acd4c5..ff689c7a2a 100644 --- a/cmake/ports/hifi-deps/CONTROL +++ b/cmake/ports/hifi-deps/CONTROL @@ -1,4 +1,4 @@ Source: hifi-deps -Version: 0.1.4-github-actions +Version: 0.1.5-github-actions Description: Collected dependencies for High Fidelity applications Build-Depends: bullet3, draco, etc2comp, glad, glm, nvtt, openexr (!android), openssl (windows), opus, polyvox, tbb (!android), vhacd, webrtc (!android), zlib From 0c8359816cefd39809a9d3a4e850830df4f8cffa Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Sat, 15 Feb 2020 17:03:18 +0100 Subject: [PATCH 05/30] - make vcpkg output smaller by removing downloads and packages folders - only build the full version of the clients for now (server+client) - disable using a predefined vcpkg for CI builds for now. - --- hifi_vcpkg.py | 14 ++++++++++---- prebuild.py | 5 ++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/hifi_vcpkg.py b/hifi_vcpkg.py index 8aa928f8fe..03ed303022 100644 --- a/hifi_vcpkg.py +++ b/hifi_vcpkg.py @@ -91,16 +91,16 @@ endif() self.vcpkgUrl = self.assets_url + '/dependencies/vcpkg/builds/vcpkg-win32-client.zip%3FversionId=tSFzbw01VkkVFeRQ6YuAY4dro2HxJR9U' self.vcpkgHash = 'a650db47a63ccdc9904b68ddd16af74772e7e78170b513ea8de5a3b47d032751a3b73dcc7526d88bcb500753ea3dd9880639ca842bb176e2bddb1710f9a58cd3' self.hostTriplet = 'x64-windows' - if usePrebuilt: - self.prebuiltArchive = "https://ipfs.io/ipfs/QmcBggttJQb1vYeyz29FXfaxnJ5c1HfZW72xNQepnENude/vcpkg-win32-a2623c6a-release.zip" + #if usePrebuilt: + # self.prebuiltArchive = "https://ipfs.io/ipfs/QmcBggttJQb1vYeyz29FXfaxnJ5c1HfZW72xNQepnENude/vcpkg-win32-a2623c6a-release.zip" elif 'Darwin' == system: self.exe = os.path.join(self.path, 'vcpkg') self.bootstrapCmds = [ os.path.join(self.path, 'bootstrap-vcpkg.sh'), '--allowAppleClang', '-disableMetrics' ] self.vcpkgUrl = self.assets_url + '/dependencies/vcpkg/builds/vcpkg-osx-client.tgz%3FversionId=j0b4azo_zTlH_Q9DElEWOz1UMYZ2nqQw' self.vcpkgHash = '519d666d02ef22b87c793f016ca412e70f92e1d55953c8f9bd4ee40f6d9f78c1df01a6ee293907718f3bbf24075cc35492fb216326dfc50712a95858e9cbcb4d' self.hostTriplet = 'x64-osx' - if usePrebuilt: - self.prebuiltArchive = self.assets_url + "/dependencies/vcpkg/builds/vcpkg-osx.tgz%3FversionId=6JrIMTdvpBF3MAsjA92BMkO79Psjzs6Z" + #if usePrebuilt: + # self.prebuiltArchive = self.assets_url + "/dependencies/vcpkg/builds/vcpkg-osx.tgz%3FversionId=6JrIMTdvpBF3MAsjA92BMkO79Psjzs6Z" else: self.exe = os.path.join(self.path, 'vcpkg') self.bootstrapCmds = [ os.path.join(self.path, 'bootstrap-vcpkg.sh'), '-disableMetrics' ] @@ -262,6 +262,12 @@ endif() print("Wiping build trees") shutil.rmtree(builddir, ignore_errors=True) + # Removes large files used to build the vcpkg, for CI purposes. + def cleanupDevelopmentFiles(self): + shutil.rmtree(os.path.join(self.path, "downloads"), ignore_errors=True) + shutil.rmtree(os.path.join(self.path, "packages"), ignore_errors=True) + + def setupAndroidDependencies(self): # vcpkg prebuilt if not os.path.isdir(os.path.join(self.path, 'installed', 'arm64-android')): diff --git a/prebuild.py b/prebuild.py index 66c74630e7..b15c83e4fe 100644 --- a/prebuild.py +++ b/prebuild.py @@ -165,7 +165,7 @@ def main(): pm.setupDependencies(qt=qtInstallPath) # wipe out the build directories (after writing the tag, since failure - # here shouldn't invalidte the vcpkg install) + # here shouldn't invalidate the vcpkg install) with timer('Cleaning builds'): pm.cleanBuilds() @@ -183,6 +183,9 @@ def main(): # Fixup the vcpkg cmake to not reset VCPKG_TARGET_TRIPLET pm.fixupCmakeScript() + # Cleanup downloads and packages folders in vcpkg to make it smaller for CI + pm.cleanupDevelopmentFiles() + # Write the vcpkg config to the build directory last with timer('Writing configuration'): pm.writeConfig() From ba7f7406250f5a30607506ad2b249194553c4684 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Sat, 15 Feb 2020 17:17:41 +0100 Subject: [PATCH 06/30] try fix osx vcpkg build --- hifi_vcpkg.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hifi_vcpkg.py b/hifi_vcpkg.py index 03ed303022..4d347a289a 100644 --- a/hifi_vcpkg.py +++ b/hifi_vcpkg.py @@ -99,6 +99,8 @@ endif() self.vcpkgUrl = self.assets_url + '/dependencies/vcpkg/builds/vcpkg-osx-client.tgz%3FversionId=j0b4azo_zTlH_Q9DElEWOz1UMYZ2nqQw' self.vcpkgHash = '519d666d02ef22b87c793f016ca412e70f92e1d55953c8f9bd4ee40f6d9f78c1df01a6ee293907718f3bbf24075cc35492fb216326dfc50712a95858e9cbcb4d' self.hostTriplet = 'x64-osx' + # Potential fix for a vcpkg build issue on OSX (see https://github.com/microsoft/vcpkg/issues/9029) + self.bootstrapEnv['CXXFLAGS'] = '-D_CTERMID_H_' #if usePrebuilt: # self.prebuiltArchive = self.assets_url + "/dependencies/vcpkg/builds/vcpkg-osx.tgz%3FversionId=6JrIMTdvpBF3MAsjA92BMkO79Psjzs6Z" else: From 466e1a7ce3c21786a2363a42a3180ebf64fda35f Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Tue, 31 Mar 2020 13:39:54 +0200 Subject: [PATCH 07/30] - disable osx GHA build for now - fix tbb issue, the repo moved to another location which changed the hash of the source --- cmake/ports/tbb/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/ports/tbb/CONTROL b/cmake/ports/tbb/CONTROL index da29e48794..73569fe661 100644 --- a/cmake/ports/tbb/CONTROL +++ b/cmake/ports/tbb/CONTROL @@ -1,4 +1,4 @@ Source: tbb Version: 2019_U8-1 -Homepage: https://github.com/01org/tbb +Homepage: https://github.com/oneapi-src/oneTBB Description: Intel's Threading Building Blocks. From 25932d3ab5f63263b89148bbd877c5270357cb83 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 8 Apr 2020 11:12:23 +0200 Subject: [PATCH 08/30] the new build upload script --- .github/workflows/pr_build.yml | 7 ++ tools/ci-scripts/upload_to_publish_server.py | 77 ++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 tools/ci-scripts/upload_to_publish_server.py diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 2d603ea6f4..fba23772fe 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -105,6 +105,13 @@ jobs: shell: bash working-directory: ${{runner.workspace}}/build run: cat ./_CPack_Packages/win64/NSIS/NSISOutput.log + - name: Upload Artifact + shell: bash + working-directory: ${{runner.workspace}}/build + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + ARTIFACT_PATTERN: HighFidelity-Beta-PR${{ github.event.number }}-*.exe + run: python "$GITHUB_WORKSPACE\tools\ci-scripts\upload_to_publish_server.py" build_full_linux: runs-on: ubuntu-latest diff --git a/tools/ci-scripts/upload_to_publish_server.py b/tools/ci-scripts/upload_to_publish_server.py new file mode 100644 index 0000000000..8b363f36aa --- /dev/null +++ b/tools/ci-scripts/upload_to_publish_server.py @@ -0,0 +1,77 @@ +import os +import json +from hashlib import sha256 +import http.client +from http import HTTPStatus +import time +import struct +import random +import glob + +FILE_READ_BUFFER = 4096 + +path = os.path.join(os.getcwd(), os.environ['ARTIFACT_PATTERN']) +files = glob.glob(path, recursive=False) +uploading_files = [] +for archive_file in files: + file = open(archive_file, 'rb') + sha256_hash = sha256() + file.seek(0, 0) + for byte_block in iter(lambda: file.read(FILE_READ_BUFFER), b""): + sha256_hash.update(byte_block) + + checksum = sha256_hash.hexdigest() + + uploading_files.append({ + "filename": os.path.basename(archive_file), + "sha256_checksum": checksum, + "file_length": file.tell() + }) + file.close() + +print("BuildFileHashes: " + json.dumps(uploading_files)) + +file_contents = [] +file_sizes = [] + +for archiveFile in files: + file = open(archiveFile, 'rb') + file_data = file.read() + file_sizes.append(len(file_data)) + file_contents.append(file_data) + file.close() + +conn = http.client.HTTPSConnection("athena-build-uploader.thoys.nl") + +context = json.loads(os.environ['GITHUB_CONTEXT']) + +owner_and_repository = context["repository"].split("/") +owner = owner_and_repository[0] +repository = owner_and_repository[1] + +headers = { + "owner": owner, + "repo": repository, + "commit_hash": context["event"]["pull_request"]["head"]["sha"], + "pull_number": context["event"]["number"], + "job_name": os.environ["JOB_NAME"], + "run_id": context["run_id"], + "file_sizes": ','.join(str(e) for e in file_sizes) +} + +concat_file_body = b''.join(file_contents) + +print("Total files size: " + str(len(concat_file_body))) + +conn.request("PUT", "/", body=concat_file_body, headers=headers) +response = conn.getresponse() + +EXIT_CODE_OK = 0 +EXIT_CODE_ERROR = 1 + +if (response.status == HTTPStatus.OK): + print("response: ", json.loads(response.read())) + exit(EXIT_CODE_OK) +else: + print(response.status, response.reason, response.read()) + exit(EXIT_CODE_ERROR) From b89ddf33eca4d67b2d2610eba7de7ae15b05fd92 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 8 Apr 2020 12:07:53 +0200 Subject: [PATCH 09/30] fix missing url --- hifi_qt.py | 6 +----- hifi_utils.py | 4 ++++ prebuild.py | 9 ++++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/hifi_qt.py b/hifi_qt.py index 6cae3bf59d..b046342745 100644 --- a/hifi_qt.py +++ b/hifi_qt.py @@ -29,7 +29,7 @@ endif() self.configFilePath = os.path.join(args.build_root, 'qt.cmake') self.version = os.getenv('VIRCADIA_USE_QT_VERSION', '5.12.3') - self.assets_url = self.readVar('EXTERNAL_BUILD_ASSETS') + self.assets_url = hifi_utils.readEnviromentVariableFromFile(args.build_root, 'EXTERNAL_BUILD_ASSETS') defaultBasePath = os.path.expanduser('~/hifi/qt') self.basePath = os.getenv('HIFI_QT_BASE', defaultBasePath) @@ -89,10 +89,6 @@ endif() print("Machine : " + platform.machine()) raise Exception('UNKNOWN OPERATING SYSTEM!!!') - def readVar(self, var): - with open(os.path.join(self.args.build_root, '_env', var + ".txt")) as fp: - return fp.read() - def writeConfig(self): print("Writing cmake config to {}".format(self.configFilePath)) # Write out the configuration for use by CMake diff --git a/hifi_utils.py b/hifi_utils.py index 3a49f6d52b..157e5858a8 100644 --- a/hifi_utils.py +++ b/hifi_utils.py @@ -121,3 +121,7 @@ def downloadAndExtract(url, destPath, hash=None, hasher=hashlib.sha512(), isZip= with tarfile.open(tempFileName, 'r:*') as tgz: tgz.extractall(destPath) os.remove(tempFileName) + +def readEnviromentVariableFromFile(buildRootDir, var): + with open(os.path.join(buildRootDir, '_env', var + ".txt")) as fp: + return fp.read() diff --git a/prebuild.py b/prebuild.py index b15c83e4fe..d0bbc75fb7 100644 --- a/prebuild.py +++ b/prebuild.py @@ -95,6 +95,7 @@ def parse_args(): parser.add_argument('--release-type', type=str, default="DEV", help="DEV, PR, or PRODUCTION") parser.add_argument('--vcpkg-root', type=str, help='The location of the vcpkg distribution') parser.add_argument('--vcpkg-build-type', type=str, help='Could be `release` or `debug`. By default it doesn`t set the build-type') + parser.add_argument('--vcpkg-skip-clean', action='store_true', help='Skip the cleanup of vcpkg downloads and packages folders after vcpkg build completition.') parser.add_argument('--build-root', required=True, type=str, help='The location of the cmake build') parser.add_argument('--ports-path', type=str, default=defaultPortsPath) parser.add_argument('--ci-build', action='store_true', default=os.getenv('CI_BUILD') is not None) @@ -114,6 +115,7 @@ def main(): del os.environ[var] args = parse_args() + assets_url = hifi_utils.readEnviromentVariableFromFile(args.build_root, 'EXTERNAL_BUILD_ASSETS') if args.ci_build: logging.basicConfig(datefmt='%H:%M:%S', format='%(asctime)s %(guid)s %(message)s', level=logging.INFO) @@ -126,7 +128,7 @@ def main(): if 'Windows' == system and 'CI_BUILD' in os.environ and os.environ["CI_BUILD"] == "Github": logger.info("Downloading NSIS") with timer('NSIS'): - hifi_utils.downloadAndExtract('https://athena-public.s3.amazonaws.com/dependencies/NSIS-hifi-plugins-1.0.tgz', "C:/Program Files (x86)") + hifi_utils.downloadAndExtract(assets_url + '/dependencies/NSIS-hifi-plugins-1.0.tgz', "C:/Program Files (x86)") qtInstallPath = '' # If not android, install our Qt build @@ -183,8 +185,9 @@ def main(): # Fixup the vcpkg cmake to not reset VCPKG_TARGET_TRIPLET pm.fixupCmakeScript() - # Cleanup downloads and packages folders in vcpkg to make it smaller for CI - pm.cleanupDevelopmentFiles() + if not args.vcpkg_skip_clean: + # Cleanup downloads and packages folders in vcpkg to make it smaller for CI + pm.cleanupDevelopmentFiles() # Write the vcpkg config to the build directory last with timer('Writing configuration'): From 53bb62756f6bef68db7e9a9e0b4f9a6e2025fbba Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 8 Apr 2020 16:10:33 +0200 Subject: [PATCH 10/30] fix more links --- cmake/ports/glad/portfile.cmake | 7 ++++--- cmake/ports/polyvox/portfile.cmake | 4 +++- cmake/ports/quazip/portfile.cmake | 3 ++- cmake/ports/vhacd/portfile.cmake | 6 ++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cmake/ports/glad/portfile.cmake b/cmake/ports/glad/portfile.cmake index 56ee59e0d4..54b1d91c89 100644 --- a/cmake/ports/glad/portfile.cmake +++ b/cmake/ports/glad/portfile.cmake @@ -1,17 +1,19 @@ include(vcpkg_common_functions) vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +file(READ "${VCPKG_ROOT_DIR}/_env/EXTERNAL_BUILD_ASSETS.txt" EXTERNAL_BUILD_ASSETS) + if (ANDROID) vcpkg_download_distfile( SOURCE_ARCHIVE - URLS https://athena-public.s3.amazonaws.com/dependencies/glad/glad32es.zip + URLS ${EXTERNAL_BUILD_ASSETS}/dependencies/glad/glad32es.zip SHA512 2e02ac633eed8f2ba2adbf96ea85d08998f48dd2e9ec9a88ec3c25f48eaf1405371d258066327c783772fcb3793bdb82bd7375fdabb2ba5e2ce0835468b17f65 ) else() # else Linux desktop vcpkg_download_distfile( SOURCE_ARCHIVE - URLS https://athena-public.s3.amazonaws.com/dependencies/glad/glad45.zip + URLS ${EXTERNAL_BUILD_ASSETS}/dependencies/glad/glad45.zip SHA512 653a7b873f9fbc52e0ab95006cc3143bc7b6f62c6e032bc994e87669273468f37978525c9af5efe36f924cb4acd221eb664ad9af0ce4bf711b4f1be724c0065e FILENAME glad45.zip ) @@ -33,4 +35,3 @@ vcpkg_install_cmake() file(COPY ${CMAKE_CURRENT_LIST_DIR}/copyright DESTINATION ${CURRENT_PACKAGES_DIR}/share/glad) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) - diff --git a/cmake/ports/polyvox/portfile.cmake b/cmake/ports/polyvox/portfile.cmake index 275a1a940f..9204b26dbd 100644 --- a/cmake/ports/polyvox/portfile.cmake +++ b/cmake/ports/polyvox/portfile.cmake @@ -1,9 +1,11 @@ include(vcpkg_common_functions) +file(READ "${VCPKG_ROOT_DIR}/_env/EXTERNAL_BUILD_ASSETS.txt" EXTERNAL_BUILD_ASSETS) + # else Linux desktop vcpkg_download_distfile( SOURCE_ARCHIVE - URLS https://athena-public.s3.amazonaws.com/dependencies/polyvox-master-2015-7-15.zip + URLS ${EXTERNAL_BUILD_ASSETS}/dependencies/polyvox-master-2015-7-15.zip SHA512 cc04cd43ae74b9c7bb065953540c0048053fcba6b52dc4218b3d9431fba178d65ad4f6c53cc1122ba61d0ab4061e99a7ebbb15db80011d607c5070ebebf8eddc FILENAME polyvox.zip ) diff --git a/cmake/ports/quazip/portfile.cmake b/cmake/ports/quazip/portfile.cmake index 7ff2d07173..0789062892 100644 --- a/cmake/ports/quazip/portfile.cmake +++ b/cmake/ports/quazip/portfile.cmake @@ -1,10 +1,11 @@ include(vcpkg_common_functions) file(READ "${VCPKG_ROOT_DIR}/_env/QT_CMAKE_PREFIX_PATH.txt" QT_CMAKE_PREFIX_PATH) +file(READ "${VCPKG_ROOT_DIR}/_env/EXTERNAL_BUILD_ASSETS.txt" EXTERNAL_BUILD_ASSETS) vcpkg_download_distfile( SOURCE_ARCHIVE - URLS https://athena-public.s3.amazonaws.com/dependencies/quazip-0.7.3.zip + URLS ${EXTERNAL_BUILD_ASSETS}/dependencies/quazip-0.7.3.zip SHA512 b2d812b6346317fd6d8f4f1344ad48b721d697c429acc8b7e7cb776ce5cba15a59efd64b2c5ae1f31b5a3c928014f084aa1379fd55d8a452a6cf4fd510b3afcc FILENAME quazip.zip ) diff --git a/cmake/ports/vhacd/portfile.cmake b/cmake/ports/vhacd/portfile.cmake index 3a13e461a6..4c74bb6532 100644 --- a/cmake/ports/vhacd/portfile.cmake +++ b/cmake/ports/vhacd/portfile.cmake @@ -1,10 +1,12 @@ include(vcpkg_common_functions) vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +file(READ "${VCPKG_ROOT_DIR}/_env/EXTERNAL_BUILD_ASSETS.txt" EXTERNAL_BUILD_ASSETS) + # else Linux desktop vcpkg_download_distfile( SOURCE_ARCHIVE - URLS https://athena-public.s3.amazonaws.com/dependencies/v-hacd-master.zip + URLS ${EXTERNAL_BUILD_ASSETS}/dependencies/v-hacd-master.zip SHA512 5d9bd4872ead9eb3574e4806d6c4f490353a04036fd5f571e1e44f47cb66b709e311abcd53af30bae0015a690152170aeed93209a626c28ebcfd6591f3bb036f FILENAME vhacd.zip ) @@ -35,4 +37,4 @@ if (WIN32) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/Debug/VHACD_LIB.lib ${CURRENT_PACKAGES_DIR}/debug/lib/VHACD.lib) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/Debug) endif() -endif() \ No newline at end of file +endif() From 35efa33b747e7628e2c6793e75e0c2d38e37fd4c Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 8 Apr 2020 17:47:13 +0200 Subject: [PATCH 11/30] - set the correct artifact filter - add missing JOB_NAME env --- .github/workflows/pr_build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index fba23772fe..715effb1f5 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -39,6 +39,7 @@ jobs: id: buildenv1 run: | echo ::set-env name=GIT_COMMIT_SHORT::`echo $GIT_COMMIT | cut -c1-7` + echo ::set-env name=JOB_NAME::build-${{matrix.os}} # Linux build variables if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then echo ::set-env name=PYTHON_EXEC::python3 @@ -110,11 +111,13 @@ jobs: working-directory: ${{runner.workspace}}/build env: GITHUB_CONTEXT: ${{ toJson(github) }} - ARTIFACT_PATTERN: HighFidelity-Beta-PR${{ github.event.number }}-*.exe + ARTIFACT_PATTERN: ProjectAthena-Alpha-PR${{ github.event.number }}-*.exe run: python "$GITHUB_WORKSPACE\tools\ci-scripts\upload_to_publish_server.py" build_full_linux: runs-on: ubuntu-latest + env: + JOB_NAME: build_full_linux if: github.event.action != 'labeled' || github.event.label.name == 'rebuild' steps: - uses: actions/checkout@v1 From 0ebe33b447bf0e8d71e97b7a04b2d1abd5362ed2 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Sat, 11 Apr 2020 17:58:54 +0200 Subject: [PATCH 12/30] change upload server --- tools/ci-scripts/upload_to_publish_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci-scripts/upload_to_publish_server.py b/tools/ci-scripts/upload_to_publish_server.py index 8b363f36aa..5e1a9b24f2 100644 --- a/tools/ci-scripts/upload_to_publish_server.py +++ b/tools/ci-scripts/upload_to_publish_server.py @@ -41,7 +41,7 @@ for archiveFile in files: file_contents.append(file_data) file.close() -conn = http.client.HTTPSConnection("athena-build-uploader.thoys.nl") +conn = http.client.HTTPSConnection("build-uploader.vircadia.com") context = json.loads(os.environ['GITHUB_CONTEXT']) From 403925ef0e5cb339bb231d901a13ae5b1ac39c2f Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 15 Apr 2020 11:05:44 +0200 Subject: [PATCH 13/30] add missing exceptions qt downloader --- hifi_qt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hifi_qt.py b/hifi_qt.py index b046342745..803c848f36 100644 --- a/hifi_qt.py +++ b/hifi_qt.py @@ -74,10 +74,10 @@ endif() self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.6-ubuntu-19.10.tar.xz' elif u_major > 18 and ( u_major != 19 and u_minor != 4): print("We don't support " + distro.name(pretty=True) + " yet. Perhaps consider helping us out?") - raise Exception('UNSUPPORTED LINUX VERSION!!!') + raise Exception('YET UNSUPPORTED VERSION OF LINUX DISTRO!!!') else: print("Sorry, " + distro.name(pretty=True) + " is old and won't be officially supported. Please consider upgrading."); - raise Exception('UNSUPPORTED LINUX VERSION!!!') + raise Exception('UNKNOWN LINUX DISTRO VERSION!!!') else: print("Sorry, " + distro.name(pretty=True) + " is not supported. Please consider helping us out.") print("It's also possible to build Qt for your distribution, please see the documentation at:") From ba62b06f2529e531a0cc65365c8f1e95593156df Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 15 Apr 2020 11:15:26 +0200 Subject: [PATCH 14/30] move comment to the code it belongs to --- prebuild.py | 1 + 1 file changed, 1 insertion(+) diff --git a/prebuild.py b/prebuild.py index d0bbc75fb7..cc315a49a4 100644 --- a/prebuild.py +++ b/prebuild.py @@ -149,6 +149,7 @@ def main(): if qtInstallPath != '': pm.writeVar('QT_CMAKE_PREFIX_PATH', qtInstallPath) + # Only allow one instance of the program to run at a time with hifi_singleton.Singleton(pm.lockFile) as lock: with timer('Bootstraping'): From e71a94cc3ef7b98a4de24071551dbbdad162c71e Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 15 Apr 2020 11:45:21 +0200 Subject: [PATCH 15/30] Build.md: Generating a release/debug only vcpkg build docs --- BUILD.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/BUILD.md b/BUILD.md index bc032d4ec7..1cad8724b3 100644 --- a/BUILD.md +++ b/BUILD.md @@ -73,6 +73,18 @@ Create a build directory in the root of your checkout and then run the CMake bui If cmake gives you the same error message repeatedly after the build fails, try removing `CMakeCache.txt`. +##### Generating a release/debug only vcpkg build + +In order to generate a release or debug only vcpkg package, you could use the use the `VCPKG_BUILD_TYPE` define in your cmake generate command. Building a release only vcpkg can drastically decrease the total build time. + +For release only vcpkg: + +`cmake .. -DVCPKG_BUILD_TYPE=release` + +For debug only vcpkg: + +`cmake .. -DVCPKG_BUILD_TYPE=debug` + #### Variables Any variables that need to be set for CMake to find dependencies can be set as ENV variables in your shell profile, or passed directly to CMake with a `-D` flag appended to the `cmake ..` command. From 1dd843c916abff18db5a208ca673a14d42bdf2f3 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Fri, 17 Apr 2020 15:23:20 +0200 Subject: [PATCH 16/30] set correct JOB_NAME in osx/windows GHA environment --- .github/workflows/pr_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 715effb1f5..dd373d0ad5 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -39,7 +39,7 @@ jobs: id: buildenv1 run: | echo ::set-env name=GIT_COMMIT_SHORT::`echo $GIT_COMMIT | cut -c1-7` - echo ::set-env name=JOB_NAME::build-${{matrix.os}} + echo ::set-env name=JOB_NAME::"build (${{matrix.os}}, ${{matrix.build_type}})" # Linux build variables if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then echo ::set-env name=PYTHON_EXEC::python3 From 3a4b312b534662776fa20b30c720f2a2f9e1dc06 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Fri, 17 Apr 2020 16:15:07 +0200 Subject: [PATCH 17/30] ubuntu github actions: use pip3 instead of python 2.7 version of pip --- .github/workflows/pr_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index dd373d0ad5..685966ee63 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -127,10 +127,10 @@ jobs: - name: Update apt repository index run: sudo apt update - name: Install apt packages - run: sudo apt install -y mesa-common-dev libegl1 libglvnd-dev libdouble-conversion1 libpulse0 + run: sudo apt install -y mesa-common-dev libegl1 libglvnd-dev libdouble-conversion1 libpulse0 python3-setuptools - name: Install python modules shell: bash - run: pip install boto3 distro PyGithub + run: pip3 install boto3 distro PyGithub - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build - name: Configure CMake From fd63e0ed4fb1fe7178fcc87160b256ae3ee44f86 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 22 Apr 2020 12:20:30 +0200 Subject: [PATCH 18/30] set linux github action to 16.04 to maintain backward compatibility --- .github/workflows/pr_build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 685966ee63..cd7c42ff80 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -9,7 +9,8 @@ env: BUILD_TYPE: Release CI_BUILD: Github GIT_COMMIT: ${{ github.sha }} - HIFI_VCPKG_BOOTSTRAP: true + # VCPKG did not build well on OSX disabling HIFI_VCPKG_BOOTSTRAP, which invokes a download to a working version of vcpkg + # HIFI_VCPKG_BOOTSTRAP: true RELEASE_TYPE: PR RELEASE_NUMBER: ${{ github.event.number }} VERSION_CODE: ${{ github.event.number }} @@ -115,7 +116,7 @@ jobs: run: python "$GITHUB_WORKSPACE\tools\ci-scripts\upload_to_publish_server.py" build_full_linux: - runs-on: ubuntu-latest + runs-on: ubuntu-16.04 env: JOB_NAME: build_full_linux if: github.event.action != 'labeled' || github.event.label.name == 'rebuild' From 5fa8571c0ba62d4e79450b815fdd4779a8253b3d Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 22 Apr 2020 19:14:18 +0200 Subject: [PATCH 19/30] shared seems to require linking with CoreFoundation and OpenGL on OSX --- libraries/shared/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/shared/CMakeLists.txt b/libraries/shared/CMakeLists.txt index eb3e286843..57904be586 100644 --- a/libraries/shared/CMakeLists.txt +++ b/libraries/shared/CMakeLists.txt @@ -13,6 +13,13 @@ if (ANDROID) target_link_libraries(${TARGET_NAME} android) endif() +if (APPLE) + find_library(FRAMEWORK_IOKIT IOKit) + find_library(CORE_FOUNDATION CoreFoundation) + find_library(OpenGL OpenGL) + target_link_libraries(${TARGET_NAME} ${FRAMEWORK_IOKIT} ${CORE_FOUNDATION} ${OpenGL}) +endif() + target_zlib() target_nsight() target_json() From b4362ea85ae04e4520d347c3438b0d073c570208 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 22 Apr 2020 22:59:01 +0200 Subject: [PATCH 20/30] move template functions to header --- .../src/graphics/BufferViewHelpers.cpp | 44 ---------------- .../graphics/src/graphics/BufferViewHelpers.h | 50 ++++++++++++++++++- 2 files changed, 48 insertions(+), 46 deletions(-) diff --git a/libraries/graphics/src/graphics/BufferViewHelpers.cpp b/libraries/graphics/src/graphics/BufferViewHelpers.cpp index 076cb92dcf..58ddbc9f58 100644 --- a/libraries/graphics/src/graphics/BufferViewHelpers.cpp +++ b/libraries/graphics/src/graphics/BufferViewHelpers.cpp @@ -120,50 +120,6 @@ template<> glm::uint32 forEach(const gpu::BufferView& view, std::func return forEachGlmVec(view, func); } -template -QVariant glmVecToVariant(const T& v, bool asArray /*= false*/) { - static const auto len = T().length(); - if (asArray) { - QVariantList list; - for (int i = 0; i < len ; i++) { - list << v[i]; - } - return list; - } else { - QVariantMap obj; - for (int i = 0; i < len ; i++) { - obj[XYZW[i]] = v[i]; - } - return obj; - } -} - -template -const T glmVecFromVariant(const QVariant& v) { - auto isMap = v.type() == (QVariant::Type)QMetaType::QVariantMap; - static const auto len = T().length(); - const auto& components = isMap ? XYZW : ZERO123; - T result; - QVariantMap map; - QVariantList list; - if (isMap) map = v.toMap(); else list = v.toList(); - for (int i = 0; i < len ; i++) { - float value; - if (isMap) { - value = map.value(components[i]).toFloat(); - } else { - value = list.value(i).toFloat(); - } -#ifdef DEBUG_BUFFERVIEW_HELPERS - if (value != value) { // NAN - qWarning().nospace()<< "vec" << len << "." << components[i] << " NAN received from script.... " << v.toString(); - } -#endif - result[i] = value; - } - return result; -} - // QVector => BufferView template gpu::BufferView newFromVector(const QVector& elements, const gpu::Element& elementType) { diff --git a/libraries/graphics/src/graphics/BufferViewHelpers.h b/libraries/graphics/src/graphics/BufferViewHelpers.h index 3635ef64e5..4c467b5175 100644 --- a/libraries/graphics/src/graphics/BufferViewHelpers.h +++ b/libraries/graphics/src/graphics/BufferViewHelpers.h @@ -27,8 +27,54 @@ namespace buffer_helpers { extern const std::array XYZW; extern const std::array ZERO123; - template QVariant glmVecToVariant(const T& v, bool asArray = false); - template const T glmVecFromVariant(const QVariant& v); + template + QVariant glmVecToVariant(const T& v, bool asArray = false) { + static const auto len = T().length(); + if (asArray) { + QVariantList list; + for (int i = 0; i < len; i++) { + list << v[i]; + } + return list; + } else { + QVariantMap obj; + for (int i = 0; i < len; i++) { + obj[XYZW[i]] = v[i]; + } + return obj; + } + } + + template + const T glmVecFromVariant(const QVariant& v) { + auto isMap = v.type() == (QVariant::Type)QMetaType::QVariantMap; + static const auto len = T().length(); + const auto& components = isMap ? XYZW : ZERO123; + T result; + QVariantMap map; + QVariantList list; + if (isMap) { + map = v.toMap(); + } else { + list = v.toList(); + } + for (int i = 0; i < len; i++) { + float value; + if (isMap) { + value = map.value(components[i]).toFloat(); + } else { + value = list.value(i).toFloat(); + } +#ifdef DEBUG_BUFFERVIEW_HELPERS + if (value != value) { // NAN + qWarning().nospace() << "vec" << len << "." << components[i] << " NAN received from script.... " << v.toString(); + } +#endif + result[i] = value; + } + return result; + } + glm::uint32 forEachVariant(const gpu::BufferView& view, std::function func, const char* hint = ""); template glm::uint32 forEach(const gpu::BufferView& view, std::function func); From c4a0fc30bbe8b57e66d3806d9bf026fe1dc01caa Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 22 Apr 2020 23:09:17 +0200 Subject: [PATCH 21/30] fix not matching declaration/definition argument name --- libraries/graphics/src/graphics/BufferViewHelpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/graphics/src/graphics/BufferViewHelpers.h b/libraries/graphics/src/graphics/BufferViewHelpers.h index 4c467b5175..c42bb0426d 100644 --- a/libraries/graphics/src/graphics/BufferViewHelpers.h +++ b/libraries/graphics/src/graphics/BufferViewHelpers.h @@ -82,7 +82,7 @@ namespace buffer_helpers { template gpu::BufferView newFromVector(const QVector& elements, const gpu::Element& elementType); template gpu::BufferView newFromVariantList(const QVariantList& list, const gpu::Element& elementType); - template QVector variantToVector(const QVariant& list); + template QVector variantToVector(const QVariant& value); template QVector bufferToVector(const gpu::BufferView& view, const char *hint = ""); // note: these do value conversions from the underlying buffer type into the template type From f186c9341a3c32bb02e95e6a8c30235e3d8391b7 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 22 Apr 2020 20:46:07 +0200 Subject: [PATCH 22/30] linux gha fix # Conflicts: # .github/workflows/pr_build.yml --- .github/workflows/pr_build.yml | 65 ++++++++++++++-------------------- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index cd7c42ff80..b28e237f96 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -29,8 +29,12 @@ jobs: build: strategy: matrix: - os: [windows-latest, macOS-latest] + os: [windows-latest, macOS-latest, ubuntu-18.04] build_type: [full] + include: + - os: ubuntu-18.04 + build_type: full + apt-dependencies: mesa-common-dev libegl1 libglvnd-dev libdouble-conversion1 libpulse0 fail-fast: false runs-on: ${{matrix.os}} if: github.event.action != 'labeled' || github.event.label.name == 'rebuild' @@ -41,10 +45,12 @@ jobs: run: | echo ::set-env name=GIT_COMMIT_SHORT::`echo $GIT_COMMIT | cut -c1-7` echo ::set-env name=JOB_NAME::"build (${{matrix.os}}, ${{matrix.build_type}})" + # Linux build variables - if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then + if [[ "${{ matrix.os }}" = "ubuntu-"* ]]; then echo ::set-env name=PYTHON_EXEC::python3 echo ::set-env name=INSTALLER_EXT::tgz + echo ::set-env name=CMAKE_BUILD_EXTRA::"-- -j3" fi # Mac build variables if [ "${{ matrix.os }}" = "macOS-latest" ]; then @@ -63,11 +69,11 @@ jobs: shell: bash run: | echo "${{ steps.buildenv1.outputs.symbols_archive }}" - echo ::set-env name=ARTIFACT_PATTERN::HighFidelity-Beta-*.$INSTALLER_EXT + echo ::set-env name=ARTIFACT_PATTERN::ProjectAthena-Alpha-PR${{ github.event.number }}-*.$INSTALLER_EXT # Build type variables echo ::set-env name=INSTALLER::HighFidelity-Beta-$RELEASE_NUMBER-$GIT_COMMIT_SHORT.$INSTALLER_EXT - name: Clear Working Directory - if: matrix.os[1] == 'windows' + if: startsWith(matrix.os, 'windows') shell: bash working-directory: ${{runner.workspace}} run: rm -rf ./* @@ -75,6 +81,18 @@ jobs: with: submodules: true fetch-depth: 1 + - name: Install dependencies + shell: bash + if: startsWith(matrix.os, 'ubuntu') + run: | + echo "Installing Python Modules:" + pip3 install distro || exit 1 + + echo "Updating apt repository index" + sudo apt update || exit 1 + + echo "Installing apt packages" + sudo apt install -y ${{ matrix.apt-dependencies }} || exit 1 - name: Create Build Environment shell: bash run: cmake -E make_directory "${{runner.workspace}}/build" @@ -85,23 +103,23 @@ jobs: - name: Build Application working-directory: ${{runner.workspace}}/build shell: bash - run: cmake --build . --config $BUILD_TYPE --target $APP_NAME + run: cmake --build . --config $BUILD_TYPE --target $APP_NAME $CMAKE_BUILD_EXTRA - name: Build Domain Server working-directory: ${{runner.workspace}}/build shell: bash - run: cmake --build . --config $BUILD_TYPE --target domain-server + run: cmake --build . --config $BUILD_TYPE --target domain-server $CMAKE_BUILD_EXTRA - name: Build Assignment Client working-directory: ${{runner.workspace}}/build shell: bash - run: cmake --build . --config $BUILD_TYPE --target assignment-client + run: cmake --build . --config $BUILD_TYPE --target assignment-client $CMAKE_BUILD_EXTRA - name: Build Console working-directory: ${{runner.workspace}}/build shell: bash - run: cmake --build . --config $BUILD_TYPE --target packaged-server-console + run: cmake --build . --config $BUILD_TYPE --target packaged-server-console $CMAKE_BUILD_EXTRA - name: Build Installer working-directory: ${{runner.workspace}}/build shell: bash - run: cmake --build . --config $BUILD_TYPE --target package + run: cmake --build . --config $BUILD_TYPE --target package $CMAKE_BUILD_EXTRA - name: Output Installer Logs if: failure() && matrix.os == 'windows-latest' shell: bash @@ -112,33 +130,4 @@ jobs: working-directory: ${{runner.workspace}}/build env: GITHUB_CONTEXT: ${{ toJson(github) }} - ARTIFACT_PATTERN: ProjectAthena-Alpha-PR${{ github.event.number }}-*.exe run: python "$GITHUB_WORKSPACE\tools\ci-scripts\upload_to_publish_server.py" - - build_full_linux: - runs-on: ubuntu-16.04 - env: - JOB_NAME: build_full_linux - if: github.event.action != 'labeled' || github.event.label.name == 'rebuild' - steps: - - uses: actions/checkout@v1 - with: - submodules: true - fetch-depth: 1 - - name: Update apt repository index - run: sudo apt update - - name: Install apt packages - run: sudo apt install -y mesa-common-dev libegl1 libglvnd-dev libdouble-conversion1 libpulse0 python3-setuptools - - name: Install python modules - shell: bash - run: pip3 install boto3 distro PyGithub - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - shell: bash - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_BUILD_TYPE=release -DBUILD_TOOLS:BOOLEAN=FALSE - - name: - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake --build . -- -j3 From ee8ee9c6118343eeb86bcc9ef91b49da3a3ceab5 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Thu, 23 Apr 2020 09:48:09 +0200 Subject: [PATCH 23/30] disable build tools --- .github/workflows/pr_build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index b28e237f96..05f049fae6 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -51,6 +51,7 @@ jobs: echo ::set-env name=PYTHON_EXEC::python3 echo ::set-env name=INSTALLER_EXT::tgz echo ::set-env name=CMAKE_BUILD_EXTRA::"-- -j3" + echo ::set-env name=CMAKE_EXTRA::"-DBUILD_TOOLS:BOOLEAN=FALSE" fi # Mac build variables if [ "${{ matrix.os }}" = "macOS-latest" ]; then From 5375c341a634d98ce63400166336a8d5e99c6e6c Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Thu, 23 Apr 2020 11:10:56 +0200 Subject: [PATCH 24/30] fix upload script path --- .github/workflows/pr_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 05f049fae6..0a854f687b 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -131,4 +131,4 @@ jobs: working-directory: ${{runner.workspace}}/build env: GITHUB_CONTEXT: ${{ toJson(github) }} - run: python "$GITHUB_WORKSPACE\tools\ci-scripts\upload_to_publish_server.py" + run: python "$GITHUB_WORKSPACE/tools/ci-scripts/upload_to_publish_server.py" From 3105b7f7c6601ee8f96dd785ea1fceb1e98fa11a Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Thu, 23 Apr 2020 12:24:45 +0200 Subject: [PATCH 25/30] use PYTHON_EXEC for upload script to select the correct version of python --- .github/workflows/pr_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 0a854f687b..43709d02cf 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -131,4 +131,4 @@ jobs: working-directory: ${{runner.workspace}}/build env: GITHUB_CONTEXT: ${{ toJson(github) }} - run: python "$GITHUB_WORKSPACE/tools/ci-scripts/upload_to_publish_server.py" + run: $PYTHON_EXEC "$GITHUB_WORKSPACE/tools/ci-scripts/upload_to_publish_server.py" From 44cc1c14b405e5bdda59a62aecbbed5f98b7be41 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Thu, 23 Apr 2020 14:00:23 +0200 Subject: [PATCH 26/30] get multiple linux artifacts to check them out --- .github/workflows/pr_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 43709d02cf..57d32741ca 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -49,7 +49,7 @@ jobs: # Linux build variables if [[ "${{ matrix.os }}" = "ubuntu-"* ]]; then echo ::set-env name=PYTHON_EXEC::python3 - echo ::set-env name=INSTALLER_EXT::tgz + echo ::set-env name=INSTALLER_EXT::* echo ::set-env name=CMAKE_BUILD_EXTRA::"-- -j3" echo ::set-env name=CMAKE_EXTRA::"-DBUILD_TOOLS:BOOLEAN=FALSE" fi From bbda0cc6d009ecf6d7576c33927186f8f5724ae6 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Mon, 27 Apr 2020 01:17:45 +0200 Subject: [PATCH 27/30] CR fixes --- hifi_qt.py | 2 +- hifi_vcpkg.py | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hifi_qt.py b/hifi_qt.py index 803c848f36..10708e4bc9 100644 --- a/hifi_qt.py +++ b/hifi_qt.py @@ -74,7 +74,7 @@ endif() self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.6-ubuntu-19.10.tar.xz' elif u_major > 18 and ( u_major != 19 and u_minor != 4): print("We don't support " + distro.name(pretty=True) + " yet. Perhaps consider helping us out?") - raise Exception('YET UNSUPPORTED VERSION OF LINUX DISTRO!!!') + raise Exception('LINUX DISTRO IS NOT SUPPORTED YET!!!') else: print("Sorry, " + distro.name(pretty=True) + " is old and won't be officially supported. Please consider upgrading."); raise Exception('UNKNOWN LINUX DISTRO VERSION!!!') diff --git a/hifi_vcpkg.py b/hifi_vcpkg.py index 4d347a289a..569bd49545 100644 --- a/hifi_vcpkg.py +++ b/hifi_vcpkg.py @@ -83,7 +83,9 @@ endif() self.bootstrapEnv = os.environ.copy() self.buildEnv = os.environ.copy() self.prebuiltArchive = None - usePrebuilt = ('CI_BUILD' in os.environ) and os.environ["CI_BUILD"] == "Github" and (not self.noClean) + usePrebuilt = False + # usePrebuild Disabled, to re-enabled using the prebuilt archives for GitHub action builds uncomment the following line: + # usePrebuilt = ('CI_BUILD' in os.environ) and os.environ["CI_BUILD"] == "Github" and (not self.noClean) if 'Windows' == system: self.exe = os.path.join(self.path, 'vcpkg.exe') @@ -91,8 +93,8 @@ endif() self.vcpkgUrl = self.assets_url + '/dependencies/vcpkg/builds/vcpkg-win32-client.zip%3FversionId=tSFzbw01VkkVFeRQ6YuAY4dro2HxJR9U' self.vcpkgHash = 'a650db47a63ccdc9904b68ddd16af74772e7e78170b513ea8de5a3b47d032751a3b73dcc7526d88bcb500753ea3dd9880639ca842bb176e2bddb1710f9a58cd3' self.hostTriplet = 'x64-windows' - #if usePrebuilt: - # self.prebuiltArchive = "https://ipfs.io/ipfs/QmcBggttJQb1vYeyz29FXfaxnJ5c1HfZW72xNQepnENude/vcpkg-win32-a2623c6a-release.zip" + if usePrebuilt: + self.prebuiltArchive = self.assets_url + "/dependencies/vcpkg/builds/vcpkg-win32.zip%3FversionId=3SF3mDC8dkQH1JP041m88xnYmWNzZflx" elif 'Darwin' == system: self.exe = os.path.join(self.path, 'vcpkg') self.bootstrapCmds = [ os.path.join(self.path, 'bootstrap-vcpkg.sh'), '--allowAppleClang', '-disableMetrics' ] @@ -101,8 +103,8 @@ endif() self.hostTriplet = 'x64-osx' # Potential fix for a vcpkg build issue on OSX (see https://github.com/microsoft/vcpkg/issues/9029) self.bootstrapEnv['CXXFLAGS'] = '-D_CTERMID_H_' - #if usePrebuilt: - # self.prebuiltArchive = self.assets_url + "/dependencies/vcpkg/builds/vcpkg-osx.tgz%3FversionId=6JrIMTdvpBF3MAsjA92BMkO79Psjzs6Z" + if usePrebuilt: + self.prebuiltArchive = self.assets_url + "/dependencies/vcpkg/builds/vcpkg-osx.tgz%3FversionId=6JrIMTdvpBF3MAsjA92BMkO79Psjzs6Z" else: self.exe = os.path.join(self.path, 'vcpkg') self.bootstrapCmds = [ os.path.join(self.path, 'bootstrap-vcpkg.sh'), '-disableMetrics' ] From 488cea43cdec8af1af255d78f057009f6cc39fe4 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Mon, 4 May 2020 11:28:35 +0200 Subject: [PATCH 28/30] disk usage github actions, for debugging linux build issue --- .github/workflows/pr_build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 57d32741ca..f5104dbe43 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -121,6 +121,13 @@ jobs: working-directory: ${{runner.workspace}}/build shell: bash run: cmake --build . --config $BUILD_TYPE --target package $CMAKE_BUILD_EXTRA + - name: Output system stats + if: ${{ always() }} + working-directory: ${{runner.workspace}}/build + shell: bash + run: | + echo "Disk usage:" + df -h - name: Output Installer Logs if: failure() && matrix.os == 'windows-latest' shell: bash From 748439f055bbfc46078903b56be97398d1e3d44a Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 6 May 2020 23:20:21 +0200 Subject: [PATCH 29/30] add retry command for packaging, since linux screenshare has about a 50% chance to fail a build --- .github/workflows/pr_build.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index f5104dbe43..4b3d66da50 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -120,7 +120,30 @@ jobs: - name: Build Installer working-directory: ${{runner.workspace}}/build shell: bash - run: cmake --build . --config $BUILD_TYPE --target package $CMAKE_BUILD_EXTRA + run: | + echo "Retry code from https://unix.stackexchange.com/a/137639" + function fail { + echo $1 >&2 + exit 1 + } + + function retry { + local n=1 + local max=5 + local delay=15 + while true; do + "$@" && break || { + if [[ $n -lt $max ]]; then + ((n++)) + echo "Command failed. Attempt $n/$max:" + sleep $delay; + else + fail "The command has failed after $n attempts." + fi + } + done + } + retry cmake --build . --config $BUILD_TYPE --target package $CMAKE_BUILD_EXTRA - name: Output system stats if: ${{ always() }} working-directory: ${{runner.workspace}}/build From b9d4791af2dc6b9de4624da61f3fe61a774cb95c Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Fri, 8 May 2020 00:55:43 +0200 Subject: [PATCH 30/30] fix CR style error --- hifi_vcpkg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hifi_vcpkg.py b/hifi_vcpkg.py index 569bd49545..1b9976da6e 100644 --- a/hifi_vcpkg.py +++ b/hifi_vcpkg.py @@ -83,7 +83,7 @@ endif() self.bootstrapEnv = os.environ.copy() self.buildEnv = os.environ.copy() self.prebuiltArchive = None - usePrebuilt = False + usePrebuilt = False # usePrebuild Disabled, to re-enabled using the prebuilt archives for GitHub action builds uncomment the following line: # usePrebuilt = ('CI_BUILD' in os.environ) and os.environ["CI_BUILD"] == "Github" and (not self.noClean) @@ -248,7 +248,7 @@ endif() print("Installing host tools") if (self.vcpkgBuildType): self.copyTripletForBuildType(self.hostTriplet) - self.run(['install', '--triplet', self.getTripletWithBuildType(self.hostTriplet), 'hifi-host-tools']) + self.run(['install', '--triplet', self.getTripletWithBuildType(self.hostTriplet), 'hifi-host-tools']) # If not android, install the hifi-client-deps libraries if not self.args.android: