Skip to content

Commit 5acbced

Browse files
myungjoojanvorli
authored andcommitted
Move intermediate file into intermediate dir (dotnet#5981)
The intermediate file, cmake.definitions, is moved into the intermediate directory: bin/obj/OS.Arch.Conf/ The script won't emit error for not having the cmake results because some systems (Windows) do not use Cmake and users might use "skipnative". Fixes #5976 Signed-off-by: MyungJoo Ham <[email protected]>
1 parent 4f134e6 commit 5acbced

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

definitionsconsistencycheck.cmake

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
get_directory_property( DirDefs COMPILE_DEFINITIONS )
22

33
# Reset the definition file
4-
file(WRITE cmake.definitions "")
4+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cmake.definitions "")
55
foreach( d ${DirDefs} )
66
if($ENV{VERBOSE})
77
message( STATUS "Compiler Definition: " ${d} )
88
endif($ENV{VERBOSE})
9-
file(APPEND cmake.definitions ${d})
10-
file(APPEND cmake.definitions "\n")
9+
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/cmake.definitions ${d})
10+
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/cmake.definitions "\n")
1111
endforeach()

src/mscorlib/System.Private.CoreLib.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,9 @@
183183
<Message Importance="High" Text="============" />
184184
<PropertyGroup>
185185
<IgnoreDefineConstants>FEATURE_IMPLICIT_TLS;FEATURE_HIJACK</IgnoreDefineConstants>
186+
<CMakeDefinitionSaveFile>$(IntermediateOutputPath)\cmake.definitions</CMakeDefinitionSaveFile>
186187
</PropertyGroup>
187-
<Exec Command='python $(MSBuildThisFileDirectory)../scripts/check-definitions.py $(MSBuildThisFileDirectory)../../cmake.definitions "$(DefineConstants)" "$(IgnoreDefineConstants)" ' />
188+
<Exec Command='python $(MSBuildThisFileDirectory)..\scripts\check-definitions.py "$(CMakeDefinitionSaveFile)" "$(DefineConstants)" "$(IgnoreDefineConstants)" ' />
188189
<Message Importance="High" Text="============" />
189190
</Target>
190191

src/scripts/check-definitions.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@
3333
# For the native part, return the sorted definition array.
3434
def loadDefinitionFile(filename):
3535
result = []
36-
f = open(filename, 'r')
36+
try:
37+
f = open(filename, 'r')
38+
except:
39+
sys.exit(0)
40+
# if cmake was not used (because of skipnative or systems that do not use cmake), this script won't work.
41+
3742
for line in f:
3843
theLine = line.rstrip("\r\n").strip()
3944
if (len(theLine) > 0):

0 commit comments

Comments
 (0)