Skip to content

Commit

Permalink
Add CI pipeline on windows (#4)
Browse files Browse the repository at this point in the history
* convert the project to use Microsoft vcpkg tool to fetch the wxWidgets and Boost dependencies on Windows
* update the VS solution file to remove any WXDIR and BOOST_DIR-related settings... now vcpkg makes it easier: no explicit reference needs to be inside the solution file
* update the NSIS installer to reference updated build paths
  • Loading branch information
f18m authored Nov 6, 2023
1 parent 9dbc3c5 commit 1ba68d0
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 33 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,37 @@ on:
branches: [ master ]

jobs:
build:
LinuxBuild:
runs-on: ubuntu-latest

steps:
# install deps
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: install debian-packaged dependencies
run: sudo apt install -y libwxgtk3.0-gtk3-dev libboost-graph1.74.0 libboost-serialization1.74.0 libboost-all-dev

# build
- name: build netlist-viewer
- name: build netlist-viewer
run: cd NetlistViewer/build/linux && make

WindowsBuild:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1

# setup vcpkg & msbuild tools
# NOTE: no packages/dependencies are installed at this time -- msbuild will use vcpkg to download&build dependencies
# specified in the vcpkg.json during the build step below. This happens because the VisualStudio solution has
# the 'VcpkgEnableManifest' property set to True
- name: Setup anew (or from cache) vcpkg (and does not build any package)
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 8eb57355a4ffb410a2e94c07b4dca2dffbee8e50
- name: Integrate vcpkg
run: vcpkg integrate install

# build
- name: build netlist-viewer
run: msbuild NetlistViewer\build\win\netlist_viewer_vs2022.vcxproj -t:rebuild -property:Configuration=Release -property:Platform=x64
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ NetlistViewer/build/linux/NetlistViewer
NetlistViewer/build/win/x64
NetlistViewer/build/win/.vs
NetlistViewer/build/win/*.pdb
NetlistViewer/build/win/*.exe
NetlistViewer/distrib/*.exe

vcpkg_installed/
29 changes: 22 additions & 7 deletions NetlistViewer/build/win/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
# Building NetListViewer on Windows

Please download and compile with latest VisualStudio both
NetListViewer uses [vcpkg](https://vcpkg.io/en/getting-started) to install its 2 dependencies:
1. wxWidgets >= 3.0.0
1. Boost >= 1.58

Then define the following 2 environment variables:
1. WXWIN to point to the base root of your wxWidgets directory
1. BOOST_DIR to point to the base root of your Boost directory

For more info on how to do it, please look on Google, e.g.: https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10
Step by step procedure to get them installed:

Finally open the netlist_viewer_vs2022.sln project with VisualStudio and you should be able to build it.
1. Install vcpkg following the [vcpkg getting started guide](https://vcpkg.io/en/getting-started)
1. From a "cmd.exe" window run:

```
cd <netlist-viewer-git-repo>
vcpkg install # this will read the dependencies from vcpkg.json and download and build them
vcpkg integrate install # this allows the dependencies to be usable from msbuild
```

Note that this step will take a while: it will rebuild all wxWidgets and Boost libraries and all their
dependencies as well.

1. Open the netlist_viewer_vs2022.sln project with VisualStudio 2022 or newer and you should be able to build it.
Alternatively the build can be launched from a console window as well:

```
cd <netlist-viewer-git-repo>
msbuild NetlistViewer\build\win\netlist_viewer_vs2022.vcxproj -t:rebuild -property:Configuration=Release -property:Platform=x64
```

NOTE: as of Nov 2023, the installation through vcpkg of the "expat" library (one of wxWidgets dependencies) can
fail due to https://github.com/libexpat/libexpat/issues/418 if you have a localized version of VisualStudio.
Check that URL for the workaround (i.e. installing the English pack in VisualStudio)
17 changes: 6 additions & 11 deletions NetlistViewer/build/win/netlist_viewer_vs2022.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,17 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(WXWIN)\wxwidgets.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>15.0.26919.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnableManifest>true</VcpkgEnableManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(BOOST_DIR);$(MSBuildThisFileDirectory)include\msvc;$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregex$(wxSuffix).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>$(BOOST_DIR)\stage\lib;$(wxLibOrDllDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\app.cpp" />
Expand Down
15 changes: 5 additions & 10 deletions NetlistViewer/distrib/setup.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,8 @@ Section "install" ; No components page, name is not important
SetOutPath "$INSTDIR"
File gnugpl.txt
File ..\src\icon.ico
File ..\build\win\NetlistViewer.exe

!echo "FMON test $%WXWIN%"

File "$%WXWIN%\lib\vc14x_x64_dll\*.dll"
;;;File ${INSTALLER_MODE}\*.dll

File ..\build\win\x64\Release\netlist_viewer.exe
File ..\build\win\x64\Release\*.dll

SetOutPath "$INSTDIR\examples"
File /nonfatal ..\examples\*.ckt
Expand Down Expand Up @@ -126,7 +121,7 @@ Section "install" ; No components page, name is not important
SetShellVarContext all ; see http://nsis.sourceforge.net/Shortcuts_removal_fails_on_Windows_Vista
SetOutPath "$INSTDIR" ; this will be the working directory for the shortcuts created below
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\NetlistViewer.lnk" "$INSTDIR\netlistviewer.exe"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\NetlistViewer.lnk" "$INSTDIR\netlist_viewer.exe"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"

SectionEnd
Expand All @@ -149,7 +144,7 @@ Section "un.install"
Delete "$INSTDIR\uninstall.exe"
Delete "$INSTDIR\gnugpl.txt"
Delete "$INSTDIR\icon.ico"
Delete "$INSTDIR\netlistviewer.exe"
Delete "$INSTDIR\netlist_viewer.exe"
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\*.manifest"
Delete "$INSTDIR\examples\*.ckt"
Expand All @@ -162,5 +157,5 @@ SectionEnd

Function .oninstsuccess
; launch the application at the end of the install
Exec "$INSTDIR\NetlistViewer.exe"
Exec "$INSTDIR\netlist_viewer.exe"
FunctionEnd
14 changes: 14 additions & 0 deletions vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"default-registry": {
"kind": "git",
"baseline": "638b1588be3a265a9c7ad5b212cef72a1cad336a",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [
{
"kind": "artifact",
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
"name": "microsoft"
}
]
}
20 changes: 20 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"dependencies": [
{
"name": "wxwidgets",
"version>=": "3.2.3"
},
{
"name": "boost-graph",
"version>=": "1.82.0"
},
{
"name": "boost-serialization",
"version>=": "1.82.0"
},
{
"name": "boost-functional",
"version>=": "1.82.0"
}
]
}

0 comments on commit 1ba68d0

Please sign in to comment.