Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
Use more expressive conanfile.py for Conan.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikogenvik committed May 22, 2023
1 parent 4b30e86 commit 9b9c0d1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 43 deletions.
12 changes: 1 addition & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
cmake_minimum_required(VERSION 3.12)

project(Cyphesis)
#Append paths to make Conan work. This will play nicely with the cmake_find_package generator.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/tools/cmake)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/tools/cmake)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)

Expand Down Expand Up @@ -46,14 +44,6 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
link_libraries(Threads::Threads)

#TODO: Remove this and provide the PYTHON_IS_STATIC flag from conanfile.py instead.
if (CONAN_CXX_FLAGS)
message(STATUS "Using Conan for dependency resolution.")
#If Python has been built statically (as with Conan) we need to mark this so we can enable exports so the dynamic loading works.
set(PYTHON_IS_STATIC TRUE)

endif ()

find_package(Python3 COMPONENTS Development Interpreter REQUIRED)

find_package(Atlas 0.7.0 REQUIRED)
Expand Down
35 changes: 35 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from conan import ConanFile
from conan.tools.cmake import cmake_layout, CMakeDeps, CMakeToolchain
from conan.tools.microsoft import is_msvc


class Conan(ConanFile):
package_type = "application"
settings = "os", "arch", "compiler", "build_type"

def requirements(self):
self.requires("atlas/0.7.0@worldforge")
self.requires("mercator/0.4.0@worldforge")
self.requires("varconf/1.0.3@worldforge")
self.requires("wfmath/1.0.3@worldforge")
self.requires("libxdg-basedir/1.2.3@worldforge")
self.requires("sigc++/2.10.0@worldforge")
self.requires("libgcrypt/1.8.4")
self.requires("zlib/1.2.13")
self.requires("bzip2/1.0.8")
self.requires("sqlite3/3.42.0")
self.requires("readline/8.1.2@worldforge")
self.requires("cpython/3.10.0@worldforge")
self.requires("boost/1.81.0")
self.requires("bullet3/2.89")

def generate(self):
deps = CMakeDeps(self)
deps.generate()

tc = CMakeToolchain(self)
tc.variables["PYTHON_IS_STATIC"] = "TRUE"
tc.generate()

def layout(self):
cmake_layout(self)
32 changes: 0 additions & 32 deletions conanfile.txt

This file was deleted.

0 comments on commit 9b9c0d1

Please sign in to comment.