Skip to content

Commit

Permalink
Merge pull request #283 from Laguna1989/feature/fix_gcc_warnings
Browse files Browse the repository at this point in the history
Feature/fix gcc warnings
  • Loading branch information
Laguna1989 authored Mar 20, 2023
2 parents a0e7547 + 16a80ca commit 2b02483
Show file tree
Hide file tree
Showing 36 changed files with 85 additions and 336 deletions.
23 changes: 4 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ endif ()

if (JT_ENABLE_WEB)
add_compile_definitions(MUSIC_OGG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -g --std=c++17 -fpermissive ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_SDL=2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='[\"bmp\",\"png\"]'")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_VORBIS=1 -s USE_OGG=1")
Expand All @@ -33,26 +33,11 @@ if (JT_ENABLE_WEB)
"SHELL:-s ALLOW_MEMORY_GROWTH=1"
"SHELL:--use-preload-plugins"
"SHELL:--preload-file assets")
else ()
if (MSVC)
## disable warnings from external libraries:
## * 5205 from tileson
## * 4005 from better enums
## the warning level for those is set to 4 (disable) while general warning level is 3
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w45205 /w44005 /W3 /EHsc")
else ()
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lstdc++fs")
endif ()
if (JT_ENABLE_PERFORMANCETESTS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra --std=c++17 -fpermissive")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra --std=c++17 -fpermissive")
endif ()
endif ()
elseif (MSVC)
elseif (NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lstdc++fs")
endif ()


## set include for mac homebrew
#####################################################
if (NOT USE_SFML)
Expand Down
9 changes: 9 additions & 0 deletions impl/game/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ endif ()
target_link_libraries(${PROJECTNAME} GameLib)
target_include_directories(${PROJECTNAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if (MSVC)
target_compile_options(${PROJECTNAME} PRIVATE "/W3")
target_compile_options(${PROJECTNAME} PRIVATE "/EHsc")
else ()
target_compile_options(${PROJECTNAME} PRIVATE "-Wall")
target_compile_options(${PROJECTNAME} PRIVATE "-Wextra")
endif ()


jt_use_assets(${PROJECTNAME})
7 changes: 7 additions & 0 deletions impl/gamelib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ endif ()

target_link_libraries(GameLib PUBLIC JamTemplateLib)
target_include_directories(GameLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
if (MSVC)
target_compile_options(GameLib PRIVATE "/W3")
target_compile_options(GameLib PRIVATE "/EHsc")
else ()
target_compile_options(GameLib PRIVATE "-Wall")
target_compile_options(GameLib PRIVATE "-Wextra")
endif ()

6 changes: 3 additions & 3 deletions impl/gamelib/player/sound/sound_component_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
#include <audio/sound_group.hpp>
#include <audio/sound_null.hpp>

SoundComponentImpl::SoundComponentImpl(jt::AudioInterface& audio, jt::LoggerInterface& logger)
SoundComponentImpl::SoundComponentImpl(jt::AudioInterface& /*audio*/, jt::LoggerInterface& /*logger*/)
{
// TODO load Sounds
}

void SoundComponentImpl::play(SoundComponentInterface::SoundId sound)
void SoundComponentImpl::play(SoundComponentInterface::SoundId /*sound*/)
{
// TODO Play sounds based on ID
}

bool SoundComponentImpl::isPlaying(SoundComponentInterface::SoundId sound)
bool SoundComponentImpl::isPlaying(SoundComponentInterface::SoundId /*sound*/)
{
// TODO return value based on ID
return false;
Expand Down
7 changes: 7 additions & 0 deletions impl/jamtemplate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,11 @@ else ()
endif ()


if (MSVC)
target_compile_options(JamTemplateLib PRIVATE "/W3")
target_compile_options(JamTemplateLib PRIVATE "/EHsc")
else ()
target_compile_options(JamTemplateLib PRIVATE "-Wall")
target_compile_options(JamTemplateLib PRIVATE "-Wextra")
endif ()

9 changes: 5 additions & 4 deletions impl/jamtemplate/common/audio/audio_null.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ std::shared_ptr<jt::SoundInterface> jt::AudioNull::addPermanentSound(
{
return std::make_shared<jt::SoundNull>();
}
std::shared_ptr<jt::SoundInterface> jt::AudioNull::addPermanentSound(std::string const& identifier,
std::string const& introFileName, std::string const& loopingFileName,
oalpp::effects::MonoEffectInterface& effect)
std::shared_ptr<jt::SoundInterface> jt::AudioNull::addPermanentSound(
std::string const& /*identifier*/, std::string const& /*introFileName*/,
std::string const& /*loopingFileName*/, oalpp::effects::MonoEffectInterface& /*effect*/)
{
return std::make_shared<jt::SoundNull>();
}
Expand All @@ -48,7 +48,8 @@ std::shared_ptr<jt::SoundInterface> jt::AudioNull::addTemporarySoundGroup(
{
auto group = std::make_shared<jt::SoundGroup>();

for (auto const& sound : sounds) {
for (auto const& _ : sounds) {
(void)_;
group->add(std::make_shared<jt::SoundNull>());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,8 @@ float jt::IntroLoopingSoundWithEffect::getPosition() const
}

int jt::IntroLoopingSoundWithEffect::getSampleRate() const { return m_introSound->getSampleRate(); }
void jt::IntroLoopingSoundWithEffect::setVolumeProvider(jt::GroupVolumeGetterInterface& provider) {
void jt::IntroLoopingSoundWithEffect::setVolumeProvider(jt::GroupVolumeGetterInterface& provider)
{
m_introSound->setVolumeProvider(provider);
m_loopingSound->setVolumeProvider(provider);
}
4 changes: 2 additions & 2 deletions impl/jamtemplate/common/audio/sound_null.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ int jt::SoundNull::getSampleRate() const { return 44100; }
void jt::SoundNull::setPitch(float /*pitch*/) { }
float jt::SoundNull::getPitch() const { return 1.0f; }

void jt::SoundNull::setVolumeProvider(jt::GroupVolumeGetterInterface& provider) { }
void jt::SoundNull::setVolumeGroup(std::string const& string) { }
void jt::SoundNull::setVolumeProvider(jt::GroupVolumeGetterInterface& /*provider*/) { }
void jt::SoundNull::setVolumeGroup(std::string const& /*string*/) { }
1 change: 1 addition & 0 deletions impl/jamtemplate/common/cache_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
jt::CacheImpl::CacheImpl(std::unique_ptr<jt::TilemapCacheInterface> tilemapCache,
std::shared_ptr<jt::LogHistoryInterface> logHistory)
: m_tilemapCache { std::move(tilemapCache) }
, m_logHistory { logHistory }
{
if (m_tilemapCache == nullptr) {
m_tilemapCache = std::make_unique<jt::TilemapCache>();
Expand Down
31 changes: 0 additions & 31 deletions impl/jamtemplate/common/ease/back.cpp

This file was deleted.

16 changes: 0 additions & 16 deletions impl/jamtemplate/common/ease/back.hpp

This file was deleted.

27 changes: 0 additions & 27 deletions impl/jamtemplate/common/ease/circ.cpp

This file was deleted.

16 changes: 0 additions & 16 deletions impl/jamtemplate/common/ease/circ.hpp

This file was deleted.

18 changes: 0 additions & 18 deletions impl/jamtemplate/common/ease/cubic.cpp

This file was deleted.

15 changes: 0 additions & 15 deletions impl/jamtemplate/common/ease/cubic.hpp

This file was deleted.

26 changes: 0 additions & 26 deletions impl/jamtemplate/common/ease/quad.cpp

This file was deleted.

16 changes: 0 additions & 16 deletions impl/jamtemplate/common/ease/quad.hpp

This file was deleted.

23 changes: 0 additions & 23 deletions impl/jamtemplate/common/ease/quart.cpp

This file was deleted.

16 changes: 0 additions & 16 deletions impl/jamtemplate/common/ease/quart.hpp

This file was deleted.

23 changes: 0 additions & 23 deletions impl/jamtemplate/common/ease/quint.cpp

This file was deleted.

Loading

0 comments on commit 2b02483

Please sign in to comment.