Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
libaec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mathis Rosenhauer
libaec
Commits
627426f1
Commit
627426f1
authored
10 years ago
by
Mathis Rosenhauer
Browse files
Options
Downloads
Patches
Plain Diff
CMake checks for inline and restrict. Toupper.
parent
7d528864
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+73
-24
73 additions, 24 deletions
CMakeLists.txt
src/CMakeLists.txt
+13
-13
13 additions, 13 deletions
src/CMakeLists.txt
tests/CMakeLists.txt
+13
-13
13 additions, 13 deletions
tests/CMakeLists.txt
with
99 additions
and
50 deletions
CMakeLists.txt
+
73
−
24
View file @
627426f1
cmake_minimum_required
(
VERSION 2.6
)
include
(
CheckIncludeFiles
)
include
(
TestBigEndian
)
include
(
CheckCSourceCompiles
)
project
(
libaec
)
set
(
libaec_VERSION_MAJOR 0
)
set
(
libaec_VERSION_MINOR 2
)
set
(
CMAKE_BUILD_TYPE Release
)
enable_testing
()
if
(
CMAKE_COMPILER_IS_GNUCC
)
set
(
CMAKE_C_FLAGS
"-Wall -std=gnu99
${
CMAKE_C_FLAGS
}
"
)
endif
(
CMAKE_COMPILER_IS_GNUCC
)
check_include_files
(
malloc.h HAVE_MALLOC_H
)
check_include_files
(
stdint.h HAVE_STDINT_H
)
test_big_endian
(
WORDS_BIGENDIAN
)
check_c_source_compiles
(
"int main(void) { return __builtin_clzll(1LL); }"
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.6
)
INCLUDE
(
CheckIncludeFiles
)
INCLUDE
(
TestBigEndian
)
INCLUDE
(
CheckCSourceCompiles
)
PROJECT
(
libaec
)
SET
(
libaec_VERSION_MAJOR 0
)
SET
(
libaec_VERSION_MINOR 2
)
SET
(
CMAKE_BUILD_TYPE Release
)
ENABLE_TESTING
()
CHECK_INCLUDE_FILES
(
malloc.h HAVE_MALLOC_H
)
CHECK_INCLUDE_FILES
(
stdint.h HAVE_STDINT_H
)
TEST_BIG_ENDIAN
(
WORDS_BIGENDIAN
)
CHECK_C_SOURCE_COMPILES
(
"int main(int argc, char *argv[])
{return __builtin_clzll(1LL)
\;
}"
HAVE_DECL___BUILTIN_CLZLL
)
configure_file
(
#Inspired from http://www.cmake.org/Wiki/CMakeTestInline
SET
(
INLINE_TEST_SRC
"/* Inspired by autoconf's c.m4 */
static inline int static_foo(){return 0
\;
}
int main(int argc, char *argv[]){return 0
\;
}
"
)
FILE
(
WRITE
${
CMAKE_CURRENT_BINARY_DIR
}
/CMakeTestCInline.c
${
INLINE_TEST_SRC
}
)
FOREACH
(
KEYWORD
"inline"
"__inline__"
"__inline"
)
IF
(
NOT DEFINED C_INLINE
)
TRY_COMPILE
(
C_HAS_
${
KEYWORD
}
${
CMAKE_CURRENT_BINARY_DIR
}
${
CMAKE_CURRENT_BINARY_DIR
}
/CMakeTestCInline.c
COMPILE_DEFINITIONS
"-Dinline=
${
KEYWORD
}
"
)
IF
(
C_HAS_
${
KEYWORD
}
)
SET
(
C_INLINE TRUE
)
ADD_DEFINITIONS
(
"-Dinline=
${
KEYWORD
}
"
)
ENDIF
(
C_HAS_
${
KEYWORD
}
)
ENDIF
(
NOT DEFINED C_INLINE
)
ENDFOREACH
(
KEYWORD
)
IF
(
NOT DEFINED C_INLINE
)
ADD_DEFINITIONS
(
"-Dinline="
)
ENDIF
(
NOT DEFINED C_INLINE
)
SET
(
RESTRICT_TEST_SRC
"/* Inspired by autoconf's c.m4 */
int foo (int * restrict ip){return ip[0]
\;
}
int main(int argc, char *argv[]){int s[1]
\;
int * restrict t = s
\;
t[0] = 0
\;
return foo(t)
\;
}
"
)
FILE
(
WRITE
${
CMAKE_CURRENT_BINARY_DIR
}
/CMakeTestCRestrict.c
${
RESTRICT_TEST_SRC
}
)
FOREACH
(
KEYWORD
"restrict"
"__restrict"
"__restrict__"
"_Restrict"
)
IF
(
NOT DEFINED C_RESTRICT
)
TRY_COMPILE
(
C_HAS_
${
KEYWORD
}
${
CMAKE_CURRENT_BINARY_DIR
}
${
CMAKE_CURRENT_BINARY_DIR
}
/CMakeTestCRestrict.c
COMPILE_DEFINITIONS
"-Drestrict=
${
KEYWORD
}
"
)
IF
(
C_HAS_
${
KEYWORD
}
)
SET
(
C_RESTRICT TRUE
)
ADD_DEFINITIONS
(
"-Drestrict=
${
KEYWORD
}
"
)
ENDIF
(
C_HAS_
${
KEYWORD
}
)
ENDIF
(
NOT DEFINED C_RESTRICT
)
ENDFOREACH
(
KEYWORD
)
IF
(
NOT DEFINED C_RESTRICT
)
ADD_DEFINITIONS
(
"-Drestrict="
)
ENDIF
(
NOT DEFINED C_RESTRICT
)
CONFIGURE_FILE
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/config.h.in
${
CMAKE_CURRENT_BINARY_DIR
}
/config.h
)
include_directories
(
"
${
PROJECT_BINARY_DIR
}
"
)
add_subdirectory
(
src
)
add_subdirectory
(
tests EXCLUDE_FROM_ALL
)
INCLUDE_DIRECTORIES
(
"
${
PROJECT_BINARY_DIR
}
"
)
ADD_SUBDIRECTORY
(
src
)
ADD_SUBDIRECTORY
(
tests EXCLUDE_FROM_ALL
)
This diff is collapsed.
Click to expand it.
src/CMakeLists.txt
+
13
−
13
View file @
627426f1
set
(
libaec_SRCS encode.c encode_accessors.c decode.c
)
add_library
(
aec SHARED
${
libaec_SRCS
}
)
set_target_properties
(
aec PROPERTIES
SET
(
libaec_SRCS encode.c encode_accessors.c decode.c
)
ADD_LIBRARY
(
aec SHARED
${
libaec_SRCS
}
)
SET_TARGET_PROPERTIES
(
aec PROPERTIES
VERSION 0
SOVERSION 0.0
)
add_library
(
sz SHARED sz_compat.c
)
set_target_properties
(
sz PROPERTIES
ADD_LIBRARY
(
sz SHARED sz_compat.c
)
SET_TARGET_PROPERTIES
(
sz PROPERTIES
VERSION 0
SOVERSION 0.0
)
target_link_libraries
(
sz aec
)
TARGET_LINK_LIBRARIES
(
sz aec
)
add_executable
(
aec_client aec.c
)
set_target_properties
(
aec_client PROPERTIES OUTPUT_NAME
"aec"
)
target_link_libraries
(
aec_client aec
)
add_executable
(
utime EXCLUDE_FROM_ALL utime.c
)
ADD_EXECUTABLE
(
aec_client aec.c
)
SET_TARGET_PROPERTIES
(
aec_client PROPERTIES OUTPUT_NAME
"aec"
)
TARGET_LINK_LIBRARIES
(
aec_client aec
)
ADD_EXECUTABLE
(
utime EXCLUDE_FROM_ALL utime.c
)
install
(
FILES libaec.h szlib.h DESTINATION include
)
install
(
TARGETS aec sz
INSTALL
(
FILES libaec.h szlib.h DESTINATION include
)
INSTALL
(
TARGETS aec sz
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install
(
PROGRAMS
${
CMAKE_CURRENT_BINARY_DIR
}
/aec DESTINATION bin
)
INSTALL
(
PROGRAMS
${
CMAKE_CURRENT_BINARY_DIR
}
/aec DESTINATION bin
)
This diff is collapsed.
Click to expand it.
tests/CMakeLists.txt
+
13
−
13
View file @
627426f1
add_library
(
check_aec check_aec.c
)
ADD_LIBRARY
(
check_aec check_aec.c
)
add_executable
(
check_code_options check_code_options.c
)
target_link_libraries
(
check_code_options check_aec aec
)
ADD_EXECUTABLE
(
check_code_options check_code_options.c
)
TARGET_LINK_LIBRARIES
(
check_code_options check_aec aec
)
add_executable
(
check_buffer_sizes check_buffer_sizes.c
)
target_link_libraries
(
check_buffer_sizes check_aec aec
)
ADD_EXECUTABLE
(
check_buffer_sizes check_buffer_sizes.c
)
TARGET_LINK_LIBRARIES
(
check_buffer_sizes check_aec aec
)
add_executable
(
check_long_fs check_long_fs.c
)
target_link_libraries
(
check_long_fs check_aec aec
)
ADD_EXECUTABLE
(
check_long_fs check_long_fs.c
)
TARGET_LINK_LIBRARIES
(
check_long_fs check_aec aec
)
add_test
(
check_code_options check_code_options
)
add_test
(
check_buffer_sizes check_buffer_sizes
)
add_test
(
check_long_fs check_long_fs
)
ADD_TEST
(
check_code_options check_code_options
)
ADD_TEST
(
check_buffer_sizes check_buffer_sizes
)
ADD_TEST
(
check_long_fs check_long_fs
)
add_custom_target
(
check COMMAND
${
CMAKE_CTEST_COMMAND
}
)
add_dependencies
(
check
ADD_CUSTOM_TARGET
(
check COMMAND
${
CMAKE_CTEST_COMMAND
}
)
ADD_DEPENDENCIES
(
check
check_code_options
check_buffer_sizes
check_long_fs
)
add_custom_target
(
bench
ADD_CUSTOM_TARGET
(
bench
COMMAND
${
CMAKE_SOURCE_DIR
}
/tests/benc.sh
COMMAND
${
CMAKE_SOURCE_DIR
}
/tests/bdec.sh
DEPENDS aec_client utime
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment