This commit is contained in:
Riley 2025-05-07 17:30:29 -05:00
commit ffe1bd554b
6 changed files with 93 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
build/*
.vscode/*

5
build.bat Normal file
View file

@ -0,0 +1,5 @@
conan install . --output-folder=build --build=missing
cd build
meson setup --native-file conan_meson_native.ini .. meson-src
meson compile -C meson-src
meson-src\compressor.exe

38
conanfile.py Normal file
View file

@ -0,0 +1,38 @@
from conan import ConanFile
from conan.tools.meson import MesonToolchain, Meson
from conan.tools.gnu import PkgConfigDeps
class helloConan(ConanFile):
name = "hello"
version = "1.0"
package_type = "application"
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
# Sources are located in the same place as this recipe, copy them to the recipe
exports_sources = "meson.build", "src/*"
def layout(self):
self.folders.build = "build"
def requirements(self):
self.requires("zlib/1.2.11")
def generate(self):
deps = PkgConfigDeps(self)
deps.generate()
tc = MesonToolchain(self)
tc.generate()
def build(self):
meson = Meson(self)
meson.configure()
meson.build()
def package(self):
meson = Meson(self)
meson.install()

7
docs/default Normal file
View file

@ -0,0 +1,7 @@
[settings]
os=Windows
arch=x86_64
compiler=gcc
compiler.version=13
compiler.libcxx=libstdc++11
build_type=Release

9
meson.build Normal file
View file

@ -0,0 +1,9 @@
project('tutorial', 'c')
CC = meson.get_compiler('c')
zlib = dependency('zlib', version : '1.2.11', static: true, required: true)
files = files('src/main.c')
executable('compressor', files, dependencies: zlib)

32
src/main.c Normal file
View file

@ -0,0 +1,32 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <zlib.h>
int main(void) {
char buffer_in [256] = {"Conan is a MIT-licensed, Open Source package manager for C and C++ development "
"for C and C++ development, allowing development teams to easily and efficiently "
"manage their packages and dependencies across platforms and build systems."};
char buffer_out [256] = {0};
z_stream defstream;
defstream.zalloc = Z_NULL;
defstream.zfree = Z_NULL;
defstream.opaque = Z_NULL;
defstream.avail_in = (uInt) strlen(buffer_in);
defstream.next_in = (Bytef *) buffer_in;
defstream.avail_out = (uInt) sizeof(buffer_out);
defstream.next_out = (Bytef *) buffer_out;
deflateInit(&defstream, Z_BEST_COMPRESSION);
deflate(&defstream, Z_FINISH);
deflateEnd(&defstream);
printf("Uncompressed size is: %lu\n", strlen(buffer_in));
printf("Compressed size is: %lu\n", strlen(buffer_out));
printf("ZLIB VERSION: %s\n", zlibVersion());
return EXIT_SUCCESS;
}