Commit Graph

209 Commits

Author SHA1 Message Date
Ernestas Kulik
03e86d000f Remove HAVE_CONFIG_H defs and uses
Since GLib files are only meant to be built as part of GLib, config.h
always exists, so the checks are more or less pointless.

https://bugzilla.gnome.org/show_bug.cgi?id=793399
2018-02-21 13:57:10 +00:00
Philip Withnall
a131134918 build: Drop nmake/MSC build system for GLib
It hasn’t been seriously maintained for the best part of 10 years and is
very outdated. The recommended way to build GLib on Windows is now
Visual Studio:

https://wiki.gnome.org/Projects/GTK%2B/Win32/MSVCCompilationOfGTKStack#GLib

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=722047
2017-07-10 11:22:40 +01:00
Chun-wei Fan
6dfc6fee7b Visual Studio builds: Move project files to win32/
It was suggested that the project files be moved here as we don't actually
need to go two directory layers from $(srcroot), and would help us to
standardize on things in the future across the board.
2017-01-09 14:00:46 +08:00
Chun-wei Fan
b14b09c8bc Makefile.msvcproj: Document further
Mention that the *.headers are needed only if headers need to be installed
with the project/module after the build.  Also, use a generic "YourProject"
rather than the "gdk-4" project file name--I missed changing the name in the
process.
2017-01-09 12:07:42 +08:00
Chun-wei Fan
7d26e9ef93 Makefile.msvcproj: Document things a bit better
If Visual Studio 2013 or later is required, let people know how this
autotools module should be used.
2017-01-09 12:03:06 +08:00
Chun-wei Fan
c5754bdc43 build/Makefile.msvcproj: Fix cleanup
When we make Visual Studio 2013 the baseline Visual Studio version, we need to
the *.vs12.sourcefiles that are generated along the way so that 'make distcheck'
won't complain about the leftover files.  This was not caught in GLib as we do
not yet require Visual Studio 2013, but we update this here as this module is
intended to be used in projects that support Visual Studio project builds.
2016-12-20 14:36:02 +08:00
Chun-wei Fan
673036d609 Visual Studio builds: Update gio-2.0.pc generation
We don't have libmount on Windows, so just make the entry for it blank.
2016-11-23 11:12:00 +08:00
Chun-wei Fan
acd07cfc55 build/Makefile-newvs.am: Do not hardcode the baseline MSVC version
This is to allow specification of the baseline Visual Studio 201x version as
the baseline version may not be 2010 anymore as we begin to require C99
features that will require Visual Studio 2013 or later.
2016-11-01 15:39:16 +08:00
Chun-wei Fan
1f33b36cd1 build/Makefile.msvcproj: Add rules for MSVC 2013 to be the baseline version
We are starting to require C99 features that can only be supported in
Visual Studio 2013 and later, so we need to prepare rules for Visual Studio
2013 to be our baseline version for Visual Studio builds, so that we can
move the templates from Visual Studio 2010 to Visual Studio 2013.

As this strives to be a shared autotools module between projects, there is
duplication at this point, though, because we still want to support
2008~2012 for projects that do not yet require the C99 features and depends
on GLib-2.50.x/GTK+-3.22.x or earlier.
2016-11-01 15:39:16 +08:00
Chun-wei Fan
c718bf881a build/win32/vs10/Makefile.am: Delete glib-install.props's on re-generation
This is to ensure the changes that is applied to glib-install.props here is
applied to the projects files in build/win32/vs[11|12|14] as well.
2016-10-19 15:31:24 +08:00
Chun-wei Fan
70040b4094 build/: Force MSVC project file generation on Makefile.am changes
Make the Makefile.am targets for generating the Visual Studio projects re-generate the
project files and the header listings whenever the Makefile.am's that include
build/Makefile.msvcproj changes, so that whenever a source/header is added, they will
be reflected in the projects and in the property sheets that are used to copy the
headers.

Also ensure that these are applied to the vs11, vs12 and vs14 projects when this
happens, as they are copied and processed from the Visual Studio 2010 projects.
2016-10-19 14:54:12 +08:00
Chun-wei Fan
fc0567780b MSVC Builds: Fix gio-tool projects
We need to look in $(srcroot)\gmodule for the up-to-date gmodule.h.

Pointed out by Ignacio Casal Quinteiro.
2016-09-20 15:08:42 +08:00
Chun-wei Fan
c6aee1bf15 Visual Studio builds: Build the gio tool
https://bugzilla.gnome.org/show_bug.cgi?id=768357
2016-07-18 10:39:20 +08:00
Chun-wei Fan
bbf07fb15e Visual Studio builds: Fix .pc generation
The previous update did not account for when no exec_prefix is spcified,
so update that, and use ${prefix} by default.  Clean up a bit as well.
2016-06-20 10:52:06 +08:00
Chun-wei Fan
39a22880b6 Visual Studio builds: Improve flexibility of .pc generation
Allow the use of shorthands using ${prefix} for exec_prefix, and
${exec_prefix} for includedir and libdir, which makes the generated .pc
files a bit cleaner and more flexible.
2016-06-15 17:30:24 +08:00
Chun-wei Fan
be16115e67 Visual Studio projects: Clean up a little bit
For the Visual Studio 201x projects, we can force the "install" projects
to always run in a simpler way, by specifying an output file that will
never exist.  Makes things look a bit cleaner.
2016-06-15 16:31:40 +08:00
Chun-wei Fan
33549086bc Visual Studio builds: Refine .pc creation
We may not have $(CopyDir) created, which the script that generates the
.pc files check for, so create it if it is not there.  This makes things a
bit more convenient for people.
2016-06-15 16:23:27 +08:00
Chun-wei Fan
bd0911afda build/win32/pc_base.py: Allow custom options
Some packages might have some parts that are built for certain build
configs, meaning that they could have .pc files of their own, such as
Pango, where PangoFT2 is optionally built.  Allow such an option if
needed.

Also remove some trailing whitespaces.
2016-04-21 19:12:25 +08:00
Chun-wei Fan
98ab9fa94f MSVC builds: Update string replacement util script
This makes the replace-single function make use of the replace-multi
function, that was just added, to ease future maintenance.
2016-03-11 16:54:39 +08:00
Chun-wei Fan
374a61f245 MSVC builds: Add scripts to generate .pc files
Add a generic script, pc_base.py, which can be utilized to obtain path
info, along with user-input version info, which can be used to generate
pkg-config .pc files.  Also enhance replace.py a bit so that it can also
be used in the future to replace multiple items in a file in one shot.
This is done to make building introspection files easier, as it depends
much on the pkg-config .pc files to work.

Update the project files so that when Python is available, we can generate
the full, usable .pc files when we complete and 'install' the builds, and
copy them to appropriate locations so that pkg-config can be set to find
them easily.
2016-03-10 20:33:35 +08:00
Chun-wei Fan
99b30f389e Visual Studio builds: Move @GLIB_VERSION@ usage
... from glib-gen-srcs.[vsprops|props].in to
glib-version-paths.[vsprops|props].in, and instead let autotools generate
glib-version-paths.[vsprops|props] rather than
glib-gen-srcs.[vsprops|props], as this will need to be referenced for
other items as well, namely generating the .pc files which will become
useful for introspection builds.
2016-02-25 18:37:01 +08:00
Chun-wei Fan
57f9c590f9 Visual Studio builds: Include pcre_version.c in build
... for builds using the PCRE bundled with the GLib sources, so that
pcre_version() will also be defined, and be exported so that the regex test program
will properly link when the bundled PCRE sources are used.

This is a follow-up commit to 476f30a.
2016-01-20 17:20:27 +08:00
Chun-wei Fan
e3ab6ab38a Visual Studio builds: Rearrange build configs
This is a follow-up commit for commit 82c2461, where the default build is
to use the PCRE that is installed in the system, if it is available and is
not overridden with --with-internal-pcre.

For Visual Studio builds, this means that the new 'Debug' and 'Release'
configs will now use PCRE that is found on the system, which were renamed
from the '*_ExtPCRE' configs; and that there are now 'Debug_BundledPCRE'
and 'Release_BundledPCRE' configs which make use of the PCRE that is
supplied with the GLib sources, which, replaces the former 'Debug' and
'Release' configs.
2016-01-18 16:04:45 +08:00
Chun-wei Fan
244f9e66f9 build/win32: Add NMake Makefile module for building tests and introspection
This adds a NMake Makefile module that can be used for building tests and
introspection using, NMake.  This is not yet distributed in the main GLib
tarballs, but this is placed here as the base location as this is
intended to be used in projects that support Visual Studio builds and
support the build of tests and/or introspection under Visual Studio using
NMake.
2015-12-02 21:23:10 +08:00
Chun-wei Fan
c50bb218de MSVC 2010+ builds: Do not explicitly use /LTCG
This partially reverts dc4361f.

As we now ensure that items using GResources and GConstructors are always
referenced so that the linker does not optimize them out in a default
Release build, we no longer need to enforce the use of /LTCG, so
/LTCG:incremental will work as well.
2015-11-12 15:26:20 +08:00
Dan Winship
263aac125e .gitignore updates 2015-10-23 11:28:03 -04:00
Chun-wei Fan
dc4361f4cb MSVC 2010+ builds: Explicitly use /LTCG
The Visual Studio projects used a default setting for link-time code
generation, which is a part of the various linker optimizations that is
available, which is set as /LTCG for Visual Studio 2013 and earlier.

This changed in Visual Studio 2015 to become /LTCG:incremental, which would
cause GResources-generated code to be optimized out during linking, unless
they were referred to directly in the main line code (such as when the
GResource is manually registered), causing programs to crash as a result as
they can't find the needed code/data at run time.

Fix this by explicitly setting /LTCG for all release builds, for Visual
Studio 2010 and later.

https://bugzilla.gnome.org/show_bug.cgi?id=752837
2015-10-13 19:30:22 +08:00
Chun-wei Fan
b7e2973048 gobject: Further optimize MSVC builds
Use /ltcg (link time code generation) for linking as well.

In fact, whole program optimization and /ltcg are the default for Release
builds, so we don't really have to set them explicitly in the projects, so
as a result, we can clean up the projects a little bit.

https://bugzilla.gnome.org/show_bug.cgi?id=752837
2015-10-12 16:56:46 +08:00
Chun-wei Fan
670400ee33 gobject: MSVC builds-improve optimization a bit
Use whole program optimization (/GL) as we now use DllMain() to
initialize the library on Windows builds.

https://bugzilla.gnome.org/show_bug.cgi?id=752837
2015-10-12 15:05:23 +08:00
Chun-wei Fan
a0b4e87f44 build/Makefile-newvs.am: Update Comments for Usage
Update the notes that this is also used for Visual Studio 2015 support,
and correct the MSVC_VER_LONG for MSVC 2015, which is 14, not 2015.

Also add a note that this can be used for other projects that have
Visual Studio build support.
2015-09-25 19:41:21 +08:00
Chun-wei Fan
762437c849 Build: Make Makefile.msvcproj A Bit More Generic
Handle also the situation where $(srcdir) == $(top_srcdir), so that this
can also be used in cases like librsvg and gobject-introspection.
2015-09-25 19:41:11 +08:00
Chun-wei Fan
ecd2652883 build/win32/replace.py: Add Note On Its Reusability
Add a note stating that this script can be copied for use to replace
strings in files when necessary, such as replacing autotools variables
in non-autotools builds, such as Visual Studio builds.
2015-09-25 17:47:33 +08:00
Chun-wei Fan
aef2d0c56d build/win32: Make "Install" Property Sheet Generation More Robust
List the files that are generated in the process to generate the
glib-install property sheets, so that we can use that list as a
depedency, as well as deleting those files in one shot after the
property sheet is generated, so we don't need to worry about those
in 'make distclean' or so.
2015-09-23 18:33:28 +08:00
Chun-wei Fan
ea93847a7d MSVC Build: Make Re-use Comment of Autotools Module Clearer 2015-09-17 09:15:27 +08:00
Chun-wei Fan
4025b5a54f MSVC Builds: "Add" MSVC 2015 Projects
This "adds" the Visual Studio 2015 Project files by doing what we did
before: copying the Visual Studio 2010 projects and replacing items
in them, as the formats of the Visual Studio 201x projects are largely
the same.
2015-09-09 15:21:26 +08:00
Chun-wei Fan
9c7df09c3b MSVC Builds: Simplify Script to Generate glib-mkenums
Use a simple all-purpose utility script to generate the glib-mkenums
PERL script with the version info, and stop using the script that
tries to parse the autotools files.  Move the things that
were taken out from build/win32/setup.py back there.
2015-09-09 15:21:12 +08:00
Chun-wei Fan
0be6766d9b MSVC Builds: Prepare For Visual Studio 2015
Update the autotools module so that we can use it to upgrade the
Visual Studio 2010 projects to become Visual Studio 2015-compatible.

Note that this will make the MSVC 2015 builds use the the the latest
VC140 CRT.
2015-09-08 15:51:58 +08:00
Chun-wei Fan
1387a16bf4 MSVC Builds: Remove Static Items
... which are now generated with the new autotools module, so we just
need to ensure the generated items are being dist'ed.

https://bugzilla.gnome.org/show_bug.cgi?id=735429
2015-09-03 19:10:26 +08:00
Chun-wei Fan
041e77249a Cleanup and Enhance the MSVC Project Generation
Make use of the common autotools module that is used to generate the MSVC
project files from their respective templates so that the main build files
beccome cleaner, and enhance them in a way that the headers that should be
installed can be written to the property sheets during 'make dist', so that
the chances of missing headers for MSVC builds can be greatly reduced.

Also use this autotools module to fill in the projects for
glib-compile-schemas and glib-compile-resources.

https://bugzilla.gnome.org/show_bug.cgi?id=735429
2015-09-03 19:10:06 +08:00
Chun-wei Fan
700983c8c9 build: Add Common Autotools Module for MSVC Projects
This adds a common autotools module that can be used by various
projects to generate the Visual Studio projects as needed, and
if necessary, generate the headers listings to "install" for that
project, based on items passed in to this.  This is modelled on the
Makefile.introspection autotools file that is used by many GNOME
projects to generate the introspection files.

https://bugzilla.gnome.org/show_bug.cgi?id=735429
2015-09-03 19:08:55 +08:00
Chun-wei Fan
cf940b66bc build/Makefile-newvs.am: Fix %.vcxproj Rule
The if-else statement added in commit 9bc3ae9 was missing a '\' after the
'else', causing 'make dist/distcheck' to break with "unexpected
end-of-file" errors.

Fix this-didn't notice this when reviewing that patch.  My fault. :|
2015-04-22 16:36:13 +08:00
Simon McVittie
9bc3ae9207 Makefile-newvs: some .vcxproj.filters files are in builddir, some in srcdir
Without this change, out-of-tree distcheck doesn't get very far.

Similarly, allow *.vcxproj, *.props to be in either the builddir or
the srcdir.

Finally, since I'm touching these lines anyway, eliminate some
useless uses of cat: "cat x | sed 's/foo/bar/' > y" is
equivalent to "sed 's/foo/bar/' < x > y".

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=748176
Reviewed-by: Chun-wei Fan <fanchunwei@src.gnome.org>
2015-04-20 15:55:29 +01:00
Chun-wei Fan
68bb63e3ee build/Makfile-newvs.am: Use Pattern Rules
Make use of pattern rules when generating the Visual Studio 2012/2013
Projects from the Visual Studio 2010 projects, which will help to clean up
the file and also avoid problems when running items like 'make -jN dist'.
2015-04-17 19:17:13 +08:00
Chun-wei Fan
74c9eaac11 MSVC Builds: Few More Enahncements
Update the .pdb file generation for the MSVC 2010+ DLLs (and the x64 gspawn
helper programs), so that they match the names of the DLLs/EXEs that are
built.  Also update the .lib generation so that all will use -$(ApiVersion)
from the property sheets instead of the -2.0 which was previously hard
coded (as we will eventually move into GLib 3.x in the future, for example)
2015-03-04 20:11:43 +08:00
Chun-wei Fan
6be1e678dc Visual Studio Builds: "Install" .pdb files
They are helpful in debugging in a stack.
2015-03-03 19:21:40 +08:00
Chun-wei Fan
6e117b3fcc MSVC Builds: GIO: Standardize zlib Linking
Link to zlib1.lib for all builds, as:
-The notion of zlib1d.lib is rather not standardized across the board for
 most cases.
-Easier for the grand all-in-one solution file.
2015-03-03 18:24:58 +08:00
Chun-wei Fan
d76ac1560e Visual Studio 2008 Builds: Speed Up Release Builds
Use the /MP option so that each project can build multiple sources in
parallel, which can cut down release build times by quite a bit.  This will
cause a brief warning for debug builds due to their use of /Gm, and builds
would otherwise proceed as they did before.

Unfortunately Visual Studio 2008 is too old to support the /d2Zi+ flag, so
we can't make a better debug situation for it at the moment.
2015-03-03 18:09:42 +08:00
Chun-wei Fan
7b1729f3c0 MSVC Builds: Improve Build Speed and Debugging
Use Multiprocessor compilation which can cut down build times by quite a
bit and use the /d2Zi+ flag to have better debugging info being logged to
the .pdb for release builds.

These are only applicable for Visual Studio 2010/2012 and later.
2015-03-03 13:52:22 +08:00
Chun-wei Fan
94b9d87a43 MSVC Builds: Fix and Update "Installation"
The gobjectnotifyqueue.c was accidently dropped from the files to copy, and
a new public header for GIO was added, so address these parts.
2015-03-03 12:06:22 +08:00
Chun-wei Fan
642f7a5c79 Visual Studio 2008 Builds: Fix Header "Installation"
Apparently I did not fix the "installation" of gliststore.h and
glistmodel.h fully for Visual Studio 2008 builds.  Fix that.  Doh!
2015-02-04 16:00:52 +08:00