Initial commit
This commit is contained in:
12
lodepng/all/CMakeLists.txt
Normal file
12
lodepng/all/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(lodepng LANGUAGES CXX)
|
||||
|
||||
add_library(lodepng ${LODEPNG_SRC_DIR}/lodepng.cpp)
|
||||
set_target_properties(lodepng PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS lodepng
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||
install(FILES ${LODEPNG_SRC_DIR}/lodepng.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
7
lodepng/all/conandata.yml
Normal file
7
lodepng/all/conandata.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
sources:
|
||||
"cci.20250727":
|
||||
url: "https://github.com/lvandeve/lodepng/archive/344b4b442d0de0787a999724dd6569461a00c92c.tar.gz"
|
||||
sha256: "ffc13ecfbe27978e018e2ac6b089d6a2bd1a571d81b5ebb50e7364ec17ca3a74"
|
||||
"cci.20241228":
|
||||
url: "https://github.com/lvandeve/lodepng/archive/0b1d9ccfc2093e5d6620cd9a11d03ee6ff6705f5.tar.gz"
|
||||
sha256: "d3efafbd2c938f834aa9ff764e93425fdf7f78e9f74e92285ff991b45708c72a"
|
||||
68
lodepng/all/conanfile.py
Normal file
68
lodepng/all/conanfile.py
Normal file
@@ -0,0 +1,68 @@
|
||||
from conan import ConanFile
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import copy, get
|
||||
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.53.0"
|
||||
|
||||
|
||||
class LodepngConan(ConanFile):
|
||||
name = "lodepng"
|
||||
description = "PNG encoder and decoder in C and C++, without dependencies."
|
||||
license = "Zlib"
|
||||
topics = ("png", "encoder", "decoder")
|
||||
homepage = "https://github.com/lvandeve/lodepng"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
}
|
||||
|
||||
exports_sources = "CMakeLists.txt"
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def validate(self):
|
||||
if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self):
|
||||
raise ConanInvalidConfiguration("lodepng shared doesn't support Visual Studio with static runtime")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["LODEPNG_SRC_DIR"] = self.source_folder.replace("\\", "/")
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir))
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = ["lodepng"]
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
self.cpp_info.system_libs.append("m")
|
||||
8
lodepng/all/test_package/CMakeLists.txt
Normal file
8
lodepng/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package LANGUAGES CXX)
|
||||
|
||||
find_package(lodepng REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.cpp)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE lodepng::lodepng)
|
||||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
|
||||
26
lodepng/all/test_package/conanfile.py
Normal file
26
lodepng/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
12
lodepng/all/test_package/test_package.cpp
Normal file
12
lodepng/all/test_package/test_package.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <iostream>
|
||||
#include "lodepng.h"
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
LodePNGCompressSettings compress_settings;
|
||||
lodepng_compress_settings_init(&compress_settings);
|
||||
|
||||
printf("compress_settings.btype = %d\n", compress_settings.btype);
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
lodepng/all/test_v1_package/CMakeLists.txt
Normal file
8
lodepng/all/test_v1_package/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package)
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package)
|
||||
17
lodepng/all/test_v1_package/conanfile.py
Normal file
17
lodepng/all/test_v1_package/conanfile.py
Normal file
@@ -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)
|
||||
5
lodepng/config.yml
Normal file
5
lodepng/config.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
versions:
|
||||
"cci.20250727":
|
||||
folder: all
|
||||
"cci.20241228":
|
||||
folder: all
|
||||
Reference in New Issue
Block a user