Skip to content

Commit

Permalink
changes for multi OS code ql
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Apr 17, 2024
1 parent 79e1698 commit 9b079aa
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 2 deletions.
20 changes: 20 additions & 0 deletions .codeql-prebuild-cpp-Linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# install dependencies for C++ analysis
set -e

sudo apt-get update -y
sudo apt-get install -y \
build-essential \
mingw-w64-x86_64-cmake

# clean apt cache
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*

# build
mkdir -p build
cd build || exit 1
cmake -G "Unix Makefiles" ..
make -j"$(nproc)"

# skip autobuild
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"
21 changes: 21 additions & 0 deletions .codeql-prebuild-cpp-Windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# install dependencies for C++ analysis
set -e

# update pacman
pacman --noconfirm -Suy

# install dependencies
pacman --noconfirm -S \
base-devel \
cmake \
make \
mingw-w64-x86_64-toolchain

# build
mkdir -p build
cd build || exit 1
cmake -G "MinGW Makefiles" ..
mingw32-make -j"$(nproc)"

# skip autobuild
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"
15 changes: 15 additions & 0 deletions .codeql-prebuild-cpp-macOS.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# install dependencies for C++ analysis
set -e

# install dependencies
brew install \
cmake

# build
mkdir -p build
cd build || exit 1
cmake -G "Unix Makefiles" ..
make -j"$(sysctl -n hw.logicalcpu)"

# skip autobuild
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
update: true
install: >-
base-devel
cmake
make
mingw-w64-x86_64-binutils
mingw-w64-x86_64-cmake
Expand Down
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,25 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

# options
option(BUILD_TESTS "Build tests" ON)
option(CODE_QL_ANALYSIS "Build is for codeql analysis" OFF)

# auto-set CODE_QL_ANALYSIS based on env variable
if(DEFINED ENV{GITHUB_CODEQL_BUILD})
set(CODE_QL_ANALYSIS ON)
endif()

# if windows
if(WIN32)
include(${CMAKE_MODULE_PATH}/windows.cmake)
elseif(APPLE)
message(FATAL_ERROR "MacOS is not supported yet.")
if(NOT CODE_QL_ANALYSIS)
message(FATAL_ERROR "MacOS is not supported yet.")
endif()
# include(${CMAKE_MODULE_PATH}/macos.cmake)
else()
message(FATAL_ERROR "Linux is not supported yet.")
if(NOT CODE_QL_ANALYSIS)
message(FATAL_ERROR "Linux is not supported yet.")
endif()
# include(${CMAKE_MODULE_PATH}/linux.cmake)
endif()

Expand Down

0 comments on commit 9b079aa

Please sign in to comment.