Compare commits
8 Commits
Author | SHA1 | Date |
---|---|---|
Deukhoofd | 71d77350d5 | |
Deukhoofd | 2e9248ff18 | |
Deukhoofd | 0c82ff9e82 | |
Deukhoofd | 44e850cfc7 | |
Deukhoofd | 810968354e | |
Deukhoofd | 176cb9f1c0 | |
Deukhoofd | 69404a26da | |
Deukhoofd | e4cf12137a |
|
@ -1,3 +1,4 @@
|
||||||
/cmake-build-debug/
|
/cmake-build-debug/
|
||||||
/cmake-build-release/
|
/cmake-build-release/
|
||||||
|
/build-release-windows/
|
||||||
/.idea/
|
/.idea/
|
|
@ -1,14 +1,42 @@
|
||||||
cmake_minimum_required(VERSION 3.18)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
project(PokemonScriptTester)
|
project(PokemonScriptTester)
|
||||||
|
|
||||||
|
include(CPM.cmake)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
|
||||||
option(WINDOWS "Whether the build target is Windows or not." OFF)
|
option(WINDOWS "Whether the build target is Windows or not." OFF)
|
||||||
set(SHARED OFF)
|
set(SHARED OFF)
|
||||||
|
|
||||||
include(CMakeLists.txt.in)
|
if (WINDOWS)
|
||||||
include_pkmnlib()
|
SET(ANGELSCRIPT_DEBUGGER OFF)
|
||||||
|
else()
|
||||||
|
SET(ANGELSCRIPT_DEBUGGER ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME PkmnLib
|
||||||
|
GIT_REPOSITORY https://git.p-epsilon.com/Deukhoofd/PkmnLib.git
|
||||||
|
GIT_TAG master
|
||||||
|
OPTIONS
|
||||||
|
"SHARED=${SHARED}"
|
||||||
|
"WINDOWS=${WINDOWS}"
|
||||||
|
"ANGELSCRIPT_DEBUGGER=${ANGELSCRIPT_DEBUGGER}"
|
||||||
|
)
|
||||||
|
execute_process(COMMAND ln -sf ${PkmnLib_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/include/PkmnLib)
|
||||||
|
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME Angelscript
|
||||||
|
GIT_REPOSITORY https://git.p-epsilon.com/Deukhoofd/Angelscript.git
|
||||||
|
GIT_TAG master
|
||||||
|
DOWNLOAD_ONLY YES
|
||||||
|
)
|
||||||
|
include_directories(${Angelscript_SOURCE_DIR}/angelscript/include)
|
||||||
|
include_directories(${Angelscript_SOURCE_DIR}/add_on)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
add_compile_options(-fconcepts)
|
add_compile_options(-fconcepts)
|
||||||
|
@ -18,12 +46,32 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
add_link_options(-fuse-ld=lld)
|
add_link_options(-fuse-ld=lld)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
set(SRC_FILES_PATTERN src/*.cpp src/*.hpp)
|
||||||
file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.hpp extern/AngelscriptDebugger/src/*.cpp)
|
if (NOT WINDOWS)
|
||||||
|
set(SRC_FILES_PATTERN ${SRC_FILES_PATTERN} extern/AngelscriptDebugger/src/*.cpp)
|
||||||
|
endif()
|
||||||
|
file(GLOB_RECURSE SRC_FILES ${SRC_FILES_PATTERN})
|
||||||
add_executable(PokemonScriptTester ${SRC_FILES})
|
add_executable(PokemonScriptTester ${SRC_FILES})
|
||||||
add_definitions(-DLEVEL_U8)
|
|
||||||
|
|
||||||
SET(_LINKS -static pkmnLib)
|
target_include_directories(PokemonScriptTester PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
||||||
|
target_include_directories(PokemonScriptTester PUBLIC ${PkmnLib_BINARY_DIR}/include/)
|
||||||
|
target_link_directories(PokemonScriptTester PUBLIC ${Angelscript_BINARY_DIR})
|
||||||
|
|
||||||
|
add_definitions(-DLEVEL_U8)
|
||||||
|
if (NOT WINDOWS)
|
||||||
|
ADD_DEFINITIONS(-DANGELSCRIPT_DEBUGGER)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
SET(_LINKS -static pkmnLib Arbutils)
|
||||||
|
|
||||||
|
if (NOT WINDOWS)
|
||||||
|
SET(_LINKS ${_LINKS} AngelscriptDebugger)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (WINDOWS)
|
||||||
|
SET(_LINKS ${_LINKS} -Wl,-Bstatic -lgcc -lstdc++ -lpthread -Wl,-Bdynamic)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(PokemonScriptTester PUBLIC ${_LINKS})
|
target_link_libraries(PokemonScriptTester PUBLIC ${_LINKS})
|
||||||
target_compile_options(PokemonScriptTester PRIVATE -Wall -Wextra -Werror)
|
target_compile_options(PokemonScriptTester PRIVATE -Wall -Wextra -Werror)
|
||||||
|
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.8.12)
|
|
||||||
|
|
||||||
project(PokemonScriptTester NONE)
|
|
||||||
|
|
||||||
include(ExternalProject)
|
|
||||||
ExternalProject_Add(pkmnlib
|
|
||||||
GIT_REPOSITORY https://git.p-epsilon.com/Deukhoofd/PkmnLib
|
|
||||||
GIT_TAG master
|
|
||||||
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/PkmnLib"
|
|
||||||
CONFIGURE_COMMAND ""
|
|
||||||
BUILD_COMMAND ""
|
|
||||||
INSTALL_COMMAND ""
|
|
||||||
TEST_COMMAND ""
|
|
||||||
CMAKE_ARGS "-DSHARED=${SHARED} -DWINDOWS=${WINDOWS} -DSTATICC=${STATICC}"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
function(include_pkmnlib)
|
|
||||||
# Download and unpack googletest at configure time
|
|
||||||
configure_file(CMakeLists.txt.in PkmnLib/download/CMakeLists.txt)
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
|
||||||
RESULT_VARIABLE result
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/download)
|
|
||||||
if (result)
|
|
||||||
message(FATAL_ERROR "CMake step for pkmnlib failed: ${result}")
|
|
||||||
endif ()
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
|
||||||
RESULT_VARIABLE result
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/download)
|
|
||||||
if (result)
|
|
||||||
message(FATAL_ERROR "Build step for pkmnlib failed: ${result}")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Add googletest directly to our build. This defines
|
|
||||||
# the gtest and gtest_main targets.
|
|
||||||
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/bin
|
|
||||||
EXCLUDE_FROM_ALL)
|
|
||||||
|
|
||||||
execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include)
|
|
||||||
execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib/src
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include/PkmnLib)
|
|
||||||
execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib/extern
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include/extern)
|
|
||||||
execute_process(COMMAND cp -r ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib/extern
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include/PkmnLib/extern)
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib/extern/AngelscriptDebuggerServer/extern/asio-1.18.2/include
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/bin/CreatureLib/include
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/bin/Angelscript/src/AngelscriptProj/angelscript/include
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/bin/CreatureLib/bin/Arbutils/include)
|
|
||||||
|
|
||||||
|
|
||||||
endfunction()
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit e2edf6129dd3c2feb44bf5ce98644b26da9609f8
|
Subproject commit fd24ce63c1113eef37d6153ad295928b700545fa
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef POKEMONSCRIPTTESTER_MISCMOCKFUNCTIONS_HPP
|
#ifndef POKEMONSCRIPTTESTER_MISCMOCKFUNCTIONS_HPP
|
||||||
#define POKEMONSCRIPTTESTER_MISCMOCKFUNCTIONS_HPP
|
#define POKEMONSCRIPTTESTER_MISCMOCKFUNCTIONS_HPP
|
||||||
|
|
||||||
#include <PkmnLib/extern/angelscript_addons/scripthandle/scripthandle.h>
|
#include <scripthandle/scripthandle.h>
|
||||||
|
|
||||||
class MiscMockFunctions {
|
class MiscMockFunctions {
|
||||||
static CScriptHandle CreateMoveScript(const ArbUt::StringView& name) {
|
static CScriptHandle CreateMoveScript(const ArbUt::StringView& name) {
|
||||||
|
|
|
@ -34,9 +34,10 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i32 RunAll(bool waitForDebugger) {
|
i32 RunAll([[maybe_unused]]bool waitForDebugger) {
|
||||||
auto ctx = _scriptResolver->GetContextPool()->RequestContext();
|
auto ctx = _scriptResolver->GetContextPool()->RequestContext();
|
||||||
ctx->SetUserData(_scriptResolver->GetUserdata());
|
ctx->SetUserData(_scriptResolver->GetUserdata());
|
||||||
|
#if ANGELSCRIPT_DEBUGGER
|
||||||
_scriptResolver->SetDebugger(new AngelscriptDebugger());
|
_scriptResolver->SetDebugger(new AngelscriptDebugger());
|
||||||
auto& debugger = *_scriptResolver->GetDebugger().GetValue();
|
auto& debugger = *_scriptResolver->GetDebugger().GetValue();
|
||||||
debugger.Run(8684);
|
debugger.Run(8684);
|
||||||
|
@ -48,6 +49,7 @@ public:
|
||||||
}
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (auto& test : _tests) {
|
for (auto& test : _tests) {
|
||||||
test.second->Run(ctx);
|
test.second->Run(ctx);
|
||||||
|
|
Loading…
Reference in New Issue