Skip to content

Convenience script for Visual Studio 2019 #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ generated_proto/
demoinfogo.exe
demoinfogo.opensdf
protobuf-2.5.0/
test.dem
protoc-2.5.0-win32/
.vs/
test.dem
Backup
UpgradeLog.htm
10 changes: 10 additions & 0 deletions demoinfogo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ Building demoinfogo

### Windows

#### Visual Studio 2019 (Automated)

Executing the vs19.ps1 PowerShell script will resolve all dependencies, upgrade solution files, and build demoinfogo.exe

```
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& './vs19.ps1'"
```

#### Visual Studio 2010 (Manual)

In order to build demoinfogo on Windows, follow these steps:

1. Download [protobuf-2.5.0.zip](https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.zip) and extract it into the `demoinfogo` folder. This creates the folder `demoinfogo/protobuf-2.5.0`.
Expand Down
30 changes: 30 additions & 0 deletions vs19.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Download protobuf and protoc
cmd /c "curl -L https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.zip --output protobuf-2.5.0.zip"
cmd /c "tar -xzf protobuf-2.5.0.zip -C demoinfogo"
cmd /c "del protobuf-2.5.0.zip"
cmd /c "curl -L https://github.com/google/protobuf/releases/download/v2.5.0/protoc-2.5.0-win32.zip --output protoc-2.5.0-win32.zip"
cmd /c "tar -xzf protoc-2.5.0-win32.zip -C demoinfogo/protoc-2.5.0-win32"
cmd /c "del protoc-2.5.0-win32.zip"

# Upgrade protobuf sln
cmd /c "devenv demoinfogo\protobuf-2.5.0\vsprojects\protobuf.sln /Upgrade"

# Include algorithm in zero_copy_stream_impl_lite.cc, min function will be unresolved otherwise
get-content demoinfogo\protobuf-2.5.0\src\google\protobuf\io\zero_copy_stream_impl_lite.cc | %{$_ -replace "#include <google/protobuf/stubs/stl_util.h>", "#include <google/protobuf/stubs/stl_util.h>`n#include <algorithm>"} | out-file temp
cmd /c "move /y temp demoinfogo\protobuf-2.5.0\src\google\protobuf\io\zero_copy_stream_impl_lite.cc"

# Define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS for hash_map deprecation
$projects = "demoinfogo\protobuf-2.5.0\vsprojects\libprotobuf.vcxproj", "demoinfogo\protobuf-2.5.0\vsprojects\libprotobuf-lite.vcxproj", "demoinfogo\protobuf-2.5.0\vsprojects\libprotoc.vcxproj"
foreach ($project in $projects) {
get-content $project | %{$_ -replace "<PreprocessorDefinitions>", "<PreprocessorDefinitions>_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;"} | out-file temp
cmd /c "move /y temp $project"
}

# Build libprotobuf
cmd /c "devenv demoinfogo\protobuf-2.5.0\vsprojects\protobuf.sln /Build `"Release|Win32`" /Project libprotobuf"

# Upgrade demoinfogo sln
cmd /c "devenv demoinfogo\demoinfogo.sln /Upgrade"

# Build demoinfogo
cmd /c "devenv demoinfogo\demoinfogo.sln /Build `"Release|Win32`" /Project demoinfogo"