From 024bd8f8b6118af697c62338c9583c31a983a1d2 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:12:40 -0400 Subject: [PATCH] ci(codeql): migrate builds to ninja (#3250) --- .codeql-prebuild-cpp-Windows.sh | 42 ++++++++++++++++----------------- .codeql-prebuild-cpp-macOS.sh | 26 ++++++++++++-------- docs/building.md | 8 ++++--- toolchain-mingw64.cmake | 19 --------------- 4 files changed, 41 insertions(+), 54 deletions(-) delete mode 100644 toolchain-mingw64.cmake diff --git a/.codeql-prebuild-cpp-Windows.sh b/.codeql-prebuild-cpp-Windows.sh index 04986c85..f4c7f54d 100644 --- a/.codeql-prebuild-cpp-Windows.sh +++ b/.codeql-prebuild-cpp-Windows.sh @@ -5,33 +5,31 @@ set -e pacman --noconfirm -Syu # install dependencies -pacman -S --noconfirm \ - base-devel \ - diffutils \ - gcc \ - git \ - make \ - mingw-w64-ucrt-x86_64-cmake \ - mingw-w64-ucrt-x86_64-cppwinrt \ - mingw-w64-ucrt-x86_64-curl-winssl \ - mingw-w64-ucrt-x86_64-graphviz \ - mingw-w64-ucrt-x86_64-miniupnpc \ - mingw-w64-ucrt-x86_64-nlohmann-json \ - mingw-w64-ucrt-x86_64-nodejs \ - mingw-w64-ucrt-x86_64-nsis \ - mingw-w64-ucrt-x86_64-onevpl \ - mingw-w64-ucrt-x86_64-openssl \ - mingw-w64-ucrt-x86_64-opus \ - mingw-w64-ucrt-x86_64-rust \ - mingw-w64-ucrt-x86_64-toolchain +dependencies=( + "git" + "mingw-w64-ucrt-x86_64-cmake" + "mingw-w64-ucrt-x86_64-cppwinrt" + "mingw-w64-ucrt-x86_64-curl-winssl" + "mingw-w64-ucrt-x86_64-miniupnpc" + "mingw-w64-ucrt-x86_64-nlohmann-json" + "mingw-w64-ucrt-x86_64-nodejs" + "mingw-w64-ucrt-x86_64-nsis" + "mingw-w64-ucrt-x86_64-onevpl" + "mingw-w64-ucrt-x86_64-openssl" + "mingw-w64-ucrt-x86_64-opus" + "mingw-w64-ucrt-x86_64-toolchain" +) +pacman -S --noconfirm "${dependencies[@]}" # build mkdir -p build -cd build || exit 1 cmake \ + -B build \ + -G Ninja \ + -S . \ -DBUILD_DOCS=OFF \ - -G "MinGW Makefiles" .. -mingw32-make -j"$(nproc)" + -DBUILD_WERROR=ON +ninja -C build # skip autobuild echo "skip_autobuild=true" >> "$GITHUB_OUTPUT" diff --git a/.codeql-prebuild-cpp-macOS.sh b/.codeql-prebuild-cpp-macOS.sh index 0a505136..7fbc090a 100644 --- a/.codeql-prebuild-cpp-macOS.sh +++ b/.codeql-prebuild-cpp-macOS.sh @@ -2,22 +2,28 @@ set -e # install dependencies -brew install \ - boost \ - cmake \ - miniupnpc \ - node \ - opus \ - pkg-config +dependencies=( + "boost" + "cmake" + "miniupnpc" + "ninja" + "node" + "openssl@3" + "opus" + "pkg-config" +) +brew install "${dependencies[@]}" # build mkdir -p build -cd build || exit 1 cmake \ + -B build \ + -G Ninja \ + -S . \ -DBOOST_USE_STATIC=OFF \ -DBUILD_DOCS=OFF \ - -G "Unix Makefiles" .. -make -j"$(sysctl -n hw.logicalcpu)" + -DBUILD_WERROR=ON +ninja -C build # skip autobuild echo "skip_autobuild=true" >> "$GITHUB_OUTPUT" diff --git a/docs/building.md b/docs/building.md index 83861943..851b21b1 100644 --- a/docs/building.md +++ b/docs/building.md @@ -34,12 +34,13 @@ dependencies=( "graphviz" # Optional, for docs "icu4c" # Optional, if boost is not installed "miniupnpc" + "ninja" "node" "openssl@3" "opus" "pkg-config" ) -brew install ${dependencies[@]} +brew install "${dependencies[@]}" ``` If there are issues with an SSL header that is not found: @@ -63,10 +64,11 @@ dependencies=( "graphviz" # Optional, for docs "libopus" "miniupnpc" + "ninja" "npm9" "pkgconfig" ) -sudo port install ${dependencies[@]} +sudo port install "${dependencies[@]}" ``` #### Windows @@ -97,7 +99,7 @@ dependencies=( "mingw-w64-ucrt-x86_64-opus" "mingw-w64-ucrt-x86_64-toolchain" ) -pacman -S ${dependencies[@]} +pacman -S "${dependencies[@]}" ``` ### Clone diff --git a/toolchain-mingw64.cmake b/toolchain-mingw64.cmake deleted file mode 100644 index a090f58f..00000000 --- a/toolchain-mingw64.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# the name of the target operating system -SET(CMAKE_SYSTEM_NAME Windows) - -# which compilers to use for C and C++ -SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) -SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) -SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) - -# here is the target environment located -SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) -#SET(CMAKE_SYSROOT ${CMAKE_FIND_ROOT_PATH}) -#SET(CMAKE_EXE_LINKER_FLAGS "-static ${CMAKE_EXE_LINKER_FLAGS}") - -# adjust the default behaviour of the FIND_XXX() commands: -# search headers and libraries in the target environment, search -# programs in the host environment -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)