Skip to content

Commit

Permalink
A few Windows build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kblaschke committed Apr 29, 2023
1 parent 083df14 commit bf344b6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/libprojectM/Audio/FrameAudioData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
*/
#pragma once

#include "projectM-4/projectM_export.h"
#include "AudioConstants.hpp"

#include <array>

namespace libprojectM {
namespace Audio {

class FrameAudioData
class PROJECTM_EXPORT FrameAudioData
{
public:
float bass{0.f};
Expand Down
2 changes: 1 addition & 1 deletion src/libprojectM/Audio/PCM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class PROJECTM_EXPORT PCM
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;
Expand Down
24 changes: 13 additions & 11 deletions src/libprojectM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,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>
Expand All @@ -173,10 +175,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
Expand All @@ -187,9 +185,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()


Expand Down
6 changes: 2 additions & 4 deletions src/libprojectM/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
Expand All @@ -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 "";
Expand Down
7 changes: 7 additions & 0 deletions src/libprojectM/MilkdropPreset/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/libprojectM/MilkdropPreset/PresetFileParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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&)
{
}
}
Expand All @@ -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&)
{
}
}
Expand Down

0 comments on commit bf344b6

Please sign in to comment.