]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Add vcpkg support for MSVC builds
authorWolfgang Stöggl <c72578@yahoo.de>
Mon, 17 Jun 2019 10:07:19 +0000 (12:07 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Mon, 17 Jun 2019 12:29:23 +0000 (14:29 +0200)
- This allows building against newer and up-to-date versions of
  required libraries. Vcpkg is a library manager and can be found here:
  https://github.com/microsoft/vcpkg
- Libraries are provided for 32-bit and 64-bit.
  Current versions of libraries are e.g.:
  cairo 1.16.0, expat 2.2.6, fontconfig 2.12.4, freetype 2.9.1,
  gettext 0.19, glib 2.52.3, libpng 1.6.37, pango 1.40.11, pcre 8.41,
  libxml2 2.9.9 and zlib 1.2.11
  Furthermore these libraries from vcpkg are regularly updated.
- Added information to WIN32-BUILD-TIPS.txt and win32/README concerning
  vcpkg
- Added win32/Makefile_vcpkg.msc for building using nmake

.gitignore
WIN32-BUILD-TIPS.txt
win32/Makefile_vcpkg.msc [new file with mode: 0644]
win32/README

index b818ce4cf5b6be83931d508bae9e4abe5090891c..f4c58d12eb843ffcd7d8d5acc1385009b5b8aa18 100644 (file)
@@ -68,6 +68,7 @@ Makefile
 /bindings/dotnet/*.suo
 /contrib
 /contrib-x64
+/vcpkg
 /win32/*.VC.db
 /win32/*.VC.opendb
 /win32/*.opensdf
index 0c2873e5d42e1e2747f415de7b87ae9c138ad649..acc769899292489fd287f9e1ba0c73e9aa174f49 100644 (file)
@@ -6,6 +6,28 @@ Compiling RRDtool on Win32 with Microsoft Visual C++:
 
 Here are step by step instructions for building librrd-4.dll and rrdtool.exe
 version 1.4.5 and newer with Microsoft Visual Studio 2013 (12.0.x) and newer.
+I you would like to build RRDtool using MinGW-w64, please have a look at
+win32/README-MinGW-w64
+
+# Installation of up-to-date, required third party headers and libraries
+
+An efficient way, to obtain headers and libraries required by RRDtool is using vcpkg from:
+https://github.com/microsoft/vcpkg
+
+(1) Follow the vcpkg installation instructions found in README.md and clone vcpkg e.g. to a folder named "vcpkg"
+    in the top directory of rrdtool.
+    cd vcpkg
+
+(2) Install the headers and libraries the following way for 32-bit or 64-bit:
+    .\vcpkg install cairo expat fontconfig freetype gettext glib libpng libxml2 pango pcre zlib --triplet x86-windows
+    .\vcpkg install cairo expat fontconfig freetype gettext glib libpng libxml2 pango pcre zlib --triplet x64-windows
+
+Information, how to compile using nmake, can be found here: win32/README
+
+# Legacy instructions
+
+Libraries mentioned in the section below are outdated and not updated any more.
+However, the described procedure still works.
 
 (1) Create a folder named "contrib" in the directory where this text file is located.
 
diff --git a/win32/Makefile_vcpkg.msc b/win32/Makefile_vcpkg.msc
new file mode 100644 (file)
index 0000000..85a39be
--- /dev/null
@@ -0,0 +1,142 @@
+# Makefile for rrdtool using Microsoft (Visual) C\r
+#\r
+# Usage:\r
+#   nmake -f win32/Makefile_vcpkg.msc                 (for 32 bit Windows target)\r
+#   nmake -f win32/Makefile_vcpkg.msc USE_64BIT=1     (for 64 bit Windows target)\r
+#   nmake -f win32/Makefile_vcpkg.msc clean           (to remove all generated files)\r
+\r
+# The toplevel directory of the source tree\r
+#\r
+TOP = .\r
+RRD_LIB_NAME=librrd-4\r
+ARCH_PATH_X86=vcpkg\installed\x86-windows\r
+ARCH_PATH_X64=vcpkg\installed\x64-windows\r
+\r
+\r
+!ifndef USE_64BIT\r
+LD_FLAGS=/RELEASE /MACHINE:X86\r
+ARCH_PATH=$(ARCH_PATH_X86)\r
+CPPFLAGS = /arch:SSE2\r
+!else\r
+LD_FLAGS=/RELEASE /MACHINE:X64\r
+ARCH_PATH=$(ARCH_PATH_X64)\r
+!endif\r
+\r
+CPPFLAGS = $(CPPFLAGS) /TC /EHsc /O2 /Zi /Fd$(TOP)/win32/vc.pdb \\r
+        /I $(TOP)/win32 /I $(TOP)/src \\r
+        /I $(ARCH_PATH)\include \\r
+        /I $(ARCH_PATH)\include\cairo \\r
+        /I $(ARCH_PATH)\include\pango-1.0 \\r
+        /I $(ARCH_PATH)\include\glib-2.0 \\r
+        /I $(ARCH_PATH)\lib\glib-2.0\include \\r
+        /I $(ARCH_PATH)\include\libxml2\r
+\r
+THIRD_PARTY_LIB = /LIBPATH:$(ARCH_PATH)\lib \\r
+        libpng16.lib libxml2.lib \\r
+        glib-2.0.lib gobject-2.0.lib \\r
+        pango-1.0.lib pangocairo-1.0.lib cairo.lib \\r
+        Ws2_32.lib zlib.lib\r
+\r
+RRD_LIB_OBJ_LIST = \\r
+        $(TOP)/src/hash_32.obj \\r
+        $(TOP)/src/mkstemp.obj \\r
+        $(TOP)/src/mutex.obj \\r
+        $(TOP)/src/optparse.obj \\r
+        $(TOP)/src/plbasename.obj \\r
+        $(TOP)/src/pngsize.obj \\r
+        $(TOP)/src/quicksort.obj \\r
+        $(TOP)/src/rrd_client.obj \\r
+        $(TOP)/src/rrd_create.obj \\r
+        $(TOP)/src/rrd_diff.obj \\r
+        $(TOP)/src/rrd_dump.obj \\r
+        $(TOP)/src/rrd_error.obj \\r
+        $(TOP)/src/rrd_fetch.obj \\r
+        $(TOP)/src/rrd_fetch_cb.obj \\r
+        $(TOP)/src/rrd_first.obj \\r
+        $(TOP)/src/rrd_flushcached.obj \\r
+        $(TOP)/src/rrd_format.obj \\r
+        $(TOP)/src/rrd_gfx.obj \\r
+        $(TOP)/src/rrd_graph.obj \\r
+        $(TOP)/src/rrd_graph_helper.obj \\r
+        $(TOP)/src/rrd_hw.obj \\r
+        $(TOP)/src/rrd_hw_math.obj \\r
+        $(TOP)/src/rrd_hw_update.obj \\r
+        $(TOP)/src/rrd_info.obj \\r
+        $(TOP)/src/rrd_last.obj \\r
+        $(TOP)/src/rrd_lastupdate.obj \\r
+        $(TOP)/src/rrd_list.obj \\r
+        $(TOP)/src/rrd_modify.obj \\r
+        $(TOP)/src/rrd_nan_inf.obj \\r
+        $(TOP)/src/rrd_open.obj \\r
+        $(TOP)/src/rrd_parsetime.obj \\r
+        $(TOP)/src/rrd_resize.obj \\r
+        $(TOP)/src/rrd_restore.obj \\r
+        $(TOP)/src/rrd_rpncalc.obj \\r
+        $(TOP)/src/rrd_snprintf.obj \\r
+        $(TOP)/src/rrd_strtod.obj \\r
+        $(TOP)/src/rrd_thread_safe_nt.obj \\r
+        $(TOP)/src/rrd_tune.obj \\r
+        $(TOP)/src/rrd_update.obj \\r
+        $(TOP)/src/rrd_utils.obj \\r
+        $(TOP)/src/rrd_version.obj \\r
+        $(TOP)/src/rrd_xport.obj \\r
+        $(TOP)/win32/asprintf.obj \\r
+        $(TOP)/win32/vasprintf-msvc.obj \\r
+        $(TOP)/win32/win32-glob.obj\r
+# win32comp.obj is not added to RRD_LIB_OBJ_LIST, because definitions are already in rrd_thread_safe_nt.obj\r
+\r
+all: $(TOP)/win32/$(RRD_LIB_NAME).dll $(TOP)/win32/rrdtool.exe \\r
+        $(TOP)/win32/rrdupdate.exe $(TOP)/win32/rrdcgi.exe\r
+\r
+clean:\r
+    -@del /F /Q $(TOP)\src\*.obj 2>NUL\r
+    -@del /F /Q $(TOP)\win32\*.obj 2>NUL\r
+    -@del /F /Q $(TOP)\win32\*.res 2>NUL\r
+    -@del /F /Q $(TOP)\win32\*.exe 2>NUL\r
+    -@del /F /Q $(TOP)\win32\*.pdb 2>NUL\r
+    -@del /F /Q $(TOP)\win32\$(RRD_LIB_NAME).dll 2>NUL\r
+    -@del /F /Q $(TOP)\win32\$(RRD_LIB_NAME).exp 2>NUL\r
+    -@del /F /Q $(TOP)\win32\$(RRD_LIB_NAME).lib 2>NUL\r
+\r
+$(TOP)/win32/$(RRD_LIB_NAME).dll $(TOP)/win32/$(RRD_LIB_NAME).lib: \\r
+        $(TOP)/win32/$(RRD_LIB_NAME).def $(TOP)/win32/$(RRD_LIB_NAME).res \\r
+        $(RRD_LIB_OBJ_LIST)\r
+    cl /nologo /MD /LD /Zi /Fe$(TOP)/win32/$(RRD_LIB_NAME).dll \\r
+        /Fd$(TOP)/win32/$(RRD_LIB_NAME).pdb \\r
+        $(TOP)/win32/$(RRD_LIB_NAME).def $(TOP)/win32/$(RRD_LIB_NAME).res \\r
+        $(RRD_LIB_OBJ_LIST) /link $(THIRD_PARTY_LIB) $(LD_FLAGS)\r
+\r
+$(TOP)/win32/rrdtool.exe: $(TOP)/win32/rrdtool.res $(TOP)/src/rrd_tool.obj \\r
+        $(TOP)/win32/$(RRD_LIB_NAME).lib\r
+    cl /nologo /MD /Zi /Fe$@ $(TOP)/win32/rrdtool.res $(TOP)/src/rrd_tool.obj \\r
+        $(TOP)/win32/$(RRD_LIB_NAME).lib /link $(LD_FLAGS)\r
+#Just waiting for antivirus program to finished check tasks\r
+    -@ping 1.1.1.1 -n 1 -w 1000 > NUL\r
+    -mt -manifest $(TOP)/win32/uac.manifest -outputresource:$(TOP)/win32/rrdtool.exe;#1\r
+\r
+$(TOP)/win32/rrdupdate.exe: $(TOP)/win32/rrdupdate.res $(TOP)/src/rrdupdate.obj \\r
+        $(TOP)/src/plbasename.obj $(TOP)/win32/$(RRD_LIB_NAME).lib\r
+    cl /nologo /MD /Zi /Fe$@ $(TOP)/win32/rrdupdate.res $(TOP)/src/rrdupdate.obj \\r
+        $(TOP)/src/plbasename.obj $(TOP)/win32/$(RRD_LIB_NAME).lib /link $(LD_FLAGS)\r
+#Just waiting for antivirus program to finished check tasks\r
+    -@ping 1.1.1.1 -n 1 -w 1000 > NUL\r
+    -mt -manifest $(TOP)/win32/uac.manifest -outputresource:$(TOP)/win32/rrdupdate.exe;#1\r
+\r
+$(TOP)/win32/rrdcgi.exe: $(TOP)/win32/rrdcgi.res $(TOP)/src/rrd_cgi.obj \\r
+        $(TOP)/src/optparse.obj \\r
+        $(TOP)/win32/$(RRD_LIB_NAME).lib\r
+    cl /nologo /MD /Zi /Fe$@ $(TOP)/win32/rrdcgi.res $(TOP)/src/rrd_cgi.obj \\r
+        $(TOP)/src/optparse.obj \\r
+        $(TOP)/win32/$(RRD_LIB_NAME).lib /link $(LD_FLAGS)\r
+#Just waiting for antivirus program to finished check tasks\r
+    -@ping 1.1.1.1 -n 1 -w 1000 > NUL\r
+    -mt -manifest $(TOP)/win32/uac.manifest -outputresource:$(TOP)/win32/rrdcgi.exe;#1\r
+\r
+{$(TOP)/src}.c{$(TOP)/src}.obj:\r
+    cl /nologo /MD /DWIN32 /c $(CPPFLAGS) /Fo$@ $<\r
+\r
+{$(TOP)/win32}.rc{$(TOP)/win32}.res:\r
+    rc /nologo /I./src /fo$@ $<\r
+\r
+{$(TOP)/win32}.c{$(TOP)/win32}.obj:\r
+    cl /nologo /MD /DWIN32 /c $(CPPFLAGS) /Fo$@ $<\r
index 5d57e39b9d283bdd60df62a47340eef18617206f..25c768d0ee1428db42786d3843095fe0a8df5f1c 100644 (file)
@@ -1,10 +1,15 @@
-Win32 Build Instructions:\r
+Win32 Build Instructions (using nmake Makefile):\r
 \r
 1) See build-rrdtool.dot (build-rrdtool.svg or build-rrdtool.pdf) for build\r
    dependency.\r
 \r
-2) If you do not want to build the build-dependencies, you can download prebuilt\r
-   versions from the following address:\r
+2) An efficient way, to obtain up-to-date build-dependencies, is using vcpkg.\r
+   Install the headers and libraries the following way into the vcpkg directory:\r
+   .\vcpkg install cairo expat fontconfig freetype gettext glib libpng libxml2 pango pcre zlib --triplet x86-windows\r
+   .\vcpkg install cairo expat fontconfig freetype gettext glib libpng libxml2 pango pcre zlib --triplet x64-windows\r
+\r
+   If you do not want to build the build-dependencies, you can download prebuilt\r
+   (but in the meantime outdated) versions from the following address:\r
 \r
    32bit dependencies should then be extracted into the contrib directory:\r
    http://ftp.gnome.org/pub/gnome/binaries/win32/\r
@@ -19,12 +24,15 @@ Win32 Build Instructions:
    from the following address:\r
    http://msinttypes.googlecode.com/svn/trunk/stdint.h\r
 \r
-4) Adjust the include path, library path, and library names which in the\r
-   Makefile.msc, to correspond with your local path or names.\r
+4) Adjust the include path, library path, and library names found in\r
+   Makefile_vcpkg.msc or Makefile.msc, to correspond to your local path or names.\r
+\r
+5) Run 'nmake -f win32\Makefile_vcpkg.msc' for 32 bit Windows target,\r
+   Run 'nmake -f win32\Makefile_vcpkg.msc USE_64BIT=1' for 64 bit Windows target.\r
+   Run 'nmake -f win32\Makefile_vcpkg.msc clean' to remove all generated files.\r
 \r
-5) Run 'nmake -f win32\Makefile.msc' for 32 bit Windows target,\r
-   Run 'nmake -f win32\Makefile.msc USE_64BIT=1' for 64 bit Windows target.\r
-   Run 'nmake -f win32\Makefile.msc clean' to remove all generated files.\r
+   If you use headers and libraries in the contrib or the contrib-x64 folder,\r
+   use Makefile.msc instead of Makefile_vcpkg.msc in the three commands above.\r
 \r
 6) librrd-4.dll, librrd-4.lib, rrdtool.exe, rrdupdate.exe, rrdcgi.exe, and\r
    these corresponding pdb files will be located in the win32 directory.\r