43 lines
1.5 KiB
CMake
43 lines
1.5 KiB
CMake
cmake_minimum_required(VERSION 3.19)
|
|
project(pkmnlib_ai)
|
|
|
|
# Enable all warnings, and make them error when occurring.
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
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(AIRUNNER "Whether we should build a runner application for the AIs" OFF)
|
|
set(STATICC TRUE)
|
|
|
|
include(CMakeLists.txt.in)
|
|
include_pkmnlib()
|
|
|
|
file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.hpp CInterface/pkmnlibai.cpp CInterface/Core.cpp)
|
|
add_library(pkmnlib_ai SHARED ${SRC_FILES})
|
|
set_target_properties(pkmnlib_ai PROPERTIES LINKER_LANGUAGE CXX)
|
|
add_definitions(-DLEVEL_U8)
|
|
|
|
if (WINDOWS)
|
|
MESSAGE(WARNING, "Using Windows Build.")
|
|
# Add a definition for the compiler, so we can use it in C++ as well.
|
|
ADD_DEFINITIONS(-D WINDOWS=1)
|
|
# -m64: Build a 64 bit library
|
|
add_compile_options(-m64)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-allow-multiple-definition")
|
|
if (SHARED)
|
|
set_target_properties(pkmnlib_ai PROPERTIES SUFFIX ".dll")
|
|
endif(SHARED)
|
|
endif (WINDOWS)
|
|
|
|
|
|
SET(_LINKS Arbutils CreatureLib pkmnLib angelscript -lpthread)
|
|
target_link_libraries(pkmnlib_ai PUBLIC ${_LINKS})
|
|
target_compile_options(pkmnlib_ai PRIVATE -Wall -Wextra -Werror)
|
|
|
|
|
|
if (AIRUNNER)
|
|
file(GLOB_RECURSE RUNNER_SRC_FILES test_runner/*.cpp test_runner/*.hpp)
|
|
add_executable(pkmnlib_ai_runner ${RUNNER_SRC_FILES})
|
|
target_compile_options(pkmnlib_ai_runner PRIVATE -Wall -Wextra -Werror)
|
|
target_link_libraries(pkmnlib_ai_runner PUBLIC pkmnlib_ai ${_LINKS})
|
|
endif() |