Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Windows-Ubuntu vcpkg-CMake-build action #3

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on multiple platforms

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest, windows-latest]
triplet: [x64-linux, x64-windows]
build_type: [Debug, Release, RelWithDebInfo, MinSizeRel]
c_compiler: [gcc, clang, cl]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl

steps:
- uses: actions/checkout@v4

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "scripts-dir=${{ github.workspace }}/scripts" >> "$GITHUB_OUTPUT"

- name: Set up dependencies with custom script
run: |
chmod +x ${{ steps.strings.outputs.scripts-dir }}/vcpkg.sh
${{ steps.strings.outputs.scripts-dir }}/script.sh ${{ matrix.triplet } https ${{ github.workspace }}/vcpkg

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

# - name: Test
# working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# run: ctest --build-config ${{ matrix.build_type }}
77 changes: 1 addition & 76 deletions FetchDependencies.sh
Original file line number Diff line number Diff line change
@@ -1,77 +1,2 @@
if [ -z "$1" ]; then
echo "No triplet supplied, defaulting to x64-windows"
platform="x64-windows"
else
platform=$1
fi

if [ -z "$2" ]; then
echo "No clonemode supplied, defaulting to https"
clonemode="https"
else
clonemode=$2
fi

mkdir -p vcpkg
if [ "$clonemode" = "https" ]; then
git clone https://github.com/Microsoft/vcpkg.git
elif [ "$clonemode" = "ssh" ]; then
git clone git@github.com:microsoft/vcpkg.git
else
echo '\033[0;31mIncorrect clonemode! Expected https or ssh got something else!'
exit
fi

cd vcpkg
git pull
chmod +x bootstrap-vcpkg.sh
./bootstrap-vcpkg.sh
./vcpkg integrate install

echo "Installing AngelScript"
./vcpkg install angelscript[addons] --triplet $platform --recurse

echo "Installing argparse"
./vcpkg install argparse --triplet $platform

echo "Installing Assimp"
./vcpkg install assimp --triplet $platform

echo "Installing ImGui"
./vcpkg install imgui[core,docking-experimental,glfw-binding,opengl3-binding] --triplet $platform --recurse
./vcpkg install imguizmo --triplet $platform

echo "Installing EnTT"
./vcpkg install entt --triplet $platform

echo "Istalling Eventpp"
./vcpkg install eventpp --triplet $platform

echo "Installing GLEW"
./vcpkg install glew --triplet $platform

echo "Installing GLFW"
./vcpkg install glfw3 --triplet $platform

echo "Installing GLM"
./vcpkg install glm --triplet $platform

echo "Installing ICU"
./vcpkg install icu --triplet $platform

echo "Installing LunaSVG"
./vcpkg install lunasvg --triplet $platform

echo "Installing STB"
./vcpkg install stb --triplet $platform

echo "Installing TinyXML2"
./vcpkg install tinyxml2 --triplet $platform

echo "Installing ZeroMQ (cppzmp)"
./vcpkg install cppzmq --triplet $platform

./vcpkg upgrade

./vcpkg integrate install
./scripts/vcpkg.sh
read -rsp $'Press any key to continue...\n' -n1 key
83 changes: 83 additions & 0 deletions scripts/vcpkg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
if [ -z "$1" ]; then
echo "No triplet supplied, defaulting to x64-windows"
platform="x64-windows"
else
platform=$1
fi

if [ -z "$2" ]; then
echo "No clonemode supplied, defaulting to https"
clonemode="https"
else
clonemode=$2
fi

if [ -z "$3" ]; then
echo "No vcpkg path supplied, defaulting to ./vcpkg"
path="./vcpkg"
else
path=$3
fi

mkdir -p $path
cd $path
if [ "$clonemode" = "https" ]; then
git clone https://github.com/Microsoft/vcpkg.git .
elif [ "$clonemode" = "ssh" ]; then
git clone git@github.com:microsoft/vcpkg.git .
else
echo '\033[0;31mIncorrect clonemode! Expected https or ssh got something else!'
exit
fi

git pull
chmod +x bootstrap-vcpkg.sh
./bootstrap-vcpkg.sh
./vcpkg integrate install

echo "Installing AngelScript"
./vcpkg install angelscript[addons] --triplet $platform --recurse

echo "Installing argparse"
./vcpkg install argparse --triplet $platform

echo "Installing Assimp"
./vcpkg install assimp --triplet $platform

echo "Installing ImGui"
./vcpkg install imgui[core,docking-experimental,glfw-binding,sdl2-binding,opengl3-binding,vulkan-binding,dx11-binding,dx12-binding] --triplet $platform --recurse
./vcpkg install imguizmo --triplet $platform

echo "Installing EnTT"
./vcpkg install entt --triplet $platform

echo "Istalling Eventpp"
./vcpkg install eventpp --triplet $platform

echo "Installing GLEW"
./vcpkg install glew --triplet $platform

echo "Installing GLFW"
./vcpkg install glfw3 --triplet $platform

echo "Installing GLM"
./vcpkg install glm --triplet $platform

echo "Installing ICU"
./vcpkg install icu --triplet $platform

echo "Installing LunaSVG"
./vcpkg install lunasvg --triplet $platform

echo "Installing STB"
./vcpkg install stb --triplet $platform

echo "Installing TinyXML2"
./vcpkg install tinyxml2 --triplet $platform

echo "Installing ZeroMQ (cppzmp)"
./vcpkg install cppzmq --triplet $platform

./vcpkg upgrade

./vcpkg integrate install