diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..9e57b7a --- /dev/null +++ b/conanfile.py @@ -0,0 +1,45 @@ +import os +from conan import ConanFile +from conan.tools.meson import MesonToolchain, Meson +from conan.tools.layout import basic_layout +from conan.tools.files import copy + +class daw_expConan(ConanFile): + name = "daw-exp" + version = "1.0" + package_type = "library" + + # Binary configuration + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} + + # Sources are located in the same place as this recipe, copy them to the recipe + exports_sources = "meson.build", "src/*" + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self) + + def generate(self): + tc = MesonToolchain(self) + tc.generate() + + def build(self): + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + meson = Meson(self) + meson.install() + + def package_info(self): + self.cpp_info.libs = ["daw-exp"] diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..7bb58df --- /dev/null +++ b/meson.build @@ -0,0 +1,6 @@ +project('daw-exp ', 'cpp') +qt6 = import('qt6') +qt_dep = dependency('qt6', modules: ['Core', 'Widgets']) +exe = executable('myapp', 'src/main.cpp', + dependencies: [qt_dep], + install: true) diff --git a/src/daw-exp.cpp b/src/daw-exp.cpp new file mode 100644 index 0000000..a6eeff3 --- /dev/null +++ b/src/daw-exp.cpp @@ -0,0 +1,120 @@ +#include +#include "daw-exp.h" + + + +void daw_exp(){ + + + #ifdef NDEBUG + std::cout << "daw-exp/1.0: Hello World Release!\n"; + #else + std::cout << "daw-exp/1.0: Hello World Debug!\n"; + #endif + + // ARCHITECTURES + #ifdef _M_X64 + std::cout << " daw-exp/1.0: _M_X64 defined\n"; + #endif + + #ifdef _M_IX86 + std::cout << " daw-exp/1.0: _M_IX86 defined\n"; + #endif + + #ifdef _M_ARM64 + std::cout << " daw-exp/1.0: _M_ARM64 defined\n"; + #endif + + #if __i386__ + std::cout << " daw-exp/1.0: __i386__ defined\n"; + #endif + + #if __x86_64__ + std::cout << " daw-exp/1.0: __x86_64__ defined\n"; + #endif + + #if __aarch64__ + std::cout << " daw-exp/1.0: __aarch64__ defined\n"; + #endif + + // Libstdc++ + #if defined _GLIBCXX_USE_CXX11_ABI + std::cout << " daw-exp/1.0: _GLIBCXX_USE_CXX11_ABI "<< _GLIBCXX_USE_CXX11_ABI << "\n"; + #endif + + // MSVC runtime + #if defined(_DEBUG) + #if defined(_MT) && defined(_DLL) + std::cout << " daw-exp/1.0: MSVC runtime: MultiThreadedDebugDLL\n"; + #elif defined(_MT) + std::cout << " daw-exp/1.0: MSVC runtime: MultiThreadedDebug\n"; + #endif + #else + #if defined(_MT) && defined(_DLL) + std::cout << " daw-exp/1.0: MSVC runtime: MultiThreadedDLL\n"; + #elif defined(_MT) + std::cout << " daw-exp/1.0: MSVC runtime: MultiThreaded\n"; + #endif + #endif + + // COMPILER VERSIONS + #if _MSC_VER + std::cout << " daw-exp/1.0: _MSC_VER" << _MSC_VER<< "\n"; + #endif + + #if _MSVC_LANG + std::cout << " daw-exp/1.0: _MSVC_LANG" << _MSVC_LANG<< "\n"; + #endif + + #if __cplusplus + std::cout << " daw-exp/1.0: __cplusplus" << __cplusplus<< "\n"; + #endif + + #if __INTEL_COMPILER + std::cout << " daw-exp/1.0: __INTEL_COMPILER" << __INTEL_COMPILER<< "\n"; + #endif + + #if __GNUC__ + std::cout << " daw-exp/1.0: __GNUC__" << __GNUC__<< "\n"; + #endif + + #if __GNUC_MINOR__ + std::cout << " daw-exp/1.0: __GNUC_MINOR__" << __GNUC_MINOR__<< "\n"; + #endif + + #if __clang_major__ + std::cout << " daw-exp/1.0: __clang_major__" << __clang_major__<< "\n"; + #endif + + #if __clang_minor__ + std::cout << " daw-exp/1.0: __clang_minor__" << __clang_minor__<< "\n"; + #endif + + #if __apple_build_version__ + std::cout << " daw-exp/1.0: __apple_build_version__" << __apple_build_version__<< "\n"; + #endif + + // SUBSYSTEMS + + #if __MSYS__ + std::cout << " daw-exp/1.0: __MSYS__" << __MSYS__<< "\n"; + #endif + + #if __MINGW32__ + std::cout << " daw-exp/1.0: __MINGW32__" << __MINGW32__<< "\n"; + #endif + + #if __MINGW64__ + std::cout << " daw-exp/1.0: __MINGW64__" << __MINGW64__<< "\n"; + #endif + + #if __CYGWIN__ + std::cout << " daw-exp/1.0: __CYGWIN__" << __CYGWIN__<< "\n"; + #endif +} + +void daw_exp_print_vector(const std::vector &strings) { + for(std::vector::const_iterator it = strings.begin(); it != strings.end(); ++it) { + std::cout << "daw_exp/1.0 " << *it << std::endl; + } +} diff --git a/src/daw-exp.h b/src/daw-exp.h new file mode 100644 index 0000000..d592780 --- /dev/null +++ b/src/daw-exp.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + + +#ifdef _WIN32 + #define DAW_EXP_EXPORT __declspec(dllexport) +#else + #define DAW_EXP_EXPORT +#endif + +DAW_EXP_EXPORT void daw_exp(); +DAW_EXP_EXPORT void daw_exp_print_vector(const std::vector &strings); diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..428bdee --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + QLabel label("Hello from Qt + Meson + Conan!"); + label.show(); + return app.exec(); +} diff --git a/test_package/conanfile.py b/test_package/conanfile.py new file mode 100644 index 0000000..4f97134 --- /dev/null +++ b/test_package/conanfile.py @@ -0,0 +1,26 @@ +import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.meson import MesonToolchain, Meson +from conan.tools.layout import basic_layout + + +class daw_expTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "PkgConfigDeps", "MesonToolchain" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + meson = Meson(self) + meson.configure() + meson.build() + + def layout(self): + basic_layout(self) + + def test(self): + if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "example") + self.run(cmd, env="conanrun") diff --git a/test_package/meson.build b/test_package/meson.build new file mode 100644 index 0000000..01ce3d6 --- /dev/null +++ b/test_package/meson.build @@ -0,0 +1,3 @@ +project('Testdaw-exp', 'cpp') +daw-exp = dependency('daw-exp', version : '>=0.1') +executable('example', 'src/example.cpp', dependencies: daw-exp) diff --git a/test_package/src/example.cpp b/test_package/src/example.cpp new file mode 100644 index 0000000..873a717 --- /dev/null +++ b/test_package/src/example.cpp @@ -0,0 +1,12 @@ +#include "daw-exp.h" +#include +#include + +int main() { + daw_exp(); + + std::vector vec; + vec.push_back("test_package"); + + daw_exp_print_vector(vec); +}