From f8d043ed59a063d2e7ef1287dd13f0743869c6ea Mon Sep 17 00:00:00 2001 From: Mattia Montanari Date: Sat, 3 Jul 2021 13:28:12 +0200 Subject: [PATCH] Easy compile on Win with mingw32 --- examples/c/CMakeLists.txt | 11 ++++++++--- examples/c/main.c | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/examples/c/CMakeLists.txt b/examples/c/CMakeLists.txt index 253854c..01be2ad 100644 --- a/examples/c/CMakeLists.txt +++ b/examples/c/CMakeLists.txt @@ -42,12 +42,17 @@ set(SOURCE_FILES main.c ) # Create the executable add_executable(demo ${SOURCE_FILES}) -# Copy input files after build +# Copy input files for this example after build add_custom_command( TARGET demo POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/*.dat - ${CMAKE_CURRENT_BINARY_DIR}/ ) + ${CMAKE_CURRENT_SOURCE_DIR}/userP.dat + ${CMAKE_CURRENT_BINARY_DIR}/userP.dat ) +add_custom_command( + TARGET demo POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/userQ.dat + ${CMAKE_CURRENT_BINARY_DIR}/userQ.dat ) # PLATFORM-SPECIFIC SETTING if (UNIX) diff --git a/examples/c/main.c b/examples/c/main.c index 7258e87..7606bd1 100644 --- a/examples/c/main.c +++ b/examples/c/main.c @@ -77,7 +77,7 @@ int readinput(const char *inputfile, double ***pts, int * out) { } /* Read number of input vertices. */ - if (fscanf_s(fp, "%d", &npoints) != 1) + if (fscanf(fp, "%d", &npoints) != 1) return 1; /* Allocate memory. */ @@ -88,7 +88,7 @@ int readinput(const char *inputfile, double ***pts, int * out) { /* Read and store vertices' coordinates. */ for (idx = 0; idx < npoints; idx++) { - if (fscanf_s(fp, "%lf %lf %lf\n", &arr[idx][0], &arr[idx][1], &arr[idx][2]) != 3) + if (fscanf(fp, "%lf %lf %lf\n", &arr[idx][0], &arr[idx][1], &arr[idx][2]) != 3) return 1; }