This guide creates a minimal CMake project that restores dependencies through Toolkit Package Manager.
package("HelloTPKG")
version("0.1.0")
default_config("debug")
default_platform("host")
default_arch("x64")
require("fmt", {
source = "https://github.com/fmtlib/fmt.git",
ref = "10.2.1",
build = "cmake",
cmake = {
options = {
FMT_DOC = false,
FMT_TEST = false
}
},
artifacts = {
include_dirs = {"include"},
libs = {"fmt"}
}
})tpkg sdk detect
tpkg sdk listChoose a profile ID shown by sdk list, for example windows-msvc-x64.
tpkg restore --config debug --toolchain windows-msvc-x64This reads tpkg.lua, fetches dependency sources, builds dependencies if needed, writes or updates tpkg.lock.toml, and stores artifacts under .tpkg/.
tpkg generate --config debug --toolchain windows-msvc-x64The default output is:
.tpkg/generated/cmake/
cmake_minimum_required(VERSION 3.25)
project(HelloTPKG LANGUAGES CXX)
include("${CMAKE_SOURCE_DIR}/.tpkg/generated/cmake/tpkg_deps.cmake")
add_executable(hello src/main.cpp)
target_link_libraries(hello PRIVATE fmt)Commit:
tpkg.lua
tpkg.lock.toml
CMakeLists.txt
Do not commit:
.tpkg/