Browse Source

Merge pull request #2341 from FlyGoat/cross-plat

Add support for MIPS architecture
Jim 6 years ago
parent
commit
b88ea35c34

+ 19 - 1
CMakeLists.txt

@@ -78,8 +78,26 @@ if(${CMAKE_C_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "C
 	set(CMAKE_COMPILER_IS_CLANG TRUE)
 endif()
 
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64(le)?")
+if (MSVC_CXX_ARCHITECTURE_ID)
+    string(TOLOWER ${MSVC_CXX_ARCHITECTURE_ID} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
+else ()
+    string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
+endif ()
+
+if(LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86|x64|x86_64|amd64)")
+	set(NEEDS_SIMDE "0")
+	if(NOT MSVC)
+		set(ARCH_SIMD_FLAGS "-mmmx" "-msse" "-msse2")
+	endif()
+elseif(LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64(le)?")
+	set(NEEDS_SIMDE "0")
+	set(ARCH_SIMD_FLAGS "-mvsx")
 	add_compile_definitions(NO_WARN_X86_INTRINSICS)
+else()
+	set(NEEDS_SIMDE "1")
+	add_definitions(-DNEEDS_SIMDE=1)
+	set(ARCH_SIMD_FLAGS "")
+	message(STATUS "No Native SSE2 SIMD Support - Using SIMDE")
 endif()
 
 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)

+ 4 - 15
deps/media-playback/CMakeLists.txt

@@ -23,26 +23,15 @@ add_library(media-playback STATIC
 	${media-playback_SOURCES}
 	)
 
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64(le)?")
-	target_compile_options(media-playback
-			PUBLIC
-			-mvsx)
-	add_compile_definitions(NO_WARN_X86_INTRINSICS)
-elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
-	target_compile_options(media-playback
-			PUBLIC)
-elseif(NOT MSVC)
-	target_compile_options(media-playback
-		PUBLIC
-			-mmmx
-			-msse
-			-msse2)
-endif()
+target_compile_options(media-playback
+	PUBLIC
+	${ARCH_SIMD_FLAGS})
 
 target_include_directories(media-playback
 	PUBLIC .
 	)
 
+
 if(NOT MSVC)
         if(NOT MINGW)
                 target_compile_options(media-playback PRIVATE -fPIC)

+ 12 - 24
libobs/CMakeLists.txt

@@ -174,20 +174,21 @@ elseif(UNIX)
 		util/pipe-posix.c
 		util/platform-nix.c)
 
-	if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
+	if(NEEDS_SIMDE)
 		set(libobs_PLATFORM_HEADERS
-			util/aarch/check.h
-			util/aarch/hedley.h
-			util/aarch/mmx.h
-			util/aarch/simde-arch.h
-			util/aarch/simde-common.h
-			util/aarch/sse.h
-			util/aarch/sse2.h
+			util/simde/check.h
+			util/simde/hedley.h
+			util/simde/mmx.h
+			util/simde/simde-arch.h
+			util/simde/simde-common.h
+			util/simde/sse.h
+			util/simde/sse2.h
 			util/threading-posix.h)
 	else()
 		set(libobs_PLATFORM_HEADERS
 			util/threading-posix.h)
 	endif()
+
 	if(HAVE_PULSEAUDIO)
 		set(libobs_audio_monitoring_HEADERS
 			audio-monitoring/pulse/pulseaudio-wrapper.h)
@@ -475,22 +476,9 @@ target_compile_definitions(libobs
 	PUBLIC
 		HAVE_OBSCONFIG_H)
 
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64(le)?")
-	target_compile_options(libobs
-		PUBLIC
-			-mvsx)
-	add_compile_definitions(NO_WARN_X86_INTRINSICS)
-elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
-        target_compile_options(libobs
-                        PUBLIC)
-elseif(NOT MSVC)
-	target_compile_options(libobs
-		PUBLIC
-			-mmmx
-			-msse
-			-msse2)
-endif()
-
+target_compile_options(libobs
+	PUBLIC
+	${ARCH_SIMD_FLAGS})
 
 target_compile_options(libobs
 	PUBLIC

+ 1 - 0
libobs/obsconfig.h.in

@@ -19,6 +19,7 @@
 #define HAVE_DBUS @HAVE_DBUS@
 #define HAVE_PULSEAUDIO @HAVE_PULSEAUDIO@
 #define USE_XINPUT @USE_XINPUT@
+#define NEEDS_SIMDE @NEEDS_SIMDE@
 #define LIBOBS_IMAGEMAGICK_DIR_STYLE_6L 6
 #define LIBOBS_IMAGEMAGICK_DIR_STYLE_7GE 7
 #define LIBOBS_IMAGEMAGICK_DIR_STYLE @LIBOBS_IMAGEMAGICK_DIR_STYLE@

+ 0 - 0
libobs/util/aarch/check.h → libobs/util/simde/check.h


+ 0 - 0
libobs/util/aarch/hedley.h → libobs/util/simde/hedley.h


+ 0 - 0
libobs/util/aarch/mmx.h → libobs/util/simde/mmx.h


+ 0 - 0
libobs/util/aarch/simde-arch.h → libobs/util/simde/simde-arch.h


+ 0 - 0
libobs/util/aarch/simde-common.h → libobs/util/simde/simde-common.h


+ 0 - 0
libobs/util/aarch/sse.h → libobs/util/simde/sse.h


+ 0 - 0
libobs/util/aarch/sse2.h → libobs/util/simde/sse2.h


+ 2 - 2
libobs/util/sse-intrin.h

@@ -17,9 +17,9 @@
 
 #pragma once
 
-#ifdef __aarch64__
+#if NEEDS_SIMDE
 
-#include "aarch/sse2.h"
+#include "simde/sse2.h"
 
 #define __m128 simde__m128
 #define _mm_setzero_ps simde_mm_setzero_ps

+ 1 - 1
plugins/linux-v4l2/v4l2-controls.c

@@ -27,7 +27,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #if defined(__i386__)
 #define UINT_TO_POINTER(val) ((void *)(unsigned int)(val))
 #define POINTER_TO_UINT(p) ((unsigned int)(unsigned int)(p))
-#elif defined(__x86_64__)
+#elif defined(__x86_64__) || defined(__aarch64__) || (_MIPS_SIM == _ABI64)
 #define UINT_TO_POINTER(val) ((void *)(unsigned long)(val))
 #define POINTER_TO_UINT(p) ((unsigned int)(unsigned long)(p))
 #else