Skip to content

Commit

Permalink
Move intermediate file into intermediate dir (dotnet#5981)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
myungjoo authored and janvorli committed Jun 28, 2016
1 parent 4f134e6 commit 5acbced
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions definitionsconsistencycheck.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
get_directory_property( DirDefs COMPILE_DEFINITIONS )

# Reset the definition file
file(WRITE cmake.definitions "")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cmake.definitions "")
foreach( d ${DirDefs} )
if($ENV{VERBOSE})
message( STATUS "Compiler Definition: " ${d} )
endif($ENV{VERBOSE})
file(APPEND cmake.definitions ${d})
file(APPEND cmake.definitions "\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/cmake.definitions ${d})
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/cmake.definitions "\n")
endforeach()
3 changes: 2 additions & 1 deletion src/mscorlib/System.Private.CoreLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@
<Message Importance="High" Text="============" />
<PropertyGroup>
<IgnoreDefineConstants>FEATURE_IMPLICIT_TLS;FEATURE_HIJACK</IgnoreDefineConstants>
<CMakeDefinitionSaveFile>$(IntermediateOutputPath)\cmake.definitions</CMakeDefinitionSaveFile>
</PropertyGroup>
<Exec Command='python $(MSBuildThisFileDirectory)../scripts/check-definitions.py $(MSBuildThisFileDirectory)../../cmake.definitions "$(DefineConstants)" "$(IgnoreDefineConstants)" ' />
<Exec Command='python $(MSBuildThisFileDirectory)..\scripts\check-definitions.py "$(CMakeDefinitionSaveFile)" "$(DefineConstants)" "$(IgnoreDefineConstants)" ' />
<Message Importance="High" Text="============" />
</Target>

Expand Down
7 changes: 6 additions & 1 deletion src/scripts/check-definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@
# For the native part, return the sorted definition array.
def loadDefinitionFile(filename):
result = []
f = open(filename, 'r')
try:
f = open(filename, 'r')
except:
sys.exit(0)
# if cmake was not used (because of skipnative or systems that do not use cmake), this script won't work.

for line in f:
theLine = line.rstrip("\r\n").strip()
if (len(theLine) > 0):
Expand Down

0 comments on commit 5acbced

Please sign in to comment.