2 ms·
As the xmake C++ module main contributor, i can affirm that xmake module support is ahead of cmake, i added support for gcc, clang and msvc, headerunits, import
by arthapz 2y ago
As the xmake C++ module main contributor, i can affirm that xmake module support is ahead of cmake, i added support for gcc, clang and msvc, headerunits, import std, automatic reuse of bmi when flags are compatible,import module from an external package (like glm or vulkan_hpp) and i’m closely watching compilers repository to support new things before compiler release
for clangd i can't do much currently, there is a PR that add some support, i tried it, but doesn't require for now buildsystem intervention
For example:
add_requires("vulkan-headers", {configs = {modules = true}})
# xmake.lua
target("test-vk")
set_languages("c++latest")
add_files("src/\*.cpp")
set_policy("build.c++.modules", true)
add_packages("vulkan-headers")
// main.cpp
import std;
import vulkan_hpp;
int main() {
auto vk_context = vk::raii::Context();
const auto exts = vk_context.enumerateInstanceExtensionProperties();
for(auto &&ext : exts)
std::println("{}", std::string{ext.extensionName});
return 0;
}
// result
> xmake f --toolchain=llvm --runtimes="c++_shared" --yes; xmake b
checking for platform ... windows
checking for architecture ... x64
[ 0%]: <test-vk> generating.module.deps src\main.cpp
[ 0%]: <test-vk> generating.module.deps F:\llvm\bin\..\lib\..\share\libc++\v1\std.cppm
[ 0%]: <test-vk> generating.module.deps F:\packages\xmake\v\vulkan-headers\1.3.275+0\ae359cf8d45b4d049acf1ae7350e6dc3\modules\b028617b\vulkan.cppm
[ 12%]: <test-vk> compiling.module.release std
[ 12%]: <test-vk> compiling.module.release vulkan_hpp
[ 62%]: compiling.release src\main.cpp
[ 75%]: linking.release test-vk.exe
[100%]: build ok, spent 5.64s
> xmake run
VK_KHR_device_group_creation
VK_KHR_external_fence_capabilities
VK_KHR_external_memory_capabilities
VK_KHR_external_semaphore_capabilities
VK_KHR_get_physical_device_properties2
VK_KHR_get_surface_capabilities2
VK_KHR_surface
VK_KHR_win32_surface
VK_EXT_debug_report
VK_EXT_debug_utils
VK_EXT_swapchain_colorspace
VK_KHR_portability_enumeration
VK_LUNARG_direct_driver_loading