Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mainly build system fixes #177

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .gitlab-ci-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,19 @@ build_mingw_ubuntu2204:
extends: .build_only_template_full
image: $CI_REGISTRY/pub/dockerimages/ubuntu_2204_full:latest
variables:
toolchainfile: cmake/toolchains/x86_64-w64-mingw32-gcc-posix-ubuntu2204.cmake
toolchainfile: cmake/toolchains/x86_64-w64-mingw32-gcc-posix-ubuntu.cmake

build_aarch64_gcc_ubuntu2204:
extends: .build_only_template_full
image: $CI_REGISTRY/pub/dockerimages/ubuntu_2204_full:latest
variables:
toolchainfile: cmake/toolchains/aarch64-linux-gnu-gcc-ubuntu2204.cmake
toolchainfile: cmake/toolchains/aarch64-linux-gnu-gcc-ubuntu.cmake

build_armv7_gcc_ubuntu2204:
extends: .build_only_template_full
image: $CI_REGISTRY/pub/dockerimages/ubuntu_2204_full:latest
variables:
toolchainfile: cmake/toolchains/arm-linux-gnueabihf-gcc-ubuntu.cmake

build_ios:
extends: .build_only_template_full
Expand Down Expand Up @@ -297,6 +303,15 @@ test_vc193x_Win32:
tags:
- vc193x

build_vc193x_arm64:
extends: .build_only_template_full
variables:
MSVC_ARCH: arm64
tags:
- vc193x
script:
- make msvc-arch=${MSVC_ARCH} all

test_macos_arm64:
extends: .build_test_macos_template
variables:
Expand Down
61 changes: 53 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,59 @@ endif()
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" )
message( STATUS "CMAKE_MODULE_PATH: updating module path to: ${CMAKE_MODULE_PATH}" )

set( VVDEC_ARM_SIMD_DEFAULT FALSE )
if( ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64\|arm"
OR "${CMAKE_CXX_COMPILER}" MATCHES "aarch64\|arm"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64\|armv" )
AND NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86\|x64" )
# # dump all cmake variables
# get_cmake_property(_variableNames VARIABLES)
# list (SORT _variableNames)
# foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
# endforeach()

function( append_cpu_type_guess output_list input_str )
set( ret ${${output_list}} )

string( TOLOWER "${input_str}" input_lower )
if( ${input_lower} MATCHES "x86\|i386\|x64\|win32\|amd64" )
list( APPEND ret "X86" )
elseif( ${input_lower} MATCHES "aarch64\|arm")
list( APPEND ret "ARM" )
endif()

set( ${output_list} ${ret} PARENT_SCOPE )
endfunction()

# try to detect the actual target architecture
if( ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten" )
message( DEBUG "Emscripten" )
# Emscripten doesn't set the CMAKE_SYSTEM_PROCESSOR
list( PREPEND vvdec_target_arch_list "WASM" )
elseif( NOT CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR )
message( DEBUG "sys != host ${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR} " )
# cross compiling: CMAKE_SYSTEM_PROCESSOR was set explicitly, so we use that as first guess
append_cpu_type_guess( vvdec_target_arch_list "${CMAKE_SYSTEM_PROCESSOR}" )
endif()

# build list of architectures in order of probability
append_cpu_type_guess( vvdec_target_arch_list "${CMAKE_VS_PLATFORM_NAME}" )
append_cpu_type_guess( vvdec_target_arch_list "${CMAKE_OSX_ARCHITECTURES}" )
append_cpu_type_guess( vvdec_target_arch_list "${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" ) # set by msvc, wen not using msbuild
append_cpu_type_guess( vvdec_target_arch_list "${CMAKE_ANDROID_ARCH_ABI}" )
append_cpu_type_guess( vvdec_target_arch_list "${CMAKE_C_LIBRARY_ARCHITECTURE}" )
append_cpu_type_guess( vvdec_target_arch_list "${CMAKE_SYSTEM_PROCESSOR}" )
append_cpu_type_guess( vvdec_target_arch_list "${CMAKE_HOST_SYSTEM_PROCESSOR}" )
list( APPEND vvdec_target_arch_list "UNKNOWN" ) # no architecture for which we have specific optimizations
message( DEBUG "vvdec_target_arch_list: ${vvdec_target_arch_list}" )

# get most probable architecture
list( POP_FRONT vvdec_target_arch_list VVDEC_TARGET_ARCH )
message( STATUS "normalized target architecture: ${VVDEC_TARGET_ARCH}" )
unset( vvdec_target_arch_list )

if( VVDEC_TARGET_ARCH STREQUAL "ARM" )
set( VVDEC_ARM_SIMD_DEFAULT TRUE )
if( MSVC )
message( STATUS "ARM SIMD intinsics disabling default on MSVC" )
set( VVDEC_ARM_SIMD_DEFAULT FALSE )
endif()
endif()

# we enable x86 intrinsics for all target architectures, because they are implemented through simd-everywhere on non-x86
Expand Down Expand Up @@ -61,9 +108,7 @@ if( VVDEC_ENABLE_ARM_SIMD )
add_compile_definitions( TARGET_SIMD_ARM )
endif()

if( ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten" )
set( VVDEC_TARGET_WASM TRUE )

if( VVDEC_TARGET_ARCH STREQUAL "WASM" )
add_compile_options( -pthread )
add_link_options(
--bind
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ VVdeC, the Fraunhofer Versatile Video Decoder, is a fast software H.266/VVC deco
</tr>
<tr>
<td>armv7</td>
<td>:black_square_button:</td>
<td>:x:</td>
<td>armv7</td>
<td>:white_check_mark:</td>
<td></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,11 @@ set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH )

set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

set( USE_OPENCV_TOOLCHAIN_FLAGS ON )
if( USE_OPENCV_TOOLCHAIN_FLAGS )
# ---
# Snatched from OpenCV 3.4.2-1
# ---

set( CMAKE_CXX_FLAGS_INIT "-fdata-sections -Wa,--noexecstack -fsigned-char" )
set( CMAKE_C_FLAGS_INIT "-fdata-sections -Wa,--noexecstack -fsigned-char" )

set( ARM_LINKER_FLAGS "-Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now" )

set( CMAKE_SHARED_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" )
set( CMAKE_MODULE_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" )

endif()
set( ARM_COMPILER_FLAGS "-fdata-sections -Wa,--noexecstack -fsigned-char" )
set( CMAKE_C_FLAGS_INIT "${ARM_COMPILER_FLAGS}" )
set( CMAKE_CXX_FLAGS_INIT "${ARM_COMPILER_FLAGS}" )

set( ARM_LINKER_FLAGS "-Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now" )
set( CMAKE_SHARED_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" )
set( CMAKE_MODULE_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" )
45 changes: 0 additions & 45 deletions cmake/toolchains/aarch64-linux-gnu-gcc-ubuntu2004.cmake

This file was deleted.

45 changes: 0 additions & 45 deletions cmake/toolchains/aarch64-linux-gnu-gcc-ubuntu2204.cmake

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# name of the target operating system
set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_SYSTEM_PROCESSOR aarch64 )
set( CMAKE_SYSTEM_PROCESSOR arm )

set( GNU_MACHINE "aarch64-linux-gnu" )
set( GNU_MACHINE "arm-linux-gnueabihf" )

# which compilers to use for C and C++
set( CMAKE_C_COMPILER ${GNU_MACHINE}-gcc )
Expand All @@ -27,19 +27,11 @@ set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH )

set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

set( USE_OPENCV_TOOLCHAIN_FLAGS ON )
if( USE_OPENCV_TOOLCHAIN_FLAGS )
# ---
# Snatched from OpenCV 3.4.2-1
# ---
set( ARM_COMPILER_FLAGS "-fdata-sections -Wa,--noexecstack -fsigned-char -march=armv7-a -mfloat-abi=hard -mfpu=neon-vfpv3" )
set( CMAKE_C_FLAGS_INIT "${ARM_COMPILER_FLAGS}" )
set( CMAKE_CXX_FLAGS_INIT "${ARM_COMPILER_FLAGS}" )

set( CMAKE_CXX_FLAGS_INIT "-fdata-sections -Wa,--noexecstack -fsigned-char" )
set( CMAKE_C_FLAGS_INIT "-fdata-sections -Wa,--noexecstack -fsigned-char" )

set( ARM_LINKER_FLAGS "-Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now" )

set( CMAKE_SHARED_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" )
set( CMAKE_MODULE_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" )

endif()
set( ARM_LINKER_FLAGS "-Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now" )
set( CMAKE_SHARED_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" )
set( CMAKE_MODULE_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" )
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@ set( CMAKE_RC_COMPILER i686-w64-mingw32-windres )
# /usr/x86_64-w64-mingw32/include
# /usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include
# /usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/libstdc++.a
set( CMAKE_FIND_ROOT_PATH /usr/share/mingw-w64 /usr/i686-w64-mingw32 /usr/lib/gcc/i686-w64-mingw32/5.3-posix )
set( CMAKE_FIND_ROOT_PATH /usr/share/mingw-w64 /usr/i686-w64-mingw32 )

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

set( bb_MINGW_RUNTIME_FILES
/usr/lib/gcc/i686-w64-mingw32/5.3-posix/libstdc++-6.dll
/usr/lib/gcc/i686-w64-mingw32/5.3-posix/libgcc_s_sjlj-1.dll
/usr/i686-w64-mingw32/lib/libwinpthread-1.dll )
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@ set( CMAKE_RC_COMPILER x86_64-w64-mingw32-windres )
# /usr/x86_64-w64-mingw32/include
# /usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include
# /usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/libstdc++.a
set( CMAKE_FIND_ROOT_PATH /usr/share/mingw-w64 /usr/x86_64-w64-mingw32 /usr/lib/gcc/x86_64-w64-mingw32/10-posix )
set( CMAKE_FIND_ROOT_PATH /usr/share/mingw-w64 /usr/x86_64-w64-mingw32 )

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

set( bb_MINGW_RUNTIME_FILES
/usr/lib/gcc/x86_64-w64-mingw32/10-posix/libstdc++-6.dll
/usr/lib/gcc/x86_64-w64-mingw32/10-posix/libgcc_s_seh-1.dll
/usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll )
31 changes: 0 additions & 31 deletions cmake/toolchains/x86_64-w64-mingw32-gcc-posix-ubuntu1604.cmake

This file was deleted.

31 changes: 0 additions & 31 deletions cmake/toolchains/x86_64-w64-mingw32-gcc-posix-ubuntu1804.cmake

This file was deleted.

Loading