Skip to content

Commit

Permalink
[WIP] init vcpkg. Disable alphaShapes for now (cf CGAL/cgal#7667)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Dec 11, 2023
1 parent ae0a12d commit 66c2f06
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 1 deletion.
50 changes: 50 additions & 0 deletions .github/workflows/vcpkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build with vcpkg on Windows

on:
push:
branches-ignore:
- '*'
pull_request:
branches:
- '*'

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache vcpkg dependencies
uses: actions/cache@v2
with:
path: vcpkg_installed
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg/vcpkg-export.txt') }}

- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
- name: Install vcpkg dependencies
run: |
cd vcpkg
.\vcpkg install cgal
- name: Export vcpkg installed packages
run: |
cd vcpkg
.\vcpkg list > vcpkg-export.txt
- name: Set up vcpkg environment
run: |
echo "::add-path::${RUNNER_WORKSPACE}\\vcpkg"
- name: Build project with vcpkg
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSFCGAL_BUILD_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=${RUNNER_WORKSPACE}\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake
cmake --build build
ctest -V --output-on-failure --test-dir build
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ test/unit/unit-test-SFCGAL
*/.DS_Store

build
/.vs
/out/install/x64-Debug/include/SFCGAL
/CMakeSettings.json
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
file( GLOB_RECURSE SFCGAL_SOURCES "*.cpp" )
file( GLOB_RECURSE SFCGAL_HEADERS "*.h" )

if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC )
list(REMOVE_ITEM SFCGAL_SOURCES ${CMAKE_SOURCE_DIR}/src/algorithm/alphaShapes.cpp)
list(REMOVE_ITEM SFCGAL_HEADERS ${CMAKE_SOURCE_DIR}/src/algorithm/alphaShapes.h)
endif()

file( GLOB_RECURSE SFCGAL_HEADERS_COPIED RELATIVE ${CMAKE_SOURCE_DIR}/src "*.h" )
add_custom_target(copy)
foreach (header ${SFCGAL_HEADERS_COPIED})
Expand Down
5 changes: 4 additions & 1 deletion src/capi/sfcgal_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
#include <SFCGAL/io/ewkt.h>
#include <SFCGAL/io/wkt.h>

#if _MSC_VER && !__INTEL_COMPILER
#include <SFCGAL/algorithm/alphaShapes.h>
#endif
#include <SFCGAL/algorithm/area.h>
#include <SFCGAL/algorithm/convexHull.h>
#include <SFCGAL/algorithm/covers.h>
Expand Down Expand Up @@ -1216,6 +1218,7 @@ sfcgal_geometry_line_sub_string(const sfcgal_geometry_t *geom, double start,
return ls.release();
}

#if !_MSC_VER
extern "C" sfcgal_geometry_t *
sfcgal_geometry_alpha_shapes(const sfcgal_geometry_t *geom, double alpha,
bool allow_holes)
Expand Down Expand Up @@ -1258,7 +1261,7 @@ sfcgal_geometry_optimal_alpha_shapes(const sfcgal_geometry_t *geom,

return result.release();
}

#endif

extern "C" sfcgal_geometry_t *
sfcgal_y_monotone_partition_2(const sfcgal_geometry_t *geom)
Expand Down
2 changes: 2 additions & 0 deletions src/capi/sfcgal_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,7 @@ SFCGAL_API sfcgal_geometry_t *
sfcgal_geometry_line_sub_string(const sfcgal_geometry_t *geom, double start,
double end);

#if !_MSC_VER
/**
* Returns the alpha shapes of geom
* @pre isValid(geom) == true
Expand All @@ -1044,6 +1045,7 @@ sfcgal_geometry_alpha_shapes(const sfcgal_geometry_t *geom, double alpha,
SFCGAL_API sfcgal_geometry_t *
sfcgal_geometry_optimal_alpha_shapes(const sfcgal_geometry_t *geom,
bool allow_holes, size_t nb_components);
#endif

/**
* Returns the y monotone partition of a geometry (polygon without hole)
Expand Down
5 changes: 5 additions & 0 deletions test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ if( SFCGAL_USE_STATIC_LIBS )
endif()

file( GLOB_RECURSE SFCGAL_UNIT_TEST_SOURCES *.cpp )

if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC )
list(REMOVE_ITEM SFCGAL_UNIT_TEST_SOURCES ${CMAKE_SOURCE_DIR}/test/unit/SFCGAL/algorithm/AlphaShapesTest.cpp)
endif()

add_executable( unit-test-SFCGAL ${SFCGAL_UNIT_TEST_SOURCES} )
target_link_libraries( unit-test-SFCGAL SFCGAL)
target_link_libraries(unit-test-SFCGAL ${CGAL_3RD_PARTY_LIBRARIES} ${Boost_LIBRARIES})
Expand Down

0 comments on commit 66c2f06

Please sign in to comment.