Compare commits

...

1 Commits

Author SHA1 Message Date
Arwed Mett 3333f08ff0
added conan support 2 years ago
  1. 1
      .gitignore
  2. 23
      CMakeLists.txt
  3. 2
      cmake/pack.cmake
  4. 35
      conanfile.py

1
.gitignore

@ -70,3 +70,4 @@ build
# End of https://www.gitignore.io/api/c,cmake
build
.clangd

23
CMakeLists.txt

@ -1,31 +1,22 @@
cmake_minimum_required(VERSION 3.5)
project(logging LANGUAGES C)
message(STATUS ${CMAKE_SYSTEM_NAME})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
include(require-git)
#Targets
set(SRCS src/logging.c)
add_library(logging-headers INTERFACE)
target_include_directories(logging-headers INTERFACE
# Library
add_library(logging src/logging.c)
target_include_directories(logging PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
add_library(logging-shared SHARED ${SRCS})
target_link_libraries(logging-shared PUBLIC logging-headers)
add_library(logging-static STATIC ${SRCS})
target_link_libraries(logging-static PUBLIC logging-headers)
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
add_executable(example example/main.c)
target_link_libraries(example PRIVATE logging-shared)
endif()
# Example
add_executable(example example/main.c)
target_link_libraries(example PRIVATE logging)
#Install
install(TARGETS logging-headers logging-static logging-shared EXPORT loggingTargets
install(TARGETS logging EXPORT loggingTargets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin

2
cmake/pack.cmake

@ -1,6 +1,6 @@
set(CPACK_BUNDLE_NAME "logging.h")
set(CPACK_PACKAGE_CONTACT "arwed.mett@googlemail.com")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://gitea.metthub.de/Pfeifenjoy/argparse")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://gitea.metthub.de/Pfeifenjoy/logging.h")
set(CPACK_PACKAGE_CHECKSUM "SHA512")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt")

35
conanfile.py

@ -0,0 +1,35 @@
from conans import ConanFile, CMake, tools
class LogginghConan(ConanFile):
name = "logging.h"
version = "0.0.2"
license = "LICENSE.txt"
author = "Arwed Mett arwed.mett@googlemail.com"
url = "https://gitea.metthub.de/Pfeifenjoy/logging.h"
description = "A very simple logging library which provides colored output."
topics = ("logging")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = {"shared": False}
generators = "cmake"
def source(self):
self.run("git clone https://gitea.metthub.de/Pfeifenjoy/logging.h.git")
def build(self):
cmake = CMake(self)
cmake.configure(source_folder="logging.h")
cmake.build()
def package(self):
self.copy("*.h", dst="include/logging", src="logging.h")
self.copy("*logging.h.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 = ["logging.h"]
Loading…
Cancel
Save