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,6 +8,13 @@ project(CreatureLib)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) 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) if (WINDOWS)
ADD_DEFINITIONS(-D WINDOWS=1) ADD_DEFINITIONS(-D WINDOWS=1)
endif (WINDOWS) endif (WINDOWS)
@ -57,10 +64,3 @@ if (NOT DEFINED CONAN_EXPORTED)
# Add a definition for the test library # Add a definition for the test library
target_compile_definitions(CreatureLibTests PRIVATE TESTS_BUILD) target_compile_definitions(CreatureLibTests PRIVATE TESTS_BUILD)
endif () 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" url = "https://git.p-epsilon.com/Deukhoofd/CreatureLib"
description = "The core implementation for turn based battling using creatures." description = "The core implementation for turn based battling using creatures."
settings = "compiler" settings = "compiler"
options = {"shared": [True, False]} options = {"shared": [True, False], "windows": [True, False]}
default_options = {"shared": True} default_options = {"shared": True, "windows": False}
generators = "cmake" generators = "cmake"
exports_sources = "*" exports_sources = "*"
compiler = "clang" compiler = "clang"
def build(self): def build(self):
cmake = CMake(self) cmake = CMake(self)
cmake.definitions["WINDOWS"] = self.settings.get_safe("windows")
cmake.configure() cmake.configure()
cmake.build() cmake.build()