diff options
author | Boyuan Yang <byang@debian.org> | 2021-11-07 08:50:18 -0500 |
---|---|---|
committer | Boyuan Yang <byang@debian.org> | 2021-11-07 08:50:18 -0500 |
commit | 320ef65362608ee1148c299d8d5d7618af34e470 (patch) | |
tree | c47911c219d1e35b8b0771e9e0176eff0e0d08ec /cmake | |
parent | 2381d803c76105f44717d75f089ec37f51e5cfe4 (diff) | |
download | libgav1-320ef65362608ee1148c299d8d5d7618af34e470.tar.gz libgav1-320ef65362608ee1148c299d8d5d7618af34e470.tar.bz2 libgav1-320ef65362608ee1148c299d8d5d7618af34e470.zip |
New upstream version 0.17.0
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/libgav1_build_definitions.cmake | 11 | ||||
-rw-r--r-- | cmake/libgav1_cpu_detection.cmake | 3 | ||||
-rw-r--r-- | cmake/libgav1_flags.cmake | 13 | ||||
-rw-r--r-- | cmake/libgav1_targets.cmake | 28 | ||||
-rw-r--r-- | cmake/toolchains/aarch64-linux-gnu.cmake | 9 | ||||
-rw-r--r-- | cmake/toolchains/arm-linux-gnueabihf.cmake | 9 |
6 files changed, 66 insertions, 7 deletions
diff --git a/cmake/libgav1_build_definitions.cmake b/cmake/libgav1_build_definitions.cmake index fc83490..0d00bb6 100644 --- a/cmake/libgav1_build_definitions.cmake +++ b/cmake/libgav1_build_definitions.cmake @@ -32,7 +32,7 @@ macro(libgav1_set_build_definitions) # # We set LIBGAV1_SOVERSION = [c-a].a.r set(LT_CURRENT 0) - set(LT_REVISION 0) + set(LT_REVISION 1) set(LT_AGE 0) math(EXPR LIBGAV1_SOVERSION_MAJOR "${LT_CURRENT} - ${LT_AGE}") set(LIBGAV1_SOVERSION "${LIBGAV1_SOVERSION_MAJOR}.${LT_AGE}.${LT_REVISION}") @@ -53,7 +53,8 @@ macro(libgav1_set_build_definitions) "LIBGAV1_FLAGS_TMPDIR=\"/tmp\"") if(MSVC OR WIN32) - list(APPEND libgav1_defines "_CRT_SECURE_NO_DEPRECATE=1" "NOMINMAX=1") + list(APPEND libgav1_defines "_CRT_SECURE_NO_WARNINGS" "NOMINMAX" + "_SCL_SECURE_NO_WARNINGS") endif() if(ANDROID) @@ -159,7 +160,7 @@ macro(libgav1_set_build_definitions) # Source file names ending in these suffixes will have the appropriate # compiler flags added to their compile commands to enable intrinsics. - set(libgav1_avx2_source_file_suffix "avx2.cc") - set(libgav1_neon_source_file_suffix "neon.cc") - set(libgav1_sse4_source_file_suffix "sse4.cc") + set(libgav1_avx2_source_file_suffix "avx2(_test)?.cc") + set(libgav1_neon_source_file_suffix "neon(_test)?.cc") + set(libgav1_sse4_source_file_suffix "sse4(_test)?.cc") endmacro() diff --git a/cmake/libgav1_cpu_detection.cmake b/cmake/libgav1_cpu_detection.cmake index e17e27c..d79b83a 100644 --- a/cmake/libgav1_cpu_detection.cmake +++ b/cmake/libgav1_cpu_detection.cmake @@ -33,17 +33,20 @@ macro(libgav1_optimization_detect) list(APPEND libgav1_defines "LIBGAV1_ENABLE_AVX2=1") else() list(APPEND libgav1_defines "LIBGAV1_ENABLE_AVX2=0") + set(libgav1_have_avx2 OFF) endif() if(libgav1_have_neon AND LIBGAV1_ENABLE_NEON) list(APPEND libgav1_defines "LIBGAV1_ENABLE_NEON=1") else() list(APPEND libgav1_defines "LIBGAV1_ENABLE_NEON=0") + set(libgav1_have_neon, OFF) endif() if(libgav1_have_sse4 AND LIBGAV1_ENABLE_SSE4_1) list(APPEND libgav1_defines "LIBGAV1_ENABLE_SSE4_1=1") else() list(APPEND libgav1_defines "LIBGAV1_ENABLE_SSE4_1=0") + set(libgav1_have_sse4 OFF) endif() endmacro() diff --git a/cmake/libgav1_flags.cmake b/cmake/libgav1_flags.cmake index a5408e2..4f2c4fd 100644 --- a/cmake/libgav1_flags.cmake +++ b/cmake/libgav1_flags.cmake @@ -259,5 +259,18 @@ macro(libgav1_set_test_flags) if(LIBGAV1_ENABLE_TESTS) set(LIBGAV1_TEST_CXX_FLAGS ${LIBGAV1_CXX_FLAGS}) list(FILTER LIBGAV1_TEST_CXX_FLAGS EXCLUDE REGEX "-Wframe-larger-than") + + if(NOT CMAKE_CXX_COMPILER_ID STREQUAL CMAKE_C_COMPILER_ID) + message( + FATAL_ERROR + "C/CXX compiler mismatch (${CMAKE_C_COMPILER_ID} vs" + " ${CMAKE_CXX_COMPILER_ID})! Compiler flags are only tested using" + " CMAKE_CXX_COMPILER, rerun cmake with CMAKE_C_COMPILER set to the" + " C compiler from the same package as CMAKE_CXX_COMPILER to ensure" + " the build completes successfully.") + endif() + set(LIBGAV1_TEST_C_FLAGS ${LIBGAV1_TEST_CXX_FLAGS}) + list(FILTER LIBGAV1_TEST_C_FLAGS EXCLUDE REGEX + "-fvisibility-inlines-hidden") endif() endmacro() diff --git a/cmake/libgav1_targets.cmake b/cmake/libgav1_targets.cmake index 997f8bd..f8326a9 100644 --- a/cmake/libgav1_targets.cmake +++ b/cmake/libgav1_targets.cmake @@ -17,6 +17,14 @@ if(LIBGAV1_CMAKE_GAV1_TARGETS_CMAKE_) endif() # LIBGAV1_CMAKE_GAV1_TARGETS_CMAKE_ set(LIBGAV1_CMAKE_GAV1_TARGETS_CMAKE_ 1) +if(LIBGAV1_IDE_FOLDER) + set(LIBGAV1_EXAMPLES_IDE_FOLDER "${LIBGAV1_IDE_FOLDER}/examples") + set(LIBGAV1_TESTS_IDE_FOLDER "${LIBGAV1_IDE_FOLDER}/tests") +else() + set(LIBGAV1_EXAMPLES_IDE_FOLDER "libgav1_examples") + set(LIBGAV1_TESTS_IDE_FOLDER "libgav1_tests") +endif() + # Resets list variables used to track libgav1 targets. macro(libgav1_reset_target_lists) unset(libgav1_targets) @@ -100,6 +108,13 @@ macro(libgav1_add_executable) endif() add_executable(${exe_NAME} ${exe_SOURCES}) + if(exe_TEST) + add_test(NAME ${exe_NAME} COMMAND ${exe_NAME}) + set_property(TARGET ${exe_NAME} PROPERTY FOLDER ${LIBGAV1_TESTS_IDE_FOLDER}) + else() + set_property(TARGET ${exe_NAME} + PROPERTY FOLDER ${LIBGAV1_EXAMPLES_IDE_FOLDER}) + endif() if(exe_OUTPUT_NAME) set_target_properties(${exe_NAME} PROPERTIES OUTPUT_NAME ${exe_OUTPUT_NAME}) @@ -366,4 +381,17 @@ macro(libgav1_add_library) libgav1_create_dummy_source_file(TARGET ${lib_NAME} BASENAME ${lib_NAME}) endif() endif() + + if(lib_TEST) + set_property(TARGET ${lib_NAME} PROPERTY FOLDER ${LIBGAV1_TESTS_IDE_FOLDER}) + else() + set(sources_list ${lib_SOURCES}) + list(FILTER sources_list INCLUDE REGEX examples) + if(sources_list) + set_property(TARGET ${lib_NAME} + PROPERTY FOLDER ${LIBGAV1_EXAMPLES_IDE_FOLDER}) + else() + set_property(TARGET ${lib_NAME} PROPERTY FOLDER ${LIBGAV1_IDE_FOLDER}) + endif() + endif() endmacro() diff --git a/cmake/toolchains/aarch64-linux-gnu.cmake b/cmake/toolchains/aarch64-linux-gnu.cmake index 7ffe397..fdcb012 100644 --- a/cmake/toolchains/aarch64-linux-gnu.cmake +++ b/cmake/toolchains/aarch64-linux-gnu.cmake @@ -23,6 +23,13 @@ if("${CROSS}" STREQUAL "") set(CROSS aarch64-linux-gnu-) endif() -set(CMAKE_CXX_COMPILER ${CROSS}g++) +# For c_decoder_test.c and c_version_test.c. +if(NOT CMAKE_C_COMPILER) + set(CMAKE_C_COMPILER ${CROSS}gcc) +endif() +set(CMAKE_C_FLAGS_INIT "-march=armv8-a") +if(NOT CMAKE_CXX_COMPILER) + set(CMAKE_CXX_COMPILER ${CROSS}g++) +endif() set(CMAKE_CXX_FLAGS_INIT "-march=armv8-a") set(CMAKE_SYSTEM_PROCESSOR "aarch64") diff --git a/cmake/toolchains/arm-linux-gnueabihf.cmake b/cmake/toolchains/arm-linux-gnueabihf.cmake index 8051f0d..7448f54 100644 --- a/cmake/toolchains/arm-linux-gnueabihf.cmake +++ b/cmake/toolchains/arm-linux-gnueabihf.cmake @@ -23,7 +23,14 @@ if("${CROSS}" STREQUAL "") set(CROSS arm-linux-gnueabihf-) endif() -set(CMAKE_CXX_COMPILER ${CROSS}g++) +# For c_decoder_test.c and c_version_test.c. +if(NOT CMAKE_C_COMPILER) + set(CMAKE_C_COMPILER ${CROSS}gcc) +endif() +set(CMAKE_C_FLAGS_INIT "-march=armv7-a -marm") +if(NOT CMAKE_CXX_COMPILER) + set(CMAKE_CXX_COMPILER ${CROSS}g++) +endif() set(CMAKE_CXX_FLAGS_INIT "-march=armv7-a -marm") set(CMAKE_SYSTEM_PROCESSOR "armv7") set(LIBGAV1_NEON_INTRINSICS_FLAG "-mfpu=neon") |