Some CMake file clean up and a fix for non X86 build.

from Brad (maintainer)
This commit is contained in:
ajacoutot 2020-06-20 11:12:50 +00:00
parent 6e49442527
commit c13dbccffa
7 changed files with 235 additions and 0 deletions

View File

@ -0,0 +1,57 @@
$OpenBSD: patch-CMakeLists_txt,v 1.1 2020/06/20 11:12:50 ajacoutot Exp $
Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -10,17 +10,8 @@ if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CUR
"Please use the Build folder or create your own.")
endif()
-option(YASM "Use yasm (if present in PATH)" ON)
-if(YASM)
- find_program(YASM_EXE yasm)
- if(YASM_EXE AND NOT CMAKE_ASM_NASM_COMPILER MATCHES "yasm")
- set(CMAKE_ASM_NASM_COMPILER ${YASM_EXE})
- message(STATUS "Found YASM: ${YASM_EXE}")
- endif()
-endif()
-
project(svt-av1 VERSION 0.8.3
- LANGUAGES C CXX ASM_NASM)
+ LANGUAGES C CXX)
# Default build type to release if the generator does not has its own set of build types
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
@@ -29,6 +20,32 @@ endif()
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
message(WARNING "32-bit is not supported")
+endif()
+
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
+ set(X86 TRUE)
+ find_program(YASM_EXE yasm)
+ option(ENABLE_NASM "Use nasm if available (Uses yasm by default if found)" OFF)
+ if(YASM_EXE AND NOT CMAKE_ASM_NASM_COMPILER MATCHES "yasm" AND NOT ENABLE_NASM)
+ set(CMAKE_ASM_NASM_COMPILER "${YASM_EXE}" CACHE FILEPATH "Path to nasm compatible compiler" FORCE)
+ else()
+ set(NASM_VERSION "0.0.0")
+ include(CheckLanguage)
+ check_language(ASM_NASM)
+ execute_process(COMMAND ${CMAKE_ASM_NASM_COMPILER} -v
+ OUTPUT_VARIABLE NASM_VERSION
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX MATCH "([.0-9])+" NASM_VERSION "${NASM_VERSION}")
+ # NASM_VERSION should now contain something like 2.14.02
+ # Needs to error out on a version less than 2.14
+ if(NASM_VERSION VERSION_LESS "2.14" AND CMAKE_ASM_NASM_COMPILER MATCHES "nasm")
+ message(FATAL_ERROR "Found nasm is too old (requires at least 2.14, found ${NASM_VERSION})!")
+ endif()
+ endif()
+ enable_language(ASM_NASM)
+else()
+ set(X86 FALSE)
endif()
include(GNUInstallDirs)

View File

@ -0,0 +1,37 @@
$OpenBSD: patch-Source_Lib_Common_CMakeLists_txt,v 1.1 2020/06/20 11:12:50 ajacoutot Exp $
Index: Source/Lib/Common/CMakeLists.txt
--- Source/Lib/Common/CMakeLists.txt.orig
+++ Source/Lib/Common/CMakeLists.txt
@@ -18,23 +18,16 @@ macro(test_apply_compiler_flags)
message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: ${CMAKE_C_FLAGS}")
endif()
endmacro()
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
- set (X86 TRUE)
-else ()
- set (X86 FALSE)
-endif ()
add_library(common_lib INTERFACE)
-if(X86)
add_subdirectory(Codec)
add_subdirectory(C_DEFAULT)
-add_subdirectory(ASM_SSE2)
-add_subdirectory(ASM_SSSE3)
-add_subdirectory(ASM_SSE4_1)
-add_subdirectory(ASM_AVX2)
-add_subdirectory(ASM_AVX512)
-else ()
-add_subdirectory(Codec)
-add_subdirectory(C_DEFAULT)
-endif ()
+
+if(X86)
+ add_subdirectory(ASM_SSE2)
+ add_subdirectory(ASM_SSSE3)
+ add_subdirectory(ASM_SSE4_1)
+ add_subdirectory(ASM_AVX2)
+ add_subdirectory(ASM_AVX512)
+endif()

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-Source_Lib_Common_Codec_CMakeLists_txt,v 1.1 2020/06/20 11:12:50 ajacoutot Exp $
Index: Source/Lib/Common/Codec/CMakeLists.txt
--- Source/Lib/Common/Codec/CMakeLists.txt.orig
+++ Source/Lib/Common/Codec/CMakeLists.txt
@@ -3,11 +3,6 @@
# SPDX - License - Identifier: BSD - 2 - Clause - Patent
#
# Common/Codec Directory CMakeLists.txt
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
- set (X86 TRUE)
-else ()
- set (X86 FALSE)
-endif ()
add_custom_target(EbVersionHeaderGen
${CMAKE_COMMAND}

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-Source_Lib_Decoder_CMakeLists_txt,v 1.1 2020/06/20 11:12:50 ajacoutot Exp $
Index: Source/Lib/Decoder/CMakeLists.txt
--- Source/Lib/Decoder/CMakeLists.txt.orig
+++ Source/Lib/Decoder/CMakeLists.txt
@@ -9,11 +9,6 @@ set(DEC_VERSION_MAJOR 0)
set(DEC_VERSION_MINOR 8)
set(DEC_VERSION_PATCH 3)
set(DEC_VERSION ${DEC_VERSION_MAJOR}.${DEC_VERSION_MINOR}.${DEC_VERSION_PATCH})
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
- set(X86 TRUE)
-else()
- set(X86 FALSE)
-endif()
if(UNIX)
if(NOT APPLE)

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-Source_Lib_Encoder_CMakeLists_txt,v 1.1 2020/06/20 11:12:50 ajacoutot Exp $
Index: Source/Lib/Encoder/CMakeLists.txt
--- Source/Lib/Encoder/CMakeLists.txt.orig
+++ Source/Lib/Encoder/CMakeLists.txt
@@ -10,12 +10,6 @@ set(ENC_VERSION_MINOR 8)
set(ENC_VERSION_PATCH 3)
set(ENC_VERSION ${ENC_VERSION_MAJOR}.${ENC_VERSION_MINOR}.${ENC_VERSION_PATCH})
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
- set(X86 TRUE)
-else()
- set(X86 FALSE)
-endif()
-
if(UNIX)
if(NOT APPLE)
find_library(M_LIB name m)

View File

@ -0,0 +1,45 @@
$OpenBSD: patch-Source_Lib_Encoder_Codec_CMakeLists_txt,v 1.1 2020/06/20 11:12:50 ajacoutot Exp $
Index: Source/Lib/Encoder/Codec/CMakeLists.txt
--- Source/Lib/Encoder/Codec/CMakeLists.txt.orig
+++ Source/Lib/Encoder/Codec/CMakeLists.txt
@@ -4,31 +4,23 @@
#
# C_DEFAULT Directory CMakeLists.txt
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
- set (X86 TRUE)
-else ()
- set (X86 FALSE)
-endif ()
-if(X86)
+
# Include Encoder Subdirectories
include_directories(../../../API
../../Encoder/Codec
${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/C_DEFAULT/
+ ${PROJECT_SOURCE_DIR}/third_party/fastfeat/
+ ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Globals/
+ )
+
+if(X86)
+# Include Encoder Subdirectories
+include_directories(
${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_SSE2/
${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_SSSE3/
${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_SSE4_1/
${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_AVX2/
${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_AVX512/
- ${PROJECT_SOURCE_DIR}/third_party/fastfeat/
- ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Globals/
- )
-else ()
-# Include Encoder Subdirectories
-include_directories(../../../API
- ../../Encoder/Codec
- ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/C_DEFAULT/
- ${PROJECT_SOURCE_DIR}/third_party/fastfeat/
- ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Globals/
)
endif ()
file(GLOB all_files

View File

@ -0,0 +1,44 @@
$OpenBSD: patch-Source_Lib_Encoder_Globals_CMakeLists_txt,v 1.1 2020/06/20 11:12:50 ajacoutot Exp $
Index: Source/Lib/Encoder/Globals/CMakeLists.txt
--- Source/Lib/Encoder/Globals/CMakeLists.txt.orig
+++ Source/Lib/Encoder/Globals/CMakeLists.txt
@@ -4,31 +4,23 @@
#
# Globals Directory CMakeLists.txt
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
- set (X86 TRUE)
-else ()
- set (X86 FALSE)
-endif ()
-if(X86)
+
# Include Encoder Subdirectories
include_directories(../../../API
${PROJECT_BINARY_DIR}/Source/Lib/Common/Codec/
${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec
${PROJECT_SOURCE_DIR}/Source/Lib/Common/C_DEFAULT/
+ ${PROJECT_SOURCE_DIR}/third_party/fastfeat/
+ )
+
+if(X86)
+# Include Encoder Subdirectories
+include_directories(
${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_SSE2/
${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_SSSE3/
${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_SSE4_1/
${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_AVX2/
${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_AVX512/
- ${PROJECT_SOURCE_DIR}/third_party/fastfeat/
- )
-else()
-# Include Encoder Subdirectories
-include_directories(../../../API
- ${PROJECT_BINARY_DIR}/Source/Lib/Common/Codec/
- ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec
- ${PROJECT_SOURCE_DIR}/Source/Lib/Common/C_DEFAULT/
- ${PROJECT_SOURCE_DIR}/third_party/fastfeat/
)
endif()