Skip to content

Commit

Permalink
Merge pull request #113 from xantares/mingw
Browse files Browse the repository at this point in the history
CMake enhancements
  • Loading branch information
matteo-frigo authored Nov 20, 2017
2 parents 2e0cfdd + 8ba34c4 commit 708b202
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 23 deletions.
27 changes: 23 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ option (ENABLE_SSE2 "Compile with SSE2 instruction set support" OFF)
option (ENABLE_AVX "Compile with AVX instruction set support" OFF)
option (ENABLE_AVX2 "Compile with AVX2 instruction set support" OFF)

option (DISABLE_FORTRAN "Disable Fortran wrapper routines" OFF)

include(GNUInstallDirs)


include (CheckIncludeFile)
check_include_file (alloca.h HAVE_ALLOCA_H)
check_include_file (altivec.h HAVE_ALTIVEC_H)
check_include_file (c_asm.h HAVE_C_ASM_H)
check_include_file (dlfcn.h HAVE_DLFCN_H)
check_include_file (intrinsics.h HAVE_INTRINSICS_H)
check_include_file (inttypes.h HAVE_INTTYPES_H)
check_include_file (libintl.h HAVE_LIBINTL_H)
Expand Down Expand Up @@ -67,14 +70,21 @@ check_prototype_definition (posix_memalign "int posix_memalign(void **memptr, si
include (CheckSymbolExists)
check_symbol_exists (clock_gettime time.h HAVE_CLOCK_GETTIME)
check_symbol_exists (gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
check_symbol_exists (getpagesize unistd.h HAVE_GETPAGESIZE)
check_symbol_exists (drand48 stdlib.h HAVE_DRAND48)
check_symbol_exists (srand48 stdlib.h HAVE_SRAND48)
check_symbol_exists (memalign malloc.h HAVE_MEMALIGN)
check_symbol_exists (posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
check_symbol_exists (mach_absolute_time mach/mach_time.h HAVE_MACH_ABSOLUTE_TIME)
check_symbol_exists (alloca alloca.h HAVE_ALLOCA)
if (NOT HAVE_ALLOCA)
unset (HAVE_ALLOCA CACHE)
check_symbol_exists (alloca malloc.h HAVE_ALLOCA)
endif ()
check_symbol_exists (isnan math.h HAVE_ISNAN)
check_symbol_exists (snprintf stdio.h HAVE_SNPRINTF)
check_symbol_exists (strchr string.h HAVE_STRCHR)
check_symbol_exists (sysctl unistd.h HAVE_SYSCTL)

if (UNIX)
set (CMAKE_REQUIRED_LIBRARIES m)
Expand All @@ -93,8 +103,11 @@ check_type_size ("unsigned long" SIZEOF_UNSIGNED_LONG)
check_type_size ("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG)
check_type_size ("size_t" SIZEOF_SIZE_T)
check_type_size ("ptrdiff_t" SIZEOF_PTRDIFF_T)
math (EXPR SIZEOF_INT_BITS "8 * ${SIZEOF_INT}")
set (C_FFTW_R2R_KIND "C_INT${SIZEOF_INT_BITS}_T")

if (UNIX)
find_library (LIBM_LIBRARY NAMES m)
if (LIBM_LIBRARY)
set (HAVE_LIBM TRUE)
endif ()

Expand Down Expand Up @@ -290,7 +303,6 @@ if (BUILD_SHARED_LIBS)
add_definitions (-DFFTW_DLL)
endif ()


add_library (${fftw3_lib} ${SOURCEFILES})
if (MSVC)
target_compile_definitions (${fftw3_lib} PRIVATE /bigobj)
Expand Down Expand Up @@ -349,8 +361,15 @@ install(TARGETS ${fftw3_lib}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

install (FILES api/fftw3.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if (EXISTS api/fftw3.f)
install (FILES api/fftw3.f DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if (EXISTS ${CMAKE_SOURCE_DIR}/api/fftw3.f)
install (FILES api/fftw3.f api/fftw3l.f03 api/fftw3q.f03 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif ()
if (EXISTS ${CMAKE_SOURCE_DIR}/api/fftw3.f03.in)
file (READ api/fftw3.f03.in FFTW3_F03_IN OFFSET 42)
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/fftw3.f03 "! Generated automatically. DO NOT EDIT!\n\n")
file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/fftw3.f03 " integer, parameter :: C_FFTW_R2R_KIND = ${C_FFTW_R2R_KIND}\n\n")
file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/fftw3.f03 "${FFTW3_F03_IN}")
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/fftw3.f03 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif ()

if (BUILD_TESTS)
Expand Down
35 changes: 16 additions & 19 deletions cmake.config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/* #undef C_ALLOCA */

/* Define to disable Fortran wrappers. */
/* #undef DISABLE_FORTRAN */
#cmakedefine DISABLE_FORTRAN 1

/* Define to dummy `main' function (if any) required to link to the Fortran
libraries. */
Expand Down Expand Up @@ -87,14 +87,11 @@
/* #undef HAVE_BSDGETTIMEOFDAY */

/* Define to 1 if you have the `clock_gettime' function. */
#cmakedefine HAVE_CLOCK_GETTIME
#cmakedefine01 HAVE_CLOCK_GETTIME

/* Define to 1 if you have the `cosl' function. */
#cmakedefine HAVE_COSL 1

/* Define to 1 if you have the <c_asm.h> header file. */
#cmakedefine HAVE_C_ASM_H 1

/* Define to 1 if you have the declaration of `cosl', and to 0 if you don't.
*/
#cmakedefine01 HAVE_DECL_COSL
Expand Down Expand Up @@ -127,6 +124,9 @@
don't. */
#cmakedefine01 HAVE_DECL_SRAND48

/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H 1

/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
/* #undef HAVE_DOPRNT */

Expand All @@ -145,15 +145,15 @@
/* Define to 1 if you have the `gethrtime' function. */
/* #undef HAVE_GETHRTIME */

/* Define to 1 if you have the `getpagesize' function. */
#cmakedefine HAVE_GETPAGESIZE 1

/* Define to 1 if you have the `gettimeofday' function. */
#cmakedefine HAVE_GETTIMEOFDAY 1

/* Define to 1 if hrtime_t is defined in <sys/time.h> */
/* #undef HAVE_HRTIME_T */

/* Define to 1 if you have the <intrinsics.h> header file. */
#cmakedefine HAVE_INTRINSICS_H 1

/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1

Expand All @@ -178,15 +178,15 @@
/* Define to 1 if you have the `mach_absolute_time' function. */
#cmakedefine HAVE_MACH_ABSOLUTE_TIME 1

/* Define to 1 if you have the <mach/mach_time.h> header file. */
#cmakedefine HAVE_MACH_MACH_TIME_H 1

/* Define to 1 if you have the <malloc.h> header file. */
#cmakedefine HAVE_MALLOC_H 1

/* Define to 1 if you have the `memalign' function. */
#cmakedefine HAVE_MEMALIGN 1

/* Define to 1 if you have the `memmove' function. */
#cmakedefine HAVE_MEMMOVE 1

/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H 1

Expand Down Expand Up @@ -224,7 +224,7 @@
#define HAVE_SQRT 1

/* Define to enable SSE/SSE2 optimizations. */
#cmakedefine01 HAVE_SSE2
#cmakedefine HAVE_SSE2 1

/* Define to 1 if you have the <stddef.h> header file. */
#cmakedefine HAVE_STDDEF_H 1
Expand All @@ -235,21 +235,21 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H 1

/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1

/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine HAVE_STRINGS_H 1

/* Define to 1 if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H 1

/* Define to 1 if you have the `sysctl' function. */
#define HAVE_SYSCTL 1
#cmakedefine HAVE_SYSCTL 1

/* Define to 1 if you have the <sys/stat.h> header file. */
#cmakedefine HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/sysctl.h> header file. */
#cmakedefine HAVE_SYS_SYSCTL_H 1

/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H 1

Expand Down Expand Up @@ -284,9 +284,6 @@
*/
#define LT_OBJDIR ".libs/"

/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */

/* Name of package */
#define PACKAGE "fftw"

Expand Down

0 comments on commit 708b202

Please sign in to comment.