diff --git a/cmake/Modules/CompilerOptions.cmake b/cmake/Modules/CompilerOptions.cmake index 021b9d70b..82c8f0cb9 100644 --- a/cmake/Modules/CompilerOptions.cmake +++ b/cmake/Modules/CompilerOptions.cmake @@ -2,9 +2,7 @@ include_guard(GLOBAL) include(DetectArchitecture) -if(MSVC) - add_compile_options(/MP) -else() +if(NOT MSVC) add_compile_options(-Wall -Wextra -Wvla -Woverloaded-virtual -ffast-math -ftree-vectorize) endif() diff --git a/cmake/Modules/DetectArchitecture.cmake b/cmake/Modules/DetectArchitecture.cmake index 29daa06e4..ded8d15b3 100644 --- a/cmake/Modules/DetectArchitecture.cmake +++ b/cmake/Modules/DetectArchitecture.cmake @@ -141,8 +141,12 @@ endif() if (MSVC) # Glue to make ARCH_OPT more flexible for MSVC if (ARCH_OPT STREQUAL "native") - detect_msvc_native_opt() - FILE(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/tmp) + # Some compilers simulating MSVC supports the march flag, so use it if we can + check_cxx_compiler_flag("-march=native" MARCH_NATIVE_SUPPORTED) + if (NOT MARCH_NATIVE_SUPPORTED) + detect_msvc_native_opt() + FILE(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/tmp) + endif() elseif(ARCH_OPT STREQUAL "SSE4_2") force_ext_available(SSE4_2) set(ARCH_OPT "") @@ -165,7 +169,7 @@ message(STATUS "Target architecture: ${ARCHITECTURE}-${ARCH_OPT}") cmake_push_check_state(RESET) if (ARCH_OPT) - if(MSVC) + if(MSVC AND NOT MARCH_NATIVE_SUPPORTED) set(CMAKE_REQUIRED_FLAGS "/arch:${ARCH_OPT}") add_compile_options(${CMAKE_REQUIRED_FLAGS}) else() diff --git a/exports/export.h b/exports/export.h index 7f4b7600b..d66a0c2df 100644 --- a/exports/export.h +++ b/exports/export.h @@ -127,4 +127,17 @@ # define SWG_API #endif +/* the 'SDRBENCH_API' controls the import/export of 'sdrbench' symbols + */ +#if !defined(sdrangel_STATIC) +# ifdef sdrbench_EXPORTS +# define SDRBENCH_API __SDR_EXPORT +# else +# define SDRBENCH_API __SDR_IMPORT +# endif +#else +# define SDRBENCH_API +#endif + + #endif /* __SDRANGEL_EXPORT_H */ diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 7ce0b9244..66b86415f 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -68,7 +68,6 @@ elseif (LINUX) ) endif () -list(APPEND COMMON_CMAKE_ARGS -DCMAKE_POLICY_DEFAULT_CMP0069:STRING=NEW) if(CMAKE_MSVC_RUNTIME_LIBRARY) list(APPEND COMMON_CMAKE_ARGS -DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW) list(APPEND COMMON_CMAKE_ARGS -DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}) @@ -78,6 +77,15 @@ if(CMAKE_BUILD_TYPE) list(APPEND COMMON_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) endif() +list(APPEND COMMON_CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}) +list(APPEND COMMON_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}) +if (CMAKE_LINKER) + list(APPEND COMMON_CMAKE_ARGS -DCMAKE_LINKER=${CMAKE_LINKER}) +endif() +if (CMAKE_AR) + list(APPEND COMMON_CMAKE_ARGS -DCMAKE_AR=${CMAKE_AR}) +endif() + list(APPEND COMMON_CMAKE_ARGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}) list(APPEND COMMON_CMAKE_ARGS -DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}) list(APPEND COMMON_CMAKE_ARGS -DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}) diff --git a/sdrbase/audio/audioopus.h b/sdrbase/audio/audioopus.h index 80049c4c2..5444c5e82 100644 --- a/sdrbase/audio/audioopus.h +++ b/sdrbase/audio/audioopus.h @@ -23,7 +23,7 @@ #include #include "export.h" -class OpusEncoder; +struct OpusEncoder; class SDRBASE_API AudioOpus { diff --git a/sdrbase/channel/remotedatareadqueue.h b/sdrbase/channel/remotedatareadqueue.h index 6a6399f3f..d5dfe7067 100644 --- a/sdrbase/channel/remotedatareadqueue.h +++ b/sdrbase/channel/remotedatareadqueue.h @@ -30,7 +30,7 @@ #include "export.h" class RemoteDataBlock; -class Sample; +struct Sample; class SDRBASE_API RemoteDataReadQueue { diff --git a/sdrbase/dsp/decimatorsff.cpp b/sdrbase/dsp/decimatorsff.cpp index 0c785d404..c654fc74d 100644 --- a/sdrbase/dsp/decimatorsff.cpp +++ b/sdrbase/dsp/decimatorsff.cpp @@ -18,7 +18,7 @@ #include "decimatorsff.h" template<> -void DecimatorsFF::decimate1(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) +SDRBASE_API void DecimatorsFF::decimate1(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) { float xreal, yimag; @@ -33,7 +33,7 @@ void DecimatorsFF::decimate1(FSampleVector::iterator* it, const float* buf } template<> -void DecimatorsFF::decimate1(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) +SDRBASE_API void DecimatorsFF::decimate1(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) { float xreal, yimag; diff --git a/sdrbase/dsp/decimatorsff.h b/sdrbase/dsp/decimatorsff.h index e62a0943c..2509a13c3 100644 --- a/sdrbase/dsp/decimatorsff.h +++ b/sdrbase/dsp/decimatorsff.h @@ -29,11 +29,11 @@ class DecimatorsFF { public: SDRBASE_API void decimate1(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); - SDRBASE_API void decimate2_inf(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); - SDRBASE_API void decimate2_sup(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); + void decimate2_inf(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); + void decimate2_sup(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); void decimate2_cen(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); - SDRBASE_API void decimate4_inf(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); - SDRBASE_API void decimate4_sup(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); + void decimate4_inf(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); + void decimate4_sup(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); void decimate4_cen(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); void decimate8_inf(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); void decimate8_sup(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ); diff --git a/sdrbase/dsp/decimatorsfi.cpp b/sdrbase/dsp/decimatorsfi.cpp index 659a56b25..55d36a4d1 100644 --- a/sdrbase/dsp/decimatorsfi.cpp +++ b/sdrbase/dsp/decimatorsfi.cpp @@ -18,7 +18,7 @@ #include "decimatorsfi.h" template<> -void DecimatorsFI::decimate1(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) +SDRBASE_API void DecimatorsFI::decimate1(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) { float xreal, yimag; @@ -33,7 +33,7 @@ void DecimatorsFI::decimate1(SampleVector::iterator* it, const float* buf, } template<> -void DecimatorsFI::decimate1(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) +SDRBASE_API void DecimatorsFI::decimate1(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) { float xreal, yimag; @@ -48,7 +48,7 @@ void DecimatorsFI::decimate1(SampleVector::iterator* it, const float* buf } template<> -void DecimatorsFI::decimate2_inf(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) +SDRBASE_API void DecimatorsFI::decimate2_inf(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) { float xreal, yimag; @@ -69,7 +69,7 @@ void DecimatorsFI::decimate2_inf(SampleVector::iterator* it, const float* } template<> -void DecimatorsFI::decimate2_inf(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) +SDRBASE_API void DecimatorsFI::decimate2_inf(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) { float xreal, yimag; @@ -90,7 +90,7 @@ void DecimatorsFI::decimate2_inf(SampleVector::iterator* it, const float* } template<> -void DecimatorsFI::decimate2_sup(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) +SDRBASE_API void DecimatorsFI::decimate2_sup(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) { float xreal, yimag; @@ -111,7 +111,7 @@ void DecimatorsFI::decimate2_sup(SampleVector::iterator* it, const float* } template<> -void DecimatorsFI::decimate2_sup(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) +SDRBASE_API void DecimatorsFI::decimate2_sup(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) { float xreal, yimag; @@ -132,7 +132,7 @@ void DecimatorsFI::decimate2_sup(SampleVector::iterator* it, const float* } template<> -void DecimatorsFI::decimate4_inf(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) +SDRBASE_API void DecimatorsFI::decimate4_inf(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) { float xreal, yimag; @@ -149,7 +149,7 @@ void DecimatorsFI::decimate4_inf(SampleVector::iterator* it, const float* } template<> -void DecimatorsFI::decimate4_inf(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) +SDRBASE_API void DecimatorsFI::decimate4_inf(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) { float xreal, yimag; @@ -166,7 +166,7 @@ void DecimatorsFI::decimate4_inf(SampleVector::iterator* it, const float* } template<> -void DecimatorsFI::decimate4_sup(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) +SDRBASE_API void DecimatorsFI::decimate4_sup(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) { // Sup (USB): // x y x y x y x y / x -> 1,-2,-5,6 / y -> -0,-3,4,7 @@ -189,7 +189,7 @@ void DecimatorsFI::decimate4_sup(SampleVector::iterator* it, const float* } template<> -void DecimatorsFI::decimate4_sup(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) +SDRBASE_API void DecimatorsFI::decimate4_sup(SampleVector::iterator* it, const float* buf, qint32 nbIAndQ) { // Sup (USB): // x y x y x y x y / x -> 1,-2,-5,6 / y -> -0,-3,4,7 diff --git a/sdrbase/plugin/pluginmanager.h b/sdrbase/plugin/pluginmanager.h index 8f5e76b6f..705c38d5f 100644 --- a/sdrbase/plugin/pluginmanager.h +++ b/sdrbase/plugin/pluginmanager.h @@ -33,7 +33,7 @@ class QPluginLoader; class Message; class MessageQueue; class DeviceAPI; -class DeviceUserArgs; +struct DeviceUserArgs; class WebAPIAdapterInterface; class SDRBASE_API PluginManager : public QObject { diff --git a/sdrbench/mainbench.h b/sdrbench/mainbench.h index 20510a39e..008c3d224 100644 --- a/sdrbench/mainbench.h +++ b/sdrbench/mainbench.h @@ -35,12 +35,12 @@ namespace qtwebapp { class LoggerWithFile; } -class MainBench: public QObject { +class SDRBENCH_API MainBench: public QObject { Q_OBJECT public: - SDRBASE_API explicit MainBench(qtwebapp::LoggerWithFile *logger, const ParserBench& parser, QObject *parent = 0); - SDRBASE_API ~MainBench(); + explicit MainBench(qtwebapp::LoggerWithFile *logger, const ParserBench& parser, QObject *parent = 0); + ~MainBench(); public slots: void run(); diff --git a/sdrbench/parserbench.h b/sdrbench/parserbench.h index f9ae7000f..5cdf715ec 100644 --- a/sdrbench/parserbench.h +++ b/sdrbench/parserbench.h @@ -24,7 +24,7 @@ #include "export.h" -class ParserBench +class SDRBENCH_API ParserBench { public: typedef enum @@ -38,10 +38,10 @@ public: TestAMBE } TestType; - SDRBASE_API ParserBench(); - SDRBASE_API ~ParserBench(); + ParserBench(); + ~ParserBench(); - SDRBASE_API void parse(const QCoreApplication& app); + void parse(const QCoreApplication& app); const QString& getTestStr() const { return m_testStr; } TestType getTestType() const;