Loading repository data…
Loading repository data…
blockspacer / repository
C++ compile-time programming (serialization, reflection, code modification, enum to string, better enum, enum to json, extend or parse language, etc.)
Main project page: https://blockspacer.github.io/flex_docs/
Tested on Ubuntu 20.04.2 LTS.
May work on other platforms with minor modifications.
To be able to add the list of dependency remotes please type the following command:
cmake -E time conan config install conan/remotes/
# OR:
# cmake -E time conan config install conan/remotes_disabled_ssl/
conan packages
NOTE: cling with LLVM build may take couple of hours.
Command below uses --profile clang12_compiler12_compiler.
Example conan profile ~/.conan/profiles/clang:
[settings]
# We are building in Ubuntu Linux
os_build=Linux
os=Linux
arch_build=x86_64
arch=x86_64
compiler=clang
compiler.version=10
compiler.libcxx=libstdc++11
[env]
CC=/usr/bin/clang-10
CXX=/usr/bin/clang++-10
[build_requires]
cmake_installer/3.15.5@conan/stable
Create clang12_compiler profile:
[settings]
# We are building in Ubuntu Linux
os_build=Linux
os=Linux
arch_build=x86_64
arch=x86_64
compiler=clang
compiler.version=12
compiler.libcxx=libstdc++11
compiler.cppstd=17
llvm_9:build_type=Release
[env]
CC=/usr/bin/clang-12
CXX=/usr/bin/clang++-12
[build_requires]
cmake_installer/3.15.5@conan/stable
Before creation of conan profile file, see: https://docs.conan.io/en/latest/using_packages/using_profiles.html.
We use .cmake script to download and install conan packages.
git clone https://github.com/blockspacer/conan_github_downloader.git ~/conan_github_downloader
cmake \
-DSCRIPT_PATH="$PWD/get_conan_dependencies.cmake"\
-DENABLE_CLING=TRUE\
-DENABLE_LLVM=TRUE\
-DENABLE_LLVM_INSTALLER=FALSE\
-DEXTRA_CONAN_OPTS="--profile;clang12_compiler\
;-s;build_type=Debug\
;-s;cling_conan:build_type=Release\
;-s;llvm_12:build_type=Release\
;--build;missing" \
-P ~/conan_github_downloader/conan_github_downloader.cmake
# clean build cache
conan remove "*" --build --force
If you want to install flextool and its plugins in single command, change the options provided to tools/buildConanThirdparty.cmake.
NOTE: tools/buildConanThirdparty.cmake will perform a FULL RE-BUILD; it may take couple of hours.
Command below uses --profile clang12_compiler12_compiler. Before creation of conan profile file, see: https://docs.conan.io/en/latest/using_packages/using_profiles.html.
We use buildConanThirdparty.cmake script to download and install conan packages.
NOTE: set -DENABLE_CLING=FALSE if you already installed Cling using tools/buildConanThirdparty.cmake above.
git clone https://github.com/blockspacer/conan_github_downloader.git ~/conan_github_downloader
cmake \
-DSCRIPT_PATH="$PWD/get_conan_dependencies.cmake"\
-DENABLE_CLING=TRUE\
-DENABLE_LLVM=TRUE\
-DENABLE_LLVM_INSTALLER=FALSE\
-DENABLE_FLEXTOOL=TRUE \
-DENABLE_BASIS_PLUGIN_HELPER=TRUE \
-DENABLE_FLEX_REFLECT_PLUGIN=TRUE \
-DENABLE_SQUARETS=TRUE \
-DENABLE_FLEX_SQUARETS_PLUGIN=TRUE \
-DENABLE_FLEX_PIMPL_PLUGIN=TRUE \
-DENABLE_FLEX_TYPECLASS_PLUGIN=TRUE \
-DENABLE_FLEX_META_PLUGIN=TRUE \
-DENABLE_FLEX_META_DEMO=TRUE \
-DEXTRA_CONAN_OPTS="--profile;clang12_compiler\
;-s;build_type=Debug\
;-s;cling_conan:build_type=Release\
;-s;llvm_12:build_type=Release\
;--build;missing" \
-P ~/conan_github_downloader/conan_github_downloader.cmake
# clean build cache
conan remove "*" --build --force
Use command below to re-build flextool (plugins must be installed separately).
Command below uses --profile clang12_compiler12_compiler. Before creation of conan profile file, see: https://docs.conan.io/en/latest/using_packages/using_profiles.html
export VERBOSE=1
export CONAN_REVISIONS_ENABLED=1
export CONAN_VERBOSE_TRACEBACK=1
export CONAN_PRINT_RUN_COMMANDS=1
export CONAN_LOGGING_LEVEL=10
# 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 \
-s llvm_tools:build_type=Release \
--profile clang12_compiler \
-e flextool:enable_tests=True \
-e flextool:enable_llvm_tools=True
# clean build cache
conan remove "*" --build --force
compile_commands.jsonDisable generation of compilation database when you use flextool.
If you are using CMake, set CMAKE_EXPORT_COMPILE_COMMANDS to FALSE.
If compile_commands.json exists in build folder (or in parent folder), flextool may fail.
This project is possible because of flexferrum's autoprogrammer.
Articles about flexferrum's autoprogrammer in media:
find . -type f -name "*_buildflags.h" -exec rm {} \;
find . -type f -name "*_buildflags.tmp" -exec rm {} \;
(rm -rf local_build || true)
export CONAN_REVISIONS_ENABLED=1
export CONAN_VERBOSE_TRACEBACK=1
export CONAN_PRINT_RUN_COMMANDS=1
export CONAN_LOGGING_LEVEL=10
export PKG_NAME=flextool/master@conan/stable
(CONAN_REVISIONS_ENABLED=1 \
conan remove --force $PKG_NAME || true)
# NOTE: use --build=missing if you got error `ERROR: Missing prebuilt package`
cmake -E time \
conan install . \
--install-folder local_build \
-s build_type=Debug \
-s cling_conan:build_type=Release \
-s llvm_12:build_type=Release \
-o openssl:shared=True \
-e basis:enable_tests=True \
-o chromium_base:shared=True \
-e chromium_base:enable_tests=True \
-o perfetto:is_hermetic_clang=False \
--profile clang12_compiler \
-e flexlib:enable_tests=True \
-o flexlib:shared=False \
-o perfetto:is_hermetic_clang=False \
-o flexlib:enable_cling=True \
-e flextool:enable_tests=True \
-o flextool:enable_cling=True
(rm local_build/CMakeCache.txt || true)
cmake -E time \
conan source . \
--source-folder . \
--install-folder local_build
# You can use `cmake --build . -- -j14` on second run.
cmake -E time \
conan build . \
--build-folder local_build \
--source-folder . \
--install-folder local_build
conan package . \
--build-folder local_build \
--package-folder local_build/package_dir \
--source-folder . \
--install-folder local_build
cmake -E time \
conan export-pkg . conan/stable \
--package-folder local_build/package_dir \
-s build_type=Debug \
--force \
-s cling_conan:build_type=Release \
-s llvm_12:build_type=Release \
-o openssl:shared=True \
-e basis:enable_tests=True \
-o chromium_base:shared=True \
-e chromium_base:enable_tests=True \
-o perfetto:is_hermetic_clang=False \
--profile clang12_compiler \
-e flexlib:enable_tests=True \
-o flexlib:shared=False \
-o perfetto:is_hermetic_clang=False \
-o flexlib:enable_cling=True \
-e flextool:enable_tests=True \
-o flextool:enable_cling=True
cmake -E time \
conan test test_package \
flextool/master@conan/stable \
-s build_type=Debug \
-s cling_conan:build_type=Release \
-s llvm_12:build_type=Release \
-o openssl:shared=True \
-e basis:enable_tests=True \
-o chromium_base:shared=True \
-e chromium_base:enable_tests=True \
-o perfetto:is_hermetic_clang=False \
--profile clang12_compiler \
-e flexlib:enable_tests=True \
-o flexlib:shared=False \
-o perfetto:is_hermetic_clang=False \
-o flexlib:enable_cling=True \
-e flextool:enable_tests=True \
-o flextool:enable_cling=True
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.
For details, see: https://docs.conan.io/en/latest/developing_packages/editable_packages.html
Build locally:
export VERBOSE=1
export CONAN_REVISIONS_ENABLED=1
export CONAN_VERBOSE_TRACEBACK=1
export CONAN_PRINT_RUN_COMMANDS=1
export CONAN_LOGGING_LEVEL=10
cmake -E time \
conan install . \
--install-folder local_build \
-s build_type=Debug \
-s cling_conan:build_type=Release \
-s llvm_tools:build_type=Release \
--profile clang12_compiler \
-e flextool:enable_tests=True \
-e flextool:enable_llvm_tools=True
cmake -E time \
conan source . \
--source-folder local_build \
--install-folder local_b