Easy compile on Win with mingw32

fixes-turtlebasket
Mattia Montanari 2021-07-03 13:28:12 +02:00
parent 6ef178f508
commit f8d043ed59
2 changed files with 10 additions and 5 deletions

View File

@ -42,12 +42,17 @@ set(SOURCE_FILES main.c )
# Create the executable # Create the executable
add_executable(demo ${SOURCE_FILES}) add_executable(demo ${SOURCE_FILES})
# Copy input files after build # Copy input files for this example after build
add_custom_command( add_custom_command(
TARGET demo POST_BUILD TARGET demo POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/*.dat ${CMAKE_CURRENT_SOURCE_DIR}/userP.dat
${CMAKE_CURRENT_BINARY_DIR}/ ) ${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 # PLATFORM-SPECIFIC SETTING
if (UNIX) if (UNIX)

View File

@ -77,7 +77,7 @@ int readinput(const char *inputfile, double ***pts, int * out) {
} }
/* Read number of input vertices. */ /* Read number of input vertices. */
if (fscanf_s(fp, "%d", &npoints) != 1) if (fscanf(fp, "%d", &npoints) != 1)
return 1; return 1;
/* Allocate memory. */ /* Allocate memory. */
@ -88,7 +88,7 @@ int readinput(const char *inputfile, double ***pts, int * out) {
/* Read and store vertices' coordinates. */ /* Read and store vertices' coordinates. */
for (idx = 0; idx < npoints; idx++) 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; return 1;
} }