{"id":17317242,"url":"https://github.com/rjuju/pg_msvc_generator","last_synced_at":"2025-04-14T15:06:26.638Z","repository":{"id":145905936,"uuid":"398463825","full_name":"rjuju/pg_msvc_generator","owner":"rjuju","description":"Automatically generate MSVC project for PostgreSQL extensions.","archived":false,"fork":false,"pushed_at":"2024-06-01T09:18:24.000Z","size":44,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T03:51:11.431Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rjuju.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-21T04:18:31.000Z","updated_at":"2024-06-01T09:18:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"9c8e18f3-9728-452d-8d8c-c60f1d23a31c","html_url":"https://github.com/rjuju/pg_msvc_generator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rjuju%2Fpg_msvc_generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rjuju%2Fpg_msvc_generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rjuju%2Fpg_msvc_generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rjuju%2Fpg_msvc_generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rjuju","download_url":"https://codeload.github.com/rjuju/pg_msvc_generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248904642,"owners_count":21180834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T13:15:57.462Z","updated_at":"2025-04-14T15:06:26.596Z","avatar_url":"https://github.com/rjuju.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"pg_msvc_generator\n=================\n\nProject to help developping PostgreSQL or its extensions on Windows.\n\nIt contains:\n\n- a script to bootstrap an environment to compile PostgreSQL using MSVC\n- a tool to generate MSBC project for PostgreSQL extensions.\n\nEnvironment bootstrap\n---------------------\n\n/!\\ This script is still a work in progress /!\\\n\nThe script is aimed to be run against the [evalutation virtual\nmachine](https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/).\n\nOpen an administrator powershell, and execute **bootstrap.ps1**.\n\nYou may need to execute first:\n\n```\nSet-ExecutionPolicy RemoteSigned -Scope CurrentUser\n```\n\nTo be able to run the script.\n\nThe script will install all dependencies, configure some environment variable\nand create a **postgres.bat** script on the desktop to launch a shell properly\nconfigured.\n\n\nProject generator\n-----------------\n\nBasic tool usage is:\n\n```\npg_msvc_generator.pl [ options ]\n\nOptions:\n\n    --default version pgver  : default PostgreSQL version. This is only used\n                if you compile the project without specifying a specific major\n                version, or when the project is opened with Visual Studio\n                IDE.  If not provided, a default value based on the year will\n                be chosen (13 for 2021, 14 for 2022 and so on).\n    -d | --dir ext_directory : root directory of the extension source code.\n    -e | --extension         : extension name.  If not provided, the extension\n                name will be assumed using the last part of the given root\n                directory.\n    -h | --help              : Show this message.\n```\n\nIt will generate an `msvc` subdirectory in the given extension directory,\ncontaining the required `.sln` and `.vcxproj` files to be able to compile the\nextension using Visual Studio 2019, with support for Debug/Release and 32/64\nbits builds.  It will alse create copy the `release.pl` and generate a\n`build.bat` scripts that can automatically compile and create release archive\nfiles for all installed PostgreSQL versions.\n\nExample:\n\n```\npg_msvc_generator.pl -d C:\\git\\hypopg\n```\n\nRequirements\n------------\n\n**At project generation time**:\n\n  - A Windows host with Perl installed to generate the project files\n\n**At extension compilation time**:\n\n  - Perl\n  - Visual Studio 2019\n  - All major PostgreSQL versions for which you want to build the extension\n  - Optionally, NSIS installed **in the default location**\n    (`C:\\Program Files (x86)\\NSIS`) to generate installers\n\nDoing a release of your extension\n---------------------------------\n\nAll you need to do is to execute the `msvc\\release.bat` script.  It will setup\nthe MSVC environment and call the `release.pl` script.  That script will\nprepare everything for a release under a\n`msvc\\${extension_name}-${extension_version}` directory.\n\nIt will automatically find the installed PostgreSQL version reading the\n`HKLM/SOFTWARE/PostgreSQL/Installations/` registry, compile the extension with\nall those versions and for each will generate a subdirectory containing the dll\nand the SQL scripts if any, a zip archive with the same content and optionally\nqn installer.\n\nFor instance, assuming that you have PostgreSQL 12 and 13 installed and\nreleased HypoPG 1.3.2 and NSIS installed, your `msvc` directory will now have\nthis additional content:\n\n```\nmsvc\\hypopg-1.3.2\\12-x64\\lib\\hypopg.dll\nmsvc\\hypopg-1.3.2\\12-x64\\share\\extension\\hypopg.control\nmsvc\\hypopg-1.3.2\\12-x64\\share\\extension\\*.sql\nmsvc\\hypopg-1.3.2\\13-x64\\lib\\hypopg.dll\nmsvc\\hypopg-1.3.2\\13-x64\\share\\extension\\hypopg.control\nmsvc\\hypopg-1.3.2\\13-x64\\share\\extension\\*.sql\nmsvc\\hypopg-1.3.2\\hypopg-1.3.2-pg12-x64.exe\nmsvc\\hypopg-1.3.2\\hypopg-1.3.2-pg12-x64.zip\nmsvc\\hypopg-1.3.2\\hypopg-1.3.2-pg13-x64.exe\nmsvc\\hypopg-1.3.2\\hypopg-1.3.2-pg13-x64.zip\n```\n\nInstaller\n---------\n\nIf you have [NSIS](https://nsis.sourceforge.io/) installed in the default\nlocation (`C:\\Program Files (x86)\\NSIS), the `release.pl` script will generate\na `.nsi` file and compile it using **makensis.exe** to generate a specific\ninstaller for each PostgreSQL major versions found when running the\n`release.pl` script/.  At execution time, he installer will try to discover the\nserver's PostgreSQL installation path by reading the registry key\n**HKEY_LOCAL_MACHINE\\SOFTWARE\\PostgreSQL\\Installations\\postgresql-$architecture-$majorversion\\Base\nDirectory**.\n\nIf the key is found, the installer will inform the user and use it as the\ndefault installation location.  Otherwise, the installer will inform the user\nthat no installation was automatically found and will force the user to choose\na location before being able to continue the installation.\n\nManually compiling the extension\n--------------------------------\n\nThe Visual Studio project contains a `pgver` parameter that can be used to\ncompile the extension for a specific major version.\n\nParameters available for the msvc project:\n\n  - **pgroot**: root directory of your PostgreSQL local installations.  Default\n                is **C:\\Program Files\\PostgreSQL** for 64bits platform and\n                **C:\\Program Files (x86)\\PostgreSQL** for 32bits platform.\n  - **pgver**: major PostgreSQL version, which will be concatenated to the\n               **pgroot** directory.\n\nExample:\n\n```\nmsbuild C:\\git\\hypopg\\msvc\\hypopg.sln /p:Configuration=Release /p:Platform=x64 /p:pgver=12\n```\n\nIf the project compiles correctly, the DLL will be generated in the\n`msvc\\$Platform\\$configuration\\` subdirectory.  In the previous example, it\nwould be `msvc\\x64\\Release\\hypopg.dll`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frjuju%2Fpg_msvc_generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frjuju%2Fpg_msvc_generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frjuju%2Fpg_msvc_generator/lists"}