commit ffe1bd554bec50c9239706294558cb40737b8a42 Author: Riley Date: Wed May 7 17:30:29 2025 -0500 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..367f77e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build/* +.vscode/* \ No newline at end of file diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..7eb4771 --- /dev/null +++ b/build.bat @@ -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 \ No newline at end of file diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..68509d3 --- /dev/null +++ b/conanfile.py @@ -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() diff --git a/docs/default b/docs/default new file mode 100644 index 0000000..bd29125 --- /dev/null +++ b/docs/default @@ -0,0 +1,7 @@ +[settings] +os=Windows +arch=x86_64 +compiler=gcc +compiler.version=13 +compiler.libcxx=libstdc++11 +build_type=Release \ No newline at end of file diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..02c195f --- /dev/null +++ b/meson.build @@ -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) \ No newline at end of file diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..0abb1b5 --- /dev/null +++ b/src/main.c @@ -0,0 +1,32 @@ +#include +#include +#include + +#include + +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; +} \ No newline at end of file