Skip to content

Commit 9646d11

Browse files
committed
fix: remove avx2 requirement for linux
1 parent 2b97ac6 commit 9646d11

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

BUILDING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ If all goes to plan, a folder called 'staging' has been created with everything
9696

9797
-DUSE_SYSTEM_CEF=OFF - (Linux only, default ON) use the version of CEF from your OS. This expects to be using builds from https://launchpad.net/~casparcg/+archive/ubuntu/ppa
9898

99-
-DENABLE_AVX2=ON (Linux only, default ON) Enable the AVX and AVX2 instruction sets (requires a CPU that supports it)
99+
-DENABLE_AVX2=ON (Linux only, default OFF) Enable the AVX and AVX2 instruction sets (requires a CPU that supports it)
100100

101101
-DDIAG_FONT_PATH - Specify an alternate path/font to use for the DIAG window. On linux, this will often want to be set to an absolute path of a font
102102

src/CMakeModules/Bootstrap_Linux.cmake

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ set(ENABLE_HTML ON CACHE BOOL "Enable CEF and HTML producer")
1515
set(USE_STATIC_BOOST OFF CACHE BOOL "Use shared library version of Boost")
1616
set(USE_SYSTEM_CEF ON CACHE BOOL "Use the version of cef from your OS (only tested with Ubuntu)")
1717
set(CASPARCG_BINARY_NAME "casparcg" CACHE STRING "Custom name of the binary to build (this disables some install files)")
18-
set(ENABLE_AVX2 ON CACHE BOOL "Enable the AVX2 instruction set (requires a CPU that supports it)")
18+
set(ENABLE_AVX2 OFF CACHE BOOL "Enable the AVX2 instruction set (requires a CPU that supports it)")
1919

2020
# Determine build (target) platform
2121
SET (PLATFORM_FOLDER_NAME "linux")
@@ -131,11 +131,12 @@ IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x64|x86_64|amd64|e2k)")
131131
ADD_COMPILE_OPTIONS (-mavx)
132132
ADD_COMPILE_OPTIONS (-mavx2)
133133
ENDIF ()
134+
ELSE ()
135+
ADD_COMPILE_DEFINITIONS (USE_SIMDE) # Enable OpenMP support in simde
136+
ADD_COMPILE_DEFINITIONS (SIMDE_ENABLE_OPENMP) # Enable OpenMP support in simde
137+
ADD_COMPILE_OPTIONS (-fopenmp-simd) # Enable OpenMP SIMD support
134138
ENDIF ()
135139

136-
ADD_COMPILE_DEFINITIONS (USE_SIMDE) # Enable OpenMP support in simde
137-
ADD_COMPILE_DEFINITIONS (SIMDE_ENABLE_OPENMP) # Enable OpenMP support in simde
138-
ADD_COMPILE_OPTIONS (-fopenmp-simd) # Enable OpenMP SIMD support
139140
ADD_COMPILE_OPTIONS (-fnon-call-exceptions) # Allow signal handler to throw exception
140141

141142
ADD_COMPILE_OPTIONS (-Wno-deprecated-declarations -Wno-write-strings -Wno-multichar -Wno-cpp -Werror)

src/modules/decklink/consumer/config.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,16 @@ configuration parse_xml_config(const boost::property_tree::wptree& ptree,
137137
<< msg_info(L"The decklink consumer only supports rgba output on 8-bit channels"));
138138
}
139139

140+
if (config.pixel_format != configuration::pixel_format_t::rgba) {
140141
#ifdef WIN32
141-
if (!CHECK_INSTRUCTION_SUPPORT(__IA_SUPPORT_VECTOR256, 0) &&
142-
config.pixel_format != configuration::pixel_format_t::rgba) {
143-
CASPAR_THROW_EXCEPTION(user_error()
144-
<< msg_info(L"You cpu does not support the features needed for yuv output"));
145-
}
142+
if (!CHECK_INSTRUCTION_SUPPORT(__IA_SUPPORT_VECTOR256, 0)) {
143+
#else
144+
if (!__builtin_cpu_supports("avx2")) {
146145
#endif
146+
CASPAR_THROW_EXCEPTION(user_error()
147+
<< msg_info(L"You cpu does not support the features needed for yuv output"));
148+
}
149+
}
147150
}
148151

149152
config.primary = parse_output_config(ptree, format_repository);

src/modules/decklink/consumer/v210_strategies.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
#include "../StdAfx.h"
2323

24+
// Force this file to compile with avx2, as it has been crafted with intrinsics that require it.
25+
#pragma GCC target("avx2")
26+
2427
#ifdef USE_SIMDE
2528
#define SIMDE_ENABLE_NATIVE_ALIASES
2629
#include <simde/x86/avx2.h>

0 commit comments

Comments
 (0)