From 18fcc04c963d09c79586859cce46450dda9ebe7e Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Thu, 3 Oct 2024 03:31:13 +0300 Subject: [PATCH] ci: try a unicode build --- ci/CMakeLists.txt | 5 +++++ examples/example1.cpp | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ci/CMakeLists.txt b/ci/CMakeLists.txt index 43d038b..15f3043 100644 --- a/ci/CMakeLists.txt +++ b/ci/CMakeLists.txt @@ -21,6 +21,11 @@ set_target_properties( COMPILE_DEFINITIONS WWA_OPENTELEMETRY_RESOURCE_DETECTORS_STATIC_DEFINE ) +if(WIN32) + target_compile_definitions(ci-cmake PRIVATE -DUNICODE -D_UNICODE) + set_target_properties(ci-cmake PROPERTIES LINK_FLAGS "/ENTRY:wWinMainCRTStartup") +endif() + if(NOT WIN32) include(FindPkgConfig) pkg_check_modules(wwa_opentelemetry_resource_detectors REQUIRED IMPORTED_TARGET wwa_opentelemetry_resource_detectors) diff --git a/examples/example1.cpp b/examples/example1.cpp index 9251e69..062f220 100644 --- a/examples/example1.cpp +++ b/examples/example1.cpp @@ -1,3 +1,10 @@ +#ifdef _WIN32 +# include +# define MAIN _tmain +#else +# define MAIN main +#endif + #include #include #include @@ -29,7 +36,7 @@ struct adl_serializer { } // namespace nlohmann -int main() // NOLINT(bugprone-exception-escape) +int MAIN() // NOLINT(bugprone-exception-escape) { std::vector> detectors; detectors.emplace_back(std::make_unique());