Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Ogg
Commits
fb05258b
Commit
fb05258b
authored
Jul 20, 2019
by
Vitaly Kirsanov
Committed by
Erik de Castro Lopo
Jul 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMake: checking type sizes (#48)
parent
ec2d16de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
5 deletions
+76
-5
CMakeLists.txt
CMakeLists.txt
+3
-5
cmake/CheckSizes.cmake
cmake/CheckSizes.cmake
+73
-0
No files found.
CMakeLists.txt
View file @
fb05258b
...
...
@@ -58,11 +58,9 @@ check_include_files(inttypes.h INCLUDE_INTTYPES_H)
check_include_files
(
stdint.h INCLUDE_STDINT_H
)
check_include_files
(
sys/types.h INCLUDE_SYS_TYPES_H
)
set
(
SIZE16 int16_t
)
set
(
USIZE16 uint16_t
)
set
(
SIZE32 int32_t
)
set
(
USIZE32 uint32_t
)
set
(
SIZE64 int64_t
)
list
(
APPEND CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
include
(
CheckSizes
)
configure_file
(
include/ogg/config_types.h.in
${
CMAKE_CURRENT_BINARY_DIR
}
/include/ogg/config_types.h @ONLY
)
...
...
cmake/CheckSizes.cmake
0 → 100644
View file @
fb05258b
include
(
CheckTypeSize
)
check_type_size
(
"int16_t"
INT16_SIZE LANGUAGE C
)
check_type_size
(
"uint16_t"
UINT16_SIZE LANGUAGE C
)
check_type_size
(
"u_int16_t"
U_INT16_SIZE LANGUAGE C
)
check_type_size
(
"int32_t"
INT32_SIZE LANGUAGE C
)
check_type_size
(
"uint32_t"
UINT32_SIZE LANGUAGE C
)
check_type_size
(
"u_int32_t"
U_INT32_SIZE LANGUAGE C
)
check_type_size
(
"int64_t"
INT64_SIZE LANGUAGE C
)
check_type_size
(
"short"
SHORT_SIZE LANGUAGE C
)
check_type_size
(
"int"
INT_SIZE LANGUAGE C
)
check_type_size
(
"long"
LONG_SIZE LANGUAGE C
)
check_type_size
(
"long long"
LONG_LONG_SIZE LANGUAGE C
)
if
(
INT16_SIZE EQUAL 2
)
set
(
SIZE16
"int16_t"
)
elseif
(
SHORT_SIZE EQUAL 2
)
set
(
SIZE16
"short"
)
elseif
(
INT_SIZE EQUAL 2
)
set
(
SIZE16
"int"
)
else
()
message
(
FATAL_ERROR
"No 16 bit type found on this platform!"
)
endif
()
if
(
UINT16_SIZE EQUAL 2
)
set
(
USIZE16
"uint16_t"
)
elseif
(
SHORT_SIZE EQUAL 2
)
set
(
USIZE16
"unsigned short"
)
elseif
(
INT_SIZE EQUAL 2
)
set
(
USIZE16
"unsigned int"
)
elseif
(
U_INT_SIZE EQUAL 2
)
set
(
USIZE16
"u_int16_t"
)
else
()
message
(
FATAL_ERROR
"No unsigned 16 bit type found on this platform!"
)
endif
()
if
(
INT32_SIZE EQUAL 4
)
set
(
SIZE32
"int32_t"
)
elseif
(
SHORT_SIZE EQUAL 4
)
set
(
SIZE32
"short"
)
elseif
(
INT_SIZE EQUAL 4
)
set
(
SIZE32
"int"
)
elseif
(
LONG_SIZE EQUAL 4
)
set
(
SIZE16
"long"
)
else
()
message
(
FATAL_ERROR
"No 32 bit type found on this platform!"
)
endif
()
if
(
UINT32_SIZE EQUAL 4
)
set
(
USIZE32
"uint32_t"
)
elseif
(
SHORT_SIZE EQUAL 4
)
set
(
USIZE32
"unsigned short"
)
elseif
(
INT_SIZE EQUAL 4
)
set
(
USIZE32
"unsigned int"
)
elseif
(
LONG_SIZE EQUAL 4
)
set
(
USIZE32
"unsigned long"
)
elseif
(
U_INT_SIZE EQUAL 4
)
set
(
USIZE32
"u_int32_t"
)
else
()
message
(
FATAL_ERROR
"No unsigned 32 bit type found on this platform!"
)
endif
()
if
(
INT64_SIZE EQUAL 8
)
set
(
SIZE64
"int64_t"
)
elseif
(
INT_SIZE EQUAL 8
)
set
(
SIZE64
"int"
)
elseif
(
LONG_SIZE EQUAL 8
)
set
(
SIZE64
"long"
)
elseif
(
LONG_LONG_SIZE EQUAL 8
)
set
(
SIZE64
"long long"
)
else
()
message
(
FATAL_ERROR
"No 64 bit type found on this platform!"
)
endif
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment