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

CI for Linux, MinGW and macOS #47

Merged
merged 8 commits into from
Jul 5, 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
9 changes: 6 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ skip_branch_with_pr: true
only_commits:
files:
- .appveyor.yml
- example1/
- example2/
- example3/
# The rest of this list should stay in sync with azure-pipelines.yml
- crunch/
- crnlib/
- example1/
- example2/
- example3/
- inc/
- test/
- cmake/
- CMakeLists.txt

Expand Down Expand Up @@ -52,3 +53,5 @@ build_script:
-DBUILD_CRUNCH=ON -DBUILD_SHARED_LIBCRN=ON -DBUILD_EXAMPLES=ON

cmake --build build --config Release

python test\test.py
127 changes: 127 additions & 0 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Documentation: https://wiki.unvanquished.net/wiki/Continuous_integration

trigger:
branches:
include:
- master

pr:
branches:
include:
- '*'
paths:
include:
- .azure-pipelines.yml
# The rest of this list should stay in sync with .appveyor.yml
- crunch/
- crnlib/
- inc/
- example1/
- example2/
- example3/
- test/
- cmake/
- CMakeLists.txt

strategy:
matrix:
Linux amd64 GCC:
VM_IMAGE: 'ubuntu-20.04'
APT_PACKAGES: ninja-build g++-8
CXX_COMPILER: g++-8
RUN_TESTS: true
Linux i686 GCC:
VM_IMAGE: 'ubuntu-20.04'
APT_PACKAGES: ninja-build g++-i686-linux-gnu
CXX_COMPILER: i686-linux-gnu-g++
RUN_TESTS: true
Linux arm64 GCC:
VM_IMAGE: 'ubuntu-20.04'
APT_PACKAGES: ninja-build g++-aarch64-linux-gnu
CXX_COMPILER: aarch64-linux-gnu-g++
Linux armhf GCC:
VM_IMAGE: 'ubuntu-20.04'
APT_PACKAGES: ninja-build g++-arm-linux-gnueabihf
CXX_COMPILER: arm-linux-gnueabihf-g++
Linux amd64 Clang:
VM_IMAGE: 'ubuntu-20.04'
APT_PACKAGES: ninja-build
CXX_COMPILER: clang++
RUN_TESTS: true
Windows amd64 MinGW:
VM_IMAGE: 'ubuntu-20.04'
APT_PACKAGES: ninja-build g++-mingw-w64-x86-64 mingw-w64-x86-64-dev
SETUP_COMMANDS: sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
TOOLCHAIN_FILE: cmake/cross-toolchain-mingw64.cmake
BUILD_EXAMPLES: ON
EXE_EXTENSIONS: .exe
Windows i686 MinGW:
VM_IMAGE: 'ubuntu-20.04'
APT_PACKAGES: ninja-build g++-mingw-w64-i686 mingw-w64-i686-dev
SETUP_COMMANDS: sudo update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
TOOLCHAIN_FILE: cmake/cross-toolchain-mingw32.cmake
BUILD_EXAMPLES: ON
EXE_EXTENSIONS: .exe
macOS amd64 AppleClang:
VM_IMAGE: 'macOS-12'
CMAKE_GENERATOR: Unix Makefiles
NPROC_COMMAND: sysctl -n hw.logicalcpu
RUN_TESTS: true
macOS arm64 AppleClang:
VM_IMAGE: 'macOS-12'
CMAKE_GENERATOR: Unix Makefiles
COMPILER_FLAGS: -target arm64-apple-macos11 -Wno-overriding-t-option
NPROC_COMMAND: sysctl -n hw.logicalcpu
Web Asm.js Emscripten:
VM_IMAGE: 'ubuntu-22.04'
APT_PACKAGES: ninja-build emscripten
TOOLCHAIN_FILE: /usr/share/emscripten/cmake/Modules/Platform/Emscripten.cmake
SOURCE_DIR: emscripten
EXE_EXTENSIONS: .js .wasm

pool:
vmImage: $(VM_IMAGE)

steps:
- bash: |
set -xue
if [ -n "${APT_PACKAGES:-}" ]; then
sudo apt-get update && sudo apt-get -y -q --no-install-recommends install ${APT_PACKAGES}
fi
if [ -n "${SETUP_COMMANDS:-}" ]; then
$(SETUP_COMMANDS)
fi
displayName: 'Setup'
- bash: |
set -xue
export CMAKE_BUILD_PARALLEL_LEVEL="$(${NPROC_COMMAND:-nproc})"
echo "${CMAKE_BUILD_PARALLEL_LEVEL}"
cmake_args=(-G"${CMAKE_GENERATOR:-Ninja}")
if [ -n "${TOOLCHAIN_FILE:-}" ]; then
cmake_args+=(-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}")
fi
if [ -n "${CXX_COMPILER:-}" ]; then
cmake_args+=(-DCMAKE_CXX_COMPILER="${CXX_COMPILER}")
fi
if [ -n "${COMPILER_FLAGS:-}" ]; then
cmake_args+=(-DCMAKE_CXX_FLAGS="${COMPILER_FLAGS}")
fi
if [ -z "${SOURCE_DIR:-}" ]; then
cmake_args+=(-DBUILD_CRUNCH=ON -DBUILD_SHARED_LIBCRN=ON -DBUILD_EXAMPLES="${BUILD_EXAMPLES:-OFF}")
fi
cmake -S"${SOURCE_DIR:-.}" -Bbuild "${cmake_args[@]}"
cmake --build build --config Release
displayName: 'Build'
- bash: |
set -xue
if [ -z "${EXE_EXTENSIONS:-}" ]; then
file 'build/crunch'
else
for ext in ${EXE_EXTENSIONS}; do
file "build/crunch${ext}"
done
fi
if "${RUN_TESTS:-false}"; then
test/test.py
fi
displayName: 'Test'
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*.o
*.js
*.wasm
*.2010.vcxproj.user
*.2010.suo
/crnlib/crunch
Expand All @@ -15,4 +17,4 @@
/lib
/bin/*
!bin/crunch_x64.exe
/build
build*
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.5)

set(CMAKE_CXX_STANDARD 11)

set(CRUNCH_PROJECT_NAME crunch)
set(CRUNCH_LIBRARY_NAME crn)
set(CRUNCH_EXE_NAME crunch)

project(${CRUNCH_PROJECT_NAME})
project(${CRUNCH_PROJECT_NAME} LANGUAGES CXX)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})

Expand Down Expand Up @@ -66,7 +66,7 @@ option(BUILD_EXAMPLES "Build examples" OFF)
# Enable extra optimization flags, like using -O3 even in RelWithDebInfo build.
option(USE_EXTRA_OPTIMIZATION "Enable extra optimization" ON)
# Enable link time optimization, slows down the build but produce faster and smaller binaries.
option(USE_LTO "Enable link-time optimization" ON)
option(USE_LTO "Enable link-time optimization" OFF)
# Enabling fast math makes generated images less likely to be reproducible.
# See https://github.com/DaemonEngine/crunch/issues/29
option(USE_FAST_MATH "Enable fast math (generated images are less likely to be reproducible)" ON)
Expand Down
Loading