Skip to content

Commit

Permalink
Merge pull request #110 from torressa/fix108
Browse files Browse the repository at this point in the history
v1.0.3
  • Loading branch information
torressa authored Jan 5, 2023
2 parents ba8a059 + 0ace212 commit 27415f6
Show file tree
Hide file tree
Showing 55 changed files with 3,699 additions and 812 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
continue-on-error: true

windows-build:
runs-on: windows-latest
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Install SWIG 4.0.2
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
fail-fast: false
matrix:
python: # Update this list whenever the docker image is updated (check /opt/python/)
- cp36-cp36m
- cp37-cp37m
- cp38-cp38
- cp39-cp39
- cp310-cp310
- cp311-cp311
steps:
- uses: actions/checkout@v2
- name: Install python3-devel
Expand Down Expand Up @@ -74,8 +74,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-10.15, macos-11] # 10.14 and 11 don't work
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
os: [macos-10.15, macos-11]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
Expand Down Expand Up @@ -107,14 +107,14 @@ jobs:
continue-on-error: true

windows-build:
runs-on: windows-latest
runs-on: windows-2019
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
os: [macos-11, macos-10.15]
env:
SYSTEM_VERSION_COMPAT: 0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ on: [push, pull_request]
jobs:
# Building using the github runner environement directly.
build:
runs-on: windows-latest
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Check swig
run: swig -version
- name: Check cmake
run: cmake --version
- name: Configure
run: cmake -S. -Bbuild -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_PYTHON=OFF
run: cmake -S. -Bbuild -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_PYTHON=OFF
- name: Build
run: cmake --build build --config Release --target ALL_BUILD -- /verbosity:normal /maxcpucount
- name: Test (cd into build)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows_dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ on: [push, pull_request]
jobs:
# Building using the github runner environement directly.
build:
runs-on: windows-latest
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Check swig
run: swig -version
- name: Check cmake
run: cmake --version
- name: Configure
run: cmake -S. -Bbuild -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_DOTNET=ON
run: cmake -S. -Bbuild -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_DOTNET=ON
- name: Build
run: cmake --build build --config Release --target ALL_BUILD -- /verbosity:normal /maxcpucount
- name: Test
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/windows_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on: [push, pull_request]
jobs:
# Building using the github runner environement directly.
build:
runs-on: windows-latest
runs-on: windows-2019
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Check cmake
run: cmake --version
- name: Configure
run: cmake -S. -Bbuild -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON=ON -DBUILD_TESTING=ON -DPython3_ROOT_DIR=$env:pythonLocation -DPython_ROOT_DIR=$env:pythonLocation -DPython3_FIND_STRATEGY=LOCATION -DPython3_FIND_REGISTRY=LAST
run: cmake -S. -Bbuild -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON=ON -DBUILD_TESTING=ON -DPython3_ROOT_DIR=$env:pythonLocation -DPython_ROOT_DIR=$env:pythonLocation -DPython3_FIND_STRATEGY=LOCATION -DPython3_FIND_REGISTRY=LAST
- name: Build
run: cmake --build build --config Release --target ALL_BUILD -- /verbosity:normal /maxcpucount
- name: Run python tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ xml
*.o
*.so
*.sw*
*.DS_Store
3 changes: 0 additions & 3 deletions .style.yapf

This file was deleted.

10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [v1.0.3]

### Fixed

- Fixed #108: Non-elementary checks for 2-cycles (`i->j->i` are not allowed).
Thanks @felizce

## [v1.0.2]

### Changed
Expand Down Expand Up @@ -291,7 +298,8 @@ path using `networkx.shortest_simple_paths`.
- Docstring modifications to include maths.
- Updated README.

[unreleased]: https://github.com/torressa/cspy/compare/v1.0.2...HEAD
[unreleased]: https://github.com/torressa/cspy/compare/v1.0.3...HEAD
[v1.0.3]: https://github.com/torressa/cspy/compare/v1.0.3...v1.0.3
[v1.0.2]: https://github.com/torressa/cspy/compare/v1.0.1...v1.0.2
[v1.0.1]: https://github.com/torressa/cspy/compare/v1.0.0...v1.0.1
[v1.0.0]: https://github.com/torressa/cspy/compare/v1.0.0-alpha...v1.0.0
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ endif()

project(
cspy
VERSION 1.0.2
VERSION 1.0.3
LANGUAGES CXX)
message(STATUS "project: ${PROJECT_NAME}")
message(STATUS "version: ${PROJECT_VERSION}")
Expand Down
52 changes: 43 additions & 9 deletions cmake/dotnet.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# CMake from https://github.com/Mizux/dotnet-native LICENSE: Apache License 2.0
if(NOT BUILD_DOTNET)
return()
endif()
Expand All @@ -7,6 +6,17 @@ set(CMAKE_SWIG_FLAGS)
find_package(SWIG REQUIRED)
include(UseSWIG)

# .Net Core 3.1 LTS is not available for osx arm64
if(APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
set(USE_DOTNET_CORE_31 OFF)
else()
option(USE_DOTNET_CORE_31 "Use .Net Core 3.1 LTS support" ON)
endif()
message(STATUS ".Net: Use .Net Core 3.1 LTS support: ${USE_DOTNET_CORE_31}")

option(USE_DOTNET_6 "Use .Net 6.0 LTS support" ON)
message(STATUS ".Net: Use .Net 6.0 LTS support: ${USE_DOTNET_6}")

# if(${SWIG_VERSION} VERSION_GREATER_EQUAL 4) list(APPEND CMAKE_SWIG_FLAGS
# "-doxygen") endif()

Expand Down Expand Up @@ -44,19 +54,42 @@ elseif(UNIX)
endif()

list(APPEND CMAKE_SWIG_FLAGS ${FLAGS} "-I${PROJECT_SOURCE_DIR}")
target_link_libraries(cspy-dotnet-native PRIVATE BiDirectionalDotnet)

# Needed by dotnet/CMakeLists.txt
set(DOTNET_PACKAGE cspy.DN)
set(DOTNET_PACKAGE cspy.Dotnet)
set(DOTNET_PACKAGES_DIR "${PROJECT_BINARY_DIR}/dotnet/packages")

# Runtime IDentifier see:
# https://docs.microsoft.com/en-us/dotnet/core/rid-catalog
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
set(DOTNET_PLATFORM arm64)
else()
set(DOTNET_PLATFORM x64)
endif()

# see: https://docs.microsoft.com/en-us/dotnet/standard/frameworks
if(USE_DOTNET_CORE_31 AND USE_DOTNET_6)
set(DOTNET_TFM "<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>")
elseif(USE_DOTNET_6)
set(DOTNET_TFM "<TargetFramework>net6.0</TargetFramework>")
elseif(USE_DOTNET_CORE_31)
set(DOTNET_TFM "<TargetFramework>netcoreapp3.1</TargetFramework>")
else()
message(FATAL_ERROR "No .Net SDK selected !")
endif()

if(APPLE)
set(RUNTIME_IDENTIFIER osx-x64)
set(RUNTIME_IDENTIFIER osx-${DOTNET_PLATFORM})
elseif(UNIX)
set(RUNTIME_IDENTIFIER linux-x64)
set(RUNTIME_IDENTIFIER linux-${DOTNET_PLATFORM})
elseif(WIN32)
set(RUNTIME_IDENTIFIER win-x64)
set(RUNTIME_IDENTIFIER win-${DOTNET_PLATFORM})
else()
message(FATAL_ERROR "Unsupported system !")
endif()
message(STATUS ".Net RID: ${RUNTIME_IDENTIFIER}")

set(DOTNET_NATIVE_PROJECT ${DOTNET_PACKAGE}.runtime.${RUNTIME_IDENTIFIER})
set(DOTNET_PROJECT ${DOTNET_PACKAGE})

Expand All @@ -75,7 +108,7 @@ message(STATUS ".Net runtime project: ${DOTNET_NATIVE_PROJECT}")
set(DOTNET_NATIVE_PATH ${PROJECT_BINARY_DIR}/dotnet/${DOTNET_NATIVE_PROJECT})
message(STATUS ".Net runtime project build path: ${DOTNET_NATIVE_PATH}")

# *.csproj.in contains: CMake variable(s) (@PROJECT_NAME@) that configure_file()
# *.csproj.in contains: CMake variable(s) (@pROJECT_NAME@) that configure_file()
# can manage and generator expression ($<TARGET_FILE:...>) that file(GENERATE)
# can manage.
configure_file(${PROJECT_SOURCE_DIR}/dotnet/${DOTNET_PACKAGE}.runtime.csproj.in
Expand Down Expand Up @@ -128,12 +161,12 @@ add_custom_target(
DEPENDS ${DOTNET_PATH}/${DOTNET_PROJECT}.csproj
COMMAND ${DOTNET_EXECUTABLE} build -c Release
${DOTNET_PROJECT}/${DOTNET_PROJECT}.csproj
COMMAND ${DOTNET_EXECUTABLE} pack -c Release
COMMAND ${DOTNET_EXECUTABLE} pack --no-build -c Release
${DOTNET_PROJECT}/${DOTNET_PROJECT}.csproj
BYPRODUCTS dotnet/${DOTNET_PROJECT}/bin dotnet/${DOTNET_PROJECT}/obj
dotnet/packages
WORKING_DIRECTORY dotnet)
add_dependencies(dotnet_package dotnet_native_package)
add_dependencies(dotnet_package dotnet_native_package cspy-dotnet-native)

# ##############################################################################
# .Net Test ##
Expand Down Expand Up @@ -165,7 +198,8 @@ function(add_dotnet_test FILE_NAME)
if(BUILD_TESTING)
add_test(
NAME dotnet_${TEST_NAME}
COMMAND ${DOTNET_EXECUTABLE} test --no-build -c Release
COMMAND ${DOTNET_EXECUTABLE} test --no-build --framework net6.0 -c Release
${TEST_NAME}.csproj
WORKING_DIRECTORY ${DOTNET_TEST_PATH})
endif()

Expand Down
2 changes: 1 addition & 1 deletion dotnet/Directory.Build.props.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<MinClientVersion>4.1.0</MinClientVersion>
<NeutralLanguage>en-UK</NeutralLanguage>
<Authors>David Torres Sanchez</Authors>
<Company>Lancaster Univeristy</Company>
<Company>Lancaster University</Company>
<Copyright>Copyright (c) 2021. David Torres Sanchez</Copyright>
<!-- Pack Option -->
<PackageTags>native;sample</PackageTags>
Expand Down
12 changes: 6 additions & 6 deletions dotnet/Test.csproj.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<LangVersion>7.3</LangVersion>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>8.0</LangVersion>
@DOTNET_TFM@
<EnableDefaultItems>false</EnableDefaultItems>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<!-- see https://github.com/dotnet/docs/issues/12237 -->
Expand Down Expand Up @@ -33,9 +33,9 @@

<ItemGroup>
<Compile Include="@FILE_NAME@" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="@DOTNET_PROJECT@" Version="@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="@DOTNET_PROJECT@" Version="@PROJECT_VERSION@" />
</ItemGroup>
</Project>
11 changes: 8 additions & 3 deletions dotnet/cspy.DN.csproj.in → dotnet/cspy.Dotnet.csproj.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>netstandard2.1;netstandard2.0</TargetFrameworks>
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
@DOTNET_TFM@
<RuntimeIdentifier>@RUNTIME_IDENTIFIER@</RuntimeIdentifier>
<AssemblyName>@DOTNET_PROJECT@</AssemblyName>
<Version>@PROJECT_VERSION@</Version>

Expand All @@ -26,16 +26,19 @@
<ItemGroup>
<RuntimeLinux Include="@DOTNET_PACKAGES_DIR@/@[email protected].*.nupkg"/>
<RuntimeOsx Include="@DOTNET_PACKAGES_DIR@/@[email protected].*.nupkg"/>
<RuntimeOsxArm Include="@DOTNET_PACKAGES_DIR@/@[email protected].*.nupkg"/>
<RuntimeWin Include="@DOTNET_PACKAGES_DIR@/@[email protected].*.nupkg"/>
</ItemGroup>
<Message Importance="high" Text="Package @[email protected]: found" Condition="Exists('@(RuntimeLinux)')"/>
<Message Importance="high" Text="------- $(OS) "/>
<Message Importance="high" Text="Package @[email protected]: not found" Condition="!Exists('@(RuntimeLinux)')"/>
<Message Importance="high" Text="Package @[email protected]: found" Condition="Exists('@(RuntimeOsxArm)')"/>
<Message Importance="high" Text="Package @[email protected]: not found" Condition="!Exists('@(RuntimeOsxArm)')"/>
<Message Importance="high" Text="Package @[email protected]: found" Condition="Exists('@(RuntimeOsx)')"/>
<Message Importance="high" Text="Package @[email protected]: not found" Condition="!Exists('@(RuntimeOsx)')"/>
<Message Importance="high" Text="Package @[email protected]: found" Condition="Exists('@(RuntimeWin)')"/>
<Message Importance="high" Text="Package @[email protected]: not found" Condition="!Exists('@(RuntimeWin)')"/>
<Error Text="You must locally 'dotnet pack' at least one @[email protected].{rid} Project." Condition="!Exists('@(RuntimeLinux)') AND !Exists('@(RuntimeOsx)') AND !Exists('@(RuntimeWin)')"/>
<Error Text="You must locally 'dotnet pack' at least one @[email protected].{rid} Project." Condition="!Exists('@(RuntimeLinux)') AND !Exists('@(RuntimeOsx)') AND !Exists('@(RuntimeWin)') AND !Exists('@(RuntimeOsxArm)')"/>
</Target>

<!-- Need to add required runtime dependencies so Meta-Project will pull runtime Nuget(s) -->
Expand All @@ -47,9 +50,11 @@
<ItemGroup>
<RuntimeLinux Include="@DOTNET_PACKAGES_DIR@/@[email protected].*.nupkg"/>
<RuntimeOsx Include="@DOTNET_PACKAGES_DIR@/@[email protected].*.nupkg"/>
<RuntimeOsxArm Include="@DOTNET_PACKAGES_DIR@/@[email protected].*.nupkg"/>
<RuntimeWin Include="@DOTNET_PACKAGES_DIR@/@[email protected].*.nupkg"/>
<PackageReference Include="@[email protected]" Version="@PROJECT_VERSION@" Condition="Exists('@(RuntimeLinux)')"/>
<PackageReference Include="@[email protected]" Version="@PROJECT_VERSION@" Condition="Exists('@(RuntimeOsx)')" />
<PackageReference Include="@[email protected]" Version="@PROJECT_VERSION@" Condition="Exists('@(RuntimeOsxArm)')" />
<PackageReference Include="@[email protected]" Version="@PROJECT_VERSION@" Condition="Exists('@(RuntimeWin)')" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>netstandard2.1;netstandard2.0</TargetFrameworks>
@DOTNET_TFM@
<RuntimeIdentifier>@RUNTIME_IDENTIFIER@</RuntimeIdentifier>
<AssemblyName>cspy-dotnet-native</AssemblyName>
<Version>@PROJECT_VERSION@</Version>
Expand All @@ -11,7 +11,7 @@
<IncludeBuildOutput>false</IncludeBuildOutput>

<!-- Pack Option -->
<Title>@DOTNET@ @RUNTIME_IDENTIFIER@ v@PROJECT_VERSION@</Title>
<Title>@DOTNET_PACKAGE@ @RUNTIME_IDENTIFIER@ v@PROJECT_VERSION@</Title>
<PackageId>@DOTNET_NATIVE_PROJECT@</PackageId>

<!-- Signing -->
Expand All @@ -22,12 +22,10 @@

<ItemGroup>
<!-- Native library must be in native directory... -->
<Content Include="$<TARGET_FILE:BiDirectionalCpp>">
<PackagePath>runtimes/@RUNTIME_IDENTIFIER@/native/%(Filename)%(Extension)</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$<TARGET_FILE:cspy-dotnet-native>">
<Content Include="
$<TARGET_FILE:cspy-dotnet-native>
$<$<STREQUAL:$<TARGET_PROPERTY:BiDirectionalCpp,TYPE>,SHARED_LIBRARY>:;$<TARGET_SONAME_FILE:BiDirectionalCpp>>
">
<PackagePath>runtimes/@RUNTIME_IDENTIFIER@/native/%(Filename)%(Extension)</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
4 changes: 4 additions & 0 deletions src/cc/bidirectional.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ class BiDirectional {
params_ptr_->setElementary(elementary_in);
}
/// @see bidirectional::Params
void setTwoCycleElimination(const bool& two_cycle_elimination_in) {
params_ptr_->setTwoCycleElimination(two_cycle_elimination_in);
}
/// @see bidirectional::Params
void setBoundsPruning(const bool& bounds_pruning_in) {
params_ptr_->setBoundsPruning(bounds_pruning_in);
}
Expand Down
Loading

0 comments on commit 27415f6

Please sign in to comment.