-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add implot * Add imgui to implot cpp_info.requires * Apply suggestions from code review Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com> * Remove tests for find_package Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
- Loading branch information
1 parent
9b7746a
commit 7ba58d2
Showing
7 changed files
with
128 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
project(implot CXX) | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
|
||
set(SOURCE_DIR source_subfolder) | ||
file(GLOB SOURCE_FILES ${SOURCE_DIR}/*.cpp) | ||
file(GLOB HEADER_FILES ${SOURCE_DIR}/*.h) | ||
|
||
add_library(${PROJECT_NAME} ${SOURCE_FILES}) | ||
target_include_directories(${PROJECT_NAME} PRIVATE ${SOURCE_DIR}) | ||
target_link_libraries(${PROJECT_NAME} PUBLIC ${CONAN_LIBS}) | ||
|
||
include(GNUInstallDirs) | ||
|
||
install(TARGETS ${PROJECT_NAME} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
install(FILES ${HEADER_FILES} | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) |
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,4 @@ | ||
sources: | ||
"0.11": | ||
url: "https://github.com/epezent/implot/archive/v0.11.tar.gz" | ||
sha256: "1ec4c8501f70901132a9f14409c956b508a8ea3fe457e8518325b156dceada00" |
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,62 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
required_conan_version = ">=1.33.0" | ||
|
||
class ImplotConan(ConanFile): | ||
name = "implot" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/epezent/implot" | ||
description = "Advanced 2D Plotting for Dear ImGui" | ||
topics = ("conan", "imgui", "plot", "graphics") | ||
license = "MIT" | ||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
exports_sources = ["CMakeLists.txt"] | ||
generators = "cmake" | ||
requires = "imgui/1.83" | ||
|
||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False] | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True | ||
} | ||
|
||
_cmake = None | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
del self.options.fPIC | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], | ||
destination=self._source_subfolder, strip_root=True) | ||
|
||
def _configure_cmake(self): | ||
if not self._cmake: | ||
self._cmake = CMake(self) | ||
self._cmake.configure() | ||
return self._cmake | ||
|
||
def build(self): | ||
cmake = self._configure_cmake() | ||
cmake.build() | ||
|
||
def package(self): | ||
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) | ||
cmake = self._configure_cmake() | ||
cmake.install() | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = ["implot"] |
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) | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) |
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,16 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
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) |
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,6 @@ | ||
#include <implot.h> | ||
|
||
int main() { | ||
ImPlot::GetCurrentContext(); | ||
return 0; | ||
} |
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,3 @@ | ||
versions: | ||
"0.11": | ||
folder: "all" |