My ConanFile.py for TWSAPI's C++ code
from conans import ConanFile, CMake, tools
IBKR_VERSION = "10.18.01"
class TwsApiConan(ConanFile):
name = "twsapi"
version = IBKR_VERSION
license = "NA"
url = "URL_TO_CODE_FORK"
description = "Built from a mirror of the actual TWS API files in Github"
topics = ("tws", "interactive brokers")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = {"shared": False}
generators = "cmake"
def source(self):
self.run("git clone --depth 1 --branch " + IBKR_VERSION + " git@github.com/tws-api.git")
tools.replace_in_file("tws-api/CMakeLists.txt", " LANGUAGES CXX )",
''' LANGUAGES CXX )
add_compile_options(-std=c++17)''')
def build(self):
cmake = CMake(self)
cmake.configure(source_folder="tws-api")
cmake.build()
def package(self):
self.copy("*.h", dst="include", src="tws-api/source/cppclient/client")
self.copy("*.lib", dst="lib", keep_path=False)
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False)
self.copy("*.dylib", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["twsapi"]
Recently TWSAPI added a requirement for an obscure library.. which I have installed locally and linked in an downstream project.. but does it make sense to move that dependency into this ? I tried the following but don't see any change or signal that the libs were picked up.. is it merely my job to find them and add them under self.copy as well?
Conan References : https://github.com/conan-io/conan/issues/8044#issuecomment-726053437
Debian Package containing the libs : https://packages.debian.org/sid/libintelrdfpmath-dev
def package_info(self):
self.cpp_info.libs = ["twsapi", "bidgcc000"] <--- merely calling it out doesn't work
I think you're looking for self.cpp_info.system_libs
:
def package_info(self):
self.cpp_info.libs = ["twsapi"]
self.cpp_info.system_libs = ["bidgcc000"]