To get parallel processing with OpenMP in programs that use ImageMagick, the program needs to contain ...
Code: Select all
#include "studio.h"
Code: Select all
#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <direct.h>
# include <io.h>
# if !defined(MAGICKCORE_HAVE_STRERROR)
# define HAVE_STRERROR
# endif
#endif
My workaround is to copy-paste the bits I do need from studio.h into my program, which is just this:
Code: Select all
#if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
# include <omp.h>
# define MAGICKCORE_OPENMP_SUPPORT 1
#endif
#if defined(MAGICKCORE_THREAD_SUPPORT)
# include <pthread.h>
//#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
//#include <winsock2.h>
//#include <ws2tcpip.h>
//#include <windows.h>
//#pragma comment (lib, "ws2_32.lib")
#endif
This works, and my program has OpenMP. But it seems to be a kludge. Perhaps IM can be smarter in distinguishing between Mingw and Cygwin.