Skip to content

Commit edaced3

Browse files
author
Euler Taveira
committed
Build wal2json out of the tree on Windows
Build out of the tree is a common task in Unix-like systems (PostgreSQL has PGXS but it doesn't support Windows). This commit adds a project file to build out of the tree on Windows. I also add minimal instructions to build on Windows. I tested wal2json on MS Visual Studio 2017 (version 15.6.4) on a x64 platform.
1 parent 1ce1010 commit edaced3

File tree

3 files changed

+98
-2
lines changed

3 files changed

+98
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ $ USE_PGXS=1 make install
4040
Windows
4141
-------
4242

43-
Sorry, never tried it. ;(
43+
There are several ways to build wal2json on Windows. If you are build PostgreSQL too, you can put wal2json directory inside contrib, change the contrib Makefile (variable SUBDIRS) and build it following the [Installation from Source Code on Windows](http://www.postgresql.org/docs/current/static/install-windows.html) instructions. However, if you already have PostgreSQL installed, it is also possible to compile **wal2json** out of the tree. Edit wal2json.vcxproj file and change `c:\postgres\pg103` to the PostgreSQL prefix directory. The next step is to open this project file in MS Visual Studio and compile it. Final step is to copy `wal2json.dll` to the `pg_config --pkglibdir` directory.
4444

4545
Configuration
4646
=============

wal2json.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
PG_MODULE_MAGIC;
2828

2929
extern void _PG_init(void);
30-
extern void _PG_output_plugin_init(OutputPluginCallbacks *cb);
30+
extern void PGDLLEXPORT _PG_output_plugin_init(OutputPluginCallbacks *cb);
3131

3232
typedef struct
3333
{

wal2json.vcxproj

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|x64">
5+
<Configuration>Debug</Configuration>
6+
<Platform>x64</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|x64">
9+
<Configuration>Release</Configuration>
10+
<Platform>x64</Platform>
11+
</ProjectConfiguration>
12+
</ItemGroup>
13+
<PropertyGroup Label="Globals">
14+
<VCProjectVersion>15.0</VCProjectVersion>
15+
<ProjectGuid>{185AF5B6-C04A-4710-8330-18A4416BD225}</ProjectGuid>
16+
<Keyword>Win32Proj</Keyword>
17+
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
18+
</PropertyGroup>
19+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
20+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
21+
<ConfigurationType>DynamicLibrary</ConfigurationType>
22+
<UseDebugLibraries>true</UseDebugLibraries>
23+
<PlatformToolset>v141</PlatformToolset>
24+
</PropertyGroup>
25+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
26+
<ConfigurationType>DynamicLibrary</ConfigurationType>
27+
<UseDebugLibraries>false</UseDebugLibraries>
28+
<PlatformToolset>v141</PlatformToolset>
29+
</PropertyGroup>
30+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
31+
<ImportGroup Label="ExtensionSettings">
32+
</ImportGroup>
33+
<ImportGroup Label="Shared">
34+
</ImportGroup>
35+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
36+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
37+
</ImportGroup>
38+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
39+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
40+
</ImportGroup>
41+
<PropertyGroup Label="UserMacros" />
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
43+
<GenerateManifest>false</GenerateManifest>
44+
</PropertyGroup>
45+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
46+
<GenerateManifest>false</GenerateManifest>
47+
</PropertyGroup>
48+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
49+
<ClCompile>
50+
<AdditionalIncludeDirectories>C:\postgres\pg103\include\server\port\win32_msvc;C:\postgres\pg103\include\server\port\win32;C:\postgres\pg103\include\server;C:\postgres\pg103\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
51+
<PreprocessorDefinitions>WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;DEBUG=1%(PreprocessorDefinitions)</PreprocessorDefinitions>
52+
<StringPooling>false</StringPooling>
53+
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
54+
<DisableSpecificWarnings>4018;4244;4273;4102;4090;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
55+
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
56+
<CompileAs>Default</CompileAs>
57+
</ClCompile>
58+
<Link>
59+
<OutputFile>.\x64\Debug\wal2json.dll</OutputFile>
60+
<AdditionalLibraryDirectories>C:\postgres\pg103\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
61+
<AdditionalDependencies>postgres.lib;libpgcommon.lib;libpgport.lib;%(AdditionalDependencies)</AdditionalDependencies>
62+
<TargetMachine>MachineX64</TargetMachine>
63+
<AdditionalOptions>/ignore:4197 %(AdditionalOptions)</AdditionalOptions>
64+
</Link>
65+
<ProjectReference>
66+
<LinkLibraryDependencies>false</LinkLibraryDependencies>
67+
</ProjectReference>
68+
</ItemDefinitionGroup>
69+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<ClCompile>
71+
<AdditionalIncludeDirectories>C:\postgres\pg103\include\server\port\win32_msvc;C:\postgres\pg103\include\server\port\win32;C:\postgres\pg103\include\server;C:\postgres\pg103\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
72+
<PreprocessorDefinitions>WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;DEBUG=1%(PreprocessorDefinitions)</PreprocessorDefinitions>
73+
<StringPooling>false</StringPooling>
74+
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
75+
<DisableSpecificWarnings>4018;4244;4273;4102;4090;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
76+
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
77+
<CompileAs>Default</CompileAs>
78+
</ClCompile>
79+
<Link>
80+
<OutputFile>.\x64\Release\wal2json.dll</OutputFile>
81+
<AdditionalLibraryDirectories>C:\postgres\pg103\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
82+
<AdditionalDependencies>postgres.lib;libpgcommon.lib;libpgport.lib;%(AdditionalDependencies)</AdditionalDependencies>
83+
<TargetMachine>MachineX64</TargetMachine>
84+
<AdditionalOptions>/ignore:4197 %(AdditionalOptions)</AdditionalOptions>
85+
</Link>
86+
<ProjectReference>
87+
<LinkLibraryDependencies>false</LinkLibraryDependencies>
88+
</ProjectReference>
89+
</ItemDefinitionGroup>
90+
<ItemGroup>
91+
<ClCompile Include="wal2json.c" />
92+
</ItemGroup>
93+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
94+
<ImportGroup Label="ExtensionTargets">
95+
</ImportGroup>
96+
</Project>

0 commit comments

Comments
 (0)