Stephen Seo
4afec4ddb9
Some checks failed
Run UnitTests / build-and-run-tests (push) Has been cancelled
TODO: Figure out linking for Windows.
61 lines
1.8 KiB
Python
61 lines
1.8 KiB
Python
from conan import ConanFile
|
|
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
|
|
import os
|
|
|
|
|
|
class udpcRecipe(ConanFile):
|
|
name = "udpc"
|
|
version = "1.2"
|
|
package_type = "library"
|
|
|
|
# Optional metadata
|
|
license = "MIT"
|
|
author = "Stephen Seo stephen@seodisparate.com"
|
|
url = "https://git.seodisparate.com/stephenseo/UDPConnection"
|
|
description = "Implements a connection over UDP"
|
|
topics = ("UDPC", "UDP", "Network", "Network Connection")
|
|
|
|
# Binary configuration
|
|
settings = "os", "compiler", "build_type", "arch"
|
|
options = {"shared": [True, False], "fPIC": [True, False]}
|
|
default_options = {"shared": False, "fPIC": True}
|
|
|
|
# Sources are located in the same place as this recipe, copy them to the recipe
|
|
exports_sources = "CMakeLists.txt", "src/*"
|
|
|
|
def config_options(self):
|
|
if self.settings.os == "Windows":
|
|
self.options.rm_safe("fPIC")
|
|
|
|
def configure(self):
|
|
if self.options.shared:
|
|
self.options.rm_safe("fPIC")
|
|
|
|
def layout(self):
|
|
cmake_layout(self)
|
|
|
|
def requirements(self):
|
|
self.requires("libsodium/cci.20220430")
|
|
|
|
def generate(self):
|
|
deps = CMakeDeps(self)
|
|
deps.generate()
|
|
tc = CMakeToolchain(self)
|
|
tc.generate()
|
|
|
|
def build(self):
|
|
cmake = CMake(self)
|
|
cmake.configure()
|
|
cmake.build()
|
|
|
|
def package(self):
|
|
cmake = CMake(self)
|
|
cmake.install()
|
|
|
|
def package_info(self):
|
|
self.cpp_info.libs.append("UDPC")
|
|
if self.settings.os == "Linux":
|
|
self.cpp_info.system_libs.append("stdc++")
|
|
elif self.settings.os == "Macos":
|
|
self.cpp_info.system_libs.append("libc++")
|
|
# TODO figure out linking static library for other OS.
|