CI: use clang on Unix, msvc on Windows;Remove explicit flags in CMakeLists.txt;

pull/3168/head
luca 2020-04-26 12:19:59 -07:00
parent 2273160f2c
commit d98787f35b
4 changed files with 55 additions and 38 deletions

View File

@ -7,40 +7,46 @@ on:
branches: [ master ] branches: [ master ]
jobs: jobs:
linux: job:
runs-on: ubuntu-latest name: ${{ matrix.os }}-build-and-test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# For Windows msvc, for Linux and macOS let's use the clang compiler
include:
- os: windows-latest
cxx: cl.exe
cc: cl.exe
- os: ubuntu-latest
cxx: clang++
cc: clang
- os: macos-latest
cxx: clang++
cc: clang
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: configure
run: cmake CMakeLists.txt - uses: lukka/get-cmake@latest
- name: build
run: cmake --build . - uses: ilammy/msvc-dev-cmd@v1
- uses: lukka/set-shell-env@v1
with:
CXX: ${{ matrix.cxx }}
CC: ${{ matrix.cc }}
- name: configure and build
uses: lukka/run-cmake@v2
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release'
buildWithCMakeArgs: '-- -v'
buildDirectory: '${{ github.workspace }}/build/'
- name: test - name: test
run: cd bin && ./unit run: cd build/bin && ./unit
shell: bash
mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: configure
run: cmake CMakeLists.txt
- name: build
run: cmake --build .
- name: test
run: cd bin && ./unit
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: configure
run: cmake CMakeLists.txt
- name: build
run: cmake --build . --config Release
- name: test
run: |
cd bin\Release
.\unit

View File

@ -267,10 +267,10 @@ ELSEIF(MSVC)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od")
ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
IF(NOT ASSIMP_HUNTER_ENABLED) IF(NOT ASSIMP_HUNTER_ENABLED)
SET(CMAKE_CXX_FLAGS "-fPIC -std=c++11 ${CMAKE_CXX_FLAGS}") SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}") SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF() ENDIF()
SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long ${CMAKE_CXX_FLAGS}" ) SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long ${CMAKE_CXX_FLAGS}" )
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}") SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
ELSEIF( CMAKE_COMPILER_IS_MINGW ) ELSEIF( CMAKE_COMPILER_IS_MINGW )
IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)

View File

@ -382,7 +382,12 @@ namespace glTF
{ {
friend struct Accessor; friend struct Accessor;
// This field is reported as not used, making it protectd is the easiest way to work around it without going to the bottom of what the problem is:
// ../code/glTF2/glTF2Asset.h:392:19: error: private field 'accessor' is not used [-Werror,-Wunused-private-field]
protected:
Accessor &accessor; Accessor &accessor;
private:
uint8_t* data; uint8_t* data;
size_t elemSize, stride; size_t elemSize, stride;

View File

@ -389,12 +389,18 @@ struct Accessor : public Object {
class Indexer { class Indexer {
friend struct Accessor; friend struct Accessor;
// This field is reported as not used, making it protectd is the easiest way to work around it without going to the bottom of what the problem is:
// ../code/glTF2/glTF2Asset.h:392:19: error: private field 'accessor' is not used [-Werror,-Wunused-private-field]
protected:
Accessor &accessor; Accessor &accessor;
private:
uint8_t *data; uint8_t *data;
size_t elemSize, stride; size_t elemSize, stride;
Indexer(Accessor &acc); Indexer(Accessor &acc);
public: public:
//! Accesses the i-th value as defined by the accessor //! Accesses the i-th value as defined by the accessor
template <class T> template <class T>