Skip to content

Commit

Permalink
define EXPORT_AOTI_FUNCTIONS in global scope.
Browse files Browse the repository at this point in the history
  • Loading branch information
xuhancn committed Dec 20, 2024
1 parent 0815a12 commit ef4f44e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,9 @@ if(NOT MSVC)
append_cxx_flag_if_supported("-Wno-error=redundant-move" CMAKE_CXX_FLAGS)
endif()
else()
# Define export functions for AOTI.
add_compile_definitions(EXPORT_AOTI_FUNCTIONS)

# skip unwanted includes from windows.h
add_compile_definitions(WIN32_LEAN_AND_MEAN)
# Windows SDK broke compatibility since version 25131, but introduced this
Expand Down
6 changes: 3 additions & 3 deletions caffe2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ endif()

if(NOT BUILD_LIBTORCHLESS)
add_library(torch_cpu ${Caffe2_CPU_SRCS})
target_compile_definitions(torch_cpu PRIVATE -DEXPORT_AOTI_FUNCTIONS)
# target_compile_definitions(torch_cpu PRIVATE -DEXPORT_AOTI_FUNCTIONS)
if(HAVE_SOVERSION)
set_target_properties(torch_cpu PROPERTIES
VERSION ${TORCH_VERSION} SOVERSION ${TORCH_SOVERSION})
Expand Down Expand Up @@ -959,7 +959,7 @@ elseif(USE_CUDA)
set(CUDA_LINK_LIBRARIES_KEYWORD)
torch_compile_options(torch_cuda) # see cmake/public/utils.cmake
target_compile_definitions(torch_cuda PRIVATE USE_CUDA)
target_compile_definitions(torch_cuda PRIVATE -DEXPORT_AOTI_FUNCTIONS)
# target_compile_definitions(torch_cuda PRIVATE -DEXPORT_AOTI_FUNCTIONS)

if(USE_CUFILE)
target_link_libraries(torch_cuda PRIVATE torch::cufile)
Expand Down Expand Up @@ -1051,7 +1051,7 @@ if(USE_XPU)
add_library(torch_xpu ${Caffe2_XPU_SRCS})
torch_compile_options(torch_xpu) # see cmake/public/utils.cmake
target_compile_definitions(torch_xpu PRIVATE USE_XPU)
target_compile_definitions(torch_xpu PRIVATE -DEXPORT_AOTI_FUNCTIONS)
# target_compile_definitions(torch_xpu PRIVATE -DEXPORT_AOTI_FUNCTIONS)
if(WIN32)
target_compile_options(torch_xpu PRIVATE /permissive-)
endif()
Expand Down
2 changes: 1 addition & 1 deletion torch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ endif()

add_library(torch_python SHARED ${TORCH_PYTHON_SRCS})
torch_compile_options(torch_python) # see cmake/public/utils.cmake
target_compile_definitions(torch_python PRIVATE -DEXPORT_AOTI_FUNCTIONS)
# target_compile_definitions(torch_python PRIVATE -DEXPORT_AOTI_FUNCTIONS)
if(APPLE)
target_compile_options(torch_python PRIVATE
$<$<COMPILE_LANGUAGE:CXX>: -fvisibility=default>)
Expand Down

0 comments on commit ef4f44e

Please sign in to comment.