Skip to content

Commit

Permalink
small cmake fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Apr 28, 2012
1 parent ddac79b commit 4bd82d0
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 19 deletions.
2 changes: 2 additions & 0 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ include(CMakeDetermineASMCompiler)
set(CMAKE_ASM_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY})

add_subdirectory(fdlibm)
set(LapackLIB lapack)

add_subdirectory(cmake)

set(FFTW_CONFIG --enable-shared --disable-fortran --disable-mpi --disable-openmp --disable-threads --enable-sse2 --enable-fma)
Expand Down
35 changes: 35 additions & 0 deletions external/cmake/Tests.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## MACRO adapted from http://www.opensource.apple.com/source/curl/curl-57.2/curl/CMakeLists.txt licensed under the MIT license
macro(COMPILE_TEST TEST_NAME)
if(NOT DEFINED(${TESE_NAME}))
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${TEST_NAME} ${TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS}")
if(CMAKE_REQUIRED_LIBRARIES)
set(TEST_NAME_ADD_LIBRARIES
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
endif(CMAKE_REQUIRED_LIBRARIES)

message(STATUS "Performing Test ${TEST_NAME}")
try_compile(${TEST_NAME}
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/cmake/tests.c
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
"${TEST_NAME_ADD_LIBRARIES}"
OUTPUT_VARIABLE OUTPUT)
if(${TEST_NAME})
set(${TEST_NAME} 1 CACHE INTERNAL "Test ${FUNCTION}" PARENT_SCOPE)
message(STATUS "Performing Test ${TEST_NAME} - Success")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing Curl Test ${TEST_NAME} passed with the following output:\n"
"${OUTPUT}\n")
else(${TEST_NAME})
message(STATUS "Performing Test ${TEST_NAME} - Failed" PARENT_SCOPE)
set(${TEST_NAME} "" CACHE INTERNAL "Test ${FUNCTION}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing Curl Test ${TEST_NAME} failed with the following output:\n"
"${OUTPUT}\n")
endif()
else()
message(STATUS "Skipped test ${TEST_NAME}")
message(STATUS "${${TEST_NAME}}")
endif()
endmacro()
1 change: 0 additions & 1 deletion external/cmake/arpack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ set(arpacksrc_STAT_SRCS
prefixlist(arpacksrc_STAT_SRCS "${arpacksrc_DIR}")

set(arpackutil_STAT_SRCS
arscnd.f # TO BE REMOVED
icnteq.f
icopy.f
iset.f
Expand Down
29 changes: 19 additions & 10 deletions external/cmake/fftw-3.3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,17 @@ addConfigHDefine("PACKAGE_VERSION" "\"${VER}\"" CODE)
addConfigHDefine("VERSION" "\"${VER}\"" CODE)
addConfigHDefine("FFTW_CC" "\"${CMAKE_C_FLAGS}\"" CODE)

check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stddef.h HAVE_STDDEF_H)
set(HeadersToCheck malloc.h sys/types.h stdlib.h strings.h string.h stdint.h
stddef.h sys/time.h unistd.h sys/stat.h sys/sysctl.h sys/time.h sys/types.h alloca.h c_asm.h
dlfcn.h inttypes.h intrinsics.h libintl.h limits.h mach/mach_time.h memory.h)

addConfigHVarB(HAVE_SYS_TYPES_H CODE)
addConfigHVarB(HAVE_STDINT_H CODE)
addConfigHVarB(HAVE_STDDEF_H CODE)
foreach(f ${HeadersToCheck})
string(TOUPPER ${f} name)
string(REPLACE "/" "_" name ${name})
string(REPLACE "." "_" name ${name})
check_include_file(${f} HAVE_${name})
addConfigHVarB(HAVE_${name} CODE)
endforeach()

########### DETECT FMA ###############
set(DEFAULT_FMA "powerpc" "ia64" "hppa" "mips64")
Expand Down Expand Up @@ -342,12 +346,17 @@ conditionalSet(COMBINED_THREADS HAVE_COMBINED_THREADS)
#################

set(FunctionsToCheck alloca abort BSDgettimeofday gettimeofday gethrtime read_real_time time_base_to_time drand48 sqrt memset posix_memalign memalign _mm_malloc _mm_free clock_gettime mach_absolute_time sysctl abort sinl cosl snprintf)
foreach(f ${FunctionToCheck})
foreach(f ${FunctionsToCheck})
string(TOUPPER ${f} name)
CheckFunctionExists(${f} HAVE_${name})
CHECK_FUNCTION_EXISTS(${f} HAVE_${name})
addConfigHVarB(HAVE_${name} CODE)
endforeach()

include(../Tests.cmake)
message(STATUS "Running test")
COMPILE_TEST(TIME_WITH_SYS_TIME)
addConfigHVarB(TIME_WITH_SYS_TIME CODE)

## MSVC inline fix ##
if(MSVC)
set(CODE "${CODE}\n#ifndef __cplusplus\n#define inline __inline\n#endif")
Expand Down Expand Up @@ -412,7 +421,7 @@ findObjects(FFTW${PREC_PREFIX}_SOURCES reodft kernel dft_scalar_codelets dft_sca
include_directories("${TOP_SRCDIR}/api" "${TOP_SRCDIR}/kernel" "${TOP_SRCDIR}/dft" "${TOP_SRCDIR}/dft/scalar" "${TOP_SRCDIR}/dft/simd" "${TOP_SRCDIR}/rdft" "${TOP_SRCDIR}/rdft/scalar" "${TOP_SRCDIR}/rdft/simd" "${TOP_SRCDIR}/reodft" "${TOP_SRCDIR}/simd-support")
add_library(fftw3${PREC_SUFFIX} SHARED ${FFTW${PREC_PREFIX}_SOURCES})

set_target_properties(fftw3${PREC_SUFFIX} PROPERTIES VERSION 3.3.0 SOVERSION 6:0:3)
set_target_properties(fftw3${PREC_SUFFIX} PROPERTIES VERSION 3.3.0)
install(TARGETS fftw3${PREC_SUFFIX} DESTINATION lib)

#add_subdirectory(tools)
Expand All @@ -421,7 +430,7 @@ install(TARGETS fftw3${PREC_SUFFIX} DESTINATION lib)
########### install files ###############

configure_file(${TOP_SRCDIR}/fftw.pc.in ${CMAKE_CURRENT_BINARY_DIR}/fftw3${PREC_SUFFIX}.pc)
install(FILES fftw3${PREC_SUFFIX}.pc DESTINATION lib/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fftw3${PREC_SUFFIX}.pc DESTINATION lib/pkgconfig)

## Type Sizes ##
include(CheckTypeSize)
Expand Down
5 changes: 3 additions & 2 deletions external/cmake/fftw-3.3/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ addObjects(api ${api_STAT_SRCS})

########### install files ###############

install(FILES fftw3.h fftw3.f DESTINATION include)
install(FILES fftw3.f03 DESTINATION lib/pkgconfig)
install(FILES ${TOP_SRCDIR}/api/fftw3.h ${TOP_SRCDIR}/api/fftw3.f DESTINATION include)
configure_file(${TOP_SRCDIR}/api/fftw3.f03.in ${CMAKE_CURRENT_BINARY_DIR}/fftw3.f03)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fftw3.f03 DESTINATION lib/pkgconfig)

include_directories("${TOP_SRCDIR}/kernel" "${TOP_SRCDIR}/dft" "${TOP_SRCDIR}/rdft" "${TOP_SRCDIR}/reodft")

Expand Down
3 changes: 1 addition & 2 deletions external/cmake/fftw-3.3/mpi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,12 @@ target_link_libraries(mpi-bench ${LIBFFTWTHREADS} fftw3${PREC_SUFFIX}_mpi fftw3$
set_target_properties(fftw3${PREC_SUFFIX}_mpi PROPERTIES VERSION 1.0.0 SOVERSION 1)
install(TARGETS fftw3${PREC_SUFFIX}_mpi ${INSTALL_TARGETS_DEFAULT_ARGS} DESTINATION lib)

install(FILES fftw3-mpi.h DESTINATION include)
endif(MPI)

########### install files ###############
configure_file(${TOP_SRCDIR}/mpi/fftw3-mpi.f03.in ${CMAKE_CURRENT_BINARY_DIR}/fftw3-mpi.f03)

install(FILES fftw3-mpi.h DESTINATION include)
install(FILES ${TOP_SRCDIR}/mpi/fftw3-mpi.h DESTINATION include)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fftw3-mpi.f03 DESTINATION lib/pkgconfig)

############ CHECKS ######################
Expand Down
17 changes: 17 additions & 0 deletions external/cmake/tests.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifdef TIME_WITH_SYS_TIME
//Standard test for TIME_WITH_SYS_TIME

#include <sys/types.h>
#include <sys/time.h>
#include <time.h>

int
main ()
{
if ((struct tm *) 0)
return 0;
;
return 0;
}

#endif
16 changes: 12 additions & 4 deletions external/fdlibm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ cmake_minimum_required(VERSION 2.8)
project(fdlibm)

enable_language(C)
# default to release build

IF (NOT DEFINED FDLIBM_MODE)
set(FDLIBM_MODE "_IEEE_LIBM")
set(FDLIBM_MODE _IEEE_LIBM)
ENDIF()
add_definitions("-D\"${FDLIBM_MODE}\"")
add_definitions("-D${FDLIBM_MODE}")

include(TestBigEndian)

TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
if(${IS_BIG_ENDIAN})
add_definitions("-D__BIG_ENDIAN")
else()
add_definitions("-D__LITTLE_ENDIAN")
endif()

set(SOURCES
b_exp.c
Expand Down Expand Up @@ -156,4 +164,4 @@ w_sinh.c
w_sqrt.c
)

add_library(fdmlib STATIC ${SOURCES})
add_library(fdlibm STATIC ${SOURCES})

0 comments on commit 4bd82d0

Please sign in to comment.