[libsoup] build: Add common autotools modules for MSVC project files
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] build: Add common autotools modules for MSVC project files
- Date: Mon, 22 Feb 2016 08:08:54 +0000 (UTC)
commit cd44172c8e00e7056abe87abc9f0fc0e080a6549
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Thu Nov 26 20:55:18 2015 +0800
build: Add common autotools modules for MSVC project files
This adds common autotools modules that are used to:
-Generate the full MSVC projects, as well as the listing of headers to
"install", for libsoup and libsoup-gnome, from their respective templates.
-Copy and update the Visual Studio 2010 projects to become Visual Studio
2012, 2013, 2015 versions.
https://bugzilla.gnome.org/show_bug.cgi?id=758759
build/Makefile-newvs.am | 45 ++++++++++++++++++++
build/Makefile.msvcproj | 107 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 152 insertions(+), 0 deletions(-)
---
diff --git a/build/Makefile-newvs.am b/build/Makefile-newvs.am
new file mode 100644
index 0000000..97b2459
--- /dev/null
+++ b/build/Makefile-newvs.am
@@ -0,0 +1,45 @@
+# Centralized autotools file
+# Create the Visual Studio 2012/2013/2015 project files
+# from the Visual Studio 2010 project files
+
+# This autotools file, from GLib, can be used in other projects
+# that have Visual Studio build support, and is copied into
+# $(srcroot)/build/.
+
+# Author: Fan, Chun-wei
+# November 05, 2012
+
+# MSVC_VER_LONG: Long Version of Visual Studio (2012, 2013, 14 and so on)
+# MSVC_VER: Short Version of Visual Studio (11 for 2012, 12 for 2013, 14 for 2015 and so on)
+# MSVC_FORMAT_VER: Use 12 for MSVC 2012 through 2015
+
+%.sln:
+ sed 's/11\.00/$(MSVC_FORMAT_VER)\.00/g' < $(top_srcdir)/build/win32/vs10/$@ >
$(top_builddir)/build/win32/vs$(MSVC_VER)/$ tmp
+ sed 's/2010/$(MSVC_VER_LONG)/g' < $(top_builddir)/build/win32/vs$(MSVC_VER)/$ tmp >
$(top_builddir)/build/win32/vs$(MSVC_VER)/$@
+ rm $(top_builddir)/build/win32/vs$(MSVC_VER)/$ tmp
+
+%.txt:
+ sed 's/vs10/vs$(MSVC_VER)/g' < $(top_srcdir)/build/win32/vs10/$@ >
$(top_builddir)/build/win32/vs$(MSVC_VER)/$ tmp
+ sed 's/VS10/VS$(MSVC_VER)/g' < $(top_builddir)/build/win32/vs$(MSVC_VER)/$ tmp >
$(top_builddir)/build/win32/vs$(MSVC_VER)/$@
+ rm $(top_builddir)/build/win32/vs$(MSVC_VER)/$ tmp
+
+%.vcxproj:
+ if test -e $(top_srcdir)/build/win32/vs10/$@; then \
+ sed 's/v100/v$(MSVC_VER)0/g' < $(top_srcdir)/build/win32/vs10/$@ >
$(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \
+ else \
+ sed 's/v100/v$(MSVC_VER)0/g' < $(top_builddir)/build/win32/vs10/$@ >
$(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \
+ fi
+
+%.props:
+ if test -e $(top_srcdir)/build/win32/vs10/$@; then \
+ sed 's/<VSVer>10<\/VSVer>/<VSVer>$(MSVC_VER)<\/VSVer>/g' < $(top_srcdir)/build/win32/vs10/$@
$(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \
+ else \
+ sed 's/<VSVer>10<\/VSVer>/<VSVer>$(MSVC_VER)<\/VSVer>/g' <
$(top_builddir)/build/win32/vs10/$@ > $(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \
+ fi
+
+%.vcxproj.filters:
+ if test -e $(top_srcdir)/build/win32/vs10/$@; then \
+ cp $(top_srcdir)/build/win32/vs10/$@ $(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \
+ else \
+ cp $(top_builddir)/build/win32/vs10/$@ $(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \
+ fi
diff --git a/build/Makefile.msvcproj b/build/Makefile.msvcproj
new file mode 100644
index 0000000..9449a5b
--- /dev/null
+++ b/build/Makefile.msvcproj
@@ -0,0 +1,107 @@
+# Author: Fan, Chun-wei
+# Common Autotools file used to generate Visual Studio 2008+
+# Projects from their templates
+
+# This autotools file, from GLib, can be used in other projects
+# that have Visual Studio build support, and is copied into
+# $(srcroot)/build/.
+
+# * Input variables:
+#
+# MSVCPROJS - List of Projects that should be generated
+#
+# * Simple tutorial
+#
+# Add this to Makefile.am where your library/program is built:
+# include $(top_srcdir)/build/Makefile.msvcproj
+# MSVCPROJS = YourProject (can be multiple projects in a single srcdir)
+# YourProject_FILES = $(libyourlib_1_0_SOURCES)
+# YourProject_EXCLUDES = ... # list of sources to exclude, separated by '|', wildcards allowed; use random
unsed value if none
+# YourProject_HEADERS_DIR = $(libyourlibincludedir)
+# YourProject_HEADERS_INST = $(libyourlib_1_0_HEADERS)
+# YourProject_HEADERS_EXCLUDES = ... # <list of headers to exclude from installation, separated by '|',
wildcards allowed; use random unsed value if none>
+#
+# dist-hook: \ # (or add to it if it is already there, note the vs9 items will also call the vs10 items in
the process)
+# $(top_builddir)/build/win32/vs9/YourProject.vcproj \
+# $(top_builddir)/build/win32/vs9/YourProject.headers
+
+
+# Private functions
+
+## Transform the MSVC project filename (no filename extensions) to something which can reference through a
variable
+## without automake/make complaining, eg Gtk-2.0 -> Gtk_2_0
+_proj_name=$(subst /,_,$(subst -,_,$(subst .,_,$(1))))
+_proj_path_raw:=$(subst $(abs_top_srcdir),,$(abs_srcdir))
+_proj_path=$(subst /,\\,$(_proj_path_raw))
+_proj_subdir_int=$(subst \\\\,\\,\\$(_proj_path)\\)
+_proj_subdir=$(subst \\.\\,\\,$(_proj_subdir_int))
+
+_proj_files_raw=$(subst /,\\,$($(_proj_name)_FILES))
+_proj_files=$(subst $(srcdir)\\,,$(subst $(builddir)\\,,$(subst
$(top_builddir)\\$(_proj_path)\\,\\,$(_proj_files_raw))))
+_proj_filters=$($(_proj_name)_EXCLUDES)
+
+_proj_headers_raw=$(subst /,\\,$($(_proj_name)_HEADERS_INST))
+_proj_headers=$(subst $(srcdir)\\,,$(subst $(builddir)\\,,$(subst
$(top_builddir)\\$(_proj_path)\\,\\,$(_proj_headers_raw))))
+_proj_headers_excludes=$($(_proj_name)_HEADERS_EXCLUDES)
+
+_headers_dest_posix=$(subst $(includedir),,$($(_proj_name)_HEADERS_DIR))
+_headers_destdir=$(subst /,\\,$(_headers_dest_posix))
+
+#
+# Creates Visual Studio 2008/2010 projects from items passed in from autotools files
+# $(1) - Base Name of the MSVC project files (outputs)
+#
+
+define msvcproj-builder
+
+$(top_builddir)/build/win32/vs10/$(1).vcxproj: $(top_builddir)/build/win32/vs9/$(1).vcproj
+$(top_builddir)/build/win32/vs10/$(1).vcxproj.filters: $(top_builddir)/build/win32/vs9/$(1).vcproj
+$(1).sourcefiles: $(top_builddir)/build/win32/vs9/$(1).vcproj
+$(1).vs10.sourcefiles: $(top_builddir)/build/win32/vs9/$(1).vcproj
+$(1).vs10.sourcefiles.filters: $(top_builddir)/build/win32/vs9/$(1).vcproj
+
+$(top_builddir)/build/win32/vs9/$(1).vcproj:
+ -$(RM) $(top_builddir)/build/win32/vs9/$(1).vcproj
+ -$(RM) $(top_builddir)/build/win32/vs10/$(1).vcxproj
+ -$(RM) $(top_builddir)/build/win32/vs10/$(1).vcxproj.filters
+
+ for F in $(_proj_files); do \
+ case $$$$F in \
+ $(_proj_filters)) \
+ ;; \
+ *.c|*.cpp|*.cc|*.cxx) \
+ echo ' <File RelativePath="..\..\..'$(_proj_subdir)$$$$F'" />' >>$(1).sourcefiles
&& \
+ echo ' <ClCompile Include="..\..\..'$(_proj_subdir)$$$$F'" />'
$(1).vs10.sourcefiles && \
+ echo ' <ClCompile Include="..\..\..'$(_proj_subdir)$$$$F'"><Filter>Source
Files</Filter></ClCompile>' >>$(1).vs10.sourcefiles.filters \
+ ;; \
+ esac; \
+ done
+
+
+ $(CPP) -P - <$(top_srcdir)/build/win32/vs9/$(1).vcprojin >$(top_builddir)/build/win32/vs9/$(1).vcproj
+ $(CPP) -P - <$(top_srcdir)/build/win32/vs10/$(1).vcxprojin
$(top_builddir)/build/win32/vs10/$(1).vcxproj
+ $(CPP) -P - <$(top_srcdir)/build/win32/vs10/$(1).vcxproj.filtersin
$(top_builddir)/build/win32/vs10/$(1).vcxproj.filters
+ $(RM) $(1).sourcefiles
+ $(RM) $(1).vs10.sourcefiles
+ $(RM) $(1).vs10.sourcefiles.filters
+
+$(top_builddir)/build/win32/vs10/$(1).vs10.headers: $(top_builddir)/build/win32/vs9/$(1).headers
+
+$(top_builddir)/build/win32/vs9/$(1).headers:
+ -$(RM) $(top_builddir)/build/win32/vs9/$(1).headers
+ -$(RM) $(top_builddir)/build/win32/vs10/$(1).vs10.headers
+
+ for F in $(_proj_headers); do \
+ case $$$$F in \
+ $(_proj_headers_excludes)) \
+ ;; \
+ *.h|*.hpp|*.hh|*.hxx) \
+ echo 'copy ..\..\..'$(_proj_subdir)$$$$F'
$$$$(CopyDir)\include'$(_headers_destdir)'\'$$$$F'
'
$(top_builddir)/build/win32/vs9/$(1).headers && \
+ echo 'copy ..\..\..'$(_proj_subdir)$$$$F'
$$$$(CopyDir)\include'$(_headers_destdir)'\'$$$$F >>$(top_builddir)/build/win32/vs10/$(1).vs10.headers \
+ ;; \
+ esac; \
+ done
+
+endef
+
+$(foreach proj,$(MSVCPROJS),$(eval $(call msvcproj-builder,$(proj))))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]