From 120edca223bd831542d7f0d0511212db804c5805 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Fri, 5 Mar 2021 10:31:00 +0000 Subject: [PATCH] Build updates for Windows --- cross/windows-cl.txt | 9 + cross/windows-clang.txt | 9 + main/main.cpp | 1 + meson.build | 13 +- otherbuilds/Makefile.linux | 2 +- ...ram.vcxproj => rubberband-library.vcxproj} | 154 +++++++++--------- src/base/Scavenger.h | 2 +- src/system/sysutils.h | 16 +- 8 files changed, 119 insertions(+), 87 deletions(-) create mode 100644 cross/windows-cl.txt create mode 100644 cross/windows-clang.txt rename otherbuilds/{rubberband-program.vcxproj => rubberband-library.vcxproj} (52%) diff --git a/cross/windows-cl.txt b/cross/windows-cl.txt new file mode 100644 index 0000000..a690ccc --- /dev/null +++ b/cross/windows-cl.txt @@ -0,0 +1,9 @@ + +[properties] +needs_exe_wrapper = false + +[binaries] +c = 'cl' +cpp = 'cl' + + diff --git a/cross/windows-clang.txt b/cross/windows-clang.txt new file mode 100644 index 0000000..82a9d35 --- /dev/null +++ b/cross/windows-clang.txt @@ -0,0 +1,9 @@ + +[properties] +needs_exe_wrapper = false + +[binaries] +c = 'clang' +cpp = 'clang++' + + diff --git a/main/main.cpp b/main/main.cpp index 4231ffc..f22383e 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -54,6 +54,7 @@ using RubberBand::gettimeofday; #ifdef _MSC_VER using RubberBand::usleep; +#define strdup _strdup #endif double tempo_convert(const char *str) diff --git a/meson.build b/meson.build index 9f5f8b8..e9722b3 100644 --- a/meson.build +++ b/meson.build @@ -5,7 +5,9 @@ project( version: '1.9.0', license: 'GPL-2.0-or-later', default_options: [ - 'cpp_std=c++11', + # All Rubber Band code is actually C++98, but some compilers no + # longer support that + 'cpp_std=c++14', 'buildtype=release', 'b_ndebug=if-release', 'b_lundef=true', @@ -271,6 +273,13 @@ if not sndfile_dep.found() has_headers: ['sndfile.h'], header_args: extra_include_args, required: false) + if not sndfile_dep.found() + sndfile_dep = cpp.find_library('sndfile-1', + dirs: get_option('extra_lib_dirs'), + has_headers: ['sndfile.h'], + header_args: extra_include_args, + required: false) + endif endif have_sndfile = sndfile_dep.found() @@ -323,8 +332,8 @@ if system == 'darwin' endif # end architecture elif system == 'windows' + feature_defines += ['-D_WIN32', '-DNOMINMAX', '-D_USE_MATH_DEFINES', '-DGETOPT_API='] if cpp.get_id() == 'msvc' - feature_defines += ['-DWIN32', '-D__MSVC__', '-DNOMINMAX', '-D_USE_MATH_DEFINES', '-DGETOPT_API='] ladspa_symbol_args += ['-EXPORT:ladspa_descriptor'] vamp_symbol_args += ['-EXPORT:vampGetPluginDescriptor'] endif diff --git a/otherbuilds/Makefile.linux b/otherbuilds/Makefile.linux index a8e5443..324b038 100644 --- a/otherbuilds/Makefile.linux +++ b/otherbuilds/Makefile.linux @@ -6,7 +6,7 @@ OPTFLAGS := -DNDEBUG -ffast-math -O3 -ftree-vectorize ARCHFLAGS := -CXXFLAGS := $(ARCHFLAGS) $(OPTFLAGS) -I. -Isrc -Irubberband -DHAVE_LIBSAMPLERATE -DUSE_KISSFFT -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DHAVE_POSIX_MEMALIGN -DNDEBUG +CXXFLAGS := -std=c++98 $(ARCHFLAGS) $(OPTFLAGS) -I. -Isrc -Irubberband -DHAVE_LIBSAMPLERATE -DUSE_KISSFFT -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DHAVE_POSIX_MEMALIGN -DNDEBUG CFLAGS := $(ARCHFLAGS) $(OPTFLAGS) diff --git a/otherbuilds/rubberband-program.vcxproj b/otherbuilds/rubberband-library.vcxproj similarity index 52% rename from otherbuilds/rubberband-program.vcxproj rename to otherbuilds/rubberband-library.vcxproj index 00cd8e6..93125a2 100644 --- a/otherbuilds/rubberband-program.vcxproj +++ b/otherbuilds/rubberband-library.vcxproj @@ -19,26 +19,27 @@ - {06838307-FEAA-4DB0-8E08-AF19698E9C40} - rubberband-program + {020CEB11-EF4E-400E-971D-A35DB69D7CF9} + rubberband-library Win32Proj + 10.0 - Application - v140 + StaticLibrary + v142 - Application - v140 + StaticLibrary + v142 - Application - v140 + StaticLibrary + v142 - Application - v140 + StaticLibrary + v142 @@ -62,67 +63,43 @@ Debug\ Debug\ - true - MinimumRecommendedRules.ruleset - - + true + $(SourcePath) - true - MinimumRecommendedRules.ruleset - - + true Release\ Release\ - - MinimumRecommendedRules.ruleset - - - - - - MinimumRecommendedRules.ruleset - - Disabled - .;.\rubberband;.\src;C:\Program Files (x86)\Mega-Nerd\libsndfile\include;%(AdditionalIncludeDirectories) - __MSVC__;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..;..\src;%(AdditionalIncludeDirectories) + __MSVC__;WIN32;_DEBUG;_LIB;NOMINMAX;_USE_MATH_DEFINES;USE_KISSFFT;USE_SPEEX;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL - Level3 + Level2 EditAndContinue + false - - .\Debug\rubberband-library.lib;C:\Program Files (x86)\Mega-Nerd\libsndfile\lib\libsndfile-1.lib;%(AdditionalDependencies) - true - Console - MachineX86 - Disabled - .;.\rubberband;.\src;C:\Program Files\Mega-Nerd\libsndfile\include;%(AdditionalIncludeDirectories) - __MSVC__;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..;..\src;%(AdditionalIncludeDirectories) + __MSVC__;WIN32;_DEBUG;_LIB;NOMINMAX;_USE_MATH_DEFINES;USE_KISSFFT;USE_SPEEX;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL - Level3 + Level2 ProgramDatabase + false - - .\x64\Debug\rubberband-library.lib;C:\Program Files\Mega-Nerd\libsndfile\lib\libsndfile-1.lib;%(AdditionalDependencies) - true - Console - @@ -131,23 +108,16 @@ true Speed true - .;.\rubberband;.\src;C:\Program Files (x86)\Mega-Nerd\libsndfile\include;%(AdditionalIncludeDirectories) - __MSVC__;WIN32;NDEBUG;_CONSOLE;WANT_TIMING;%(PreprocessorDefinitions) + ..;..\src;%(AdditionalIncludeDirectories) + __MSVC__;WIN32;NDEBUG;_LIB;NOMINMAX;_USE_MATH_DEFINES;USE_KISSFFT;NO_TIMING;USE_SPEEX;NO_THREAD_CHECKS;%(PreprocessorDefinitions) MultiThreadedDLL + false StreamingSIMDExtensions Fast Level2 ProgramDatabase - - .\Release\rubberband-library.lib;C:\Program Files (x86)\Mega-Nerd\libsndfile\lib\libsndfile-1.lib;%(AdditionalDependencies) - false - Console - true - true - MachineX86 - @@ -156,9 +126,10 @@ true Speed true - .;.\rubberband;.\src;C:\Program Files\Mega-Nerd\libsndfile\include;%(AdditionalIncludeDirectories) - __MSVC__;WIN32;NDEBUG;_CONSOLE;WANT_TIMING;%(PreprocessorDefinitions) + ..;..\src;%(AdditionalIncludeDirectories) + __MSVC__;WIN32;NDEBUG;_LIB;NOMINMAX;_USE_MATH_DEFINES;USE_KISSFFT;NO_TIMING;USE_SPEEX;NO_THREAD_CHECKS;%(PreprocessorDefinitions) MultiThreadedDLL + false StreamingSIMDExtensions Fast @@ -166,30 +137,61 @@ Level2 ProgramDatabase - - .\x64\Release\rubberband-library.lib;C:\Program Files\Mega-Nerd\libsndfile\lib\libsndfile-1.lib;%(AdditionalDependencies) - false - Console - true - true - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/src/base/Scavenger.h b/src/base/Scavenger.h index e5b9b24..e8b6b5b 100644 --- a/src/base/Scavenger.h +++ b/src/base/Scavenger.h @@ -29,7 +29,7 @@ #include #include -#ifndef WIN32 +#ifndef _MSC_VER #include #endif diff --git a/src/system/sysutils.h b/src/system/sysutils.h index 9a0f53a..86a2896 100644 --- a/src/system/sysutils.h +++ b/src/system/sysutils.h @@ -24,13 +24,6 @@ #ifndef RUBBERBAND_SYSUTILS_H #define RUBBERBAND_SYSUTILS_H -#ifdef _MSC_VER -# if _MSC_VER < 1800 -# include "float_cast/float_cast.h" -# endif -# define R__ __restrict -#endif - #ifdef __clang__ # define R__ __restrict__ #else @@ -39,6 +32,15 @@ # endif #endif +#ifdef _MSC_VER +# if _MSC_VER < 1800 +# include "float_cast/float_cast.h" +# endif +# ifndef R__ +# define R__ __restrict +# endif +#endif + #ifndef R__ # define R__ #endif