From 802a625ae286fd664bfaa3ef33b5fa7d1ec7ea5f Mon Sep 17 00:00:00 2001 From: nihuini Date: Wed, 10 Apr 2024 19:19:23 +0800 Subject: [PATCH] fix pnnx windows build --- tools/pnnx/src/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/pnnx/src/CMakeLists.txt b/tools/pnnx/src/CMakeLists.txt index cd27ceb2e..0f52a2ab5 100644 --- a/tools/pnnx/src/CMakeLists.txt +++ b/tools/pnnx/src/CMakeLists.txt @@ -601,6 +601,10 @@ add_library(torch2pnnx OBJECT ${torch2pnnx_SRCS}) target_compile_definitions(torch2pnnx PRIVATE BUILD_TORCH2PNNX) target_compile_options(torch2pnnx PUBLIC "${TORCH_CXX_FLAGS}") +if(WIN32) + target_compile_definitions(torch2pnnx PUBLIC NOMINMAX) +endif() + if(TorchVision_FOUND) set_property(SOURCE load_torchscript.cpp APPEND PROPERTY COMPILE_DEFINITIONS PNNX_TORCHVISION) endif() @@ -713,10 +717,6 @@ if(PNNX_COVERAGE) target_link_libraries(pnnx PUBLIC -coverage -lgcov) endif() -if(WIN32) - target_compile_definitions(pnnx PUBLIC NOMINMAX) -endif() - # set_target_properties(pnnx PROPERTIES COMPILE_FLAGS -fsanitize=address) # set_target_properties(pnnx PROPERTIES LINK_FLAGS -fsanitize=address)