Browse Source

Merge pull request #3288 from makise-homura/e2k_support

E2k support
Jim 5 years ago
parent
commit
d9408b51ef
2 changed files with 29 additions and 4 deletions
  1. 28 3
      CMakeLists.txt
  2. 1 1
      plugins/obs-x264/obs-x264-options.c

+ 28 - 3
CMakeLists.txt

@@ -62,6 +62,8 @@ set(SCRIPTING_ENABLED OFF CACHE BOOL "Internal global cmake variable" FORCE)
 include(ObsHelpers)
 include(ObsCpack)
 include(GNUInstallDirs)
+include(CheckCCompilerFlag)
+include(CheckCXXCompilerFlag)
 
 # Must be a string in the format of "x.x.x-rcx"
 if(DEFINED RELEASE_CANDIDATE)
@@ -120,7 +122,7 @@ 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)")
+if(LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86|x64|x86_64|amd64|e2k)")
 	set(NEEDS_SIMDE "0")
 	if(NOT MSVC)
 		set(ARCH_SIMD_FLAGS "-mmmx" "-msse" "-msse2")
@@ -133,8 +135,16 @@ else()
 	set(NEEDS_SIMDE "1")
 	add_definitions(-DNEEDS_SIMDE=1)
 	if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
-		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp-simd -DSIMDE_ENABLE_OPENMP")
-		set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp-simd -DSIMDE_ENABLE_OPENMP")
+		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSIMDE_ENABLE_OPENMP")
+		set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSIMDE_ENABLE_OPENMP")
+		CHECK_C_COMPILER_FLAG("-fopenmp-simd" C_COMPILER_SUPPORTS_OPENMP_SIMD)
+		if(C_COMPILER_SUPPORTS_OPENMP_SIMD)
+			set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp-simd")
+		endif()
+		CHECK_CXX_COMPILER_FLAG("-fopenmp-simd" CXX_COMPILER_SUPPORTS_OPENMP_SIMD)
+		if(CXX_COMPILER_SUPPORTS_OPENMP_SIMD)
+			set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp-simd")
+		endif()
 	endif()
 	set(ARCH_SIMD_FLAGS "")
 	message(STATUS "No Native SSE2 SIMD Support - Using SIMDE")
@@ -204,6 +214,21 @@ elseif(UNIX)
 	endif()
 endif()
 
+if(LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "e2k")
+	foreach(TEST_C_FLAG "-Wno-unused-parameter" "-Wno-ignored-qualifiers" "-Wno-pointer-sign" "-Wno-unused-variable" "-Wno-sign-compare" "-Wno-bad-return-value-type" "-Wno-maybe-uninitialized")
+		CHECK_C_COMPILER_FLAG(${TEST_C_FLAG} C_COMPILER_SUPPORTS_FLAG_${TEST_C_FLAG})
+		if(C_COMPILER_SUPPORTS_FLAG_${TEST_C_FLAG})
+			set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TEST_C_FLAG}")
+		endif()
+	endforeach()
+	foreach(TEST_CXX_FLAG "-Wno-invalid-offsetof" "-Wno-maybe-uninitialized")
+		CHECK_CXX_COMPILER_FLAG(${TEST_CXX_FLAG} CXX_COMPILER_SUPPORTS_FLAG_${TEST_CXX_FLAG})
+		if(CXX_COMPILER_SUPPORTS_FLAG_${TEST_CXX_FLAG})
+			set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TEST_CXX_FLAG}")
+		endif()
+	endforeach()
+endif()
+
 option(BUILD_TESTS "Build test directory (includes test sources and possibly a platform test executable)" FALSE)
 mark_as_advanced(BUILD_TESTS)
 

+ 1 - 1
plugins/obs-x264/obs-x264-options.c

@@ -45,7 +45,7 @@ struct obs_x264_options obs_x264_parse_options(const char *options_string)
 	struct obs_x264_option *out_option = out_options;
 	for (char **input_word = input_words; *input_word; ++input_word) {
 		if (getparam(*input_word, &out_option->name,
-			     &out_option->value)) {
+			     (const char **)&out_option->value)) {
 			++out_option;
 		} else {
 			*ignored_word = *input_word;