diff --git a/.ci/jenkins/Jenkinsfile b/.ci/jenkins/Jenkinsfile index 0e9698ab..a7a49834 100644 --- a/.ci/jenkins/Jenkinsfile +++ b/.ci/jenkins/Jenkinsfile @@ -23,27 +23,27 @@ private Closure runTests(String nodeName) { + "export PYENV_ROOT=${pyenvdir} && " \ + "export PATH=\"${pyenvdir}/bin:\$PATH\" && " \ + "pyenv local \$PY36 \$PY38 \$PY39 && " \ - + "python -m pip install tox tox-venv requests && " \ - + "python .ci/last_conan_version.py && " \ + + "python -m pip install tox && " \ + "python -m tox --verbose\"" sh(script: command) } } else if (nodeName=='Macos') { def localDir = '/Users/jenkins' - withEnv(['PY36=3.6.12', 'PY38=3.8.6', 'PY39=3.9.0', + withEnv(['PY36=3.6.13', 'PY38=3.8.6', 'PY39=3.9.0', "PYENV_ROOT=${localDir}/.pyenv", "PATH+EXTRA=${localDir}/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"]) { def pythonLocation = "${localDir}/.pyenv/versions/\$PY36/bin/python" def launchCommand = "pyenv local \$PY36 \$PY38 \$PY39 && " \ - + "${pythonLocation} .ci/last_conan_version.py && ${pythonLocation} -m tox --verbose" + + "${pythonLocation} -m pip install tox && " \ + + "${pythonLocation} -m tox --verbose" sh(script: launchCommand) } } else if (nodeName=='Windows') { withEnv(['CMAKE_GENERATOR=Visual Studio 15 2017 Win64']) { def pythonLocation = "C:/Python36/python.exe" - def launchCommand = "${pythonLocation} .ci/last_conan_version.py && tox -vv" + def launchCommand = "tox -vv" bat(script: launchCommand) } } diff --git a/.ci/last_conan_version.py b/.ci/last_conan_version.py deleted file mode 100644 index 7b2f4aec..00000000 --- a/.ci/last_conan_version.py +++ /dev/null @@ -1,43 +0,0 @@ -import requests -import json -import sys -import os - -URL = 'https://pypi.python.org/pypi/{package}/json' - - -def get_conan_version(): - url = URL.format(package='conan') - response = requests.get(url).text - version = json.loads(response)['info']['version'] - sys.stdout.write("Last Conan version found: {}\n".format(version)) - return version - - -def update_tox(last_version): - conan_prev = 'conan>={major}.{minor_prev},<{major}.{minor}' - - major, minor, _ = last_version.split('.') - minor_prev = str(int(minor)-1) - minor_prev_prev = str(int(minor)-2) - - conan_prev = conan_prev.format(major=major, minor=minor, minor_prev=minor_prev, minor_prev_prev=minor_prev_prev) - sys.stdout.write(" - prev is {major}.{minor_prev}\n".format(major=major, minor_prev=minor_prev, minor_prev_prev=minor_prev_prev)) - - # Replace in 'tox.ini' file - tox_file = os.path.join(os.path.dirname(__file__), '..', 'tox.ini') - with open(tox_file, 'r') as f: - content = f.read() - - assert 'conanprev: conan-unknown' in content, "Unexpected tox.ini content" - - content = content.replace('conanprev: conan-unknown', 'conanprev: {}'.format(conan_prev)) - - with open(tox_file, 'w') as f: - f.write(content) - - - -if __name__ == '__main__': - v = get_conan_version() - update_tox(v) diff --git a/.ci/run.py b/.ci/run.py index d1dcda17..7d2bbee1 100644 --- a/.ci/run.py +++ b/.ci/run.py @@ -48,24 +48,16 @@ def get_examples_to_skip(current_version): skip = [] # Given the Conan version, some examples are skipped required_conan = { - version.parse("1.29.0"): [ - './libraries/dear-imgui/basic', # solved bug for system packages and components - ], - } + # version.parse("1.29.0"): [ + # './libraries/dear-imgui/basic', # solved bug for system packages and components + # ], + } for v, examples in required_conan.items(): if current_version < v: skip.extend(examples) - # Some binaries are not available # TODO: All the examples should have binaries available - if platform.system() == "Windows": # Folly is not availble!! and appveyor_image() == "Visual Studio 2019": - skip.extend(['./libraries/folly/basic', ]) - skip.extend(['./features/makefiles', ]) - skip.extend(['./features/emscripten', ]) # FIXME: building for windows fails - # waf does not support Visual Studio 2019 for 2.0.19 - if os.environ["CMAKE_GENERATOR"] == "Visual Studio 2019": - skip.extend(['./features/integrate_build_system', ]) - if platform.system() == "Darwin": - skip.extend(['./features/multi_config', ]) # FIXME: it fails randomly, need to investigate + if platform.system() != "Windows": + skip.extend(['./features/visual_studio']) return [os.path.normpath(it) for it in skip] @@ -75,7 +67,7 @@ def get_build_list(): builds = [] script = "build.bat" if platform.system() == "Windows" else "build.sh" - skip_folders = [os.path.normpath(it) for it in ['./.ci', './.git', './.tox', 'examples_venv', '.pyenv']] + skip_folders = [os.path.normpath(it) for it in ['./.ci', './.git', './.tox', '.local', 'examples_venv', '.pyenv', 'venv']] for root, dirs, files in os.walk('.'): root = os.path.normpath(root) if root in skip_folders: @@ -132,7 +124,8 @@ def ensure_cache_preserved(): git = Git(folder=cache_directory) with open(os.path.join(cache_directory, '.gitignore'), 'w') as gitignore: - gitignore.write(".conan/data/") + gitignore.write(".conan2/p/\n") + gitignore.write("*.sqlite3\n") git.run("init .") git.run("add .") @@ -172,7 +165,6 @@ def run(cmd): def run_scripts(scripts): results = OrderedDict.fromkeys(scripts, '') - base_dir = os.getcwd() for script in scripts: chmod_x(script) abspath = os.path.abspath(script) @@ -181,7 +173,6 @@ def run_scripts(scripts): with chdir(os.path.dirname(script)): print_build(script) build_script = [sys.executable, abspath] if abspath.endswith(".py") else abspath - run("conan config install {} --type=file".format(os.path.join(base_dir, "conf", "settings.yml"))) # for emscripten, needs clang 14 with ensure_python_environment_preserved(): with ensure_cache_preserved(): result = subprocess.call(build_script, env=env) diff --git a/.gitignore b/.gitignore index 0d028b55..e4bfa9c1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ **/project*/build !*/build.sh .vscode/ +venv # Compiled Object files *.slo diff --git a/README.md b/README.md index 248b7459..6f90f7ef 100644 --- a/README.md +++ b/README.md @@ -6,92 +6,17 @@ Several Conan examples to complement the documentation and blog. ## Examples -### [Getting started with Conan](libraries/poco/md5) +### [Creating packages with Visual Studio](features/visual_studio/creating_packages) -Example how to use Conan to consume binaries. +How to create packages with Visual Studio. -Documentation: https://docs.conan.io/en/latest/getting_started.html +Documentation: https://docs.conan.io/en/latest/integrations/visual_studio/creating_packages.html -### [Package development flow](features/package_development_flow) +### [Reusing packages with Visual Studio](features/visual_studio/chat) -Example how to use Conan commands to develop a package recipe. +How to use existing packages directly from Visual Studio. -Documentation: https://docs.conan.io/en/latest/developing_packages/package_dev_flow.html - -### [Workspace](features/workspace) - -Example how to use Conan Workspaces. - -Documentation: https://docs.conan.io/en/latest/developing_packages/workspaces.html - -### [Editable Packages](features/editable) - -Example how to use Conan Editable Packages. - -Documentation: https://docs.conan.io/en/latest/developing_packages/editable_packages.html - -### [Serializing your data with Protobuf](libraries/protobuf/serialization) - -Demonstrate how to use Protobuf to serialize data between C++ and Python. - -Blog Post: https://blog.conan.io/2019/03/06/Serializing-your-data-with-Protobuf.html - -### [Using Facebook Folly with Conan](libraries/folly/basic) - -Demonstrate how to use Folly to validate an URI using Futures, FBString, Executors, and Format. - -Blog Post: https://blog.conan.io/2018/12/03/Using-Facebook-Folly-with-Conan.html - -### [An introduction to Dear ImGui and how to use with Conan](libraries/dear-imgui/basic) - -Demonstrate how to use Dear ImGui with Conan to add a GUI to an OpenGL3 application. - -### [Exporting targets with CMake and reuse with find_package()](features/cmake/find_package/exported_targets_multiconfig) - -Use CMake to declare, export and install the targets of some libraries and using Conan to reuse them with -``find_package`` and the multi-configuration project. - -### [Using the cmake_find_package_multi generator](features/cmake/find_package/find_cmake_multi_generator_targets) - -Demonstrate how to use the ``cmake_find_package_multi`` generator to integrate seamlessly CMake with Conan -using ``find_package`` in a multi-configuration project. - - -### [Multi-configuration package (N configs -> 1 package)](features/multi_config) - -Example on how to create multi-configuration debug/release packages covering the N configs -> 1 package use case: - -- Remove the ``build_type`` from settings. -- Have a CMake script that differentiate debug and release artifacts (``set_target_properties(hello PROPERTIES DEBUG_POSTFIX _d)``). -- Have a ``build()`` that builds both configs. -- Have a ``package_info()`` method that accounts for both configs ``self.cpp_info.debug.libs``, etc. - -Documentation: https://docs.conan.io/en/latest/creating_packages/package_approaches.html#n-configs-1-package - - -### Lockfiles - -#### [Using lockfiles in CI to rebuild a whole project](features/lockfiles/ci) - -When a package in a dependency graph is modified and a new version or revision is created, it -is sometimes desired to test if that new version works well within a larger product or project, -that is, when that package is part of a larger dependency graph. The packages that depend on -the modified one might need to be rebuilt, but if something else changed, it is impossible to -achieve reproducible builds. - -Using lockfiles can enforce the same upstream dependencies, to ensure reproducible builds and to re-build and test such scenarios. - -Documentation: https://docs.conan.io/en/latest/versioning/lockfiles.html#how-to-use-lockfiles-in-ci - -### [Integrate a build system in Conan](features/integrate_build_system) - -Shows how to integrate a build-system in Conan using an *installer*, a *build-helper* and a *custom generator*. - -### [Deployment](features/deployment) - -Shows how to use conan ``json`` generator with custom script to automate the creation of deployable artifact ([makeself.io](https://makeself.io)) - -Documentation: https://docs.conan.io/en/laters/integrations/deployment.html +Documentation: https://docs.conan.io/en/latest/integrations/visual_studio/creating_packages.html#reusing-packages ## How can I reproduce the build steps? diff --git a/conf/settings.yml b/conf/settings.yml deleted file mode 100644 index 41f5b608..00000000 --- a/conf/settings.yml +++ /dev/null @@ -1,128 +0,0 @@ - -# Only for cross building, 'os_build/arch_build' is the system that runs Conan -os_build: [Windows, WindowsStore, Linux, Macos, FreeBSD, SunOS, AIX] -arch_build: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7] - -# Only for building cross compilation tools, 'os_target/arch_target' is the system for -# which the tools generate code -os_target: [Windows, Linux, Macos, Android, iOS, watchOS, tvOS, FreeBSD, SunOS, AIX, Arduino, Neutrino] -arch_target: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106] - -# Rest of the settings are "host" settings: -# - For native building/cross building: Where the library/program will run. -# - For building cross compilation tools: Where the cross compiler will run. -os: - Windows: - subsystem: [None, cygwin, msys, msys2, wsl] - WindowsStore: - version: ["8.1", "10.0"] - WindowsCE: - platform: ANY - version: ["5.0", "6.0", "7.0", "8.0"] - Linux: - Macos: - version: [None, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15", "11.0", "13.0"] - sdk: [None, "macosx"] - subsystem: [None, catalyst] - Android: - api_level: ANY - iOS: - version: ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3", "11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4", "13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6"] - sdk: [None, "iphoneos", "iphonesimulator"] - watchOS: - version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1"] - sdk: [None, "watchos", "watchsimulator"] - tvOS: - version: ["11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4", "13.0"] - sdk: [None, "appletvos", "appletvsimulator"] - FreeBSD: - SunOS: - AIX: - Arduino: - board: ANY - Emscripten: - Neutrino: - version: ["6.4", "6.5", "6.6", "7.0", "7.1"] -arch: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv4, armv4i, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106] -compiler: - sun-cc: - version: ["5.10", "5.11", "5.12", "5.13", "5.14", "5.15"] - threads: [None, posix] - libcxx: [libCstd, libstdcxx, libstlport, libstdc++] - gcc: &gcc - version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9", - "5", "5.1", "5.2", "5.3", "5.4", "5.5", - "6", "6.1", "6.2", "6.3", "6.4", "6.5", - "7", "7.1", "7.2", "7.3", "7.4", "7.5", - "8", "8.1", "8.2", "8.3", "8.4", - "9", "9.1", "9.2", "9.3", - "10", "10.1", "10.2", "10.3", - "11", "11.1"] - libcxx: [libstdc++, libstdc++11] - threads: [None, posix, win32] # Windows MinGW - exception: [None, dwarf2, sjlj, seh] # Windows MinGW - cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] - Visual Studio: &visual_studio - runtime: [MD, MT, MTd, MDd] - version: ["8", "9", "10", "11", "12", "14", "15", "16", "17"] - toolset: [None, v90, v100, v110, v110_xp, v120, v120_xp, - v140, v140_xp, v140_clang_c2, LLVM-vs2012, LLVM-vs2012_xp, - LLVM-vs2013, LLVM-vs2013_xp, LLVM-vs2014, LLVM-vs2014_xp, - LLVM-vs2017, LLVM-vs2017_xp, v141, v141_xp, v141_clang_c2, v142, - llvm, ClangCL, v143] - cppstd: [None, 14, 17, 20] - msvc: - version: ["19.0", - "19.1", "19.10", "19.11", "19.12", "19.13", "19.14", "19.15", "19.16", - "19.2", "19.20", "19.21", "19.22", "19.23", "19.24", "19.25", "19.26", "19.27", "19.28", "19.29", - "19.3", "19.30"] - runtime: [static, dynamic] - runtime_type: [Debug, Release] - cppstd: [14, 17, 20, 23] - clang: - version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0", - "5.0", "6.0", "7.0", "7.1", - "8", "9", "10", "11", "12", "13", "14"] - libcxx: [None, libstdc++, libstdc++11, libc++, c++_shared, c++_static] - cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] - runtime: [None, MD, MT, MTd, MDd] - apple-clang: &apple_clang - version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0", "12.0", "13.0"] - libcxx: [libstdc++, libc++] - cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20] - intel: - version: ["11", "12", "13", "14", "15", "16", "17", "18", "19", "19.1"] - update: [None, ANY] - base: - gcc: - <<: *gcc - threads: [None] - exception: [None] - Visual Studio: - <<: *visual_studio - apple-clang: - <<: *apple_clang - intel-cc: - version: ["2021.1", "2021.2", "2021.3"] - update: [None, ANY] - mode: ["icx", "classic", "dpcpp"] - libcxx: [None, libstdc++, libstdc++11, libc++] - cppstd: [None, 98, gnu98, 03, gnu03, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] - runtime: [None, static, dynamic] - runtime_type: [None, Debug, Release] - qcc: - version: ["4.4", "5.4", "8.3"] - libcxx: [cxx, gpp, cpp, cpp-ne, accp, acpp-ne, ecpp, ecpp-ne] - cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17] - mcst-lcc: - version: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25"] - base: - gcc: - <<: *gcc - threads: [None] - exceptions: [None] - -build_type: [None, Debug, Release, RelWithDebInfo, MinSizeRel] - - -cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] # Deprecated, use compiler.cppstd diff --git a/features/makefiles/creating_packages/Makefile b/features/makefiles/creating_packages/Makefile new file mode 100644 index 00000000..0856175d --- /dev/null +++ b/features/makefiles/creating_packages/Makefile @@ -0,0 +1,14 @@ +SRC = src/hello.cpp +OBJ = $(SRC:.cpp=.o) +OUT = src/libhello.a +INCLUDES = -I. + +.SUFFIXES: .cpp + +default: $(OUT) + +.cpp.o: + $(CXX) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ + +$(OUT): $(OBJ) + ar rcs $(OUT) $(OBJ) diff --git a/features/makefiles/creating_packages/build.py b/features/makefiles/creating_packages/build.py new file mode 100755 index 00000000..fc72e3c4 --- /dev/null +++ b/features/makefiles/creating_packages/build.py @@ -0,0 +1,16 @@ +import os +import subprocess + + +def run(cmd): + ret = os.system(cmd) + if ret != 0: + raise Exception("Failed command: %s" % cmd) + + +def main(): + run("conan create . demo/testing") + + +if __name__ == '__main__': + main() diff --git a/features/makefiles/creating_packages/conanfile.py b/features/makefiles/creating_packages/conanfile.py new file mode 100644 index 00000000..dc06e49d --- /dev/null +++ b/features/makefiles/creating_packages/conanfile.py @@ -0,0 +1,25 @@ +from conans import ConanFile +from conan.tools.gnu import Autotools + + +class HelloConan(ConanFile): + name = "hello" + version = "0.1" + settings = "os", "compiler", "build_type", "arch" + exports_sources = "Makefile", "src/*" + generators = "AutotoolsToolchain" + + def layout(self): + self.folders.source = "src" + + def build(self): + atools = Autotools(self) + atools.make() + + def package(self): + self.copy("*.h", dst="include") + self.copy("*.lib", dst="lib", keep_path=False) + self.copy("*.a", dst="lib", keep_path=False) + + def package_info(self): + self.cpp_info.libs = ["hello"] diff --git a/features/makefiles/creating_packages/src/hello.cpp b/features/makefiles/creating_packages/src/hello.cpp new file mode 100644 index 00000000..235428a0 --- /dev/null +++ b/features/makefiles/creating_packages/src/hello.cpp @@ -0,0 +1,10 @@ +#include +#include "hello.h" + +void hello(){ + #ifdef NDEBUG + std::cout << "Hello World Release!" < + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {BAD0D0C3-1EA1-478D-815A-AACD9F84E290} + Win32Proj + Greet + 8.1 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + + + + + + {a0818568-b0aa-4c43-8f90-f3f8ed07f664} + + + + + + diff --git a/features/visual_studio/creating_packages/build/Greet/Greet.vcxproj.filters b/features/visual_studio/creating_packages/build/Greet/Greet.vcxproj.filters new file mode 100644 index 00000000..841ac15a --- /dev/null +++ b/features/visual_studio/creating_packages/build/Greet/Greet.vcxproj.filters @@ -0,0 +1,25 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Source Files + + + \ No newline at end of file diff --git a/features/visual_studio/creating_packages/build/HelloLib/HelloLib.sln b/features/visual_studio/creating_packages/build/HelloLib/HelloLib.sln new file mode 100644 index 00000000..fe57f9ee --- /dev/null +++ b/features/visual_studio/creating_packages/build/HelloLib/HelloLib.sln @@ -0,0 +1,38 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloLib", "HelloLib.vcxproj", "{A0818568-B0AA-4C43-8F90-F3F8ED07F664}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Greet", "..\Greet\Greet.vcxproj", "{BAD0D0C3-1EA1-478D-815A-AACD9F84E290}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A0818568-B0AA-4C43-8F90-F3F8ED07F664}.Debug|x64.ActiveCfg = Debug|x64 + {A0818568-B0AA-4C43-8F90-F3F8ED07F664}.Debug|x64.Build.0 = Debug|x64 + {A0818568-B0AA-4C43-8F90-F3F8ED07F664}.Debug|x86.ActiveCfg = Debug|Win32 + {A0818568-B0AA-4C43-8F90-F3F8ED07F664}.Debug|x86.Build.0 = Debug|Win32 + {A0818568-B0AA-4C43-8F90-F3F8ED07F664}.Release|x64.ActiveCfg = Release|x64 + {A0818568-B0AA-4C43-8F90-F3F8ED07F664}.Release|x64.Build.0 = Release|x64 + {A0818568-B0AA-4C43-8F90-F3F8ED07F664}.Release|x86.ActiveCfg = Release|Win32 + {A0818568-B0AA-4C43-8F90-F3F8ED07F664}.Release|x86.Build.0 = Release|Win32 + {BAD0D0C3-1EA1-478D-815A-AACD9F84E290}.Debug|x64.ActiveCfg = Debug|x64 + {BAD0D0C3-1EA1-478D-815A-AACD9F84E290}.Debug|x64.Build.0 = Debug|x64 + {BAD0D0C3-1EA1-478D-815A-AACD9F84E290}.Debug|x86.ActiveCfg = Debug|Win32 + {BAD0D0C3-1EA1-478D-815A-AACD9F84E290}.Debug|x86.Build.0 = Debug|Win32 + {BAD0D0C3-1EA1-478D-815A-AACD9F84E290}.Release|x64.ActiveCfg = Release|x64 + {BAD0D0C3-1EA1-478D-815A-AACD9F84E290}.Release|x64.Build.0 = Release|x64 + {BAD0D0C3-1EA1-478D-815A-AACD9F84E290}.Release|x86.ActiveCfg = Release|Win32 + {BAD0D0C3-1EA1-478D-815A-AACD9F84E290}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/features/visual_studio/creating_packages/build/HelloLib/HelloLib.vcxproj b/features/visual_studio/creating_packages/build/HelloLib/HelloLib.vcxproj new file mode 100644 index 00000000..50668842 --- /dev/null +++ b/features/visual_studio/creating_packages/build/HelloLib/HelloLib.vcxproj @@ -0,0 +1,141 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {A0818568-B0AA-4C43-8F90-F3F8ED07F664} + Win32Proj + HelloLib + 8.1 + + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + + + + + + + Level3 + Disabled + _DEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + true + true + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + true + true + + + + + + + + + + + + + + + diff --git a/features/visual_studio/creating_packages/build/HelloLib/HelloLib.vcxproj.filters b/features/visual_studio/creating_packages/build/HelloLib/HelloLib.vcxproj.filters new file mode 100644 index 00000000..07af783c --- /dev/null +++ b/features/visual_studio/creating_packages/build/HelloLib/HelloLib.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/features/visual_studio/creating_packages/conanfile.py b/features/visual_studio/creating_packages/conanfile.py new file mode 100644 index 00000000..8b37dc4a --- /dev/null +++ b/features/visual_studio/creating_packages/conanfile.py @@ -0,0 +1,25 @@ +from conans import ConanFile +from conan.tools.microsoft import MSBuild + + + +class HelloConan(ConanFile): + name = "Hello" + version = "0.1" + license = "MIT" + url = "https://github.com/conan-io/examples" + settings = "os", "compiler", "build_type", "arch" + exports_sources = "src/*", "build/*.vcxproj*", "build/*.sln*" + generators = "MSBuildToolchain" + + def build(self): + msbuild = MSBuild(self) + msbuild.build("build/HelloLib/HelloLib.sln") + + def package(self): + self.copy("*.h", dst="include", src="src") + self.copy("*.lib", dst="lib", keep_path=False) + self.copy("*.dll", dst="bin", keep_path=False) + + def package_info(self): + self.cpp_info.libs = ["HelloLib"] diff --git a/features/visual_studio/creating_packages/src/greet.cpp b/features/visual_studio/creating_packages/src/greet.cpp new file mode 100644 index 00000000..2334dcb9 --- /dev/null +++ b/features/visual_studio/creating_packages/src/greet.cpp @@ -0,0 +1,5 @@ +#include "hello.h" + +int main() { + hello(); +} \ No newline at end of file diff --git a/features/visual_studio/creating_packages/src/hello.cpp b/features/visual_studio/creating_packages/src/hello.cpp new file mode 100644 index 00000000..bb7badd6 --- /dev/null +++ b/features/visual_studio/creating_packages/src/hello.cpp @@ -0,0 +1,19 @@ +#include +#include "hello.h" + +void hello(){ +#ifdef _WIN64 + #ifdef _DEBUG + std::cout << "Hello World Debug 64!" << std::endl; + #else + std::cout << "Hello World Release64!" << std::endl; + #endif +#else + #ifdef _DEBUG + std::cout << "Hello World Debug!" << std::endl; + #else + std::cout << "Hello World Release!" << std::endl; + #endif +#endif + +} diff --git a/features/visual_studio/creating_packages/src/hello.h b/features/visual_studio/creating_packages/src/hello.h new file mode 100644 index 00000000..a8e0ee3d --- /dev/null +++ b/features/visual_studio/creating_packages/src/hello.h @@ -0,0 +1,9 @@ +#pragma once + +#ifdef WIN32 + #define HELLO_EXPORT __declspec(dllexport) +#else + #define HELLO_EXPORT +#endif + +HELLO_EXPORT void hello(); \ No newline at end of file diff --git a/features/visual_studio/creating_packages/test_package/CMakeLists.txt b/features/visual_studio/creating_packages/test_package/CMakeLists.txt new file mode 100644 index 00000000..5647f4d6 --- /dev/null +++ b/features/visual_studio/creating_packages/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +project(PackageTest CXX) +cmake_minimum_required(VERSION 3.0) + +find_package(Hello REQUIRED) + +add_executable(example example.cpp) +target_link_libraries(example Hello::Hello) diff --git a/features/visual_studio/creating_packages/test_package/conanfile.py b/features/visual_studio/creating_packages/test_package/conanfile.py new file mode 100644 index 00000000..0d2307b6 --- /dev/null +++ b/features/visual_studio/creating_packages/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conans import ConanFile +from conan.tools.cmake import CMake +from conan.tools.layout import cmake_layout + +import os + + +class HelloTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps" + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def imports(self): + self.copy("*.dll", dst="bin", src="bin") + self.copy("*.dylib*", dst="bin", src="lib") + + def test(self): + cmd = os.path.join(self.cpp.build.bindirs[0], "example") + self.run(cmd) \ No newline at end of file diff --git a/features/visual_studio/creating_packages/test_package/example.cpp b/features/visual_studio/creating_packages/test_package/example.cpp new file mode 100644 index 00000000..4a5549c5 --- /dev/null +++ b/features/visual_studio/creating_packages/test_package/example.cpp @@ -0,0 +1,6 @@ +#include +#include "hello.h" + +int main() { + hello(); +} diff --git a/features/visual_studio/reusing_packages/build.bat b/features/visual_studio/reusing_packages/build.bat new file mode 100644 index 00000000..fb71cc42 --- /dev/null +++ b/features/visual_studio/reusing_packages/build.bat @@ -0,0 +1,9 @@ +@echo off + +pushd ..\creating_packages +conan create . demo/testing +conan create . demo/testing -s compiler=msvc -s compiler.version=19.16 -s compiler.runtime=static -s compiler.cppstd=17 +popd + +conan create . demo/testing +conan create . demo/testing -s compiler=msvc -s compiler.version=19.16 -s compiler.runtime=static -s compiler.cppstd=17 diff --git a/features/visual_studio/reusing_packages/build/ChatLib/ChatLib.sln b/features/visual_studio/reusing_packages/build/ChatLib/ChatLib.sln new file mode 100644 index 00000000..9e9df2fe --- /dev/null +++ b/features/visual_studio/reusing_packages/build/ChatLib/ChatLib.sln @@ -0,0 +1,38 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChatLib", "ChatLib.vcxproj", "{B7D900AD-0D6B-4E33-B241-FFF8142D7447}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyChat", "..\MyChat\MyChat.vcxproj", "{8EDF1257-B79E-47AF-A1AC-F7A3E47B9C79}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B7D900AD-0D6B-4E33-B241-FFF8142D7447}.Debug|x64.ActiveCfg = Debug|x64 + {B7D900AD-0D6B-4E33-B241-FFF8142D7447}.Debug|x64.Build.0 = Debug|x64 + {B7D900AD-0D6B-4E33-B241-FFF8142D7447}.Debug|x86.ActiveCfg = Debug|Win32 + {B7D900AD-0D6B-4E33-B241-FFF8142D7447}.Debug|x86.Build.0 = Debug|Win32 + {B7D900AD-0D6B-4E33-B241-FFF8142D7447}.Release|x64.ActiveCfg = Release|x64 + {B7D900AD-0D6B-4E33-B241-FFF8142D7447}.Release|x64.Build.0 = Release|x64 + {B7D900AD-0D6B-4E33-B241-FFF8142D7447}.Release|x86.ActiveCfg = Release|Win32 + {B7D900AD-0D6B-4E33-B241-FFF8142D7447}.Release|x86.Build.0 = Release|Win32 + {8EDF1257-B79E-47AF-A1AC-F7A3E47B9C79}.Debug|x64.ActiveCfg = Debug|x64 + {8EDF1257-B79E-47AF-A1AC-F7A3E47B9C79}.Debug|x64.Build.0 = Debug|x64 + {8EDF1257-B79E-47AF-A1AC-F7A3E47B9C79}.Debug|x86.ActiveCfg = Debug|Win32 + {8EDF1257-B79E-47AF-A1AC-F7A3E47B9C79}.Debug|x86.Build.0 = Debug|Win32 + {8EDF1257-B79E-47AF-A1AC-F7A3E47B9C79}.Release|x64.ActiveCfg = Release|x64 + {8EDF1257-B79E-47AF-A1AC-F7A3E47B9C79}.Release|x64.Build.0 = Release|x64 + {8EDF1257-B79E-47AF-A1AC-F7A3E47B9C79}.Release|x86.ActiveCfg = Release|Win32 + {8EDF1257-B79E-47AF-A1AC-F7A3E47B9C79}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/features/visual_studio/reusing_packages/build/ChatLib/ChatLib.vcxproj b/features/visual_studio/reusing_packages/build/ChatLib/ChatLib.vcxproj new file mode 100644 index 00000000..cbbb3099 --- /dev/null +++ b/features/visual_studio/reusing_packages/build/ChatLib/ChatLib.vcxproj @@ -0,0 +1,145 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {B7D900AD-0D6B-4E33-B241-FFF8142D7447} + Win32Proj + ChatLib + 8.1 + + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + + + + + + + Level3 + Disabled + _DEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + true + true + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + true + true + + + + + + + + + + + + + + + diff --git a/features/visual_studio/reusing_packages/build/ChatLib/ChatLib.vcxproj.filters b/features/visual_studio/reusing_packages/build/ChatLib/ChatLib.vcxproj.filters new file mode 100644 index 00000000..9a6578e4 --- /dev/null +++ b/features/visual_studio/reusing_packages/build/ChatLib/ChatLib.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/features/visual_studio/reusing_packages/build/MyChat/MyChat.vcxproj b/features/visual_studio/reusing_packages/build/MyChat/MyChat.vcxproj new file mode 100644 index 00000000..bee4ba0b --- /dev/null +++ b/features/visual_studio/reusing_packages/build/MyChat/MyChat.vcxproj @@ -0,0 +1,162 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {8EDF1257-B79E-47AF-A1AC-F7A3E47B9C79} + Win32Proj + MyChat + 8.1 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + + + + + + {b7d900ad-0d6b-4e33-b241-fff8142d7447} + + + + + + diff --git a/features/visual_studio/reusing_packages/build/MyChat/MyChat.vcxproj.filters b/features/visual_studio/reusing_packages/build/MyChat/MyChat.vcxproj.filters new file mode 100644 index 00000000..6cb76aae --- /dev/null +++ b/features/visual_studio/reusing_packages/build/MyChat/MyChat.vcxproj.filters @@ -0,0 +1,25 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Source Files + + + \ No newline at end of file diff --git a/features/visual_studio/reusing_packages/conanfile.py b/features/visual_studio/reusing_packages/conanfile.py new file mode 100644 index 00000000..81b1e64b --- /dev/null +++ b/features/visual_studio/reusing_packages/conanfile.py @@ -0,0 +1,25 @@ +from conans import ConanFile +from conan.tools.microsoft import MSBuild + + +class ChatConan(ConanFile): + name = "Chat" + version = "0.1" + license = "MIT" + url = "https://github.com/conan-io/examples" + requires = "Hello/0.1@demo/testing" + settings = "os", "compiler", "build_type", "arch" + exports_sources = "src/*", "build/*" + generators = "MSBuildDeps", "MSBuildToolchain" + + def build(self): + msbuild = MSBuild(self) + msbuild.build("build/ChatLib/ChatLib.sln") + + def package(self): + self.copy("*.h", dst="include", src="src") + self.copy("*.lib", dst="lib", keep_path=False) + self.copy("*.dll", dst="bin", keep_path=False) + + def package_info(self): + self.cpp_info.libs = ["ChatLib"] diff --git a/features/visual_studio/reusing_packages/src/chat.cpp b/features/visual_studio/reusing_packages/src/chat.cpp new file mode 100644 index 00000000..298bfda1 --- /dev/null +++ b/features/visual_studio/reusing_packages/src/chat.cpp @@ -0,0 +1,13 @@ +#include "chat.h" +#include "hello.h" + +void chat(){ + #ifdef _DEBUG + hello(); + hello(); + hello(); + #else + hello(); + hello(); + #endif +} diff --git a/features/visual_studio/reusing_packages/src/chat.h b/features/visual_studio/reusing_packages/src/chat.h new file mode 100644 index 00000000..779496ff --- /dev/null +++ b/features/visual_studio/reusing_packages/src/chat.h @@ -0,0 +1,9 @@ +#pragma once + +#ifdef WIN32 + #define HELLO_EXPORT __declspec(dllexport) +#else + #define HELLO_EXPORT +#endif + +HELLO_EXPORT void chat(); \ No newline at end of file diff --git a/features/visual_studio/reusing_packages/src/mychat.cpp b/features/visual_studio/reusing_packages/src/mychat.cpp new file mode 100644 index 00000000..3d647c90 --- /dev/null +++ b/features/visual_studio/reusing_packages/src/mychat.cpp @@ -0,0 +1,5 @@ +#include "chat.h" + +int main() { + chat(); +} \ No newline at end of file diff --git a/features/visual_studio/reusing_packages/test_package/CMakeLists.txt b/features/visual_studio/reusing_packages/test_package/CMakeLists.txt new file mode 100644 index 00000000..19ec9c57 --- /dev/null +++ b/features/visual_studio/reusing_packages/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +project(PackageTest CXX) +cmake_minimum_required(VERSION 3.0) + +find_package(Chat REQUIRED) + +add_executable(example example.cpp) +target_link_libraries(example Chat::Chat) diff --git a/features/visual_studio/reusing_packages/test_package/conanfile.py b/features/visual_studio/reusing_packages/test_package/conanfile.py new file mode 100644 index 00000000..0d2307b6 --- /dev/null +++ b/features/visual_studio/reusing_packages/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conans import ConanFile +from conan.tools.cmake import CMake +from conan.tools.layout import cmake_layout + +import os + + +class HelloTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps" + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def imports(self): + self.copy("*.dll", dst="bin", src="bin") + self.copy("*.dylib*", dst="bin", src="lib") + + def test(self): + cmd = os.path.join(self.cpp.build.bindirs[0], "example") + self.run(cmd) \ No newline at end of file diff --git a/features/visual_studio/reusing_packages/test_package/example.cpp b/features/visual_studio/reusing_packages/test_package/example.cpp new file mode 100644 index 00000000..a234ecb6 --- /dev/null +++ b/features/visual_studio/reusing_packages/test_package/example.cpp @@ -0,0 +1,5 @@ +#include "chat.h" + +int main() { + chat(); +} diff --git a/tox.ini b/tox.ini index 32101d21..2e189abf 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,10 @@ [tox] skipsdist=True -envlist = - py{36}-conan{dev,current,prev} +envlist=py36 [testenv] deps = - conancurrent: conan - conandev: git+https://github.com/conan-io/conan.git@develop - conanprev: conan-unknown + conan==2.0.0a1 coverage: coverage-enable-subprocess tabulate packaging