Update to latest version of PkmnLib

This commit is contained in:
Deukhoofd 2022-03-12 10:31:31 +01:00
parent a393c3da21
commit 826a3c20a8
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
5 changed files with 1049 additions and 59 deletions

View File

@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.19) cmake_minimum_required(VERSION 3.19)
project(pkmnlib_ai) project(pkmnlib_ai)
include(CPM.cmake)
# Enable all warnings, and make them error when occurring. # Enable all warnings, and make them error when occurring.
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
@ -7,10 +8,7 @@ set(CMAKE_CXX_STANDARD 20)
option(WINDOWS "Whether the build target is Windows or not." OFF) option(WINDOWS "Whether the build target is Windows or not." OFF)
option(SHARED "Whether we should build a shared library, instead of a static one." ON) option(SHARED "Whether we should build a shared library, instead of a static one." ON)
option(AIRUNNER "Whether we should build a runner application for the AIs" OFF) option(AIRUNNER "Whether we should build a runner application for the AIs" OFF)
set(STATICC TRUE) set(STATICC OFF)
include(CMakeLists.txt.in)
include_pkmnlib()
file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.hpp CInterface/pkmnlibai.cpp CInterface/Core.cpp) file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.hpp CInterface/pkmnlibai.cpp CInterface/Core.cpp)
add_library(pkmnlib_ai SHARED ${SRC_FILES}) add_library(pkmnlib_ai SHARED ${SRC_FILES})
@ -29,12 +27,34 @@ if (WINDOWS)
endif(SHARED) endif(SHARED)
endif (WINDOWS) endif (WINDOWS)
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}"
)
execute_process(COMMAND ln -sf ${PkmnLib_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/include/PkmnLib)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
include_directories(${PkmnLib_BINARY_DIR}/include/)
SET(_LINKS Arbutils CreatureLib pkmnLib angelscript -lpthread) 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)
target_link_directories(pkmnlib_ai PUBLIC ${Angelscript_BINARY_DIR})
SET(_LINKS Arbutils CreatureLib pkmnLib -lpthread)
target_link_libraries(pkmnlib_ai PUBLIC ${_LINKS}) target_link_libraries(pkmnlib_ai PUBLIC ${_LINKS})
target_compile_options(pkmnlib_ai PRIVATE -Wall -Wextra -Werror) target_compile_options(pkmnlib_ai PRIVATE -Wall -Wextra -Werror)
if (AIRUNNER) if (AIRUNNER)
file(GLOB_RECURSE RUNNER_SRC_FILES test_runner/*.cpp test_runner/*.hpp) file(GLOB_RECURSE RUNNER_SRC_FILES test_runner/*.cpp test_runner/*.hpp)
add_executable(pkmnlib_ai_runner ${RUNNER_SRC_FILES}) add_executable(pkmnlib_ai_runner ${RUNNER_SRC_FILES})

View File

@ -1,51 +0,0 @@
cmake_minimum_required(VERSION 2.8.12)
project(pkmnlib_ai 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)
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()

1021
CPM.cmake Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,11 +4,11 @@
#include <CreatureLib/Battling/TurnChoices/PassTurnChoice.hpp> #include <CreatureLib/Battling/TurnChoices/PassTurnChoice.hpp>
#include <CreatureLib/Battling/TurnChoices/SwitchTurnChoice.hpp> #include <CreatureLib/Battling/TurnChoices/SwitchTurnChoice.hpp>
#include <PkmnLib/Battling/Pokemon/LearnedMove.hpp> #include <PkmnLib/Battling/Pokemon/LearnedMove.hpp>
#include <PkmnLib/Battling/Pokemon/PokemonParty.hpp>
#include <algorithm> #include <algorithm>
#include <angelscript.h> #include <angelscript.h>
#include <future> #include <future>
#include <thread> #include <thread>
#include "../cmake-build-release/PkmnLib/src/pkmnlib/src/Battling/Pokemon/PokemonParty.hpp"
#include "NaiveAI.hpp" #include "NaiveAI.hpp"
#include "PokemonAI.hpp" #include "PokemonAI.hpp"

@ -1 +1 @@
Subproject commit e2edf6129dd3c2feb44bf5ce98644b26da9609f8 Subproject commit fd24ce63c1113eef37d6153ad295928b700545fa