Skip to content

Commit a612088

Browse files
authored
Update cmake files with Windows related changes (#5369)
The changes mainly affect compilation options. Signed-off-by: Anatoly Myachev <[email protected]>
1 parent 5b66aa6 commit a612088

File tree

4 files changed

+38
-33
lines changed

4 files changed

+38
-33
lines changed

CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,11 @@ if(NOT MSVC)
5858
set(CMAKE_C_FLAGS_TRITONBUILDWITHO1 "-O1")
5959
set(CMAKE_CXX_FLAGS_TRITONBUILDWITHO1 "-O1")
6060
else()
61-
set(CMAKE_C_FLAGS_TRITONRELBUILDWITHASSERTS "/Zi /RTC1 /bigobj /Zc:preprocessor")
62-
set(CMAKE_CXX_FLAGS_TRITONRELBUILDWITHASSERTS "/Zi /RTC1 /bigobj /Zc:preprocessor")
61+
set(CMAKE_C_FLAGS_TRITONRELBUILDWITHASSERTS "/Zi /RTC1 /bigobj /Zc:preprocessor /permissive-")
62+
set(CMAKE_CXX_FLAGS_TRITONRELBUILDWITHASSERTS "/Zi /RTC1 /bigobj /Zc:preprocessor /permissive-")
6363
set(CMAKE_EXE_LINKER_FLAGS_TRITONRELBUILDWITHASSERTS "/debug:fastlink /INCREMENTAL")
6464
set(CMAKE_MODULE_LINKER_FLAGS_TRITONRELBUILDWITHASSERTS "/debug:fastlink /INCREMENTAL")
6565
set(CMAKE_SHARED_LINKER_FLAGS_TRITONRELBUILDWITHASSERTS "/debug:fastlink /INCREMENTAL")
66-
set(CMAKE_STATIC_LINKER_FLAGS_TRITONRELBUILDWITHASSERTS "/debug:fastlink /INCREMENTAL")
6766
endif()
6867

6968
# Default build type
@@ -146,7 +145,7 @@ endfunction()
146145
if(NOT MSVC)
147146
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-covered-switch-default -fvisibility=hidden")
148147
else()
149-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX- /wd4244 /wd4624 /wd4715 /wd4530")
148+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4624 /wd4715 /wd4530")
150149
endif()
151150

152151
include_directories(".")

cmake/AddTritonUnitTest.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ function(add_triton_ut)
2828
gmock
2929
${__LIBS})
3030

31-
target_compile_options(${__NAME} PRIVATE -fno-rtti)
31+
if(NOT MSVC)
32+
target_compile_options(${__NAME} PRIVATE -fno-rtti)
33+
endif()
3234

3335
target_compile_definitions(${__NAME} PRIVATE ${__DEFS})
3436

lib/Instrumentation/CMakeLists.txt

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,21 @@ foreach( plugin ${GPU_INSTRUMENTATION_PASSES} )
2222
LLVMTransformUtils
2323
"$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>"
2424
)
25-
# CMAKE_LIBRARY_OUTPUT_DIRECTORY is only set during the Python
26-
# build. It is empty if building directly from the root
27-
# CMakeLists.txt file. Therefore if not building from Python just
28-
# use the default CMake shared lib path otherwise this causes a hard
29-
# build error
30-
if(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
31-
set_target_properties(${plugin} PROPERTIES
32-
LIBRARY_OUTPUT_DIRECTORY
33-
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../instrumentation")
34-
endif(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
25+
# CMAKE_LIBRARY_OUTPUT_DIRECTORY is only set during the Python
26+
# build. It is empty if building directly from the root
27+
# CMakeLists.txt file. Therefore if not building from Python just
28+
# use the default CMake shared lib path otherwise this causes a hard
29+
# build error
30+
if(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
31+
set_target_properties(${plugin} PROPERTIES
32+
LIBRARY_OUTPUT_DIRECTORY
33+
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../instrumentation")
34+
endif(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
3535

36-
# This is set to -fvisibility=hidden in the top level CMake file
37-
# which causes the llvmGetPassPluginInfo symbol to be hidden and
38-
# an "entry point not found" error. Reset it just for this target
39-
target_compile_options(${plugin} PRIVATE -fvisibility=default -fno-rtti)
36+
# This is set to -fvisibility=hidden in the top level CMake file
37+
# which causes the llvmGetPassPluginInfo symbol to be hidden and
38+
# an "entry point not found" error. Reset it just for this target
39+
if(NOT MSVC)
40+
target_compile_options(${plugin} PRIVATE -fvisibility=default -fno-rtti)
41+
endif()
4042
endforeach()

test/lib/Instrumentation/CMakeLists.txt

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,21 @@ foreach( plugin ${GPU_INSTRUMENTATION_PASSES} )
2020
LLVMCore
2121
"$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>"
2222
)
23-
# CMAKE_LIBRARY_OUTPUT_DIRECTORY is only set during the Python
24-
# build. It is empty if building directly from the root
25-
# CMakeLists.txt file. Therefore if not building from Python just
26-
# use the default CMake shared lib path otherwise this causes a hard
27-
# build error
28-
if(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
29-
set_target_properties(${plugin} PROPERTIES
30-
LIBRARY_OUTPUT_DIRECTORY
31-
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../instrumentation")
32-
endif(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
23+
# CMAKE_LIBRARY_OUTPUT_DIRECTORY is only set during the Python
24+
# build. It is empty if building directly from the root
25+
# CMakeLists.txt file. Therefore if not building from Python just
26+
# use the default CMake shared lib path otherwise this causes a hard
27+
# build error
28+
if(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
29+
set_target_properties(${plugin} PROPERTIES
30+
LIBRARY_OUTPUT_DIRECTORY
31+
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../instrumentation")
32+
endif(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
3333

34-
# This is set to -fvisibility=hidden in the top level CMake file
35-
# which causes the llvmGetPassPluginInfo symbol to be hidden and
36-
# an "entry point not found" error. Reset it just for this target
37-
target_compile_options(${plugin} PRIVATE -fvisibility=default)
34+
# This is set to -fvisibility=hidden in the top level CMake file
35+
# which causes the llvmGetPassPluginInfo symbol to be hidden and
36+
# an "entry point not found" error. Reset it just for this target
37+
if(NOT MSVC)
38+
target_compile_options(${plugin} PRIVATE -fvisibility=default)
39+
endif()
3840
endforeach()

0 commit comments

Comments
 (0)