12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #!/usr/bin/sh
- # NOTE: Use pimpl to hide the implementation details (headers from dependencies)
- set -e
- deploy_dir=build/deploy
- # Clean the project
- rm -rf test_package/build/**
- # Use conan to build the project
- conan create . --build=missing $@
- # conan install . --deployer=full_deploy --build=missing
- # cmake --build build
- # Find the test_package artifacts folder
- test_package_build_dir=$(find test_package/build/ -mindepth 1 -maxdepth 1 -type d | head -n 1)
- echo Reading build directory: $test_package_build_dir
- # Find the link.txt file and extract the library path
- link_file=$(find $test_package_build_dir/CMakeFiles/example.dir -name link.txt)
- echo Reading link file: $link_file
- # Deploy the project
- if [ -z "$deploy_dir" ]; then
- # FAILSAFE guard
- echo ❌ Deployment directory is not set. Please set the variable \`deploy_dir\` to the desired deployment directory.
- exit 1
- fi
- merged_lib_file=$deploy_dir/lib/libtsdb-merged.a
- mkdir -p $deploy_dir
- rm -rf $deploy_dir/**
- mkdir $deploy_dir/include
- mkdir $deploy_dir/lib
- cp -r include/* $deploy_dir/include
- echo Creating merged library: $merged_lib_file
- # grep -o '/[^ ]*/.conan2/p/b/[^ ]*\.a' $link_file
- # libtool -static -o $deploy_dir/lib/libtsdb-merged.a $(grep -o '/[^ ]*/.conan2/p/b/[^ ]*\.a' $link_file)
- ar cqT $merged_lib_file $(grep -o '/[^ ]*/.conan2/p/b/[^ ]*\.a' $link_file)
- printf 'create %s\naddlib %s\nsave\nend' "$merged_lib_file" "$merged_lib_file" | ar -M
- # Done!
- echo ✅ Project has been successfully deployed to \`$deploy_dir\`.
- echo
- echo To consume the library, run the following commands:
- echo
- echo " $ g++ -std=c++17 -I$deploy_dir/include -L$deploy_dir/lib main.cpp -o main -ltsdb-merged"
|