Skip to content

Commit

Permalink
[SYCLomatic][CMake]Added rules to remove unsupported compiler flags (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
TejaX-Alaghari authored Oct 17, 2024
1 parent b370ea5 commit a467bac
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: rm -rf %T && mkdir -p %T
// RUN: cd %T
// RUN: cp %S/input.cmake ./input.cmake
// RUN: dpct -in-root ./ -out-root out ./input.cmake --migrate-build-script-only --cuda-include-path="%cuda-path/include" --rule-file=%T/../../../../../../../extensions/cmake_rules/cmake_script_migration_rule_optional.yaml
// RUN: echo "begin" > %T/diff.txt
// RUN: diff --strip-trailing-cr %S/expected.txt %T/out/input.cmake >> %T/diff.txt
// RUN: echo "end" >> %T/diff.txt

// CHECK: begin
// CHECK-NEXT: end
3 changes: 3 additions & 0 deletions clang/test/dpct/cmake_migration/case_066/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
string(APPEND CMAKE_C_FLAGS " ")
string(APPEND CMAKE_CXX_FLAGS " ")
string(APPEND CMAKE_CXX_FLAGS " ")
3 changes: 3 additions & 0 deletions clang/test/dpct/cmake_migration/case_066/input.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
string(APPEND CMAKE_C_FLAGS " -prec_div")
string(APPEND CMAKE_CXX_FLAGS " -parallel")
string(APPEND CMAKE_CXX_FLAGS " -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
1 change: 1 addition & 0 deletions clang/tools/dpct/DpctOptRules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set(dpct_opt_rule_files

set(dpct_cmake_rule_files
${CMAKE_SOURCE_DIR}/../clang/tools/dpct/DpctOptRules/cmake_script_migration_rule.yaml
${CMAKE_SOURCE_DIR}/../clang/tools/dpct/DpctOptRules/cmake_script_migration_rule_optional.yaml
)

install(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright (C) Intel Corporation
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# See https://llvm.org/LICENSE.txt for license information.

# This file will be installed to folder:
# {dpct_install_folder}/extensions/opt_rules.
# The rule specified in this file can be imported with commandline option:
# --rule-file={dpct_install_folder}/extensions/opt_rules/cmake_rules/cmake_script_migration_rule_optional.yaml

- Rule: rule_unsupported_flags_prec_div
Kind: CMakeRule
Priority: Fallback
CmakeSyntax: unsupported_flags_prec_div
In: ${func_name}(${args})
Out: ${func_name}(${args})
Subrules:
args:
MatchMode: Full
In: -prec_div
Out: ""
RuleId: "remove_prec_div"

- Rule: rule_unsupported_flags_parallel
Kind: CMakeRule
Priority: Fallback
CmakeSyntax: unsupported_flags_parallel
In: ${func_name}(${args})
Out: ${func_name}(${args})
Subrules:
args:
MatchMode: Full
In: -parallel
Out: ""
RuleId: "remove_parallel"

- Rule: rule_unsupported_flags_wd
Kind: CMakeRule
Priority: Fallback
CmakeSyntax: unsupported_flags_wd
In: ${func_name}(${args})
Out: ${func_name}(${args})
Subrules:
args:
MatchMode: Full
In: -wd${warnings}
Out: ""
RuleId: "remove_wd"

0 comments on commit a467bac

Please sign in to comment.