File tree Expand file tree Collapse file tree 8 files changed +74
-17
lines changed
Expand file tree Collapse file tree 8 files changed +74
-17
lines changed Original file line number Diff line number Diff line change @@ -296,7 +296,10 @@ if(EXECUTORCH_BUILD_TESTS)
296296endif ()
297297
298298# TODO(dbort): Fix these warnings and remove this flag.
299- set (_common_compile_options -Wno-deprecated-declarations -fPIC)
299+ set (_common_compile_options
300+ $<$<CXX_COMPILER_ID:MSVC >:/wd4996>
301+ $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-Wno-deprecated-declarations -fPIC>
302+ )
300303
301304# Let files say "include <executorch/path/to/header.h>".
302305# TODO(#6475): This requires/assumes that the repo lives in a directory named
@@ -787,7 +790,10 @@ if(EXECUTORCH_BUILD_PYBIND)
787790 bundled_module PUBLIC ${_common_include_directories}
788791 )
789792 target_compile_options (
790- bundled_module PUBLIC -Wno-deprecated-declarations -fPIC
793+ bundled_module
794+ PUBLIC $<$<CXX_COMPILER_ID:MSVC >:/wd4996>
795+ $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-Wno-deprecated-declarations
796+ -fPIC>
791797 )
792798 endif ()
793799
@@ -859,8 +865,14 @@ if(EXECUTORCH_BUILD_PYBIND)
859865 endif ()
860866
861867 # compile options for pybind
862- set (_pybind_compile_options -Wno-deprecated-declarations -fPIC -frtti
863- -fexceptions
868+ set (_pybind_compile_options
869+ $<$<CXX_COMPILER_ID:MSVC >:/EHsc
870+ /GR
871+ /wd4996>
872+ $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-Wno-deprecated-declarations
873+ -fPIC
874+ -frtti
875+ -fexceptions>
864876 )
865877
866878 # util lib
Original file line number Diff line number Diff line change @@ -36,9 +36,15 @@ target_include_directories(
3636 # PyTorch AOTI headers from ExecuTorch's torch detection
3737 ${TORCH_INCLUDE_DIRS}
3838)
39- target_compile_options (aoti_common PUBLIC -fexceptions -frtti -fPIC)
39+ target_compile_options (
40+ aoti_common
41+ PUBLIC $<$<CXX_COMPILER_ID:MSVC >:/EHsc /GR>
42+ $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-fexceptions -frtti -fPIC>
43+ )
4044# Ensure symbols are exported properly
41- target_link_options (aoti_common PUBLIC -Wl,--export-dynamic)
45+ target_link_options (
46+ aoti_common PUBLIC $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-Wl,--export-dynamic>
47+ )
4248
4349# Link against ExecuTorch libraries and standard libraries
4450target_link_libraries (aoti_common PUBLIC extension_tensor ${CMAKE_DL_LIBS} )
Original file line number Diff line number Diff line change @@ -49,9 +49,14 @@ target_include_directories(
4949 # PyTorch AOTI headers from ExecutorTorch's torch detection
5050 ${TORCH_INCLUDE_DIRS}
5151)
52- target_compile_options (aoti_cuda PUBLIC -fexceptions -frtti -fPIC)
52+ target_compile_options (
53+ aoti_cuda PUBLIC $<$<CXX_COMPILER_ID:MSVC >:/EHsc /GR>
54+ $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-fexceptions -frtti -fPIC>
55+ )
5356# Ensure symbols are exported properly
54- target_link_options (aoti_cuda PUBLIC -Wl,--export-dynamic)
57+ target_link_options (
58+ aoti_cuda PUBLIC $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-Wl,--export-dynamic>
59+ )
5560
5661# Link against CUDA::cudart, common AOTI library, and PyTorch CUDA libraries
5762target_link_libraries (
Original file line number Diff line number Diff line change @@ -18,7 +18,10 @@ endif()
1818
1919set (EXECUTORCH_ROOT "${CMAKE_CURRENT_SOURCE_DIR} /../.." )
2020include (${EXECUTORCH_ROOT} /tools/cmake/Utils.cmake)
21- set (_common_compile_options -Wno-deprecated-declarations -fPIC)
21+ set (_common_compile_options
22+ $<$<CXX_COMPILER_ID:MSVC >:/wd4996>
23+ $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-Wno-deprecated-declarations -fPIC>
24+ )
2225if (NOT ANDROID_PLATFORM)
2326 set (ANDROID_PLATFORM android-30)
2427endif ()
Original file line number Diff line number Diff line change @@ -16,9 +16,14 @@ if(NOT EXECUTORCH_ROOT)
1616 set (EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR} /../../..)
1717endif ()
1818
19- set (_common_compile_options -Wno-deprecated-declarations -fPIC)
19+ set (_common_compile_options
20+ $<$<CXX_COMPILER_ID:MSVC >:/wd4996>
21+ $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-Wno-deprecated-declarations -fPIC>
22+ )
2023if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64" )
21- list (APPEND _common_compile_options "-march=armv8.2-a+dotprod" )
24+ list (APPEND _common_compile_options
25+ "$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-march=armv8.2-a+dotprod>"
26+ )
2227endif ()
2328
2429include (${EXECUTORCH_ROOT} /tools/cmake/Utils.cmake)
@@ -135,8 +140,15 @@ if(EXECUTORCH_BUILD_KERNELS_LLM_AOT)
135140 target_link_libraries (custom_ops_aot_lib PUBLIC pthreadpool cpuinfo)
136141 endif ()
137142 target_compile_options (
138- custom_ops_aot_lib PUBLIC -Wno-deprecated-declarations -fPIC -frtti
139- -fexceptions ${_common_compile_options}
143+ custom_ops_aot_lib
144+ PUBLIC $<$<CXX_COMPILER_ID:MSVC >:/EHsc
145+ /GR
146+ /wd4996>
147+ $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-Wno-deprecated-declarations
148+ -fPIC
149+ -frtti
150+ -fexceptions>
151+ ${_common_compile_options}
140152 )
141153
142154 install (
Original file line number Diff line number Diff line change @@ -35,7 +35,9 @@ target_include_directories(
3535 extension_module PUBLIC ${_common_include_directories}
3636)
3737target_compile_options (
38- extension_module PUBLIC -Wno-deprecated-declarations -fPIC
38+ extension_module
39+ PUBLIC $<$<CXX_COMPILER_ID:MSVC >:/wd4996>
40+ $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-Wno-deprecated-declarations -fPIC>
3941)
4042
4143# Module extension built as a static library. TODO(gjcomer) Remove this target
@@ -50,7 +52,9 @@ target_include_directories(
5052 extension_module_static PUBLIC ${_common_include_directories}
5153)
5254target_compile_options (
53- extension_module_static PUBLIC -Wno-deprecated-declarations -fPIC
55+ extension_module_static
56+ PUBLIC $<$<CXX_COMPILER_ID:MSVC >:/wd4996>
57+ $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-Wno-deprecated-declarations -fPIC>
5458)
5559
5660# Install libraries
Original file line number Diff line number Diff line change @@ -70,7 +70,14 @@ if(EXECUTORCH_BUILD_PYBIND)
7070
7171 target_include_directories (_training_lib PRIVATE ${TORCH_INCLUDE_DIRS} )
7272 target_compile_options (
73- _training_lib PUBLIC -Wno-deprecated-declarations -fPIC -frtti -fexceptions
73+ _training_lib
74+ PUBLIC $<$<CXX_COMPILER_ID:MSVC >:/EHsc
75+ /GR
76+ /wd4996>
77+ $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-Wno-deprecated-declarations
78+ -fPIC
79+ -frtti
80+ -fexceptions>
7481 )
7582 target_link_libraries (_training_lib PRIVATE ${_pybind_training_dep_libs} )
7683
Original file line number Diff line number Diff line change @@ -27,7 +27,15 @@ if(NOT EXECUTORCH_ROOT)
2727endif ()
2828
2929include (${EXECUTORCH_ROOT} /tools/cmake/Utils.cmake)
30- set (_common_compile_options -Wno-deprecated-declarations -fPIC -Wall -Werror)
30+ set (_common_compile_options
31+ $<$<CXX_COMPILER_ID:MSVC >:/W4
32+ /WX
33+ /wd4996>
34+ $<$<NOT :$<CXX_COMPILER_ID:MSVC >>:-Wall
35+ -Werror
36+ -Wno-deprecated-declarations
37+ -fPIC>
38+ )
3139set (_common_include_directories ${EXECUTORCH_ROOT} /..)
3240
3341set (link_libraries )
You can’t perform that action at this time.
0 commit comments