Switch to CPM for dependency management
continuous-integration/drone/push Build is failing Details
continuous-integration/drone Build is failing Details

This commit is contained in:
Deukhoofd 2022-02-11 13:47:23 +01:00
parent 8e5f196d37
commit e4cf12137a
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
5 changed files with 1050 additions and 59 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/cmake-build-debug/ /cmake-build-debug/
/cmake-build-release/ /cmake-build-release/
/build-release-windows/
/.idea/ /.idea/

View File

@ -1,14 +1,37 @@
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) execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/include)
include_pkmnlib() CPMAddPackage(
NAME PkmnLib
GIT_REPOSITORY https://git.p-epsilon.com/Deukhoofd/PkmnLib.git
GIT_TAG master
OPTIONS
"SHARED=${SHARED}"
"WINDOWS=${WINDOWS}"
"ANGELSCRIPT_DEBUGGER ON"
)
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)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
include_directories(${PkmnLib_BINARY_DIR}/include/)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-fconcepts) add_compile_options(-fconcepts)
@ -22,8 +45,9 @@ endif ()
file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.hpp extern/AngelscriptDebugger/src/*.cpp) file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.hpp extern/AngelscriptDebugger/src/*.cpp)
add_executable(PokemonScriptTester ${SRC_FILES}) add_executable(PokemonScriptTester ${SRC_FILES})
add_definitions(-DLEVEL_U8) add_definitions(-DLEVEL_U8)
ADD_DEFINITIONS(-DANGELSCRIPT_DEBUGGER)
SET(_LINKS -static pkmnLib) SET(_LINKS -static pkmnLib Arbutils AngelscriptDebugger)
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)

View File

@ -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()

1021
CPM.cmake Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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) {