Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4cded71
Add new example: Creating packages with Visual Studio
tapia Nov 23, 2021
bba6128
Update recipe url
tapia Nov 23, 2021
c61fc71
New example: features/visual_studio/chat
tapia Nov 24, 2021
59dc19b
Merge branch 'develop2' into new_examples
tapia Nov 24, 2021
11794be
Add basic autotools examples
tapia Nov 25, 2021
0a8e52e
Upgrade CI's python version in mac
tapia Nov 26, 2021
d412a71
Remove some unnecessary readme files
tapia Nov 26, 2021
a11b256
Add CI building scripts
tapia Nov 26, 2021
53dca66
Simplify the CI scripts
tapia Nov 29, 2021
fbe0972
Simplify the CI scripts
tapia Nov 29, 2021
e2f50bd
Simplify the CI scripts
tapia Nov 29, 2021
ea3efa1
Simplify the CI scripts
tapia Nov 29, 2021
36a0c37
Simplify the CI scripts
tapia Nov 29, 2021
152d14b
Simplify the CI scripts
tapia Nov 29, 2021
3f4ae86
Simplify the CI scripts
tapia Nov 29, 2021
4b75a98
Fix Visual Studio example
tapia Nov 29, 2021
15da8d8
Remove unused settings file, and rename example
tapia Nov 30, 2021
ff5c975
Simplify the CI scripts
tapia Nov 30, 2021
c204c5f
Fix visual studio examples
tapia Nov 30, 2021
e2705d2
Trying visual studio examples with msvc 19.16
tapia Nov 30, 2021
1b5271b
Trying visual studio examples with msvc 19.14
tapia Nov 30, 2021
4e7124f
Trying visual studio examples with msvc 19.13
tapia Nov 30, 2021
e25fdb1
Trying visual studio examples with msvc 19.12
tapia Nov 30, 2021
9fee9df
Fix visual studio examples
tapia Nov 30, 2021
a77683d
...
tapia Nov 30, 2021
eb6272f
...
tapia Nov 30, 2021
1c5eb92
...
tapia Nov 30, 2021
9a4da91
Remove last_conan_version.py and update python 3.6 version in mac to …
tapia Dec 1, 2021
dd11e79
Fix tox.ini
tapia Dec 1, 2021
10aec9b
Merge branch 'new_examples' into conan2/makefiles
tapia Dec 2, 2021
08e9cf9
fix features/makefiles examples
tapia Dec 2, 2021
6b1fb11
Improve autotools basic examples
tapia Dec 3, 2021
f905be1
Fix makefile example
tapia Dec 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .ci/jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
43 changes: 0 additions & 43 deletions .ci/last_conan_version.py

This file was deleted.

27 changes: 9 additions & 18 deletions .ci/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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:
Expand Down Expand Up @@ -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 .")

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
**/project*/build
!*/build.sh
.vscode/
venv

# Compiled Object files
*.slo
Expand Down
87 changes: 6 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
128 changes: 0 additions & 128 deletions conf/settings.yml

This file was deleted.

14 changes: 14 additions & 0 deletions features/makefiles/creating_packages/Makefile
Original file line number Diff line number Diff line change
@@ -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)
Loading