-
Notifications
You must be signed in to change notification settings - Fork 1
/
justfile
52 lines (42 loc) · 2.61 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env just --justfile
set dotenv-load := true
build_os := if os() == "macos" { "osx" } else { "linux" }
generator := env_var_or_default("CMAKE_GENERATOR", "Unix Makefiles")
vcpkg_default_triplet := env_var_or_default("VCPKG_DEFAULT_TRIPLET", "x64-" + build_os + "-haswell")
default_build_type := env_var_or_default("BUILD_TYPE", "debug")
default_build_jobs := env_var_or_default("BUILD_JOBS", "12")
default_build_target := env_var_or_default("BUILD_TARGET", "all")
default_distcc_jobs := env_var_or_default("DISTCC_JOBS", "24")
default_profile_name := env_var_or_default("PROFILE_NAME", "")
# configure the project using cmake
cmake build_type=default_build_type profile_name=default_profile_name:
# set the OPENSSL_ROOT_DIR to the package installed via manifest mode,
# so that `find_package(OpenSSL)` in CMake can find the OpenSSL lib with correct target architecture
PROFILE_NAME={{profile_name}} OPENSSL_ROOT_DIR=./build-cmake-{{build_type}}-{{build_os}}/vcpkg_installed/{{vcpkg_default_triplet}} cmake . --preset={{build_type}}-{{build_os}} -DVCPKG_TARGET_TRIPLET={{vcpkg_default_triplet}}
# compile the project
build build_type=default_build_type jobs=default_build_jobs target=default_build_target profile_name=default_profile_name:
PROFILE_NAME={{profile_name}} cmake --build --target {{target}} --preset={{build_type}}-{{build_os}}-build -j {{jobs}}
# install the project
install build_type=default_build_type:
DESTDIR=./{{build_type}}-{{build_os}} cmake --build --target install --preset={{build_type}}-{{build_os}}-build
# run all tests
test build_type=default_build_type:
pushd build-cmake-{{build_type}}-{{build_os}} && ctest && popd
clean:
rm -fr target && rm -fr vcpkg_installed && rm -fr build-cmake-*
# patch ./vector/Cargo.toml using ./patch/Cargo.patch.json
patch:
# @pushd vector && git diff --exit-code ./Cargo.toml > /dev/null || (echo "./vector/Cargo.toml has uncommitted modification, please commit the necessary changes or discard the changes manually, and then run 'patch' command again" && exit 1)
# this will reset the ./vector/Cargo.toml to the original state
cd vector && git checkout HEAD -- ./Cargo.toml && cd ..
tomlpatch ./vector/Cargo.toml ./patch/Cargo.patch.json
@echo "Updating patched Cargo.toml for vector"
cd vector && cargo update --package openssl --package rdkafka && cd ..
cp ./vector/Cargo.toml ./patch/ && cp ./vector/Cargo.lock ./patch/
install_toml_patch:
pip install tomlpatch --upgrade
# switch to x64_toolchain
x64_toolchain:
rustup override set 1.74.0-x86_64-apple-darwin
rustup override set 1.74.0-x86_64-apple-darwin --path vector
rustup override list