[C] Changed build options
This commit is contained in:
parent
913432d67b
commit
a864b6ab55
@ -4,7 +4,7 @@ matrix:
|
|||||||
- os: linux
|
- os: linux
|
||||||
sudo: false
|
sudo: false
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
env: GCC_BUILD=ON
|
env: FORT_COMPILER=gcc
|
||||||
before_script:
|
before_script:
|
||||||
- pip install --user cpp-coveralls
|
- pip install --user cpp-coveralls
|
||||||
after_success:
|
after_success:
|
||||||
@ -12,7 +12,7 @@ matrix:
|
|||||||
- os: linux
|
- os: linux
|
||||||
sudo: required # to prevent fail of executables build with clang and sanitizers
|
sudo: required # to prevent fail of executables build with clang and sanitizers
|
||||||
compiler: clang
|
compiler: clang
|
||||||
env: GCC_BUILD=OFF
|
env: FORT_COMPILER=clang
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ script:
|
|||||||
# Test build without optimizations
|
# Test build without optimizations
|
||||||
- mkdir -p build
|
- mkdir -p build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake .. -DFORT_BUILD_TYPE=asan -DFORT_GCC_BUILD=${GCC_BUILD}
|
- cmake .. -DFORT_BUILD_TYPE=asan -DFORT_COMPILER=${FORT_COMPILER}
|
||||||
- cmake --build . --target all
|
- cmake --build . --target all
|
||||||
- ls
|
- ls
|
||||||
- ./libfort_example
|
- ./libfort_example
|
||||||
@ -40,7 +40,7 @@ script:
|
|||||||
cd .. ;
|
cd .. ;
|
||||||
rm -r build/* ;
|
rm -r build/* ;
|
||||||
cd build ;
|
cd build ;
|
||||||
cmake .. -DFORT_COVERALLS_BUILD=ON -DFORT_BUILD_TYPE=asan -DFORT_GCC_BUILD=${GCC_BUILD} ;
|
cmake .. -DFORT_COVERALLS_BUILD=ON -DFORT_BUILD_TYPE=asan -DFORT_COMPILER=${FORT_COMPILER} ;
|
||||||
cmake --build . --target all ;
|
cmake --build . --target all ;
|
||||||
ls ;
|
ls ;
|
||||||
./libfort_test ;
|
./libfort_test ;
|
||||||
|
@ -4,11 +4,12 @@ project(libfort)
|
|||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
# Built options
|
# Built options
|
||||||
option(FORT_GCC_BUILD "Build with gcc" ON)
|
#option(FORT_GCC_BUILD "Build with gcc" ON)
|
||||||
option(FORT_MSVC_BUILD "Build with msvc" OFF)
|
#option(FORT_MSVC_BUILD "Build with msvc" OFF)
|
||||||
option(FORT_CXX_BUILD "Compile with c++ compiler instead of c" OFF)
|
option(FORT_CXX_BUILD "Compile with c++ compiler instead of c" OFF)
|
||||||
option(FORT_COVERALLS_BUILD "Build for coveralls" OFF)
|
option(FORT_COVERALLS_BUILD "Build for coveralls" OFF)
|
||||||
set(FORT_BUILD_TYPE "common" CACHE STRING "Built types (possible values: common, asan, ubsan, msan)")
|
set(FORT_BUILD_TYPE "common" CACHE STRING "Built types (possible values: common, asan, ubsan, msan)")
|
||||||
|
set(FORT_COMPILER "gcc" CACHE STRING "Compiler (possible values: gcc, clang, msvc)")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -20,13 +21,18 @@ include_directories(src)
|
|||||||
|
|
||||||
|
|
||||||
# Turn on warnings
|
# Turn on warnings
|
||||||
if(FORT_MSVC_BUILD)
|
#if(FORT_MSVC_BUILD)
|
||||||
|
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W4")
|
||||||
|
#else(FORT_MSVC_BUILD)
|
||||||
|
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g")
|
||||||
|
#endif(FORT_MSVC_BUILD)
|
||||||
|
|
||||||
|
|
||||||
|
if(FORT_COMPILER STREQUAL "msvc")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W4")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W4")
|
||||||
else(FORT_MSVC_BUILD)
|
else(FORT_COMPILER STREQUAL "msvc")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g")
|
||||||
endif(FORT_MSVC_BUILD)
|
endif(FORT_COMPILER STREQUAL "msvc")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -76,24 +82,24 @@ endif(FORT_CXX_BUILD)
|
|||||||
|
|
||||||
|
|
||||||
# Adding sanitizers
|
# Adding sanitizers
|
||||||
if(NOT FORT_MSVC_BUILD)
|
if(FORT_COMPILER STREQUAL "gcc" OR FORT_COMPILER STREQUAL "clang")
|
||||||
if(FORT_BUILD_TYPE STREQUAL "asan")
|
if(FORT_BUILD_TYPE STREQUAL "asan")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
|
||||||
if(FORT_GCC_BUILD)
|
if(FORT_COMPILER STREQUAL "gcc")
|
||||||
target_link_libraries(${PROJECT_NAME}_example asan)
|
target_link_libraries(${PROJECT_NAME}_example asan)
|
||||||
target_link_libraries(${PROJECT_NAME}_test asan)
|
target_link_libraries(${PROJECT_NAME}_test asan)
|
||||||
endif(FORT_GCC_BUILD)
|
endif(FORT_COMPILER STREQUAL "gcc")
|
||||||
endif(FORT_BUILD_TYPE STREQUAL "asan")
|
endif(FORT_BUILD_TYPE STREQUAL "asan")
|
||||||
if(FORT_BUILD_TYPE STREQUAL "ubsan")
|
if(FORT_BUILD_TYPE STREQUAL "ubsan")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize-recover") #to force fail
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize-recover") #to force fail
|
||||||
if(FORT_GCC_BUILD)
|
if(FORT_COMPILER STREQUAL "gcc")
|
||||||
target_link_libraries(${PROJECT_NAME}_example ubsan)
|
target_link_libraries(${PROJECT_NAME}_example ubsan)
|
||||||
target_link_libraries(${PROJECT_NAME}_test ubsan)
|
target_link_libraries(${PROJECT_NAME}_test ubsan)
|
||||||
endif(FORT_GCC_BUILD)
|
endif(FORT_COMPILER STREQUAL "gcc")
|
||||||
endif(FORT_BUILD_TYPE STREQUAL "ubsan")
|
endif(FORT_BUILD_TYPE STREQUAL "ubsan")
|
||||||
|
|
||||||
endif(NOT FORT_MSVC_BUILD)
|
endif(FORT_COMPILER STREQUAL "gcc" OR FORT_COMPILER STREQUAL "clang")
|
||||||
|
|
||||||
|
|
||||||
# Coveralls support
|
# Coveralls support
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# libfort (WIP - work in progress)
|
# libfort (WIP - work in progress)
|
||||||
|
|
||||||
<!---
|
|
||||||
[![Build Status](https://travis-ci.org/seleznevae/libfort.svg?branch=master)](https://travis-ci.org/seleznevae/libfort)
|
[![Build Status](https://travis-ci.org/seleznevae/libfort.svg?branch=master)](https://travis-ci.org/seleznevae/libfort)
|
||||||
[![Build status](https://ci.appveyor.com/api/projects/status/ll1qygb56pho95xw/branch/master?svg=true)](https://ci.appveyor.com/project/seleznevae/libfort/branch/master)
|
[![Build status](https://ci.appveyor.com/api/projects/status/ll1qygb56pho95xw/branch/master?svg=true)](https://ci.appveyor.com/project/seleznevae/libfort/branch/master)
|
||||||
[![Coverage Status](https://coveralls.io/repos/github/seleznevae/libfort/badge.svg?branch=master)](https://coveralls.io/github/seleznevae/libfort?branch=master)
|
[![Coverage Status](https://coveralls.io/repos/github/seleznevae/libfort/badge.svg?branch=master)](https://coveralls.io/github/seleznevae/libfort?branch=master)
|
||||||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
|
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
<!---
|
||||||
## Supported platforms and compilers
|
## Supported platforms and compilers
|
||||||
|
|
||||||
The following compilers are currently used in continuous integration at [Travis](https://travis-ci.org/seleznevae/libfort) and [AppVeyor](https://ci.appveyor.com/project/seleznevae/libfort):
|
The following compilers are currently used in continuous integration at [Travis](https://travis-ci.org/seleznevae/libfort) and [AppVeyor](https://ci.appveyor.com/project/seleznevae/libfort):
|
||||||
|
@ -14,7 +14,7 @@ install:
|
|||||||
before_build:
|
before_build:
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake -G "Visual Studio 15 2017 Win64" .. -DFORT_TEST_BUILD=OFF -DFORT_GCC_BUILD=OFF -DFORT_MSVC_BUILD=ON
|
- cmake -G "Visual Studio 15 2017 Win64" .. -DFORT_COMPILER=msvc
|
||||||
- dir
|
- dir
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
Loading…
Reference in New Issue
Block a user