Skip to content

Commit

Permalink
Merge branch 'hotfix-0.4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
HuguesDelorme committed Apr 14, 2017
2 parents 785ffa6 + ef44988 commit 6deb4fa
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 70 deletions.
54 changes: 26 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ include(CMakeDependentOption)

set(GMIO_VERSION_MAJOR 0)
set(GMIO_VERSION_MINOR 4)
set(GMIO_VERSION_PATCH 0)
set(GMIO_VERSION_PATCH 1)
set(GMIO_VERSION
${GMIO_VERSION_MAJOR}.${GMIO_VERSION_MINOR}.${GMIO_VERSION_PATCH})

Expand Down Expand Up @@ -251,16 +251,24 @@ endif()
if(CMAKE_C_COMPILER_IS_GCC_COMPATIBLE)
list(APPEND CMAKE_REQUIRED_LIBRARIES m) # -lm
endif()
check_function_exists(powf GMIO_HAVE_POWF_FUNC)
check_function_exists(sqrtf GMIO_HAVE_SQRTF_FUNC)
check_function_exists(strtof GMIO_HAVE_STRTOF_FUNC)
check_symbol_exists(isfinite math.h GMIO_HAVE_ISFINITE_SYM)
check_symbol_exists(isnan math.h GMIO_HAVE_ISNAN_SYM)
if(WIN32 AND NOT GMIO_HAVE_ISNAN_SYM)
check_symbol_exists(_finite float.h GMIO_HAVE_WIN__FINITE_SYM)
check_symbol_exists(powf math.h GMIO_HAVE_POWF)
check_symbol_exists(sqrtf math.h GMIO_HAVE_SQRTF)
check_symbol_exists(strtof stdlib.h GMIO_HAVE_STRTOF)
check_symbol_exists(isfinite math.h GMIO_HAVE_ISFINITE)
check_symbol_exists(isnan math.h GMIO_HAVE_ISNAN)
check_symbol_exists(snprintf "stdio.h;stdlib.h" GMIO_HAVE_SNPRINTF)
check_symbol_exists(vsnprintf stdio.h GMIO_HAVE_VSNPRINTF)
if(WIN32 AND NOT GMIO_HAVE_ISNAN)
check_symbol_exists(_finite float.h GMIO_HAVE_WIN__FINITE)
endif()
if(WIN32 AND NOT GMIO_HAVE_ISNAN_SYM)
check_symbol_exists(_isnan float.h GMIO_HAVE_WIN__ISNAN_SYM)
if(WIN32 AND NOT GMIO_HAVE_ISNAN)
check_symbol_exists(_isnan float.h GMIO_HAVE_WIN__ISNAN)
endif()
if(WIN32 AND NOT GMIO_HAVE_SNPRINTF)
check_symbol_exists(_snprintf stdio.h GMIO_HAVE_WIN__SNPRINTF)
endif()
if(WIN32 AND NOT GMIO_HAVE_VSNPRINTF)
check_symbol_exists(_vsnprintf stdio.h GMIO_HAVE_WIN__VSNPRINTF)
endif()

set(CMAKE_REQUIRED_LIBRARIES) # Pop changes
Expand All @@ -270,16 +278,6 @@ check_c_source_compiles(
int main() { const bool c = 0; return 0; }"
GMIO_HAVE_C99_BOOL)

check_function_exists(snprintf GMIO_HAVE_SNPRINTF_FUNC)
if(WIN32 AND NOT GMIO_HAVE_SNPRINTF_FUNC)
check_function_exists(_snprintf GMIO_HAVE_WIN__SNPRINTF_FUNC)
endif()

check_function_exists(vsnprintf GMIO_HAVE_VSNPRINTF_FUNC)
if(WIN32 AND NOT GMIO_HAVE_VSNPRINTF_FUNC)
check_function_exists(_vsnprintf GMIO_HAVE_WIN__VSNPRINTF_FUNC)
endif()

# Check available POSIX features
if(UNIX)
# See:
Expand All @@ -306,22 +304,22 @@ if (NOT DEFINED HAVE_SYS_STAT_H)
check_include_files(sys/stat.h GMIO_HAVE_SYS_STAT_H)
endif()

check_function_exists(fileno GMIO_HAVE_POSIX_FILENO_FUNC)
check_function_exists(fileno GMIO_HAVE_POSIX_FILENO)

# Have fstat64() ?
check_c_source_compiles(
"#include <sys/stat.h>
int main() { fstat64(0, NULL); return 0; }"
GMIO_HAVE_POSIX_FSTAT64_FUNC)
GMIO_HAVE_POSIX_FSTAT64)
if(WIN32)
check_function_exists(_fstat64 GMIO_HAVE_WIN__FSTAT64_FUNC)
check_function_exists(_fstat64 GMIO_HAVE_WIN__FSTAT64)
endif()

# Check size(in bytes) of stat::st_size
set(CMAKE_EXTRA_INCLUDE_FILES sys/stat.h)
if(GMIO_HAVE_WIN__FSTAT64_FUNC)
if(GMIO_HAVE_WIN__FSTAT64)
check_type_size("((struct _stat64*)0)->st_size" GMIO_SIZEOF_STRUCT_STAT_ST_SIZE)
elseif(GMIO_HAVE_POSIX_FSTAT64_FUNC)
elseif(GMIO_HAVE_POSIX_FSTAT64)
check_type_size("((struct stat64*)0)->st_size" GMIO_SIZEOF_STRUCT_STAT_ST_SIZE)
else()
check_type_size("((struct stat*)0)->st_size" GMIO_SIZEOF_STRUCT_STAT_ST_SIZE)
Expand All @@ -342,15 +340,15 @@ if(CMAKE_C_COMPILER_IS_GCC_COMPATIBLE)
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624
check_c_source_compiles(
"int main() { return (int)__builtin_bswap16(0x1122); }"
GMIO_HAVE_GCC_BUILTIN_BSWAP16_FUNC)
GMIO_HAVE_GCC_BUILTIN_BSWAP16)
check_c_source_compiles(
"int main() { return (int)__builtin_bswap32(0x11223344); }"
GMIO_HAVE_GCC_BUILTIN_BSWAP32_FUNC)
GMIO_HAVE_GCC_BUILTIN_BSWAP32)
elseif(MSVC)
check_c_source_compiles(
"#include <stdlib.h>
int main() { return (int)_byteswap_ulong(0x11223344); }"
GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC)
GMIO_HAVE_MSVC_BUILTIN_BSWAP)
endif()

#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</a>
[![Codecov](https://codecov.io/github/fougue/gmio/coverage.svg?branch=master)](https://codecov.io/gh/fougue/gmio/branch/master)
[![License](https://img.shields.io/badge/license-BSD%202--clause-blue.svg)](https://github.com/fougue/gmio/blob/master/LICENSE.txt)
[![Version](https://img.shields.io/badge/version-v0.4.0-blue.svg?style=flat)](https://github.com/fougue/gmio/releases)
[![Version](https://img.shields.io/badge/version-v0.4.1-blue.svg?style=flat)](https://github.com/fougue/gmio/releases)


C library for geometry input/output
Expand Down
6 changes: 4 additions & 2 deletions doc/Doxyfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ FULL_PATH_NAMES = YES
# If left blank the directory from which doxygen is run is used as the
# path to strip.

STRIP_FROM_PATH = @CMAKE_CURRENT_SOURCE_DIR@/../src
STRIP_FROM_PATH = @CMAKE_CURRENT_SOURCE_DIR@/../src \
@CMAKE_CURRENT_BINARY_DIR@/../src

# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells
Expand Down Expand Up @@ -642,7 +643,8 @@ WARN_LOGFILE =
# with spaces.

INPUT = @CMAKE_CURRENT_SOURCE_DIR@/../doc/mainpage.dox \
@CMAKE_CURRENT_SOURCE_DIR@/../src
@CMAKE_CURRENT_SOURCE_DIR@/../src \
@CMAKE_CURRENT_BINARY_DIR@/../src/gmio_core/version.h

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
Expand Down
6 changes: 3 additions & 3 deletions scripts/bump-version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
script_dir_name = File.expand_path(File.dirname(__FILE__))

# CMakeLists.txt
path_CMakeLists_txt = "#{script_dir_name}/CMakeLists.txt"
path_CMakeLists_txt = "#{script_dir_name}/../CMakeLists.txt"
CMakeLists_txt = File.open(path_CMakeLists_txt, "r").read
CMakeLists_txt.sub!(/(set\(GMIO_VERSION_MAJOR\s+)\d+/, "\\1#{major}")
CMakeLists_txt.sub!(/(set\(GMIO_VERSION_MINOR\s+)\d+/, "\\1#{minor}")
Expand All @@ -23,7 +23,7 @@
puts "Bumped #{path_CMakeLists_txt}"

# README.md
path_README_md = "#{script_dir_name}/README.md"
path_README_md = "#{script_dir_name}/../README.md"
README_md = File.open(path_README_md, "r").read
README_md.sub!(
/(img\.shields\.io\/badge\/version\-v)\d+\.\d+\.\d+/,
Expand All @@ -35,7 +35,7 @@
puts "Bumped #{path_README_md}"

# appveyor.yml
path_appveyor_yml = "#{script_dir_name}/appveyor.yml"
path_appveyor_yml = "#{script_dir_name}/../appveyor.yml"
appveyor_yml = File.open(path_appveyor_yml, "r").read
appveyor_yml.sub!(
/(version:\s+)\d+\.\d+(_build)/,
Expand Down
34 changes: 17 additions & 17 deletions src/gmio_core/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,30 @@
#cmakedefine GMIO_HAVE_C99_BOOL
#endif

#cmakedefine GMIO_HAVE_STRTOF_FUNC
#cmakedefine GMIO_HAVE_POWF_FUNC
#cmakedefine GMIO_HAVE_SNPRINTF_FUNC
#cmakedefine GMIO_HAVE_WIN__SNPRINTF_FUNC
#cmakedefine GMIO_HAVE_VSNPRINTF_FUNC
#cmakedefine GMIO_HAVE_WIN__VSNPRINTF_FUNC

#cmakedefine GMIO_HAVE_ISFINITE_SYM
#cmakedefine GMIO_HAVE_WIN__FINITE_SYM
#cmakedefine GMIO_HAVE_ISNAN_SYM
#cmakedefine GMIO_HAVE_WIN__ISNAN_SYM
#cmakedefine GMIO_HAVE_STRTOF
#cmakedefine GMIO_HAVE_POWF
#cmakedefine GMIO_HAVE_SNPRINTF
#cmakedefine GMIO_HAVE_WIN__SNPRINTF
#cmakedefine GMIO_HAVE_VSNPRINTF
#cmakedefine GMIO_HAVE_WIN__VSNPRINTF

#cmakedefine GMIO_HAVE_ISFINITE
#cmakedefine GMIO_HAVE_WIN__FINITE
#cmakedefine GMIO_HAVE_ISNAN
#cmakedefine GMIO_HAVE_WIN__ISNAN

/* POSIX */
#cmakedefine GMIO_HAVE_SYS_TYPES_H
#cmakedefine GMIO_HAVE_SYS_STAT_H
#cmakedefine GMIO_HAVE_POSIX_FILENO_FUNC
#cmakedefine GMIO_HAVE_POSIX_FSTAT64_FUNC
#cmakedefine GMIO_HAVE_WIN__FSTAT64_FUNC
#cmakedefine GMIO_HAVE_POSIX_FILENO
#cmakedefine GMIO_HAVE_POSIX_FSTAT64
#cmakedefine GMIO_HAVE_WIN__FSTAT64

/* Compiler byte-swap functions */
#cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP16_FUNC
#cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP32_FUNC
#cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP16
#cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP32

#cmakedefine GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC
#cmakedefine GMIO_HAVE_MSVC_BUILTIN_BSWAP

/* Target architecture */
#cmakedefine GMIO_HOST_IS_BIG_ENDIAN
Expand Down
10 changes: 5 additions & 5 deletions src/gmio_core/internal/byte_swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@

#include "../global.h"

#ifdef GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC
#ifdef GMIO_HAVE_MSVC_BUILTIN_BSWAP
# include <stdlib.h>
#endif

/*! Returns \p val with the order of bytes reversed, uses compiler builtin
* functions if available */
GMIO_INLINE uint16_t gmio_uint16_bswap(uint16_t val)
{
#ifdef GMIO_HAVE_GCC_BUILTIN_BSWAP16_FUNC
#ifdef GMIO_HAVE_GCC_BUILTIN_BSWAP16
return __builtin_bswap16(val);
#elif defined(GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC)
#elif defined(GMIO_HAVE_MSVC_BUILTIN_BSWAP)
return _byteswap_ushort(val);
#else
return ((val & 0x00FF) << 8) | ((val >> 8) & 0x00FF);
Expand All @@ -52,9 +52,9 @@ GMIO_INLINE uint16_t gmio_uint16_bswap(uint16_t val)
* functions if available */
GMIO_INLINE uint32_t gmio_uint32_bswap(uint32_t val)
{
#ifdef GMIO_HAVE_GCC_BUILTIN_BSWAP32_FUNC
#ifdef GMIO_HAVE_GCC_BUILTIN_BSWAP32
return __builtin_bswap32(val);
#elif defined(GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC)
#elif defined(GMIO_HAVE_MSVC_BUILTIN_BSWAP)
return _byteswap_ulong(val);
#else
return ((val & 0x000000FF) << 24)
Expand Down
12 changes: 6 additions & 6 deletions src/gmio_core/internal/c99_math_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,35 @@
#include "../global.h"
#include <math.h>

#ifdef GMIO_HAVE_POWF_FUNC
#ifdef GMIO_HAVE_POWF
# define gmio_powf powf
#else
/* No powf() function, call pow(double) as fallback */
GMIO_INLINE float gmio_powf(float base, float exponent)
{ return (float)pow((double)base, (double)exponent); }
#endif

#ifdef GMIO_HAVE_SQRTF_FUNC
#ifdef GMIO_HAVE_SQRTF
# define gmio_sqrtf sqrtf
#else
/* No sqrtf() function, call sqrt(double) as fallback */
GMIO_INLINE float gmio_sqrtf(float x)
{ return (float)sqrt((double)x); }
#endif

#if defined(GMIO_HAVE_ISFINITE_SYM)
#if defined(GMIO_HAVE_ISFINITE)
# define gmio_isfinite(x) isfinite(x)
#elif defined(GMIO_HAVE_WIN__FINITE_SYM)
#elif defined(GMIO_HAVE_WIN__FINITE)
# include <float.h>
# define gmio_isfinite(x) _finite(x)
#else
/* No isfinite() symbol */
# define gmio_isfinite(x) (((x) != NAN) && ((x) != INFINITY))
#endif

#if defined(GMIO_HAVE_ISNAN_SYM)
#if defined(GMIO_HAVE_ISNAN)
# define gmio_isnan(x) isnan(x)
#elif defined(GMIO_HAVE_WIN__ISNAN_SYM)
#elif defined(GMIO_HAVE_WIN__ISNAN)
# include <float.h>
# define gmio_isnan(x) _isnan(x)
#else
Expand Down
8 changes: 4 additions & 4 deletions src/gmio_core/internal/c99_stdio_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
*
* vsnprintf() appeared in C99
*/
#ifdef GMIO_HAVE_VSNPRINTF_FUNC
#ifdef GMIO_HAVE_VSNPRINTF
# define gmio_vsnprintf vsnprintf
#elif defined(GMIO_HAVE_WIN__VSNPRINTF_FUNC)
#elif defined(GMIO_HAVE_WIN__VSNPRINTF)
# define gmio_vsnprintf _vsnprintf
#else
/* No vsnprintf()-like function, call unsafe vsprintf() as fallback */
Expand All @@ -61,9 +61,9 @@ GMIO_INLINE int gmio_vsnprintf(
*
* snprintf() appeared in C99
*/
#ifdef GMIO_HAVE_SNPRINTF_FUNC
#ifdef GMIO_HAVE_SNPRINTF
# define gmio_snprintf snprintf
#elif defined(GMIO_HAVE_WIN__SNPRINTF_FUNC)
#elif defined(GMIO_HAVE_WIN__SNPRINTF)
# define gmio_snprintf _snprintf
#else
/* No snprintf()-like function, translate to gmio_vsnprintf() call */
Expand Down
2 changes: 1 addition & 1 deletion src/gmio_core/internal/c99_stdlib_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#include <stdlib.h>

#ifdef GMIO_HAVE_STRTOF_FUNC
#ifdef GMIO_HAVE_STRTOF
# define gmio_strtof strtof
#else
/* No strtof() function, call strtod() as fallback */
Expand Down
6 changes: 3 additions & 3 deletions src/gmio_core/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
/* gmio_stat_t: type alias on the stat structure
* GMIO_FSTAT_FUNC_NAME: alias on the fstat() function
*/
# if defined(GMIO_HAVE_WIN__FSTAT64_FUNC)
# if defined(GMIO_HAVE_WIN__FSTAT64)
typedef struct __stat64 gmio_stat_t;
# define GMIO_FSTAT_FUNC_NAME _fstat64
# elif defined(GMIO_HAVE_POSIX_FSTAT64_FUNC)
# elif defined(GMIO_HAVE_POSIX_FSTAT64)
typedef struct stat64 gmio_stat_t;
# define GMIO_FSTAT_FUNC_NAME fstat64
# else
Expand Down Expand Up @@ -93,7 +93,7 @@ static gmio_streamsize_t gmio_stream_stdio_size(void* cookie)

#if defined(GMIO_HAVE_SYS_TYPES_H) \
&& defined(GMIO_HAVE_SYS_STAT_H) \
&& defined(GMIO_HAVE_POSIX_FILENO_FUNC)
&& defined(GMIO_HAVE_POSIX_FILENO)

const int fd = fileno(file);
if (fd != -1) {
Expand Down
18 changes: 18 additions & 0 deletions src/gmio_core/version.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,29 @@

/* Generated by CMake */

/*! \file version.h
* Declaration of macros specifying gmio's version
*
* \addtogroup gmio_core
* @{
*/

#pragma once

/*! Expands to gmio's major version number */
#define GMIO_VERSION_MAJOR @GMIO_VERSION_MAJOR@

/*! Expands to gmio's minor version number */
#define GMIO_VERSION_MINOR @GMIO_VERSION_MINOR@

/*! Expands to gmio's patch version number */
#define GMIO_VERSION_PATCH @GMIO_VERSION_PATCH@

/*! Expands to a string that specifies gmio's version number */
#define GMIO_VERSION_STR "@GMIO_VERSION@"

/*! Expands to an hexadecimal value of the form \c 0xMMNNPP (MM=major, NN=minor,
* PP=patch) that specifies gmio's version number */
#define GMIO_VERSION 0x0@GMIO_VERSION_MAJOR@0@GMIO_VERSION_MINOR@0@GMIO_VERSION_PATCH@

/*! @} */
2 changes: 2 additions & 0 deletions src/gmio_stl/stl_infos.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ GMIO_C_LINKAGE_BEGIN
* \p flags is a bitor combination of \c gmio_stl_info_flag values and is used
* to select the informations to retrieve.
*
* The position of the input stream is preserved.
*
* \pre <tt> infos != NULL </tt>
* \pre <tt> stream != NULL </tt>
*
Expand Down

0 comments on commit 6deb4fa

Please sign in to comment.