A few Windows build fixes

This commit is contained in:
Kai Blaschke
2023-04-03 15:57:26 +02:00
committed by Kai Blaschke
parent 4b3226ac3a
commit feb7a3330a
6 changed files with 27 additions and 19 deletions

View File

@ -6,6 +6,7 @@
*/
#pragma once
#include "projectM-4/projectM_export.h"
#include "AudioConstants.hpp"
#include <array>
@ -13,7 +14,7 @@
namespace libprojectM {
namespace Audio {
class FrameAudioData
class PROJECTM_EXPORT FrameAudioData
{
public:
float bass{0.f};

View File

@ -137,7 +137,7 @@ private:
std::array<int, 34> m_ip{0};
// see https://github.com/projectM-visualizer/projectm/issues/161
class AutoLevel
class PROJECTM_EXPORT AutoLevel
{
public:
auto UpdateLevel(size_t samples, double sum, double max) -> double;

View File

@ -128,18 +128,20 @@ set_target_properties(projectM PROPERTIES
)
if(BUILD_SHARED_LIBS)
set_source_files_properties(ProjectMCWrapper.cpp PROPERTIES
COMPILE_DEFINITIONS projectM_api_EXPORTS
)
target_compile_definitions(projectM_main
PRIVATE
projectM_api_EXPORTS
)
target_link_libraries(projectM
PUBLIC
${CMAKE_DL_LIBS}
)
else()
set_source_files_properties(ProjectMCWrapper.cpp PROPERTIES
COMPILE_DEFINITIONS PROJECTM_STATIC_DEFINE
)
target_compile_definitions(projectM_main
PUBLIC
PROJECTM_STATIC_DEFINE
)
set_target_properties(projectM PROPERTIES
OUTPUT_NAME $<IF:$<PLATFORM_ID:Windows>,libprojectM,projectM>
@ -165,10 +167,6 @@ if(ENABLE_CXX_INTERFACE)
)
endif()
set_source_files_properties(ProjectM.cpp Audio/PCM.cpp PROPERTIES
COMPILE_DEFINITIONS projectM_api_EXPORTS
)
install(FILES
Common.hpp
Audio/PCM.hpp
@ -179,9 +177,13 @@ if(ENABLE_CXX_INTERFACE)
else()
# Set PROJECTM_STATIC_EXPORT for C++ implementations to use project default visibility
# and no dllimport/dllexport.
set_source_files_properties(ProjectM.cpp Audio/PCM.cpp PROPERTIES
set_source_files_properties(ProjectM.cpp Audio/PCM.cpp Audio/FrameAudioData.cpp PROPERTIES
COMPILE_DEFINITIONS PROJECTM_STATIC_DEFINE
)
target_compile_definitions(projectM
INTERFACE
PROJECTM_STATIC_DEFINE
)
endif()

View File

@ -64,8 +64,7 @@ unsigned int const numQVariables(32);
//CPP17: std::filesystem::path::extension
inline auto ParseExtension(const std::string& filename) -> std::string
{
const std::size_t start = filename.find_last_of('.');
const auto start = filename.find_last_of('.');
if (start == std::string::npos || start >= (filename.length() - 1)) {
return "";
@ -78,8 +77,7 @@ inline auto ParseExtension(const std::string& filename) -> std::string
//CPP17: std::filesystem::path::filename
inline auto ParseFilename(const std::string& filename) -> std::string
{
const std::size_t start = filename.find_last_of('/');
const auto start = filename.find_last_of('/');
if (start == std::string::npos || start >= (filename.length() - 1)) {
return "";

View File

@ -69,6 +69,13 @@ target_link_libraries(MilkdropPreset
${PROJECTM_OPENGL_LIBRARIES}
)
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(MilkdropPreset
PRIVATE
PROJECTM_STATIC_DEFINE
)
endif()
if(ENABLE_DEBUG_MILKDROP_PRESET)
target_compile_definitions(MilkdropPreset
PRIVATE

View File

@ -110,7 +110,7 @@ auto PresetFileParser::GetInt(const std::string& key, int defaultValue) -> int
{
return std::stoi(m_presetValues.at(key));
}
catch (std::logic_error& ex)
catch (std::logic_error&)
{
}
}
@ -126,7 +126,7 @@ auto PresetFileParser::GetFloat(const std::string& key, float defaultValue) -> f
{
return std::stof(m_presetValues.at(key));
}
catch (std::logic_error& ex)
catch (std::logic_error&)
{
}
}