Switch to CPM for dependency management
This commit is contained in:
parent
8e5f196d37
commit
e4cf12137a
|
@ -1,3 +1,4 @@
|
|||
/cmake-build-debug/
|
||||
/cmake-build-release/
|
||||
/build-release-windows/
|
||||
/.idea/
|
|
@ -1,14 +1,37 @@
|
|||
cmake_minimum_required(VERSION 3.18)
|
||||
project(PokemonScriptTester)
|
||||
|
||||
include(CPM.cmake)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
option(WINDOWS "Whether the build target is Windows or not." OFF)
|
||||
set(SHARED OFF)
|
||||
|
||||
include(CMakeLists.txt.in)
|
||||
include_pkmnlib()
|
||||
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 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")
|
||||
add_compile_options(-fconcepts)
|
||||
|
@ -22,8 +45,9 @@ endif ()
|
|||
file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.hpp extern/AngelscriptDebugger/src/*.cpp)
|
||||
add_executable(PokemonScriptTester ${SRC_FILES})
|
||||
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_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,7 +1,7 @@
|
|||
#ifndef POKEMONSCRIPTTESTER_MISCMOCKFUNCTIONS_HPP
|
||||
#define POKEMONSCRIPTTESTER_MISCMOCKFUNCTIONS_HPP
|
||||
|
||||
#include <PkmnLib/extern/angelscript_addons/scripthandle/scripthandle.h>
|
||||
#include <scripthandle/scripthandle.h>
|
||||
|
||||
class MiscMockFunctions {
|
||||
static CScriptHandle CreateMoveScript(const ArbUt::StringView& name) {
|
||||
|
|
Loading…
Reference in New Issue