Skip to content
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
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI

on: [push, pull_request]

env:
CTEST_OUTPUT_ON_FAILURE: 1

jobs:
ubuntu-ninja-clang:
name: Ubuntu (ninja, clang)
runs-on: ubuntu-22.04
steps:
- name: Prepare
run: |
sudo apt update
sudo apt install ninja-build
- uses: actions/checkout@v3
- name: Build and run tests
env:
CC: clang
CXX: clang++
run: |
scripts/test.sh

ubuntu-make-gcc:
name: Ubuntu (make, gcc)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Build and run tests
env:
CC: gcc
CXX: g++
run: |
scripts/initbuild.sh make
scripts/test.sh

macos:
name: macOS
runs-on: macos-12
steps:
- name: Prepare
run: |
brew install cmake ninja
- uses: actions/checkout@v3
- name: Build and run tests
run: |
scripts/test.sh

windows:
name: Windows
runs-on: windows-2022
steps:
- uses: microsoft/setup-msbuild@v1.1
- uses: actions/checkout@v3
- name: Build and run tests
run: |
cmake .
msbuild FlatCC.sln /m /property:Configuration=Release
ctest -VV
188 changes: 188 additions & 0 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
name: Weekly

on:
workflow_dispatch:
schedule:
- cron: '0 10 * * 1' # Mon 10.00 UTC

env:
CTEST_OUTPUT_ON_FAILURE: 1

jobs:
clang:
name: Clang ${{ matrix.clang-version }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
clang-version: [5, 7, 9, 11, 13, 15]
steps:
- name: Setup Clang
uses: aminya/setup-cpp@v1
with:
llvm: ${{ matrix.clang-version }}
- uses: actions/checkout@v3
- name: Build and run tests
run: |
scripts/initbuild.sh make-concurrent
scripts/test.sh

clang-32bit:
name: Clang 32bit
runs-on: ubuntu-20.04
steps:
- name: Prepare
run: |
sudo apt update
sudo apt install gcc-multilib g++-multilib
- uses: actions/checkout@v3
- name: Build and run tests
env:
CC: clang
CXX: clang++
run: |
scripts/initbuild.sh make-32bit
scripts/test.sh

gcc-old:
name: GCC 4.4
runs-on: ubuntu-20.04
steps:
- name: Setup GCC
run: |
wget http://launchpadlibrarian.net/336269522/libmpfr4_3.1.6-1_amd64.deb
wget http://old-releases.ubuntu.com/ubuntu/pool/universe/g/gcc-4.4/gcc-4.4-base_4.4.7-8ubuntu1_amd64.deb
wget http://old-releases.ubuntu.com/ubuntu/pool/universe/g/gcc-4.4/cpp-4.4_4.4.7-8ubuntu1_amd64.deb
wget http://old-releases.ubuntu.com/ubuntu/pool/universe/g/gcc-4.4/gcc-4.4_4.4.7-8ubuntu1_amd64.deb
wget http://old-releases.ubuntu.com/ubuntu/pool/universe/g/gcc-4.4/libstdc++6-4.4-dev_4.4.7-8ubuntu1_amd64.deb
wget http://old-releases.ubuntu.com/ubuntu/pool/universe/g/gcc-4.4/g++-4.4_4.4.7-8ubuntu1_amd64.deb
sudo dpkg -i ./libmpfr4_3.1.6-1_amd64.deb
sudo dpkg -i ./gcc-4.4-base_4.4.7-8ubuntu1_amd64.deb
sudo dpkg -i ./cpp-4.4_4.4.7-8ubuntu1_amd64.deb
sudo dpkg -i ./gcc-4.4_4.4.7-8ubuntu1_amd64.deb
sudo dpkg -i ./libstdc++6-4.4-dev_4.4.7-8ubuntu1_amd64.deb ./g++-4.4_4.4.7-8ubuntu1_amd64.deb
- uses: actions/checkout@v3
- name: Build and run tests
env:
CC: gcc-4.4
CXX: g++-4.4
run: |
scripts/initbuild.sh make-concurrent
scripts/test.sh

gcc:
name: GCC ${{ matrix.gcc-version }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
gcc-version: [7, 9, 11]
steps:
- name: Setup GCC
uses: aminya/setup-cpp@v1
with:
gcc: ${{ matrix.gcc-version }}
- uses: actions/checkout@v3
- name: Build and run tests
run: |
scripts/initbuild.sh make-concurrent
scripts/test.sh

gcc-32bit:
name: GCC 32bit
runs-on: ubuntu-20.04
steps:
- name: Prepare
run: |
sudo apt update
sudo apt install gcc-multilib g++-multilib
- uses: actions/checkout@v3
- name: Build and run tests
run: |
scripts/initbuild.sh make-32bit
scripts/test.sh

intel:
name: Intel ${{ matrix.compiler }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
compiler: [icc, icx]
steps:
- name: Prepare
run: |
wget -qO - https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | sudo apt-key add -
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt update
sudo apt install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2021.4.0
- name: Setup Intel oneAPI
run: |
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Build and run tests
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compiler }}
run: |
scripts/initbuild.sh make-concurrent
scripts/test.sh

macos-clang:
name: macOS Clang
runs-on: macos-11
steps:
- uses: actions/checkout@v3
- name: Build and run tests
run: |
scripts/initbuild.sh make-concurrent
scripts/test.sh

macos-gcc:
name: macOS GCC ${{ matrix.gcc-version }}
runs-on: macos-11
strategy:
fail-fast: false
matrix:
gcc-version: [9, 12]
steps:
- uses: actions/checkout@v3
- name: Build and run tests
env:
CC: gcc-${{ matrix.gcc-version }}
CXX: g++-${{ matrix.gcc-version }}
run: |
scripts/initbuild.sh make-concurrent
scripts/test.sh

windows:
name: Windows Visual Studio ${{ matrix.version }}
runs-on: windows-${{ matrix.version }}
strategy:
fail-fast: false
matrix:
version: [2019, 2022]
steps:
- uses: microsoft/setup-msbuild@v1.1
- uses: actions/checkout@v3
- name: Build and run tests
run: |
cmake .
msbuild FlatCC.sln /m /property:Configuration=Release
ctest -VV

cmake-minimum-required:
name: CMake 2.8.12 (min. required)
runs-on: ubuntu-20.04
steps:
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1
with:
cmake-version: 2.8.12
- uses: actions/checkout@v3
- name: Build and run tests
run: |
cmake --version
scripts/initbuild.sh make-concurrent
scripts/test.sh
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Ubuntu 14.04 (Trusty)
#cmake_minimum_required (VERSION 2.8.12.2)
cmake_minimum_required (VERSION 2.8.12.2)
# Centos 7
#cmake_minimum_required (VERSION 2.8.11)
cmake_minimum_required (VERSION 2.8)
#cmake_minimum_required (VERSION 2.8)

# Experimental for generating compile_commands.json so editors with
# clangd language server support can use it. Symlink
Expand Down Expand Up @@ -188,6 +188,10 @@ if (CMAKE_C_COMPILER_ID MATCHES "Clang")
if (FLATCC_IGNORE_CONST_COND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-tautological-constant-out-of-range-compare")
endif()
# Suppress warning relaxed in clang-6, see https://reviews.llvm.org/D28148
if (CMAKE_C_COMPILER_VERSION VERSION_LESS 6)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-field-initializers")
endif()

# To get assembly output
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -save-temps")
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
OS-X & Ubuntu: [![Build Status](https://travis-ci.org/dvidelabs/flatcc.svg?branch=master)](https://travis-ci.org/dvidelabs/flatcc)
Ubuntu, macOS and Windows: [![Build Status](https://github.com/dvidelabs/flatcc/actions/workflows/ci.yml/badge.svg)](https://github.com/dvidelabs/flatcc/actions/workflows/ci.yml)
Windows: [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/dvidelabs/flatcc?branch=master&svg=true)](https://ci.appveyor.com/project/dvidelabs/flatcc)
Weekly: [![Build Status](https://github.com/dvidelabs/flatcc/actions/workflows/weekly.yml/badge.svg)](https://github.com/dvidelabs/flatcc/actions/workflows/weekly.yml)


_The JSON parser may change the interface for parsing union vectors in a
Expand Down Expand Up @@ -2226,8 +2227,15 @@ Optionally switch to a different build tool by choosing one of:
scripts/initbuild.sh make-concurrent
scripts/initbuild.sh ninja

where `ninja` is the default and `make-concurrent` is `make` with the `-j`
flag. A custom build configuration `X` can be added by adding a
where `ninja` is the default and `make-concurrent` is `make` with the `-j` flag.

To enforce a 32-bit build on a 64-bit machine the following configuration
can be used:

scripts/initbuild.sh make-32bit

which uses `make` and provides the `-m32` flag to the compiler.
A custom build configuration `X` can be added by adding a
`scripts/build.cfg.X` file.

`scripts/initbuild.sh` cleans the build if a specific build
Expand Down
2 changes: 2 additions & 0 deletions include/flatcc/portable/paligned_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ extern "C" {
#define PORTABLE_C11_ALIGNED_ALLOC 0
#elif defined (__clang__)
#define PORTABLE_C11_ALIGNED_ALLOC 0
#elif defined (__APPLE__)
#define PORTABLE_C11_ALIGNED_ALLOC 0
#elif defined(__IBMC__)
#define PORTABLE_C11_ALIGNED_ALLOC 0
#elif (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
Expand Down
2 changes: 1 addition & 1 deletion include/flatcc/portable/pparsefp.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extern "C" {
#define isinf(x) (!_finite(x))
#endif
/*
* clang-5 through clang-8 but not clang-9 issues incorrect precision
* clang-3 through clang-8 but not clang-9 issues incorrect precision
* loss warning with -Wconversion flag when cast is absent.
*/
#if defined(__clang__)
Expand Down
1 change: 1 addition & 0 deletions scripts/build.cfg.make
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
FLATCC_BUILD_GEN="Unix Makefiles"
FLATCC_BUILD_CMD=make
FLATCC_BUILD_FLAGS=""
3 changes: 3 additions & 0 deletions scripts/build.cfg.make-32bit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FLATCC_BUILD_GEN="Unix Makefiles"
FLATCC_BUILD_CMD=make
FLATCC_BUILD_FLAGS="-DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32"
1 change: 1 addition & 0 deletions scripts/build.cfg.make-concurrent
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
FLATCC_BUILD_GEN="Unix Makefiles"
FLATCC_BUILD_CMD="make -j"
FLATCC_BUILD_FLAGS=""
1 change: 1 addition & 0 deletions scripts/build.cfg.ninja
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
FLATCC_BUILD_GEN=Ninja
FLATCC_BUILD_CMD=ninja
FLATCC_BUILD_FLAGS=""
4 changes: 2 additions & 2 deletions scripts/initbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ mkdir -p ${ROOT}/build/Release
rm -rf ${ROOT}/build/Debug/*
rm -rf ${ROOT}/build/Release/*

cd ${ROOT}/build/Debug && cmake -G "$FLATCC_BUILD_GEN" ../.. -DCMAKE_BUILD_TYPE=Debug
cd ${ROOT}/build/Release && cmake -G "$FLATCC_BUILD_GEN" ../.. -DCMAKE_BUILD_TYPE=Release
cd ${ROOT}/build/Debug && cmake -G "$FLATCC_BUILD_GEN" $FLATCC_BUILD_FLAGS ../.. -DCMAKE_BUILD_TYPE=Debug
cd ${ROOT}/build/Release && cmake -G "$FLATCC_BUILD_GEN" $FLATCC_BUILD_FLAGS ../.. -DCMAKE_BUILD_TYPE=Release
Loading