Skip to content

Linux support #95

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

Draft
wants to merge 37 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6b6b5c2
wip
chtenb Dec 20, 2024
105b334
Restore some windows props
chtenb Jan 8, 2025
e352956
Fix copying behavior
chtenb Jan 8, 2025
3f48ca7
fix copy command
chtenb Jan 8, 2025
4951e66
Remove .exe and .dll suffixes
chtenb Jan 8, 2025
b361458
Do not check all files for crlf
chtenb Jan 8, 2025
e4e67ac
typo
chtenb Jan 8, 2025
b979afa
Also patch rpath of executables
chtenb Jan 8, 2025
bf02b33
Renable some windows includes
chtenb Jan 8, 2025
5c72e88
test
chtenb Jan 8, 2025
642b37a
Fix build issues on windows
chtenb Jan 9, 2025
65aacf0
remove debug output
chtenb Jan 9, 2025
5f92aa8
guard kernel32 refs
chtenb Jan 9, 2025
01ab875
fixup
chtenb Jan 9, 2025
8fdf181
Comment test sources
chtenb Jan 9, 2025
8ea18d6
Merge remote-tracking branch 'github/linux' into linux
chtenb Jan 9, 2025
d21aea2
Adjust patching
chtenb Jan 9, 2025
3dc946d
Make tests pass when never deallocating graphs
chtenb Jan 10, 2025
0a6cf86
Clean up scripts and update upgrade instructions
chtenb Jan 10, 2025
533b142
Update readme
chtenb Jan 10, 2025
ae6c959
Update readme
chtenb Jan 10, 2025
cb28c52
Use version 11.0.0
chtenb Jan 10, 2025
d7801e9
Test agclose in ConsoleApplication
chtenb Jan 13, 2025
ceaf6e1
Implement Close() in RootGraph to be able to manually trigger destruc…
chtenb Jan 20, 2025
d3ef45b
Add two agclose reproductions
chtenb Jan 20, 2025
750dd8b
Add native test
chtenb Jan 20, 2025
da6891b
simplify repros
chtenb Jan 21, 2025
8758c7b
temp
chtenb Jan 21, 2025
1813b47
attempt linux ci
chtenb Jan 21, 2025
0c5db62
fix
chtenb Jan 21, 2025
f05d778
whitespace fix
chtenb Jan 21, 2025
c1ebf83
formatting
chtenb Jan 21, 2025
1913eca
fix
chtenb Jan 21, 2025
06d5c45
debug
chtenb Jan 21, 2025
c29705b
debug
chtenb Jan 21, 2025
d8ea78f
debug
chtenb Jan 21, 2025
3e80082
debug
chtenb Jan 21, 2025
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
59 changes: 59 additions & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI Linux

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
name: Checkout Code

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Restore Tools
run: dotnet tool restore

- name: Restore NuGet Packages
run: dotnet restore Rubjerg.Graphviz.sln

- name: Print PWD
run: pwd

- name: Build App
run: dotnet build Rubjerg.Graphviz.sln --configuration Release --no-restore

- name: Debug Intermediate Output
run: ls -la /home/runner/work/Graphviz.NetWrapper/Graphviz.NetWrapper/Rubjerg.Graphviz/Resources

- name: Debug Build Output
run: ls -la /home/runner/work/Graphviz.NetWrapper/Graphviz.NetWrapper/Rubjerg.Graphviz/bin/x64/Release/netstandard2.0/

- name: Debug Test Build Output
run: ls -la /home/runner/work/Graphviz.NetWrapper/Graphviz.NetWrapper/Rubjerg.Graphviz.Test/bin/x64/Release/net8.0/

- name: Run Unittests
run: bash run-tests-netcore.sh Rubjerg.Graphviz.Test/Rubjerg.Graphviz.Test.csproj

- name: Run Transitive Tests
run: bash run-tests-netcore.sh Rubjerg.Graphviz.TransitiveTest/Rubjerg.Graphviz.TransitiveTest.csproj

- name: Restore NuGet Packages for NuGet Tests
run: dotnet restore Rubjerg.Graphviz.NugetTests.sln

- name: Build NuGet Test Solution
run: dotnet build Rubjerg.Graphviz.NugetTests.sln --configuration Release --no-restore

- name: Run NuGet Tests
run: bash run-tests-netcore.sh Rubjerg.Graphviz.NugetTest/Rubjerg.Graphviz.NugetTest.csproj

- name: Run Transitive NuGet Tests
run: bash run-tests-netcore.sh Rubjerg.Graphviz.TransitiveNugetTest/Rubjerg.Graphviz.TransitiveNugetTest.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a basic workflow to help you get started with Actions

name: CI
name: CI Windows

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
Expand All @@ -25,7 +25,7 @@ jobs:

- name: Check if line endings are CRLF
run: |
bash -c "git grep -rlIP . | xargs unix2dos"
bash -c "git grep -rlIP -- ':!GraphvizWrapper/graphvizfiles/*' ':!*.sh' | xargs unix2dos"
echo test
git diff --exit-code

Expand Down
1 change: 1 addition & 0 deletions ConsoleApplication/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin
x64
*.vcxproj.user
*.svg
26 changes: 18 additions & 8 deletions ConsoleApplication/ConsoleApplication.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
#include <iostream>
#include <conio.h>
#include "GraphvizWrapper.h"
#include <string.h>

#ifdef _WIN32
#include <windows.h>
#else
#include <dlfcn.h>
#endif

#include "../GraphvizWrapper/GraphvizWrapper.h"

using namespace std;

int main()
{
int main() {
cout << "Make sure to set the current working directory to the repository root!" << endl;
cout << "Running tests..." << endl;

cout << test_agread() << endl;
cout << test_agmemread() << endl;
cout << test_rj_agmemread() << endl;
cout << missing_label_repro() << endl;
cout << stackoverflow_repro() << endl;

cout << "Press key to exit..";
auto c = _getch();
cout << agclose_repro() << endl;

cout << "Press Enter to exit...";
cin.get(); // Portable replacement for _getch()

return 0;
}

169 changes: 126 additions & 43 deletions ConsoleApplication/ConsoleApplication.vcxproj
Original file line number Diff line number Diff line change
@@ -1,78 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Project Configurations -->
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
<OutDir>bin/Debug/</OutDir>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
<OutDir>bin/Release/</OutDir>
</ProjectConfiguration>
</ItemGroup>

<!-- Globals -->
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{27a1d045-b8c9-4785-a2da-ecac48158725}</ProjectGuid>
<RootNamespace>ConsoleApplication</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

<!-- Project Reference -->
<ItemGroup>
<ProjectReference Include="../GraphvizWrapper/GraphvizWrapper.vcxproj">
<Project>{f9bc5523-352d-469f-8dbb-97eca9d70648}</Project>
</ProjectReference>
</ItemGroup>

<PropertyGroup>
<!-- Ensure this project depends on GraphvizWrapper -->
<ProjectDependencies>GraphvizWrapper</ProjectDependencies>
</PropertyGroup>

<!-- Source Files -->
<ItemGroup>
<ClCompile Include="ConsoleApplication.cpp" />
</ItemGroup>

<ItemGroup>
<None Include="missing-label-repro.dot">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="stackoverflow-repro.dot">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<!-- Build Targets -->
<Target Name="Build">
<CallTarget Targets="BuildWindows" Condition="'$(OS)' == 'Windows_NT'" />
<CallTarget Targets="BuildLinux" Condition="'$(OS)' != 'Windows_NT'" />
</Target>

<!-- Clean Target -->
<Target Name="Clean">
<Delete Files="$(OutputFile).exe" Condition="'$(OS)' == 'Windows_NT'" />
<Delete Files="$(OutputFile)" Condition="'$(OS)' != 'Windows_NT'" />
</Target>


<!-- Windows Imports -->
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" Condition="'$(OS)' == 'Windows_NT'" />

<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64' and '$(OS)' == 'Windows_NT'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64' and '$(OS)' == 'Windows_NT'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>

<!-- Windows Defines -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' and '$(OS)' == 'Windows_NT'">
<OutDir>../Rubjerg.Graphviz/Resources/</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' and '$(OS)' == 'Windows_NT'">
<OutDir>../Rubjerg.Graphviz/Resources/</OutDir>
</PropertyGroup>

<!-- Windows Debug/Release Configuration -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>../Rubjerg.Graphviz/</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>../Rubjerg.Graphviz/</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">

<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' and '$(OS)' == 'Windows_NT'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\GraphvizWrapper\;..\GraphvizWrapper\include;</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>..\Rubjerg.Graphviz\GraphvizWrapper.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>..\Rubjerg.Graphviz\Resources\GraphvizWrapper.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' and '$(OS)' == 'Windows_NT'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\GraphvizWrapper\;..\GraphvizWrapper\include;</AdditionalIncludeDirectories>
</ClCompile>
Expand All @@ -81,25 +136,53 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>..\Rubjerg.Graphviz\Resources\GraphvizWrapper.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="ConsoleApplication.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GraphvizWrapper\GraphvizWrapper.vcxproj">
<Project>{f9bc5523-352d-469f-8dbb-97eca9d70648}</Project>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="missing-label-repro.dot">
<FileType>Document</FileType>
</CopyFileToFolders>
<CopyFileToFolders Include="stackoverflow-repro.dot">
<FileType>Document</FileType>
</CopyFileToFolders>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</ItemDefinitionGroup>

<!-- More Windows Imports -->
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" Condition="'$(OS)' == 'Windows_NT'" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" Condition="'$(OS)' == 'Windows_NT'" />

<Target Name="BuildWindows" Condition="'$(OS)' == 'Windows_NT'">
<MSBuild Projects="$(MSBuildProjectFile)" />
</Target>

<!-- Linux Configuration -->
<PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
<Compiler>clang++</Compiler>
<CompilerFlags>-std=c++17 -O2 -lGraphvizWrapper -lcgraph -lgvc -lxdot -Wl,-rpath,'$ORIGIN'</CompilerFlags>
<OutputPath>bin/linux/</OutputPath>
<OutputFile>ConsoleApplication</OutputFile>
<IncludeDirs>../GraphvizWrapper/include</IncludeDirs>
<LibDirs>../Rubjerg.Graphviz/Resources</LibDirs>
<SourceFiles>ConsoleApplication.cpp</SourceFiles>
</PropertyGroup>

<Target Name="GetTargetPath">
<PropertyGroup>
<TargetPath>$(OutputPath)$(OutputFile)</TargetPath>
</PropertyGroup>
</Target>

<Target Name="BuildLinux" Condition="'$(OS)' != 'Windows_NT'">
<Message Text="Building ConsoleApplication on Linux with clang++: $(Compiler) $(CompilerFlags) -I $(IncludeDirs) $(SourceFiles) -L $(LibDirs) -o $(OutputPath)$(OutputFile)" Importance="high" />
<!-- Ensure the output directory exists -->
<Exec Command="mkdir -p $(OutputPath)" />
<Exec Command="$(Compiler) $(CompilerFlags) -I $(IncludeDirs) $(SourceFiles) -L $(LibDirs) -o $(OutputPath)$(OutputFile)" />
</Target>

<Target Name="PostBuild" AfterTargets="Build">
<Message Text="Copying dependencies: cp -r ../Rubjerg.Graphviz/Resources/* $(OutputPath) " Importance="high" />
<Exec Condition="'$(OS)' != 'Windows_NT'" Command=" cp -r ../Rubjerg.Graphviz/Resources/* $(OutputPath) " />
<Message Text="Copying dot resources: cp -r *.dot $(OutputPath) " Importance="high" />
<Exec Condition="'$(OS)' != 'Windows_NT'" Command=" cp -r *.dot $(OutputPath) " />
</Target>



</Project>

2 changes: 2 additions & 0 deletions GraphvizWrapper/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
bin
*.vcxproj.user
*.rpm
*.deb
Loading
Loading