Friendship with conan is over, ExternalProject is my best friend now.
continuous-integration/drone/push Build is failing Details

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
Deukhoofd 2021-04-12 18:50:50 +02:00
parent ba5e937dbd
commit b5d8b89c38
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
4 changed files with 48 additions and 76 deletions

View File

@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.16)
include(CheckIPOSupported)
include(CMakeLists.txt.in)
include_arbutils()
project(CreatureLib)
@ -24,8 +26,6 @@ if (CMAKE_BUILD_TYPE MATCHES Release AND NOT WINDOWS)
add_compile_options(-g -gline-tables-only)
endif ()
include(CmakeConanSetup.cmake)
SetupConan()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

46
CMakeLists.txt.in Normal file
View File

@ -0,0 +1,46 @@
cmake_minimum_required(VERSION 2.8.12)
project(arbutils-download NONE)
include(ExternalProject)
ExternalProject_Add(arbutils
GIT_REPOSITORY https://git.p-epsilon.com/Deukhoofd/Arbutils
GIT_TAG master
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/Arbutils"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
function(include_arbutils)
# Download and unpack googletest at configure time
configure_file(CMakeLists.txt.in Arbutils/download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/download)
if (result)
message(FATAL_ERROR "CMake step for arbutils failed: ${result}")
endif ()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/download)
if (result)
message(FATAL_ERROR "Build step for arbutils failed: ${result}")
endif ()
# Add googletest directly to our build. This defines
# the gtest and gtest_main targets.
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/Arbutils/src/arbutils
${CMAKE_CURRENT_BINARY_DIR}/Arbutils/bin
EXCLUDE_FROM_ALL)
execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include)
execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/src/arbutils/src
${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include/Arbutils)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include)
endfunction()

View File

@ -1,24 +0,0 @@
function(SetupConan)
# If conan isn't set up yet, we need to install the dependencies.
if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
message(WARNING "The file conanbuildinfo.cmake doesn't exist, running conan install.")
# If we're linking C statically, we also want to do so for our dependencies.
set(CONAN_STATIC_C False)
if (STATICC)
set(CONAN_STATIC_C True)
endif (STATICC)
if (NOT WINDOWS)
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
-s compiler=clang -s compiler.libcxx=libstdc++11 -o *:shared=True -o *:staticC=${CONAN_STATIC_C})
else ()
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
-s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=$ENV{CONAN_ENV_COMPILER_VERSION}
-s os=Windows -o
*:shared=True -o *:staticC=${CONAN_STATIC_C})
endif ()
endif ()
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
endfunction()

View File

@ -1,50 +0,0 @@
from conans import ConanFile, CMake
class CreatureLibConan(ConanFile):
name = "CreatureLib"
license = "TODO"
url = "https://git.p-epsilon.com/Deukhoofd/CreatureLib"
description = "The core implementation for turn based battling using creatures."
settings = "os", "compiler"
options = {"shared": [True, False], "staticC": [True, False], "level_size": [8, 16, 32, 64]}
default_options = {"shared": True, "staticC": False, "level_size": 8}
generators = "cmake"
exports_sources = "*"
compiler = "clang"
def build(self):
cmake = CMake(self)
self.output.info("Target OS: %s." % self.settings.os)
if self.settings.os == "Windows":
self.output.warn("Noticed Windows target, setting Cmake WINDOWS=On.")
cmake.definitions["WINDOWS"] = "On"
if self.options.shared:
self.output.info("Building shared library.")
cmake.definitions["SHARED"] = "On"
if self.options.staticC:
self.output.info("Linking C libraries statically")
cmake.definitions["STATICC"] = "ON"
self.output.info("Using level size of: %s" % self.options.level_size)
cmake.definitions["LEVEL_SIZE"] = self.options.level_size
cmake.configure()
cmake.build()
def package(self):
self.copy("*.hpp", dst="include/CreatureLib", src="src")
self.copy("*.hxx", dst="include/CreatureLib", src="src")
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
def imports(self):
if self.settings.os == "Windows":
self.copy("*.dll", "", "bin")
self.copy("*.a", "", "bin")
def package_info(self):
self.cpp_info.libs = ["CreatureLib"]
def requirements(self):
self.requires("Arbutils/latest@epsilon/master")