Allow setting for Windows build in Conan.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-01-01 13:02:00 +01:00
parent 4d3dc28606
commit ecb17a8bad
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 12 additions and 11 deletions

View File

@ -8,9 +8,16 @@ project(CreatureLib)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
else ()
message(WARNING "The file conanbuildinfo.cmake doesn't exist, you have to run conan install first")
endif ()
if (WINDOWS)
ADD_DEFINITIONS(-D WINDOWS=1)
endif(WINDOWS)
endif (WINDOWS)
# Create Core library with files in src/Core
file(GLOB_RECURSE CORE_SRC_FILES "src/Core/*.cpp" "src/Core/*.hpp")
@ -57,10 +64,3 @@ if (NOT DEFINED CONAN_EXPORTED)
# Add a definition for the test library
target_compile_definitions(CreatureLibTests PRIVATE TESTS_BUILD)
endif ()
if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
else ()
message(WARNING "The file conanbuildinfo.cmake doesn't exist, you have to run conan install first")
endif ()

View File

@ -7,14 +7,15 @@ class CreatureLibConan(ConanFile):
url = "https://git.p-epsilon.com/Deukhoofd/CreatureLib"
description = "The core implementation for turn based battling using creatures."
settings = "compiler"
options = {"shared": [True, False]}
default_options = {"shared": True}
options = {"shared": [True, False], "windows": [True, False]}
default_options = {"shared": True, "windows": False}
generators = "cmake"
exports_sources = "*"
compiler = "clang"
def build(self):
cmake = CMake(self)
cmake.definitions["WINDOWS"] = self.settings.get_safe("windows")
cmake.configure()
cmake.build()