Skip to content

Commit

Permalink
fixs
Browse files Browse the repository at this point in the history
  • Loading branch information
beats-dh committed Oct 13, 2024
1 parent 6ef0a13 commit eb80b35
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
24 changes: 22 additions & 2 deletions cmake/modules/BaseConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,19 @@ endif()
# === IPO Configuration ===
function(configure_linking target_name)
if(OPTIONS_ENABLE_IPO)
# Check if IPO/LTO is supported
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_output LANGUAGES CXX)

# Get the GCC compiler version, if applicable
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()

if(ipo_supported)
set_property(TARGET ${target_name} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
message(STATUS "IPO/LTO enabled for target ${target_name}.")
Expand All @@ -146,8 +157,17 @@ function(configure_linking target_name)
target_compile_options(${target_name} PRIVATE /GL)
target_link_options(${target_name} PRIVATE /LTCG)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(${target_name} PRIVATE -flto)
target_link_options(${target_name} PRIVATE -flto)
# Check if it's running on Linux, using GCC 14, and in Debug mode
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
GCC_VERSION VERSION_GREATER_EQUAL "14" AND
GCC_VERSION VERSION_LESS "15" AND
CMAKE_BUILD_TYPE STREQUAL "Debug")
message(WARNING "LTO disabled for GCC 14 in Debug mode on Linux for target ${target_name}.")
else()
target_compile_options(${target_name} PRIVATE -flto)
target_link_options(${target_name} PRIVATE -flto)
endif()
endif()
else()
message(WARNING "IPO/LTO is not supported for target ${target_name}: ${ipo_output}")
Expand Down
15 changes: 14 additions & 1 deletion src/lua/functions/core/game/lua_enums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "enums/account_type.hpp"
#include "enums/account_group_type.hpp"

constexpr const char* soundNamespace = "SOUND_EFFECT_TYPE_";

#define registerMagicEnum(luaState, enumClassType) \
{ \
auto number = magic_enum::enum_integer(enumClassType); \
Expand Down Expand Up @@ -107,6 +109,9 @@ void LuaEnums::init(lua_State* L) {
initWebhookEnums(L);
initBosstiaryEnums(L);
initSoundEnums(L);
spelltSoundEnums(L);
monsterSoundEnums(L);
effectsSoundEnums(L);
initWheelEnums(L);
initAttributeConditionSubIdEnums(L);
initConcoctionsEnum(L);
Expand Down Expand Up @@ -1242,7 +1247,6 @@ void LuaEnums::initBosstiaryEnums(lua_State* L) {

// "SOUND_EFFECT_TYPE_" is the sound lua namespace
void LuaEnums::initSoundEnums(lua_State* L) {
std::string soundNamespace = "SOUND_EFFECT_TYPE_";
registerEnumNamespace(L, soundNamespace, SoundEffect_t::SILENCE);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::HUMAN_CLOSE_ATK_FIST);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::MONSTER_CLOSE_ATK_FIST);
Expand Down Expand Up @@ -1272,6 +1276,9 @@ void LuaEnums::initSoundEnums(lua_State* L) {
registerEnumNamespace(L, soundNamespace, SoundEffect_t::MONSTER_MELEE_ATK_MAGIC);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::MONSTER_MELEE_ATK_ETHEREAL);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::MONSTER_MELEE_ATK_CONSTRUCT);
}

void LuaEnums::spelltSoundEnums(lua_State* L) {
registerEnumNamespace(L, soundNamespace, SoundEffect_t::SPELL_LIGHT_HEALING);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::SPELL_INTENSE_HEALING);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::SPELL_ULTIMATE_HEALING);
Expand Down Expand Up @@ -1423,6 +1430,9 @@ void LuaEnums::initSoundEnums(lua_State* L) {
registerEnumNamespace(L, soundNamespace, SoundEffect_t::SPELL_EXPOSE_WEAKNESS);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::SPELL_SAP_STRENGTH);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::SPELL_CANCEL_MAGIC_SHIELD);
}

void LuaEnums::monsterSoundEnums(lua_State* L) {
registerEnumNamespace(L, soundNamespace, SoundEffect_t::MONSTER_SPELL_SINGLE_TARGET_FIRE);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::MONSTER_SPELL_SINGLE_TARGET_ENERGY);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::MONSTER_SPELL_SINGLE_TARGET_EARTH);
Expand Down Expand Up @@ -1487,6 +1497,9 @@ void LuaEnums::initSoundEnums(lua_State* L) {
registerEnumNamespace(L, soundNamespace, SoundEffect_t::MONSTER_SPELL_HIGHRISK_TELEPORT);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::MONSTER_SPELL_MINION);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::MONSTER_SPELL_AGONY);
}

void LuaEnums::effectsSoundEnums(lua_State* L) {
registerEnumNamespace(L, soundNamespace, SoundEffect_t::AMPHIBIC_BARK);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::AQUATIC_BEAST_BARK);
registerEnumNamespace(L, soundNamespace, SoundEffect_t::AQUATIC_CRITTER_BARK);
Expand Down
3 changes: 3 additions & 0 deletions src/lua/functions/core/game/lua_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,8 @@ class LuaEnums final : LuaScriptInterface {
static void initWebhookEnums(lua_State* L);
static void initBosstiaryEnums(lua_State* L);
static void initSoundEnums(lua_State* L);
static void spelltSoundEnums(lua_State* L);
static void monsterSoundEnums(lua_State* L);
static void effectsSoundEnums(lua_State* L);
static void initWheelEnums(lua_State* L);
};

0 comments on commit eb80b35

Please sign in to comment.