-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#12666) nuklear: add 4.10.1 + conan v2 support
* conan v2 support * add nuklear/4.10.1
- Loading branch information
Showing
7 changed files
with
75 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,42 @@ | ||
from conan import ConanFile | ||
from conan.tools.files import copy, get | ||
from conan.tools.layout import basic_layout | ||
import os | ||
|
||
from conans import ConanFile, tools | ||
required_conan_version = ">=1.50.0" | ||
|
||
|
||
class NuklearConan(ConanFile): | ||
name = "nuklear" | ||
description = "A single-header ANSI C immediate mode cross-platform GUI library." | ||
license = ["MIT", "Unlicense"] | ||
topics = ("conan", "nuklear", "gui", "header-only") | ||
topics = ("nuklear", "gui", "header-only") | ||
homepage = "https://github.com/Immediate-Mode-UI/Nuklear" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
settings = "os", "arch", "compiler", "build_type" | ||
no_copy_source = True | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
def package_id(self): | ||
self.info.clear() | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
url = self.conan_data["sources"][self.version]["url"] | ||
extracted_dir = "Nuklear-" + os.path.splitext(os.path.basename(url))[0] | ||
os.rename(extracted_dir, self._source_subfolder) | ||
get(self, **self.conan_data["sources"][self.version], | ||
destination=self.source_folder, strip_root=True) | ||
|
||
def build(self): | ||
pass | ||
|
||
def package(self): | ||
self.copy("LICENSE", dst="licenses", src=os.path.join(self._source_subfolder, "src")) | ||
self.copy("nuklear.h", dst="include", src=self._source_subfolder) | ||
copy(self, "LICENSE", src=os.path.join(self.source_folder, "src"), dst=os.path.join(self.package_folder, "licenses")) | ||
copy(self, "nuklear.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) | ||
|
||
def package_id(self): | ||
self.info.header_only() | ||
def package_info(self): | ||
self.cpp_info.bindirs = [] | ||
self.cpp_info.frameworkdirs = [] | ||
self.cpp_info.libdirs = [] | ||
self.cpp_info.resdirs = [] | ||
if self.settings.os in ["Linux", "FreeBSD"]: | ||
self.cpp_info.system_libs.append("m") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package C) | ||
project(test_package LANGUAGES C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
find_package(nuklear REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
find_library(M_LIB m) | ||
if(M_LIB) | ||
target_link_libraries(${PROJECT_NAME} ${M_LIB}) | ||
endif() | ||
target_link_libraries(${PROJECT_NAME} PRIVATE nuklear::nuklear) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import CMake, cmake_layout | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package LANGUAGES C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(nuklear REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} ../test_package/test_package.c) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE nuklear::nuklear) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
versions: | ||
"4.10.1": | ||
folder: all | ||
"4.06.1": | ||
folder: all | ||
"4.03.1": | ||
|