Support for Windows builds.
This commit is contained in:
parent
91247909f8
commit
37c9855926
|
@ -4,6 +4,9 @@ project(pkmnlib_ai)
|
||||||
# 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)
|
||||||
|
|
||||||
|
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)
|
set(STATICC TRUE)
|
||||||
|
|
||||||
include(CMakeLists.txt.in)
|
include(CMakeLists.txt.in)
|
||||||
|
@ -15,11 +18,30 @@ target_precompile_headers(pkmnlib_ai PUBLIC src/Precompiled.hxx)
|
||||||
set_target_properties(pkmnlib_ai PROPERTIES LINKER_LANGUAGE CXX)
|
set_target_properties(pkmnlib_ai PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
add_definitions(-DLEVEL_U8)
|
add_definitions(-DLEVEL_U8)
|
||||||
|
|
||||||
SET(_LINKS Arbutils CreatureLib pkmnLib -lbfd -ldl -lpthread)
|
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 -lpthread)
|
||||||
|
if (NOT WINDOWS)
|
||||||
|
SET(_LINKS ${LINKS} -lbfd -ldl)
|
||||||
|
endif()
|
||||||
target_link_libraries(pkmnlib_ai PUBLIC ${_LINKS})
|
target_link_libraries(pkmnlib_ai PUBLIC ${_LINKS})
|
||||||
target_compile_options(pkmnlib_ai PRIVATE -Wall -Wextra -Werror -fstandalone-debug)
|
target_compile_options(pkmnlib_ai PRIVATE -Wall -Wextra -Werror)
|
||||||
|
|
||||||
|
|
||||||
|
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})
|
||||||
target_link_libraries(pkmnlib_ai_runner PUBLIC ${_LINKS} pkmnlib_ai)
|
target_compile_options(pkmnlib_ai_runner PRIVATE -Wall -Wextra -Werror)
|
||||||
|
target_link_libraries(pkmnlib_ai_runner PUBLIC pkmnlib_ai)
|
||||||
|
endif()
|
|
@ -1,4 +1,5 @@
|
||||||
#include "BuildTypes.hpp"
|
#include "BuildTypes.hpp"
|
||||||
|
|
||||||
CreatureLib::Library::TypeLibrary* BuildTypes::Build(const std::string& path) {
|
CreatureLib::Library::TypeLibrary* BuildTypes::Build(const std::string& path) {
|
||||||
std::ifstream file(path);
|
std::ifstream file(path);
|
||||||
if (file.fail()) {
|
if (file.fail()) {
|
||||||
|
|
Loading…
Reference in New Issue