Skip to content

Commit

Permalink
Build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtansia committed Apr 23, 2024
1 parent 49e04b9 commit 8b2e37c
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build

on: [pull_request, push]

jobs:
build:
strategy:
fail-fast: false
matrix:
build_type: [ Release ]

include:
- os: ubuntu
cc: gcc
cxx: g++

- os: ubuntu
cc: clang
cxx: clang++

- os: macos

- os: windows

runs-on: ${{matrix.os}}-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Configure CC & CXX
if: matrix.cc != '' && matrix.cxx != ''
run: echo "CC=${{matrix.cc}}" >> $GITHUB_ENV && echo "CXX=${{matrix.cxx}}" >> $GITHUB_ENV

- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_CXX_FLAGS="-Werror"
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ build/
build-debug/
build-release/
build-relwithdebinfo/
cmake-build-*/

.idea/
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.5)
project(bin2s)

if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wpedantic -Werror")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wpedantic")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG")

if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXECUTABLE_LINKER_FLAGS "${CMAKE_EXECUTABLE_LINKER_FLAGS} -stdlib=libc++")
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/bin2s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ result bin2s(const std::string &identifier, std::istream &input,

auto cur_pos = input.tellg();
input.seekg(0, std::ios::end);
auto size = input.tellg() - cur_pos;
std::streamsize size = input.tellg() - cur_pos;
input.seekg(cur_pos);

if (size == 0) return result::empty_stream;
Expand Down

0 comments on commit 8b2e37c

Please sign in to comment.