You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not working on Linux (dependencies for xorg and libxft missing)
Build dependencies (CMake) missing
Not available in conan center
So I opted in rewriting the recipe to meet all modern conan requirements.
The recipe has been implemented on my Windows machine and works. However
for full Linux support, I need to wait until conan-io/conan-center-index#18789 is done.
The purpose of this issue is to keep you updated on the progress and provide a draft recipe for download. Any feedback is highly appreciated!
TODO List:
Basic recipe
Windows compatibility
Windows shared lib (CMake / Conan / Nana bug? Does not build... wants to export == on debug... ofc this symbol is not defined)
OSX compatibility (Simple: It's not going to happen for 1.4.7 ... I don't have a mac...)
Linux compatibility (What is going on freetype... why do you not include yourself...)
PR on conan-center-index
Probably bug fixing until it works on all configurations
Merged into conan center
Here is my current working draft conanfile.py:
"""Conan package for http://nanapro.orgRecipe Author: https://github.com/OhjurotAVAILABLE OPTIONS: - enable_audio: WAV Audio player - enable_jpeg: JPEG Decoding for picture widget - enable_png: PNG Decoding for picture widgetINFORMATION FOR LINUX USERS: Make sure to install xorg/system once as root! After that non root user will be able to use the lib / it's x11 dependencies! > conan install --requires=xorg/system -c tools.system.package_manager:mode=install"""fromconanimportConanFilefromconan.tools.cmakeimportCMakeToolchain, CMake, cmake_layout, CMakeDepsfromconan.tools.buildimportcheck_min_cppstdfromconan.tools.filesimportget, copy, replace_in_fileimportos.pathclassNanaRecipe(ConanFile):
name="nana"version="1.7.4"# Optional metadatalicense="BSL-1.0"author="Jinhao and individual nanapro.org contributors"url="http://nanapro.org/"description="Nana is a cross-platform library for GUI programming in modern C++ style"topics= ("gui", "ui", "forms", "user", "interface", "modern")
# Binary configurationsettings="os", "compiler", "build_type", "arch"options= {
# Conan CMake defaults"shared": [True, False],
"fPIC": [True, False],
# Nana options"enable_audio": [True, False],
"enable_jpeg": [True, False],
"enable_png": [True, False],
}
default_options= {
"shared": False,
"fPIC": True,
"enable_audio": False,
"enable_jpeg": False,
"enable_png": False,
}
defsource(self):
get(self, **self.conan_data["sources"][self.version])
defvalidate(self):
check_min_cppstd(self, "11")
defrequirements(self):
# Linux requirementsifself.settings.os=="Linux":
self.requires("xorg/system")
# libxft is not conan2 compatible... # See: https://github.com/conan-io/conan-center-index/pull/17485self.requires("libxft/2.3.6")
# Option based requirementsifself.options.enable_jpeg:
self.requires("libjpeg/9e")
ifself.options.enable_png:
self.requires("libpng/1.6.39")
defbuild_requirements(self):
self.build_requires("cmake/3.26.4")
ifself.settings.os=="Linux":
self.tool_requires("pkgconf/1.9.3")
defconfig_options(self):
ifself.settings.os=="Windows":
self.options.rm_safe("fPIC")
defconfigure(self):
ifself.options.shared:
self.options.rm_safe("fPIC")
deflayout(self):
cmake_layout(self)
defgenerate(self):
deps=CMakeDeps(self)
deps.generate()
tc=CMakeToolchain(self)
# Enable the use of the conan configuration header # (required for all following options)tc.variables["NANA_CMAKE_ENABLE_CONF"] =True# Use os like include paths (but the libs will be provided by conan)tc.variables["NANA_CMAKE_LIBJPEG_FROM_OS"] =Truetc.variables["NANA_CMAKE_LIBPNG_FROM_OS"] =True# Make cmake install work tc.variables["NANA_CMAKE_INSTALL"] =True# Set vars for optional featuresifself.options.enable_audio:
tc.variables["NANA_CMAKE_ENABLE_AUDIO"] =Trueifself.options.enable_jpeg:
tc.variables["NANA_CMAKE_ENABLE_JPEG"] =Trueifself.options.enable_png:
tc.variables["NANA_CMAKE_ENABLE_PNG"] =True# Static runtime for msvccompiler=self.settings.get_safe("compiler")
ifcompilerandstr(compiler).lower() =="msvc":
compiler_runtime=self.settings.get_safe("compiler.runtime")
tc.variables["MSVC_USE_STATIC_RUNTIME"] = (
compiler_runtime!=Noneand (compiler_runtime).lower() =="static"
)
tc.generate()
defbuild(self):
# We need to patch "system/split_string.cpp" on old versions # they used "and" instead of "&&" in this fileifself.version=="1.7.4":
replace_in_file(
self,
os.path.join(self.source_folder, "source/system", "split_string.cpp"),
" and ", " && "
)
cmake=CMake(self)
cmake.configure()
cmake.build()
defpackage(self):
cmake=CMake(self)
cmake.install()
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
defpackage_info(self):
self.cpp_info.libs= ["nana"]
# Add defines based on optionsifself.options.enable_audio:
self.cpp_info.defines.append("NANA_ENABLE_AUDIO")
ifself.options.enable_jpeg:
self.cpp_info.defines.extend(("NANA_ENABLE_JPEG", "USE_LIBJPEG_FROM_OS"))
ifself.options.enable_png:
self.cpp_info.defines.extend(("NANA_ENABLE_PNG", "USE_LIBPNG_FROM_OS"))
Hello,
I recently wondered how the state of nana and conan is.
I found this: https://github.com/ppetraki/conan-nana-meson (#283)
However, I noticed a few issues with the package:
So I opted in rewriting the recipe to meet all modern conan requirements.
The recipe has been implemented on my Windows machine and works. However
for full Linux support, I need to wait until conan-io/conan-center-index#18789 is done.
The purpose of this issue is to keep you updated on the progress and provide a draft recipe for download. Any feedback is highly appreciated!
TODO List:
Windows shared lib(CMake / Conan / Nana bug? Does not build... wants to export==
on debug... ofc this symbol is not defined)OSX compatibility(Simple: It's not going to happen for 1.4.7 ... I don't have a mac...)conan-center-index
Here is my current working draft
conanfile.py
:And the corresponding
conandata.yml
The text was updated successfully, but these errors were encountered: