Skip to content

Commit

Permalink
LUA build fix for Android, iOS and Windows (#1650)
Browse files Browse the repository at this point in the history
* Update paths to lua bindings

* Update target include directories due to new extension dir structure

* Add missing libraries and paths for prebuilt option

* Current FairyGUI requires paths to parent and source directory

* Add required thirdparty search path to LUA library
  • Loading branch information
rh101 authored Feb 4, 2024
1 parent 9b4c1a3 commit 7dd7dc4
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 14 deletions.
32 changes: 31 additions & 1 deletion cmake/Modules/AXLinkHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function(ax_link_cxx_prebuilt APP_NAME AX_ROOT_DIR AX_PREBUILT_DIR)

target_include_directories(${APP_NAME}
PRIVATE ${AX_ROOT_DIR}/thirdparty/lua
PRIVATE ${AX_ROOT_DIR}/extensions/scripting
PRIVATE ${AX_ROOT_DIR}/extensions/scripting/lua-bindings/manual
PRIVATE ${AX_ROOT_DIR}
PRIVATE ${AX_ROOT_DIR}/thirdparty
Expand Down Expand Up @@ -140,6 +141,7 @@ function(ax_link_cxx_prebuilt APP_NAME AX_ROOT_DIR AX_PREBUILT_DIR)
simdjson
physics-nodes
yasio
websocket-parser
)

if (AX_ENABLE_EXT_DRAGONBONES)
Expand Down Expand Up @@ -213,7 +215,35 @@ function(ax_link_cxx_prebuilt APP_NAME AX_ROOT_DIR AX_PREBUILT_DIR)
PRIVATE ${AX_ROOT_DIR}/extensions/GUI/src
)
endif()


if (AX_ENABLE_EXT_FAIRYGUI)
list(APPEND LIBS "fairygui")
target_include_directories(${APP_NAME}
PRIVATE ${AX_ROOT_DIR}/extensions/fairygui/src
)
endif()

if (AX_ENABLE_EXT_LIVE2D)
list(APPEND LIBS "Live2D")
target_include_directories(${APP_NAME}
PRIVATE ${AX_ROOT_DIR}/extensions/Live2D/Framework/src
)
endif()

if (AX_ENABLE_EXT_EFFEKSEER)
list(APPEND LIBS "EffekseerForCocos2d-x")
target_include_directories(${APP_NAME}
PRIVATE ${AX_ROOT_DIR}/extensions/Effekseer
)
endif()

if (AX_ENABLE_EXT_PHYSICS_NODE)
list(APPEND LIBS "physics-nodes")
target_include_directories(${APP_NAME}
PRIVATE ${AX_ROOT_DIR}/extensions/physics-nodes/src
)
endif()

if (WINDOWS)
target_link_libraries(${APP_NAME}
${LIBS}
Expand Down
8 changes: 7 additions & 1 deletion extensions/fairygui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ FILE(GLOB_RECURSE FAIRYGUI_SOURCES *.h;*.cpp)
add_library(${target_name} STATIC ${FAIRYGUI_SOURCES})

target_include_directories(${target_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_include_directories(${target_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/fairygui)
target_include_directories(${target_name}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/fairygui

INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/fairygui
)

setup_ax_extension_config(${target_name})
1 change: 1 addition & 0 deletions extensions/scripting/lua-bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ target_link_libraries(${_AX_LUA_LIB} ${lua_ext_depend})

target_include_directories(${_AX_LUA_LIB}
PUBLIC ${ax_root}/thirdparty/lua
PRIVATE ${ax_root}/thirdparty
PRIVATE manual/platform/android
PRIVATE manual/platform/android/jni
PRIVATE ${ax_root}/extensions/spine/runtime/include
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
THE SOFTWARE.
****************************************************************************/

#include "scripting/lua-bindings/manual/platform/android/LuaJavaBridge.h"
#include "LuaJavaBridge.h"
#if defined(__ANDROID__)
# include "platform/android/jni/JniHelper.h"
# include <android/log.h>
Expand All @@ -32,7 +32,7 @@
# define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)

extern "C" {
# include "scripting/lua-bindings/manual/tolua_fix.h"
# include "lua-bindings/manual/tolua_fix.h"
}

LuaJavaBridge::CallInfo::~CallInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
THE SOFTWARE.
****************************************************************************/

#include "scripting/lua-bindings/manual/platform/android/jni/LuaBridge.h"
#include "LuaBridge.h"

#if defined(__ANDROID__)
# include <android/log.h>

# include "scripting/lua-bindings/manual/platform/android/LuaJavaBridge.h"
# include "lua-bindings/manual/platform/android/LuaJavaBridge.h"

# include "base/UTF8.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ of this software and associated documentation files (the "Software"), to deal
THE SOFTWARE.
****************************************************************************/

#include "scripting/lua-bindings/manual/platform/ios/LuaObjcBridge.h"
#include "lua-bindings/manual/platform/ios/LuaObjcBridge.h"
#include <Foundation/Foundation.h>

NS_AX_BEGIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ add_library(${target_name} STATIC
get_target_property(lua_header ${AX_LUA_ENGINE} INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(tolua_header tolua INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(${target_name}
PRIVATE ../../..
PRIVATE ../..
PRIVATE ../manual
PRIVATE ../manual/platform/android
PRIVATE ${lua_header}
Expand Down
4 changes: 2 additions & 2 deletions templates/lua-template-default/Source/AppDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
****************************************************************************/

#include "AppDelegate.h"
#include "scripting/lua-bindings/manual/LuaEngine.h"
#include "lua-bindings/manual/LuaEngine.h"
#include "cocos2d.h"
#include "scripting/lua-bindings/manual/lua_module_register.h"
#include "lua-bindings/manual/lua_module_register.h"

#define USE_AUDIO_ENGINE 1

Expand Down
4 changes: 2 additions & 2 deletions tests/lua-tests/proj.ios_mac/ios/LuaObjectCBridgeTest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ of this software and associated documentation files (the "Software"), to deal
#import "LuaObjectCBridgeTest.h"

#include "cocos2d.h"
#include "scripting/lua-bindings/manual/LuaEngine.h"
#include "scripting/lua-bindings/manual/LuaBridge.h"
#include "lua-bindings/manual/LuaEngine.h"
#include "lua-bindings/manual/LuaBridge.h"

USING_NS_AX;

Expand Down
4 changes: 2 additions & 2 deletions tests/lua-tests/proj.ios_mac/mac/LuaObjectCBridgeTest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ of this software and associated documentation files (the "Software"), to deal
#import "LuaObjectCBridgeTest.h"

#include "cocos2d.h"
#include "scripting/lua-bindings/manual/LuaEngine.h"
#include "scripting/lua-bindings/manual/LuaBridge.h"
#include "lua-bindings/manual/LuaEngine.h"
#include "lua-bindings/manual/LuaBridge.h"

USING_NS_AX;

Expand Down

0 comments on commit 7dd7dc4

Please sign in to comment.