Browse Source

Fix MacOS `hdiutil` CMake parallelization issue

* Make CMake builds better parallelized
* Update CI Build script parallelization
* Make `repeat_hdiutil.sh` take longer between repeats
* Make sure that bash is the latest version on CI builds.

Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
Reference-to: https://github.com/tenacityteam/tenacity/pull/391
pull/394/head
Emily Mabrey 11 months ago
committed by GitHub
parent
commit
e06af5bb29
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      CMAKE_OPTIONS.md
  2. 28
      CMakeLists.txt
  3. 9
      cmake-proxies/cmake-modules/AudacityInnoSetup.cmake
  4. 9
      lib-src/libsoxr/CMakeLists.txt
  5. 1
      lib-src/libsoxr/tests/CMakeLists.txt
  6. 2
      lib-src/portaudio-v19/CMakeLists.txt
  7. 8
      scripts/ci/build.sh
  8. 5
      scripts/ci/dependencies.sh
  9. 2
      scripts/ci/macos/repeat_hdiutil.sh
  10. 4
      src/CMakeLists.txt

8
CMAKE_OPTIONS.md

@ -1,7 +1,7 @@
| Name | Type | Default | Description |
| :-------------------------------- | :----- | :--------- | :-------------------------------------------------------------- |
| CMAKE_BUILD_TYPE | STRING | Debug | Type of the build: Debug, Release, RelWithDebInfo, MinSizeRel |
| CMAKE_INSTALL_PREFIX | PATH | /usr/local | Install path prefix, prepended onto install directories. |
| Name | Type | Default | Description |
| :------------------------| :----- | :--------- | :-------------------------------------------------------------- |
| CMAKE_BUILD_TYPE | STRING | Debug | Type of the build: Debug, Release, RelWithDebInfo, MinSizeRel |
| CMAKE_INSTALL_PREFIX | PATH | /usr/local | Install path prefix, prepended onto install directories. |
| lib_preference | STRING | local | Library preference [system (if available), local] |
| obey_system_dependencies | BOOL | Off | Use only system packages to satisfy dependencies |
| use_expat | STRING | system | Use expat library [system (if available), local, off] |

28
CMakeLists.txt

@ -172,6 +172,25 @@ include( CMakeDetermineASM_NASMCompiler )
include( CMakePushCheckState )
include( GNUInstallDirs )
include( TestBigEndian )
include( ProcessorCount )
# Determine total number of processors to enable us to only use total_available - 1 processors
# This helps prevent slow down of the other applications during the build process
ProcessorCount( CMAKE_BUILD_CPU_COUNT )
if( CMAKE_BUILD_CPU_COUNT GREATER 0 )
math( EXPR CMAKE_BUILD_CPU_COUNT "${CMAKE_BUILD_CPU_COUNT} - 2" OUTPUT_FORMAT DECIMAL )
endif()
if( CMAKE_BUILD_CPU_COUNT LESS_EQUAL 0 )
message( WARNING "Unable to optimize build CPU usage, defaulting to use all processors" )
set( CMAKE_BUILD_CPU_COUNT 0 )
elseif(NOT DEFINED CMAKE_BUILD_PARALLEL_LEVEL )
message( STATUS "Build automatically optimized to use processor count: ${CMAKE_BUILD_CPU_COUNT}" )
set( CMAKE_BUILD_PARALLEL_LEVEL ${CMAKE_BUILD_CPU_COUNT} )
#else()
# message( STATUS "Using CMAKE_BUILD_PARALLEL_LEVEL value to configure processor count: ${CMAKE_BUILD_PARALLEL_LEVEL}")
# set ( CMAKE_BUILD_CPU_COUNT ${CMAKE_BUILD_PARALLEL_LEVEL} )
endif()
# Determine 32-bit or 64-bit target
if( CMAKE_C_COMPILER_ID MATCHES "MSVC" AND CMAKE_VS_PLATFORM_NAME MATCHES "Win64|x64" )
@ -252,8 +271,13 @@ if( CMAKE_GENERATOR MATCHES "Visual Studio" )
# Build using multiple processors
foreach( config ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER "${config}" config )
string( APPEND CMAKE_C_FLAGS_${config} " /MP" )
string( APPEND CMAKE_CXX_FLAGS_${config} " /MP" )
if( NOT CMAKE_BUILD_CPU_COUNT EQUAL 0 )
string( APPEND CMAKE_C_FLAGS_${config} " /MP${CMAKE_BUILD_CPU_COUNT}" )
string( APPEND CMAKE_CXX_FLAGS_${config} " /MP${CMAKE_BUILD_CPU_COUNT}" )
else()
string( APPEND CMAKE_C_FLAGS_${config} " /MP" )
string( APPEND CMAKE_CXX_FLAGS_${config} " /MP" )
endif()
endforeach()
# Define system library information, but we'll do the install

9
cmake-proxies/cmake-modules/AudacityInnoSetup.cmake

@ -2,10 +2,10 @@
# The target will be only generated if InnoSetup 6 is installed.
find_program(
INNO_SETUP_COMPILER
INNO_SETUP_COMPILER
NAMES iscc ISCC
HINTS
"C:/Program Files (x86)/Inno Setup 6"
HINTS
"C:/Program Files (x86)/Inno Setup 6"
"C:/Program Files/Inno Setup 6"
)
@ -27,7 +27,8 @@ if( INNO_SETUP_COMPILER )
-DSIGN=${${_OPT}perform_codesign}
-DWINDOWS_CERTIFICATE=${WINDOWS_CERTIFICATE}
-D WINDOWS_CERTIFICATE_PASSWORD=${WINDOWS_CERTIFICATE_PASSWORD}
-P "${CMAKE_SOURCE_DIR}/win/Inno_Setup_Wizard/BuildInnoSetupInstaller.cmake"
-P "${CMAKE_SOURCE_DIR}/win/Inno_Setup_Wizard/BuildInnoSetupInstaller.cmake"
-parallel ${CMAKE_BUILD_PARALLEL_LEVEL}
VERBATIM
)

9
lib-src/libsoxr/CMakeLists.txt

@ -317,8 +317,13 @@ configure_file (
"${CMAKE_CURRENT_BINARY_DIR}/deinstall.cmake"
IMMEDIATE @ONLY)
add_custom_target (deinstall
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/deinstall.cmake")
add_custom_target (
deinstall
COMMAND
${CMAKE_COMMAND}
-P "${CMAKE_CURRENT_BINARY_DIR}/deinstall.cmake"
-parallel ${CMAKE_BUILD_PARALLEL_LEVEL}
)

1
lib-src/libsoxr/tests/CMakeLists.txt

@ -32,6 +32,7 @@ macro (add_cmp_test irate orate bits)
add_test (NAME ${name} COMMAND ${CMAKE_COMMAND} -Dbits=${bits} -DBIN=${BIN}
-DEXAMPLES_BIN=${EXAMPLES_BIN} -DlenToSkip=${leader} -Dorate=${orate}
-Dirate=${irate} -Dlen=${len} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmp-test.cmake)
-parallel ${CMAKE_BUILD_PARALLEL_LEVEL}
add_vector (${irate})
add_vector (${orate})
endmacro ()

2
lib-src/portaudio-v19/CMakeLists.txt

@ -462,7 +462,7 @@ IF(NOT PA_OUTPUT_OSX_FRAMEWORK AND NOT PA_DISABLE_INSTALL)
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) -parallel ${CMAKE_BUILD_PARALLEL_LEVEL}
ENDIF()
ENDIF()

8
scripts/ci/build.sh

@ -18,8 +18,12 @@ else # Linux & others
fi
export CMAKE_BUILD_PARALLEL_LEVEL=$(( ${cpus} > 2 ? $((${cpus} - 2)) : ${cpus} ))
echo "Using ${CMAKE_BUILD_PARALLEL_LEVEL} processors for cmake build"
# Build Audacity
cmake --build build -j "${cpus}" --config "${AUDACITY_BUILD_TYPE}"
cmake --build build --config "${AUDACITY_BUILD_TYPE}"
BIN_OUTPUT_DIR=build/bin/${AUDACITY_BUILD_TYPE}
SYMBOLS_OUTPUT_DIR=debug
@ -29,7 +33,7 @@ mkdir ${SYMBOLS_OUTPUT_DIR}
if [[ "${OSTYPE}" == msys* ]]; then # Windows
# copy PDBs to debug folder...
find ${BIN_OUTPUT_DIR} -name '*.pdb' | xargs -I % cp % ${SYMBOLS_OUTPUT_DIR}
# and remove debug symbol files from the file tree before archieving
# and remove debug symbol files from the file tree before archiving
find ${BIN_OUTPUT_DIR} -name '*.iobj' -o -name '*.ipdb' -o -name '*.pdb' -o -name '*.ilk' | xargs rm -f
elif [[ "${OSTYPE}" == darwin* ]]; then # macOS
find ${BIN_OUTPUT_DIR} -name '*.dSYM' | xargs -J % mv % ${SYMBOLS_OUTPUT_DIR}

5
scripts/ci/dependencies.sh

@ -10,7 +10,7 @@ if [[ "${OSTYPE}" == msys* ]]; then # Windows
# Chocolatey packages
choco_packages=(
sccache
sccache
conan
)
@ -44,6 +44,7 @@ else # Linux & others
g++
git
wget
bash
# GitHub Actions
libasound2-dev
@ -53,7 +54,7 @@ else # Linux & others
)
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends "${apt_packages[@]}"
# Download Conan from github
wget "https://github.com/conan-io/conan/releases/latest/download/conan-ubuntu-64.deb" -nv -O /tmp/conan.deb
sudo dpkg -i /tmp/conan.deb

2
scripts/ci/macos/repeat_hdiutil.sh

@ -6,7 +6,7 @@ set -uo pipefail
max_retry=5
counter=0
num_secs_await_retry=1
num_secs_await_retry=5
echo "Trying: " /usr/bin/hdiutil "$@"

4
src/CMakeLists.txt

@ -1145,6 +1145,8 @@ if( CMAKE_SYSTEM_NAME MATCHES "Windows" )
-D DST="${_EXEDIR}"
-D WXWIN="${_SHARED_PROXY_BASE_PATH}/$<CONFIG>/"
-P ${AUDACITY_MODULE_PATH}/CopyLibs.cmake
-parallel ${CMAKE_BUILD_PARALLEL_LEVEL}
POST_BUILD
)
@ -1234,6 +1236,7 @@ elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
-D DST="${_PKGLIB}"
-D WXWIN="${_SHARED_PROXY_BASE_PATH}/$<CONFIG>"
-P ${AUDACITY_MODULE_PATH}/CopyLibs.cmake
-parallel ${CMAKE_BUILD_PARALLEL_LEVEL}
POST_BUILD
)
@ -1303,6 +1306,7 @@ else()
-D DST="${_DEST}/${_PKGLIB}"
-D WXWIN="${_SHARED_PROXY_BASE_PATH}/$<CONFIG>"
-P ${AUDACITY_MODULE_PATH}/CopyLibs.cmake
-parallel ${CMAKE_BUILD_PARALLEL_LEVEL}
POST_BUILD
)
endif()

Loading…
Cancel
Save