Skip to content

Commit 7521ef5

Browse files
committed
cmakelists update
1 parent 1a43a5b commit 7521ef5

File tree

7 files changed

+22
-12
lines changed

7 files changed

+22
-12
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ if(WIN32)
109109
add_compile_options(/guard:cf)
110110
add_link_options(/guard:cf)
111111
else()
112-
add_compile_options(-fcf-protection)
112+
if(LLVM_NATIVE_ARCH MATCHES "X86")
113+
add_compile_options(-fcf-protection)
114+
endif()
113115
endif()
114116
endif(WIN32)
115117

cmake/modules/HandleLLVMOptions.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
238238

239239
if (LLVM_BUILD_STATIC)
240240
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
241+
if(MINGW)
242+
# We want to mimic MSVC standalone build here
243+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static")
244+
endif()
241245
endif()
242246

243247
if( XCODE )
@@ -425,12 +429,18 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
425429
append("-Wno-unknown-pragmas" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
426430

427431
if (MINGW)
432+
append("-Wno-cast-function-type-mismatch" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
428433
append("-Wno-implicit-fallthrough" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
429434
append("-Wno-missing-exception-spec" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
430435
append("-Wno-reorder-ctor" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
431436
append("-Wno-sign-compare" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
432437
append("-Wno-unused-const-variable" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
433438
append("-Wno-unused-function" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
439+
append("-Wno-unused-private-field" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
440+
441+
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
442+
append("-Wno-gnu-zero-variadic-macro-arguments" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
443+
endif()
434444
endif()
435445

436446
add_flag_if_supported("-Wno-unused-but-set-variable" UNUSED_BUT_SET_VARIABLE)

projects/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
set(DXC_PROJECTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
22
set(DXC_PROJECTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
33

4-
if(WIN32)
4+
if(MSVC)
55
add_subdirectory(include/Tracing) # DxcRuntimeEtw target
66

77
if(HLSL_BUILD_DXILCONV)
88
add_subdirectory(dxilconv)
99
endif (HLSL_BUILD_DXILCONV)
1010

11-
endif (WIN32)
11+
endif (MSVC)

tools/clang/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,9 @@ install(DIRECTORY include/clang-c
431431
)
432432

433433
add_definitions( -D_GNU_SOURCE )
434+
if (MINGW)
435+
add_definitions( -DMS_SUPPORT_VARIABLE_LANGOPTS )
436+
endif()
434437

435438
option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)
436439
if (CLANG_ENABLE_ARCMT)

tools/clang/tools/dxclib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ endif (MSVC)
3737
target_compile_definitions(dxclib
3838
PRIVATE VERSION_STRING_SUFFIX=" for ${CMAKE_SYSTEM_NAME}")
3939

40-
add_dependencies(dxclib TablegenHLSLOptions dxcompiler)
40+
add_dependencies(dxclib TablegenHLSLOptions)

tools/clang/tools/dxcvalidator/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,5 @@ add_clang_library(dxcvalidator
1919
dxcvalidator.cpp
2020
)
2121

22-
if (MINGW)
23-
target_link_options(dxcvalidator PUBLIC -mconsole -municode)
24-
target_link_libraries(dxcvalidator PRIVATE version)
25-
endif()
26-
2722
target_compile_definitions(dxcvalidator
2823
PRIVATE VERSION_STRING_SUFFIX=" for ${CMAKE_SYSTEM_NAME}")

tools/clang/tools/dxildll/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ set(sources
4141
dxcvalidator.cpp
4242
)
4343

44-
if (WIN32)
44+
if (MSVC)
4545
add_clang_library(dxildll SHARED ${sources})
4646
list(APPEND DXCLibs
4747
kernel32.lib
@@ -58,7 +58,7 @@ target_link_libraries(dxildll PRIVATE
5858
dxcvalidator
5959
)
6060

61-
if (WIN32)
61+
if (MSVC)
6262
add_dependencies(dxildll
6363
${DXCDependencies}
6464
DxcEtw
@@ -77,7 +77,7 @@ if (WIN32)
7777
set_target_properties(${target_name} PROPERTIES SOURCES "${sources}")
7878

7979
set_property(SOURCE dxildll.rc PROPERTY COMPILE_DEFINITIONS "INCLUDE_HLSL_VERSION_FILE=1")
80-
set_property(SOURCE dxildll.rc PROPERTY COMPILE_OPTIONS "/I" "${HLSL_VERSION_LOCATION}" "/I" "${LLVM_MAIN_SRC_DIR}")
80+
set_property(SOURCE dxildll.rc PROPERTY COMPILE_OPTIONS "-I" "${HLSL_VERSION_LOCATION}" "-I" "${LLVM_MAIN_SRC_DIR}")
8181
endif()
8282

8383
set_target_properties(dxildll

0 commit comments

Comments
 (0)