-DCMAKE_CXX_FLAGS="/EHa %USER_CFLAGS%" ^
-DCMAKE_EXE_LINKER_FLAGS="%USER_LDFLAGS%" ^
-DCMAKE_SHARED_LINKER_FLAGS="%USER_LDFLAGS%" ^
- -DUSE_ROCM=%USE_ROCM%
+ -DUSE_ROCM=%USE_ROCM% %EXTRA_CAFFE2_CMAKE_FLAGS%
IF ERRORLEVEL 1 exit 1
IF NOT ERRORLEVEL 0 exit 1
if (TORCH_STATIC)
+ target_compile_definitions(torch PUBLIC TORCH_BUILD_STATIC_LIBS)
add_library(torch STATIC ${TORCH_SRCS})
else()
add_library(torch SHARED ${TORCH_SRCS})
#pragma once
#ifdef _WIN32
+#if !defined(TORCH_BUILD_STATIC_LIBS)
#if defined(torch_EXPORTS)
#define TORCH_API __declspec(dllexport)
#else
#define TORCH_API __declspec(dllimport)
#endif
+#else
+#define TORCH_API
+#endif
#elif defined(__GNUC__)
#if defined(torch_EXPORTS)
#define TORCH_API __attribute__((__visibility__("default")))