Adds support for Angelscript debugger.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
0ebac13c14
commit
af50f1cc74
|
@ -4,6 +4,10 @@ name: default
|
|||
|
||||
type: docker
|
||||
steps:
|
||||
- name: submodules
|
||||
image: alpine/git
|
||||
commands:
|
||||
- git submodule update --init --recursive
|
||||
- name: test-debug-linux
|
||||
image: deukhoofd/linux64builder
|
||||
environment:
|
||||
|
@ -53,6 +57,6 @@ steps:
|
|||
- wine64 build-release-windows/pkmnLibTests.exe -s --duration=true --force-colors=true
|
||||
---
|
||||
kind: signature
|
||||
hmac: 72d8b9f3bc34aa773df18741607d197ffaff94e6692deb55cc139715e1726755
|
||||
hmac: b3b11a98050648beb846956c73c1fccb44395297c7bac25c7f26106d0af5b46f
|
||||
|
||||
...
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "extern/AngelscriptDebuggerServer"]
|
||||
path = extern/AngelscriptDebuggerServer
|
||||
url = https://git.p-epsilon.com/Deukhoofd/AngelscriptDebuggerServer.git
|
|
@ -50,4 +50,10 @@ export uint8_t PkmnLib_AngelScriptResolver_RegisterGlobalMethod(AngelScriptResol
|
|||
void*(func)(void*)) {
|
||||
Try(p->RegisterGlobalMethod(decl, func);)
|
||||
}
|
||||
export void PkmnLib_AngelScriptResolve_DefineWord(AngelScriptResolver* p, const char* word) { p->DefineWord(word); }
|
||||
export void PkmnLib_AngelScriptResolver_DefineWord(AngelScriptResolver* p, const char* word) { p->DefineWord(word); }
|
||||
|
||||
export void PkmnLib_AngelScriptResolver_AddDebugger(AngelScriptResolver* p, u16 port) {
|
||||
auto* d = new AngelscriptDebugger();
|
||||
d->Run(port);
|
||||
p->SetDebugger(d);
|
||||
}
|
|
@ -92,6 +92,7 @@ if (SCRIPT_PROVIDER STREQUAL "angelscript")
|
|||
"extern/angelscript_addons/*.h"
|
||||
"CInterface/AngelScript/*.cpp"
|
||||
"CInterface/AngelScript/*.hpp"
|
||||
"extern/AngelscriptDebuggerServer/src/*.cpp"
|
||||
)
|
||||
ADD_DEFINITIONS(-D AS_USE_ACCESSORS=1)
|
||||
endif ()
|
||||
|
@ -130,7 +131,7 @@ if (WINDOWS)
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-allow-multiple-definition")
|
||||
if (SHARED)
|
||||
set_target_properties(pkmnLib PROPERTIES SUFFIX ".dll")
|
||||
endif(SHARED)
|
||||
endif (SHARED)
|
||||
endif (WINDOWS)
|
||||
|
||||
if (NOT WINDOWS)
|
||||
|
@ -138,15 +139,15 @@ if (NOT WINDOWS)
|
|||
endif ()
|
||||
|
||||
if (STATICC)
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
|
||||
message(STATUS "Linking C library statically")
|
||||
set(_LINKS ${_LINKS} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lm -lstdc++ -lpthread -Wl,-Bdynamic)
|
||||
SET(_TESTLINKS ${_TESTLINKS} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic)
|
||||
else()
|
||||
set(_LINKS ${_LINKS} -Wl,-Bstatic -lm -lgcc -lstdc++ -Wl,-Bdynamic)
|
||||
SET(_TESTLINKS ${_TESTLINKS} -Wl,-Bstatic -lm -lgcc -lstdc++ -Wl,-Bdynamic)
|
||||
else ()
|
||||
SET(_LINKS ${_LINKS} -Wl,--whole-archive -lpthread -Wl,--no-whole-archive)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
target_link_libraries(pkmnLib PUBLIC ${_LINKS})
|
||||
target_link_libraries(pkmnLib PRIVATE ${_LINKS})
|
||||
|
||||
if (TESTS)
|
||||
# Create Test executable
|
||||
|
@ -162,9 +163,4 @@ if (TESTS)
|
|||
target_compile_definitions(pkmnLibTests PRIVATE TESTS_BUILD)
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
include_directories(extern/AngelscriptDebuggerServer/extern/asio-1.18.2/include)
|
||||
|
|
|
@ -14,6 +14,7 @@ ExternalProject_Add(AngelscriptProj
|
|||
TEST_COMMAND ""
|
||||
)
|
||||
|
||||
|
||||
function(include_angelscript)
|
||||
configure_file(CMakeLists.txt.angelscript.in Angelscript/download/CMakeLists.txt)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 6e99c5183e04c614ed7c5638d13115c62c9bd667
|
|
@ -121,7 +121,7 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg,
|
|||
_engine->RegisterGlobalProperty("const StaticLibrary@ StaticLib", (void*)staticLib.get());
|
||||
}
|
||||
|
||||
_contextPool = new ContextPool(_engine, _userData);
|
||||
_contextPool = new ContextPool(this, _userData);
|
||||
|
||||
asPrepareMultithread();
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <CreatureLib/Battling/ScriptHandling/ScriptResolver.hpp>
|
||||
#include <mutex>
|
||||
#include "../../../extern/AngelscriptDebuggerServer/src/AngelscriptDebugger.hpp"
|
||||
#include "../../../extern/angelscript_addons/scriptbuilder/scriptbuilder.h"
|
||||
#include "../../Battling/Library/BattleLibrary.hpp"
|
||||
#include "AngelScriptEvolutionScript.hpp"
|
||||
|
@ -24,6 +25,7 @@ private:
|
|||
CScriptBuilder _builder = {};
|
||||
std::string _sourceDirectory = {};
|
||||
AngelscriptUserdata* _userData;
|
||||
ArbUt::OptionalUniquePtr<AngelscriptDebugger> _debugger;
|
||||
|
||||
ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo*>> _typeDatabase;
|
||||
ArbUt::Dictionary<ArbUt::StringView, asITypeInfo*> _baseTypes;
|
||||
|
@ -106,6 +108,9 @@ public:
|
|||
|
||||
inline ContextPool* GetContextPool() const noexcept { return _contextPool; }
|
||||
|
||||
inline asIScriptEngine* GetEngine() const noexcept { return _engine; }
|
||||
inline AngelscriptUserdata* GetUserdata() const noexcept { return _userData; }
|
||||
inline ArbUt::OptionalBorrowedPtr<AngelscriptDebugger> GetDebugger() const noexcept { return _debugger.GetValue(); }
|
||||
inline void SetDebugger(AngelscriptDebugger* debugger) noexcept { _debugger = debugger; }
|
||||
};
|
||||
#endif // PKMNLIB_ANGELSCRIPRESOLVER_HPP
|
||||
|
|
|
@ -19,7 +19,7 @@ class ContextPool {
|
|||
};
|
||||
|
||||
ArbUt::Dictionary<std::thread::id, CtxThreadedPoolStorage*> _pool;
|
||||
asIScriptEngine* _engine;
|
||||
AngelScriptResolver* _resolver;
|
||||
AngelscriptUserdata* _userData;
|
||||
|
||||
CtxThreadedPoolStorage* GetThreadPool() {
|
||||
|
@ -32,7 +32,8 @@ class ContextPool {
|
|||
}
|
||||
|
||||
public:
|
||||
ContextPool(asIScriptEngine* engine, AngelscriptUserdata* userData) : _engine(engine), _userData(userData) {}
|
||||
ContextPool(AngelScriptResolver* resolver, AngelscriptUserdata* userData)
|
||||
: _resolver(resolver), _userData(userData) {}
|
||||
|
||||
~ContextPool() {
|
||||
for (const auto& kv : _pool) {
|
||||
|
@ -49,9 +50,12 @@ public:
|
|||
ctx = *pool->Pool.rbegin();
|
||||
pool->Pool.pop_back();
|
||||
} else {
|
||||
ctx = _engine->CreateContext();
|
||||
ctx = _resolver->GetEngine()->CreateContext();
|
||||
ctx->SetUserData(_userData);
|
||||
}
|
||||
if (_resolver->GetDebugger().HasValue()) {
|
||||
_resolver->GetDebugger().GetValue()->RegisterContext(ctx);
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue