Skip to content

Commit

Permalink
Enable checking for GCC older than 13 and if that is the case use lib…
Browse files Browse the repository at this point in the history
… format instead of GCC format.
  • Loading branch information
z2442 committed Jan 28, 2025
1 parent 3e28d6e commit 0ab6dba
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ if(DAEDALUS_GL)
add_compile_definitions(DAEDALUS_GL)
endif()

if(GCC_OLD)
message("GCC_OLD=ON")
add_compile_definitions(GCC_OLD)
endif()

if(DAEDALUS_GLES)
message("DAEDALUS_GLES=ON")
add_compile_definitions(DAEDALUS_GLES)
Expand Down
22 changes: 18 additions & 4 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ set(CMAKE_CXX_STANDARD 23)
#TODO: Separate SDL Options
list(APPEND plat_main )

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(STATUS "GCC detected: ${CMAKE_CXX_COMPILER_VERSION}")

if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13.0")
message(STATUS "GCC version is older than 13. Using LibFormat.")
message("GCC_OLD=ON")
option(GCC_OLD "Use LibFormat" ON)
endif()
endif()


## if DEBUG is added to the build_daedalus script it will execute teh Debug section otherwise by default do release.
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
Expand Down Expand Up @@ -216,9 +226,9 @@ endif(CTR)
if(DAEDALUS_SDL)
find_package(SDL2 CONFIG REQUIRED)

if(DAEDALUS_GLES)
if(GCC_OLD)
find_package(fmt REQUIRED)
endif(DAEDALUS_GLES)
endif(GCC_OLD)

link_libraries(SDL2::SDL2)
link_libraries(${SDL2_LIBRARIES})
Expand Down Expand Up @@ -293,9 +303,13 @@ link_libraries(ZLIB::ZLIB)

# --- Build ----
add_executable(daedalus ${plat_main})


if(GCC_OLD)
target_link_libraries(daedalus PRIVATE ${daed_libs} ${default_libraries} ${sys_libraries} fmt::fmt)

else()
target_link_libraries(daedalus PRIVATE ${daed_libs} ${default_libraries} ${sys_libraries} )
endif(GCC_OLD)

# --- Post Build ---
## PRX Builds add about 600kb to the binary as they're not stripped at this point. Maybe we
if(PSP)
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/RSP_HLE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Base/Types.h"
#include <cstring>
#include <fstream>
#if defined(GCC_OLD)
#include <fmt/core.h>
#else
#include <format>
#endif
#include "Core/RSP_HLE.h"

#include "Core/Interrupt.h"
Expand Down
4 changes: 4 additions & 0 deletions Source/UI/RomSelectorComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <vector>
#include <map>
#include <algorithm>
#if defined(GCC_OLD)
#include <fmt/core.h>
#else
#include <format>
#endif
#include <iostream>
#include <cctype>
#include <string_view>
Expand Down

0 comments on commit 0ab6dba

Please sign in to comment.