[F] Fixed build

This commit is contained in:
seleznevae 2018-04-01 13:40:56 +03:00
parent edaf106ed1
commit 2ae836c33a
2 changed files with 38 additions and 5 deletions

View File

@ -7,10 +7,11 @@ include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
# Built options # Built options
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_ENABLE_ASTYLE "Enable astyle" OFF) option(FORT_ENABLE_ASTYLE "Enable astyle" OFF)
set(FORT_BUILD_TYPE "common" CACHE STRING "Built types (possible values: common, asan, ubsan, coveralls)") set(FORT_BUILD_TYPE "common" CACHE STRING "Build types(common, asan, ubsan, coveralls)")
# Determine compiler (pos. values Clang, GNU, Intel, MSVC, AppleClang... (https://cmake.org/cmake/help/v3.0/variable/CMAKE_LANG_COMPILER_ID.html) # Determine compiler (pos. values Clang, GNU, Intel, MSVC, AppleClang...
# (https://cmake.org/cmake/help/v3.0/variable/CMAKE_LANG_COMPILER_ID.html)
if(FORT_CXX_BUILD) if(FORT_CXX_BUILD)
set(FORT_COMPILER ${CMAKE_CXX_COMPILER_ID}) set(FORT_COMPILER ${CMAKE_CXX_COMPILER_ID})
else(FORT_CXX_BUILD) else(FORT_CXX_BUILD)
@ -103,13 +104,14 @@ endif(FORT_CXX_BUILD)
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# sanitizers # Sanitizers
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
if(FORT_COMPILER STREQUAL "GNU" OR FORT_COMPILER STREQUAL "Clang") if(FORT_COMPILER STREQUAL "GNU" OR FORT_COMPILER STREQUAL "Clang")
# asan case # asan case
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")
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -fsanitize=address")
if(FORT_COMPILER STREQUAL "GNU") if(FORT_COMPILER STREQUAL "GNU")
target_link_libraries(${PROJECT_NAME}_example asan) target_link_libraries(${PROJECT_NAME}_example asan)
target_link_libraries(${PROJECT_NAME}_example_cpp asan) target_link_libraries(${PROJECT_NAME}_example_cpp asan)
@ -119,8 +121,9 @@ if(FORT_COMPILER STREQUAL "GNU" OR FORT_COMPILER STREQUAL "Clang")
#ubsan case #ubsan case
if(FORT_BUILD_TYPE STREQUAL "ubsan") if(FORT_BUILD_TYPE STREQUAL "ubsan")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined") # -fno-sanitize-recover option is used to force faild
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize-recover") #to force fail set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize-recover")
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -fsanitize=undefined -fno-sanitize-recover")
if(FORT_COMPILER STREQUAL "GNU") if(FORT_COMPILER STREQUAL "GNU")
target_link_libraries(${PROJECT_NAME}_example ubsan) target_link_libraries(${PROJECT_NAME}_example ubsan)
target_link_libraries(${PROJECT_NAME}_example_cpp ubsan) target_link_libraries(${PROJECT_NAME}_example_cpp ubsan)
@ -131,6 +134,7 @@ if(FORT_COMPILER STREQUAL "GNU" OR FORT_COMPILER STREQUAL "Clang")
#coveralls case #coveralls case
if(FORT_BUILD_TYPE STREQUAL "coveralls") if(FORT_BUILD_TYPE STREQUAL "coveralls")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fprofile-arcs -ftest-coverage") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fprofile-arcs -ftest-coverage")
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -g -fprofile-arcs -ftest-coverage")
endif(FORT_BUILD_TYPE STREQUAL "coveralls") endif(FORT_BUILD_TYPE STREQUAL "coveralls")
endif(FORT_COMPILER STREQUAL "GNU" OR FORT_COMPILER STREQUAL "Clang") endif(FORT_COMPILER STREQUAL "GNU" OR FORT_COMPILER STREQUAL "Clang")

View File

@ -399,7 +399,36 @@ enum ft_row_type {
FT_ROW_HEADER FT_ROW_HEADER
}; };
/**
* Set default cell option for all new formatted tables.
*
* @param option
* Option identifier
* @param value
* Option value
* @return
* - 0: Success; default cell option was changed.
* - (-1): !!!!!!!! todo
*/
FT_EXTERN int ft_set_default_cell_option(uint32_t option, int value); FT_EXTERN int ft_set_default_cell_option(uint32_t option, int value);
/**
* Set option for the specified cell of the table.
*
* @param table
* A pointer to the FTABLE structure
* @param row
* Cell row
* @param col
* Cell column
* @param option
* Option identifier
* @param value
* Option value
* @return
* - 0: Success; default cell option was changed.
* - (-1): !!!!!!!! todo
*/
FT_EXTERN int ft_set_cell_option(FTABLE *table, unsigned row, unsigned col, uint32_t option, int value); FT_EXTERN int ft_set_cell_option(FTABLE *table, unsigned row, unsigned col, uint32_t option, int value);
/** /**