Skip to content

Commit

Permalink
ci: try a unicode build
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Oct 3, 2024
1 parent f689cf7 commit 79b0a3a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ci/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:wmainCRTStartup")
endif()

if(NOT WIN32)
include(FindPkgConfig)
pkg_check_modules(wwa_opentelemetry_resource_detectors REQUIRED IMPORTED_TARGET wwa_opentelemetry_resource_detectors)
Expand Down
5 changes: 5 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ set_target_properties(
CXX_EXTENSIONS NO
COMPILE_DEFINITIONS WWA_OPENTELEMETRY_RESOURCE_DETECTORS_STATIC_DEFINE
)

if(WIN32)
target_compile_definitions(example1 PRIVATE -D_MBCS)
set_target_properties(example1 PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup")
endif()
9 changes: 8 additions & 1 deletion examples/example1.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#ifdef _WIN32
# include <windows.h>
# define MAIN __cdecl _tmain
#else
# define MAIN main
#endif

#include <iostream>
#include <memory>
#include <vector>
Expand Down Expand Up @@ -29,7 +36,7 @@ struct adl_serializer<opentelemetry::sdk::common::OwnedAttributeValue> {

} // namespace nlohmann

int main() // NOLINT(bugprone-exception-escape)
int MAIN() // NOLINT(bugprone-exception-escape)
{
std::vector<std::unique_ptr<opentelemetry::sdk::resource::ResourceDetector>> detectors;
detectors.emplace_back(std::make_unique<wwa::opentelemetry::resource::container_resource_detector>());
Expand Down

0 comments on commit 79b0a3a

Please sign in to comment.