diff --git a/Jamulus.pro b/Jamulus.pro index 024219a034..faf851ab44 100755 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -54,11 +54,10 @@ INCLUDEPATH_OPUS = libs/opus/include \ libs/opus/celt \ libs/opus/silk \ libs/opus/silk/float \ - libs/opus/silk/fixed + libs/opus/silk/fixed \ + libs/opus DEFINES += APP_VERSION=\\\"$$VERSION\\\" \ - OPUS_BUILD \ - USE_ALLOCA \ CUSTOM_MODES \ _REENTRANT @@ -497,7 +496,8 @@ HEADERS_OPUS_ARM = libs/opus/celt/arm/armcpu.h \ HEADERS_OPUS_X86 = libs/opus/celt/x86/celt_lpc_sse.h \ libs/opus/celt/x86/pitch_sse.h \ libs/opus/celt/x86/vq_sse.h \ - libs/opus/celt/x86/x86cpu.h + libs/opus/celt/x86/x86cpu.h \ + $$files(libs/opus/silk/x86/*.h) SOURCES += src/buffer.cpp \ src/channel.cpp \ @@ -660,13 +660,18 @@ SOURCES_OPUS_ARM = libs/opus/celt/arm/armcpu.c \ libs/opus/celt/arm/arm_celt_map.c \ libs/opus/silk/arm/arm_silk_map.c -SOURCES_OPUS_X86 = libs/opus/celt/x86/celt_lpc_sse4_1.c \ - libs/opus/celt/x86/pitch_sse.c \ - libs/opus/celt/x86/pitch_sse2.c \ - libs/opus/celt/x86/pitch_sse4_1.c \ - libs/opus/celt/x86/vq_sse2.c \ +SOURCES_OPUS_X86_SSE = libs/opus/celt/x86/x86cpu.c \ libs/opus/celt/x86/x86_celt_map.c \ - libs/opus/celt/x86/x86cpu.c + libs/opus/celt/x86/pitch_sse.c +SOURCES_OPUS_X86_SSE2 = libs/opus/celt/x86/pitch_sse2.c \ + libs/opus/celt/x86/vq_sse2.c +SOURCES_OPUS_X86_SSE4 = libs/opus/celt/x86/celt_lpc_sse4_1.c \ + libs/opus/celt/x86/pitch_sse4_1.c \ + libs/opus/silk/x86/NSQ_sse4_1.c \ + libs/opus/silk/x86/NSQ_del_dec_sse4_1.c \ + libs/opus/silk/x86/x86_silk_map.c \ + libs/opus/silk/x86/VAD_sse4_1.c \ + libs/opus/silk/x86/VQ_WMat_EC_sse4_1.c android { contains(ANDROID_ARCHITECTURE, arm) | contains(ANDROID_ARCHITECTURE, arm64) { @@ -679,15 +684,17 @@ android { } else:win32 | unix | macx { contains(QT_ARCH, arm) | contains(QT_ARCH, arm64) { HEADERS_OPUS += $$HEADERS_OPUS_ARM - SOURCES_OPUS += $$SOURCES_OPUS_ARM + SOURCES_OPUS_ARCH += $$SOURCES_OPUS_ARM } else:contains(QT_ARCH, x86) | contains(QT_ARCH, x86_64) { HEADERS_OPUS += $$HEADERS_OPUS_X86 - SOURCES_OPUS += $$SOURCES_OPUS_X86 - } - win32 { - HEADERS_OPUS += libs/opus/win32/config.h + SOURCES_OPUS_ARCH += $$SOURCES_OPUS_X86_SSE $$SOURCES_OPUS_X86_SSE2 $$SOURCES_OPUS_X86_SSE4 + DEFINES_OPUS += OPUS_X86_MAY_HAVE_SSE OPUS_X86_MAY_HAVE_SSE2 OPUS_X86_MAY_HAVE_SSE4_1 + # x86_64 implies SSE2 + contains(QT_ARCH, x86_64):DEFINES_OPUS += OPUS_X86_PRESUME_SSE=1 OPUS_X86_PRESUME_SSE2=1 + DEFINES_OPUS += CPU_INFO_BY_C } } +DEFINES_OPUS += OPUS_BUILD=1 USE_ALLOCA=1 OPUS_HAVE_RTCD=1 DISTFILES += ChangeLog \ COPYING \ @@ -1069,10 +1076,42 @@ contains(CONFIG, "opus_shared_lib") { DEFINES += USE_OPUS_SHARED_LIB } } else { + DEFINES += $$DEFINES_OPUS INCLUDEPATH += $$INCLUDEPATH_OPUS HEADERS += $$HEADERS_OPUS SOURCES += $$SOURCES_OPUS DISTFILES += $$DISTFILES_OPUS + + contains(QT_ARCH, x86) | contains(QT_ARCH, x86_64) { + msvc { + SOURCES += $$SOURCES_OPUS_ARCH + } else { + # Arch-specific files need special compiler flags, but we + # can't use those flags for other files because otherwise we + # might end up with vectorized code that the CPU doesn't + # support. For windows, libs/opus/win32/config.h says no + # compiler flags are needed. + sse_cc.name = sse_cc + sse_cc.input = SOURCES_OPUS_X86_SSE + sse_cc.dependency_type = TYPE_C + sse_cc.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_IN_BASE}$${first(QMAKE_EXT_OBJ)} + sse_cc.commands = ${CC} -msse $(CFLAGS) $(INCPATH) -c ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + sse_cc.variable_out = OBJECTS + sse2_cc.name = sse2_cc + sse2_cc.input = SOURCES_OPUS_X86_SSE2 + sse2_cc.dependency_type = TYPE_C + sse2_cc.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_IN_BASE}$${first(QMAKE_EXT_OBJ)} + sse2_cc.commands = ${CC} -msse2 $(CFLAGS) $(INCPATH) -c ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + sse2_cc.variable_out = OBJECTS + sse4_cc.name = sse4_cc + sse4_cc.input = SOURCES_OPUS_X86_SSE4 + sse4_cc.dependency_type = TYPE_C + sse4_cc.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_IN_BASE}$${first(QMAKE_EXT_OBJ)} + sse4_cc.commands = ${CC} -msse4 $(CFLAGS) $(INCPATH) -c ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + sse4_cc.variable_out = OBJECTS + QMAKE_EXTRA_COMPILERS += sse_cc sse2_cc sse4_cc + } + } } # disable version check if requested (#370)