This is an automated email from the ASF dual-hosted git repository. szaszm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit 47d530590cbeed23c2b6919ccf7cce94bab16f6c Author: Gabor Gyimesi <gamezb...@gmail.com> AuthorDate: Mon Jul 8 13:49:26 2024 +0200 MINIFICPP-2386 Add Jom support for building OpenSSL in parallel Closes #1799 Signed-off-by: Marton Szasz <sza...@apache.org> --- .github/workflows/ci.yml | 8 ++++++++ README.md | 1 + cmake/BundledOpenSSL.cmake | 18 ++++++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33d21da71..0e6760327 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -203,6 +203,14 @@ jobs: - name: Add sccache to path run: '[Environment]::SetEnvironmentVariable("PATH", [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::Machine) + ";" + (Split-Path -Path $env:SCCACHE_PATH -Parent), [EnvironmentVariableTarget]::Machine);' shell: powershell + - name: Install jom + run: | + Invoke-WebRequest -Uri "http://download.qt.io/official_releases/jom/jom_1_1_4.zip" -OutFile "jom.zip" + if ((Get-FileHash 'jom.zip').Hash -ne "d533c1ef49214229681e90196ed2094691e8c4a0a0bef0b2c901debcb562682b") {Write "Hash mismatch"; Exit 1} + New-Item -ItemType Directory -Path D:\jom + Expand-Archive -Path jom.zip -DestinationPath D:\jom + [Environment]::SetEnvironmentVariable("PATH", [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::Machine) + ";D:\jom", [EnvironmentVariableTarget]::Machine); + shell: powershell - name: build run: | python -m venv venv & venv\Scripts\activate & pip install -r requirements.txt & python main.py --noninteractive --skip-compiler-install --minifi-options="%WINDOWS_MINIFI_OPTIONS%" --cmake-options="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache" diff --git a/README.md b/README.md index d9f29958e..31a07cb1f 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ and rebuild. * libgps-dev -- Required if building libGPS support * perl -- Required for OpenSSL configuration * NASM -- Required for OpenSSL only on Windows +* jom (optional) -- for parallel build of OpenSSL on Windows **NOTE:** On Windows if Strawberry Perl is used the `${StrawberryPerlRoot}\c\bin` directory should not be part of the PATH environment variable as the patch executable in this directory interferes with git's patch executable. Alternatively [scoop](https://scoop.sh/) package manager can also be used to install Strawberry Perl using the command `scoop install perl` that does not pollute the PATH variable. Also on Windows CMake's CPack is used for MSI generation, building WIX files and call [...] diff --git a/cmake/BundledOpenSSL.cmake b/cmake/BundledOpenSSL.cmake index 7a429a9f5..d08c740eb 100644 --- a/cmake/BundledOpenSSL.cmake +++ b/cmake/BundledOpenSSL.cmake @@ -71,16 +71,30 @@ function(use_openssl SOURCE_DIR BINARY_DIR) # Note: when upgrading to a later release than 3.1.1 the --no-apps could be used instead of --no-tests to minimize the build size if (WIN32) + find_program(JOM_EXECUTABLE_PATH + NAMES jom.exe + PATHS ENV PATH + NO_DEFAULT_PATH) + if(JOM_EXECUTABLE_PATH) + include(ProcessorCount) + processorcount(jobs) + set(OPENSSL_BUILD_COMMAND ${JOM_EXECUTABLE_PATH} -j${jobs}) + set(OPENSSL_WINDOWS_COMPILE_FLAGS /FS) + else() + message("Using nmake for OpenSSL build") + set(OPENSSL_BUILD_COMMAND nmake) + set(OPENSSL_WINDOWS_COMPILE_FLAGS "") + endif() ExternalProject_Add( openssl-external URL https://github.com/openssl/openssl/releases/download/openssl-3.3.0/openssl-3.3.0.tar.gz URL_HASH "SHA256=53e66b043322a606abf0087e7699a0e033a37fa13feb9742df35c3a33b18fb02" SOURCE_DIR "${BINARY_DIR}/thirdparty/openssl-src" BUILD_IN_SOURCE true - CONFIGURE_COMMAND perl Configure "CFLAGS=${PASSTHROUGH_CMAKE_C_FLAGS}" "CXXFLAGS=${PASSTHROUGH_CMAKE_CXX_FLAGS}" ${OPENSSL_SHARED_FLAG} no-tests "--prefix=${OPENSSL_BIN_DIR}" "--openssldir=${OPENSSL_BIN_DIR}" + CONFIGURE_COMMAND perl Configure "CFLAGS=${PASSTHROUGH_CMAKE_C_FLAGS} ${OPENSSL_WINDOWS_COMPILE_FLAGS}" "CXXFLAGS=${PASSTHROUGH_CMAKE_CXX_FLAGS} ${OPENSSL_WINDOWS_COMPILE_FLAGS}" ${OPENSSL_SHARED_FLAG} no-tests "--prefix=${OPENSSL_BIN_DIR}" "--openssldir=${OPENSSL_BIN_DIR}" BUILD_BYPRODUCTS ${OPENSSL_LIBRARIES_LIST} EXCLUDE_FROM_ALL TRUE - BUILD_COMMAND nmake + BUILD_COMMAND ${OPENSSL_BUILD_COMMAND} INSTALL_COMMAND nmake install ) else()