Separate the eglib source and build instructions
authorJosh Peterson <petersonjm1@gmail.com>
Tue, 18 Apr 2017 18:17:10 +0000 (14:17 -0400)
committerJosh Peterson <petersonjm1@gmail.com>
Mon, 24 Apr 2017 14:08:33 +0000 (10:08 -0400)
This change extracts the eglib source files from the build instuctions
for builds via MSVC on Windows. It also separates the source files into
platform-specific and common .targets files. This provides more
flexibility for builds from MSVC in a few important ways:

1. We can do MSVC-based builds for platforms that will not be pushed to
public repos by checking out the Mono code externally and importing the
.targets files into a custom .vcxproj for the platform.
2. We can replace the platform specific .targets files with a custom set
of source files to implement a different platform abstraction layer
that will not be public without the need to merge changes to the
.vcxproj from the public repo.

This allows for ease of synchronizing changes to the public Mono
repo with private forks, while _not_ changing the behavior of the code
in the public repo.

msvc/eglib-common.targets [new file with mode: 0644]
msvc/eglib-posix.targets [new file with mode: 0644]
msvc/eglib-win32.targets [new file with mode: 0644]
msvc/eglib.vcxproj
msvc/eglib.vcxproj.filters
msvc/mono.props

diff --git a/msvc/eglib-common.targets b/msvc/eglib-common.targets
new file mode 100644 (file)
index 0000000..0b72e5a
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\garray.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gbytearray.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gerror.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gfile.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\ghashtable.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\giconv.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\glist.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmarkup.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmem.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\goutput.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gpattern.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gptrarray.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gqsort.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gqueue.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gshell.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gslist.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gspawn.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gstr.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gstring.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gunicode.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gutf8.c" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="$(MonoSourceLocation)\eglib\src\glib.h" />
+    <ClInclude Include="$(MonoSourceLocation)\eglib\src\gmodule.h" />
+    <ClInclude Include="$(MonoSourceLocation)\eglib\src\sort.frag.h" />
+  </ItemGroup>
+</Project>
diff --git a/msvc/eglib-posix.targets b/msvc/eglib-posix.targets
new file mode 100644 (file)
index 0000000..ab3165e
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gfile-posix.c" />
+  </ItemGroup>
+</Project>
diff --git a/msvc/eglib-win32.targets b/msvc/eglib-win32.targets
new file mode 100644 (file)
index 0000000..b95abe3
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gdate-win32.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gdir-win32.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gfile-win32.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmisc-win32.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmodule-win32.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gpath.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gtimer-win32.c" />
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gunicode-win32.c" />
+   </ItemGroup>
+   <ItemGroup>
+    <ClInclude Include="$(MonoSourceLocation)\eglib\src\gmodule-win32-internals.h" />
+  </ItemGroup>
+</Project>
index 98a8849ab35efb07f61a8c00374ca6cdce77dbe9..5e482d86b453ce5568d8cb1a00e6d7f0aa334819 100644 (file)
       <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>\r
     </ClCompile>\r
   </ItemDefinitionGroup>\r
-  <ItemGroup>\r
-    <ClCompile Include="..\eglib\src\garray.c" />\r
-    <ClCompile Include="..\eglib\src\gbytearray.c" />\r
-    <ClCompile Include="..\eglib\src\gdate-win32.c" />\r
-    <ClCompile Include="..\eglib\src\gdir-win32.c" />\r
-    <ClCompile Include="..\eglib\src\gerror.c" />\r
-    <ClCompile Include="..\eglib\src\gfile-posix.c" />\r
-    <ClCompile Include="..\eglib\src\gfile-win32.c" />\r
-    <ClCompile Include="..\eglib\src\gfile.c" />\r
-    <ClCompile Include="..\eglib\src\ghashtable.c" />\r
-    <ClCompile Include="..\eglib\src\giconv.c" />\r
-    <ClCompile Include="..\eglib\src\glist.c" />\r
-    <ClCompile Include="..\eglib\src\gmarkup.c" />\r
-    <ClCompile Include="..\eglib\src\gmem.c" />\r
-    <ClCompile Include="..\eglib\src\gmisc-win32.c" />\r
-    <ClCompile Include="..\eglib\src\gmodule-win32.c" />\r
-    <ClCompile Include="..\eglib\src\goutput.c" />\r
-    <ClCompile Include="..\eglib\src\gpath.c" />\r
-    <ClCompile Include="..\eglib\src\gpattern.c" />\r
-    <ClCompile Include="..\eglib\src\gptrarray.c" />\r
-    <ClCompile Include="..\eglib\src\gqsort.c" />\r
-    <ClCompile Include="..\eglib\src\gqueue.c" />\r
-    <ClCompile Include="..\eglib\src\gshell.c" />\r
-    <ClCompile Include="..\eglib\src\gslist.c" />\r
-    <ClCompile Include="..\eglib\src\gspawn.c" />\r
-    <ClCompile Include="..\eglib\src\gstr.c" />\r
-    <ClCompile Include="..\eglib\src\gstring.c" />\r
-    <ClCompile Include="..\eglib\src\gtimer-win32.c" />\r
-    <ClCompile Include="..\eglib\src\gunicode-win32.c" />\r
-    <ClCompile Include="..\eglib\src\gunicode.c" />\r
-    <ClCompile Include="..\eglib\src\gutf8.c" />\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <ClInclude Include="..\eglib\src\glib.h" />\r
-    <ClInclude Include="..\eglib\src\gmodule-win32-internals.h" />\r
-    <ClInclude Include="..\eglib\src\gmodule.h" />\r
-    <ClInclude Include="..\eglib\src\sort.frag.h" />\r
-  </ItemGroup>\r
+  <Import Project="eglib-common.targets" />\r
+  <Import Project="eglib-win32.targets" />\r
+  <Import Project="eglib-posix.targets" />\r
   <ItemGroup>\r
     <ProjectReference Include="build-init.vcxproj">\r
       <Project>{92ae7622-5f58-4234-9a26-9ec71876b3f4}</Project>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
   </ImportGroup>\r
-</Project>
\ No newline at end of file
+</Project>\r
index f49e42ae1598c84abe46799a2e66114c1017bfa9..e2ed0ac9a4081e72a815144e42bedb445e21a9d2 100644 (file)
 <?xml version="1.0" encoding="utf-8"?>\r
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <ItemGroup>\r
-    <ClCompile Include="..\eglib\src\garray.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\garray.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gbytearray.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gbytearray.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gdate-win32.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gdate-win32.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gdir-win32.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gdir-win32.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gerror.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gerror.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gfile.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gfile.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gfile-posix.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gfile-posix.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gfile-win32.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gfile-win32.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\ghashtable.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\ghashtable.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\giconv.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\giconv.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\glist.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\glist.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gmarkup.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmarkup.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gmem.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmem.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gmisc-win32.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmisc-win32.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gqueue.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmodule-win32.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gmodule-win32.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\goutput.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\goutput.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gpath.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gpath.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gpattern.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gpattern.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gptrarray.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gptrarray.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gqsort.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gqsort.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gqueue.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gshell.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gshell.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gslist.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gslist.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gspawn.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gspawn.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gstr.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gstr.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gstring.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gstring.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gtimer-win32.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gtimer-win32.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gunicode.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gunicode.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gutf8.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gunicode-win32.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\gunicode-win32.c">\r
+    <ClCompile Include="$(MonoSourceLocation)\eglib\src\gutf8.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
-    <ClInclude Include="..\eglib\src\glib.h">\r
+    <ClInclude Include="$(MonoSourceLocation)\eglib\src\glib.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\eglib\src\gmodule.h">\r
+    <ClInclude Include="$(MonoSourceLocation)\eglib\src\gmodule.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\eglib\src\sort.frag.h">\r
+    <ClInclude Include="$(MonoSourceLocation)\eglib\src\gmodule-win32-internals.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\eglib\src\gmodule-win32-internals.h">\r
+    <ClInclude Include="$(MonoSourceLocation)\eglib\src\sort.frag.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
   </ItemGroup>\r
       <Filter>Resource Files</Filter>\r
     </None>\r
   </ItemGroup>\r
-</Project>
\ No newline at end of file
+</Project>\r
index abc81a55abd8fb65449c0a008f6696c2feeab76e..4ef38268b18d2fc5bf3e3750c79722c0fcbcaf17 100644 (file)
@@ -17,7 +17,8 @@
     <MONO_USE_STATIC_LIBMONO>false</MONO_USE_STATIC_LIBMONO>
   </PropertyGroup>
   <PropertyGroup Label="MonoDirectories">
-    <top_srcdir>$(MSBuildProjectDirectory)/..</top_srcdir>
+    <MonoSourceLocation Condition="'$(MonoSourceLocation)' == '' ">..</MonoSourceLocation>
+    <top_srcdir>$(MSBuildProjectDirectory)/$(MonoSourceLocation)</top_srcdir>
     <MONO_DIR>$(top_srcdir)</MONO_DIR>
     <MONO_INCLUDE_DIR>$(MONO_DIR)/mono</MONO_INCLUDE_DIR>
     <MONO_EGLIB_INCLUDE_DIR>$(MONO_DIR)/eglib;$(MONO_DIR)/eglib/include;$(MONO_DIR)/eglib/test</MONO_EGLIB_INCLUDE_DIR>
       <AdditionalLibraryDirectories>$(MONO_BUILD_DIR_PREFIX)$(Platform)/lib/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
   </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+</Project>