-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cxx): update the xmake.lua with third_party
- Loading branch information
Showing
2 changed files
with
31 additions
and
22 deletions.
There are no files selected for viewing
16 changes: 11 additions & 5 deletions
16
template/cxx/{{cookiecutter.project_slug}}/third_party/xmake.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
-- Header-only libraries configuration | ||
-- Common configuration for third-party libraries | ||
|
||
-- Target: httplib | ||
target("httplib") | ||
set_kind("headeronly") | ||
add_includedirs("httplib") | ||
set_kind("headeronly") -- Define it as a header-only library. | ||
add_includedirs("httplib") -- Fallback to direct folder. | ||
add_headerfiles("httplib/**/*.h") -- Ensure all headers are tracked for IDEs. | ||
add_headerfiles("httplib/**/*.hpp") | ||
|
||
-- Target: cxxopts | ||
target("cxxopts") | ||
set_kind("headeronly") | ||
add_includedirs("cxxopts") | ||
set_kind("headeronly") -- Define it as a header-only library. | ||
add_includedirs("cxxopts") -- Default include path. | ||
add_headerfiles("cxxopts/**/*.h") -- Track all headers. | ||
add_headerfiles("cxxopts/**/*.hpp") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
-- Set project name and language | ||
-- Project Configuration | ||
set_project("{{cookiecutter.project_slug}}") | ||
set_version("{{cookiecutter.project_version}}") | ||
set_languages("c++{{cookiecutter.cxx_standard_version}}") | ||
|
||
-- Include directories | ||
add_includedirs("include") | ||
add_requires("spdlog 1.15.0") | ||
-- Dependencies | ||
add_requires("spdlog 1.15.0") -- Add spdlog as a required dependency | ||
|
||
-- Include third-party libraries | ||
includes("third_party") | ||
|
||
-- Add targets | ||
-- Define Library Target | ||
target("{{cookiecutter.package_name}}_lib") | ||
set_targetdir("build/lib") | ||
set_kind("static") | ||
add_packages("spdlog") | ||
add_files("src/*.cpp") | ||
add_headerfiles("include/*.h") | ||
add_deps("httplib", "cxxopts") | ||
set_kind("static") -- Build as a static library | ||
set_targetdir("build/lib") -- Specify output directory | ||
add_includedirs("include") -- Include project's header files | ||
add_files("src/*.cpp") -- Add project source files | ||
add_headerfiles("include/*.h") -- Add project's header files | ||
add_packages("spdlog") -- Link spdlog headers and library | ||
add_deps("httplib", "cxxopts") -- Use httplib and cxxopts from third_party | ||
|
||
-- Define Executable Target | ||
target("{{cookiecutter.project_slug}}") | ||
set_targetdir("build/bin") | ||
set_kind("binary") | ||
add_files("src/main.cpp") | ||
add_deps("{{cookiecutter.package_name}}_lib") | ||
set_kind("binary") -- Build as an executable | ||
set_targetdir("build/bin") -- Specify output directory | ||
add_files("src/main.cpp") -- Add main source file | ||
add_deps("{{cookiecutter.package_name}}_lib") -- Link against the library | ||
add_packages("spdlog") -- Include spdlog headers and library | ||
|
||
-- Add tests | ||
includes("tests") | ||
-- Tests Configuration | ||
includes("tests") -- Include the tests subdirectory |