C++ lib
export CXX=clang++-6.0
export CC=clang-6.0
# NOTE: change `build_type=Debug` to `build_type=Release` in production
# NOTE: use --build=missing if you got error `ERROR: Missing prebuilt package`
cmake -E time \
conan create . conan/stable \
-s build_type=Debug -s cling_conan:build_type=Release \
--profile clang \
-o squarets:shared=False \
-o squarets:enable_clang_from_conan=False \
-e squarets:enable_tests=True
# clean build cache
conan remove "*" --build --force
Commands below may be used to build project locally, without system-wide installation.
export CXX=clang++-6.0
export CC=clang-6.0
cmake -E remove_directory build
cmake -E make_directory build
# NOTE: change `build_type=Debug` to `build_type=Release` in production
build_type=Debug
# install conan requirements
cmake -E chdir build cmake -E time \
conan install \
-s build_type=${build_type} -s cling_conan:build_type=Release \
--build=missing \
--profile clang \
-e enable_tests=True \
..
# configure via cmake
cmake -E chdir build \
cmake -E time cmake .. \
-DENABLE_TESTS=TRUE \
-DCONAN_AUTO_INSTALL=OFF \
-DCMAKE_BUILD_TYPE=${build_type}
# build code
cmake -E chdir build \
cmake -E time cmake --build . \
--config ${build_type} \
-- -j8
# run unit tests
cmake -E chdir build \
cmake -E time cmake --build . \
--config ${build_type} \
--target squarets_run_all_tests
With the editable packages, you can tell Conan where to find the headers and the artifacts ready for consumption in your local working directory.
There is no need to run conan create
or conan export-pkg
.
See for details https://docs.conan.io/en/latest/developing_packages/editable_packages.html
Build locally:
cmake -E time \
conan install . \
--install-folder local_build \
-s build_type=Debug -s cling_conan:build_type=Release \
--profile clang \
-o squarets:shared=False \
-o squarets:enable_clang_from_conan=False \
-e squarets:enable_tests=True
cmake -E time \
conan source . \
--source-folder local_build \
--install-folder local_build
conan build . \
--build-folder local_build
conan package . \
--build-folder local_build \
--package-folder local_build/package_dir \
--source-folder local_build \
--install-folder local_build
Set package to editable mode:
conan editable add local_build/package_dir \
squarets/master@conan/stable
Note that conanfile.py
modified to detect local builds via self.in_local_cache
After change source in folder local_build (run commands in source package folder):
conan build . \
--build-folder local_build
conan package . \
--build-folder local_build \
--package-folder local_build/package_dir \
--source-folder local_build \
--install-folder local_build
Build your test project
In order to revert the editable mode just remove the link using:
conan editable remove \
squarets/master@conan/stable