PkmnLibAI/CMakeLists.txt

43 lines
1.5 KiB
CMake
Raw Normal View History

2021-04-18 11:37:14 +00:00
cmake_minimum_required(VERSION 3.19)
project(pkmnlib_ai)
# Enable all warnings, and make them error when occurring.
set(CMAKE_CXX_STANDARD 20)
2021-05-24 09:33:22 +00:00
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)
2021-04-18 11:37:14 +00:00
set(STATICC TRUE)
include(CMakeLists.txt.in)
include_pkmnlib()
2021-04-23 08:09:50 +00:00
file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.hpp CInterface/pkmnlibai.cpp CInterface/Core.cpp)
2021-04-18 11:37:14 +00:00
add_library(pkmnlib_ai SHARED ${SRC_FILES})
set_target_properties(pkmnlib_ai PROPERTIES LINKER_LANGUAGE CXX)
add_definitions(-DLEVEL_U8)
2021-05-24 09:33:22 +00:00
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)
2021-11-05 13:04:17 +00:00
SET(_LINKS Arbutils CreatureLib pkmnLib angelscript -lpthread)
2021-04-18 11:37:14 +00:00
target_link_libraries(pkmnlib_ai PUBLIC ${_LINKS})
2021-05-24 09:33:22 +00:00
target_compile_options(pkmnlib_ai PRIVATE -Wall -Wextra -Werror)
2021-04-18 11:37:14 +00:00
2021-05-24 09:33:22 +00:00
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)
2021-11-05 13:04:17 +00:00
target_link_libraries(pkmnlib_ai_runner PUBLIC pkmnlib_ai ${_LINKS})
2021-05-24 09:33:22 +00:00
endif()