On Unix like OSs(Linux/macOS/FreeBSD), the local 3rd-party storage path is $HOME/.admake/3rd-party.
On Windows, it is ${env:HOME}/.admake/3rd-party or ${env:USERPROFILE}/.admake/3rd-party.
You can check the directory via
PowerShellon Windows.
You can also retrieve this path via a builtin subcommand
admake config -l.
You can check the important configurations in current environment via the followiwng command:
admake config -a
You can use admake fetch to update an existent package, the output message will different from the first fetching.
# Update lcm
admake fetch lcm
# If you have already downloaded lcm
# the upon command will remove it and download again
# and the output message will change from "Fetching ..." to "Updating ..."
VSCode/CLion/QtCreator?For VSCode:
There are two ways that we recommended:
The first way: the new version(>= 3.19) CMake support a feature called cmake-presets, allow users provide some presets via a JSON file named CMakePresets.json/CMakeUserPresets.json, you can append CMAKE_MODULE_PATH, ADMAKE_PLATFORM, ADMAKE_OS in the preset JSON, so you can build a specific target in VSCode. For more details, please browse cmake-presets.
The other way: append the following code snippets into your CMakeLists.txt, and place it ahead of include (CMakeListsPub):
# For IDEs
# When using IDE to open this cmake project, it will never to append the
# argument `CMAKE_MODULE_PATH`, so we must set it in the CMakeLists.txt file
# before including the cmake modules of admake.
find_program (ADMAKE_EXE admake)
if (NOT ADMAKE_EXE)
message (FATAL_ERROR "The required admake is not in your PATH!")
endif ()
execute_process (COMMAND admake config -c
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _ADMAKE_CODE
OUTPUT_VARIABLE _ADMAKE_CMAKE_DIR
ERROR_VARIABLE _ADMAKE_ERROR)
if (NOT CMAKE_MODULE_PATH)
if (NOT _ADMAKE_CODE EQUAL "0")
message (FATAL_ERROR "Failed to append cmake modules of admake: ${_ADMAKE_ERROR}")
else ()
set (CMAKE_MODULE_PATH "${_ADMAKE_CMAKE_DIR}")
endif ()
set (IN_IDE ON)
elseif (NOT ("${_ADMAKE_CMAKE_DIR}" IN_LIST CMAKE_MODULE_PATH))
list (APPEND CMAKE_MODULE_PATH "${_ADMAKE_CMAKE_DIR}")
endif ()
In fact, this prelude script for CMake can also be outputed by
admake config -p.
For CLion:
Besides appending prelude script, you should also set the initialize script for the toolchain to make sure CLion can find the correct PATH that admake has been appended, let CLion load the profile of shell $HOME/.bashrc or $HOME/.zshrc(NOTE: you should replace $HOME with the absolute path, it is a bad design :().
For QtCreator:
There are also two ways:
One is the same as CLion upon, the other is to customize the build comnand, replace the default cmake with admake directly.
The subcommand config provide an option to output the docker command template:
bash -c "$(admake config -d admake-cross-linux-arm64:18.04)"
# You can also test the output
admake config -d
Sometimes you may need to build project on a specific platform(such as Ubuntu 18.04) for compatible,
you can also use the cross-compile environment:
bash -c "$(admake config -d admake-cross-linux-arm64:18.04)"
# In container, build for x64, for Ubuntu 18.04
(base) user@user:/workspace/project$ admake build
In fact, adtools is under heavy development, so version will be updated frequently, but don't worry, you can update the built docker image via the following commands locally:
# For more details, you can check the help message: tools/update_docker_file.sh -i -l
tools/update_docker_file.sh -i -l
This command will check and update the adtools in your local docker images.
Because of a few features are implemented by C++ runtime, so developers have to face to the ABI compatible of different version runtimes. Do not like conan, adtools use NEXUS_HOST to switch between different runtimes. That means if you want to use the libc of Ubuntu 18.04, you can give a NEXUS_HOST point to the repository contains libraries that built on Ubuntu 18.04, the easiest way:
NEXUS_HOST=http:://repository:1804 admake build
# or update 3rd-party libraries
NEXUS_HOST=http:://repository:1804 admake fetch protobuf
rpath/runpath (Unix ONLY)?By default, admake will disable the rpath globally via set (CMAKE_SKIP_BUILD_RPATH TRUE), so you will get clean Shared Objects or ELFs.
If you want to append or change the rpath/runpath, you have three ways:
target_link_options, RECOMMENDED:
target_link_options (${TARGET_NAME}
PRIVATE "-Wl,-rpath,$ORIGIN")
set_target_properties with LINK_FLAGS, NOT LINK_OPTIONS,
because the LINK_OPTIONS will overwrite all the link flags.
set_target_properties (${TEST_TARGET_NAME} PROPERTIES
LINK_FLAGS "-Wl,-rpath,$ORIGIN")
set_target_properties with SKIP_BUILD_RPATH OFF and BUILD_RPATH,
this has a side effect: will introduce all the link_directories into
your rpath/runpath, them are appended by CMake automatically.
set_target_properties (${TEST_TARGET_NAME} PROPERTIES
SKIP_BUILD_RPATH OFF
BUILD_RPATH "$ORIGIN")