Created
January 3, 2017 21:11
-
-
Save childsish/92acf361bf17d939a971cb19f5ffa344 to your computer and use it in GitHub Desktop.
Compiling igraph with CMake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INCLUDE(CheckCSourceCompiles) | |
INCLUDE(CheckFunctionExists) | |
INCLUDE(CheckIncludeFiles) | |
INCLUDE(CheckLibraryExists) | |
cmake_minimum_required(VERSION 3.6) | |
project(igraph) | |
set(CMAKE_CXX_STANDARD 11) | |
set(VERSION "0.7.1") | |
set(PACKAGE_VERSION "0.7.1") | |
set(IGRAPH_F77_SAVE "static IGRAPH_THREAD_LOCAL") | |
#set(HAVE_TLS 1) | |
# Include checks | |
check_include_files(dlfcn.h HAVE_DLFCN_H) | |
check_include_files(inttypes.h HAVE_INTTYPES_H) | |
check_include_files(memory.h HAVE_MEMORY_H) | |
check_include_files(stdarg.h HAVE_STDARG_H) | |
check_include_files(stdint.h HAVE_STDINT_H) | |
check_include_files(stdlib.h HAVE_STDLIB_H) | |
check_include_files(strings.h HAVE_STRINGS_H) | |
check_include_files(string.h HAVE_STRING_H) | |
check_include_files(sys/int_types.h HAVE_SYS_INT_TYPES_H) | |
check_include_files(sys/stat.h HAVE_SYS_STAT_H) | |
check_include_files(sys/types.h HAVE_SYS_TYPES_H) | |
check_include_files(sys/times.h HAVE_TIMES_H) | |
check_include_files(unistd.h HAVE_UNISTD_H) | |
check_include_files(time.h HAVE_TIMES_H) | |
# Function checks | |
check_function_exists(expm1 HAVE_EXPM1) | |
check_function_exists(fabsl HAVE_FABSL) | |
check_function_exists(finite HAVE_FINITE) | |
check_function_exists(fmin HAVE_FMIN) | |
check_function_exists(ftruncate HAVE_FTRUNCATE) | |
check_function_exists(isnan HAVE_ISNAN) | |
check_function_exists(log1p HAVE_LOG1P) | |
check_function_exists(log2 HAVE_LOG2) | |
check_function_exists(rint HAVE_RINT) | |
check_function_exists(rintf HAVE_RINTF) | |
check_function_exists(round HAVE_ROUND) | |
check_function_exists(snprintf HAVE_SNPRINTF) | |
check_function_exists(stpcpy HAVE_STPCPY) | |
check_function_exists(strcasecmp HAVE_STRCASECMP) | |
check_function_exists(strdup HAVE_STRDUP) | |
check_function_exists(_strdup HAVE__STRDUP) | |
#check_library_exists(f2c HAVE_LIBF2C) | |
check_c_source_compiles(" | |
__thread int tls; | |
int main(void) { | |
return 0; | |
}" HAVE_GCC_THREAD_LOCAL_STORAGE) | |
if (HAVE_GCC_THREAD_LOCAL_STORAGE) | |
set(IGRAPH_THREAD_LOCAL __thread) | |
endif() | |
configure_file(${PROJECT_SOURCE_DIR}/include/igraph_version.h.in | |
${PROJECT_BINARY_DIR}/include/igraph_version.h) | |
configure_file(${PROJECT_SOURCE_DIR}/include/igraph_threading.h.in | |
${PROJECT_BINARY_DIR}/include/igraph_threading.h) | |
configure_file(${PROJECT_SOURCE_DIR}/config.cmake.h.in | |
${PROJECT_BINARY_DIR}/include/config.h) | |
include_directories(include ${PROJECT_BINARY_DIR}/include | |
${PROJECT_SOURCE_DIR}/src) | |
add_executable(arithchk src/f2c/arithchk.c) | |
if(UNIX) | |
target_link_libraries(arithchk m) | |
endif() | |
set_target_properties(arithchk PROPERTIES COMPILE_DEFINITIONS | |
"NO_FPINIT;NO_LONG_LONG") | |
ADD_CUSTOM_COMMAND( | |
OUTPUT ${PROJECT_BINARY_DIR}/include/arith.h | |
COMMAND arithchk > ${PROJECT_BINARY_DIR}/include/arith.h | |
DEPENDS arithchk | |
) | |
file(GLOB F2S_SOURCE_FILES src/f2c/*.c*) | |
if(WIN32) | |
add_definitions(-D_COMPLEX_DEFINED) | |
endif() | |
add_library(f2c ${F2S_SOURCE_FILES} ${PROJECT_BINARY_DIR}/include/arith.h) | |
set_target_properties(f2c PROPERTIES COMPILE_DEFINITIONS "USE_CLOCK") | |
file(GLOB CS_SOURCE_FILES src/cs/*.c*) | |
add_library(cs ${CS_SOURCE_FILES}) | |
file(GLOB PRPACK_SOURCE_FILES src/prpack/*.c*) | |
add_library(prpack ${PRPACK_SOURCE_FILES}) | |
set_target_properties(prpack PROPERTIES COMPILE_DEFINITIONS | |
"PRPACK_IGRAPH_SUPPORT") | |
file(GLOB LAPACK_SOURCE_FILES src/lapack/*.c*) | |
add_library(lapack ${LAPACK_SOURCE_FILES} src/fortran_intrinsics.c) | |
target_link_libraries(lapack f2c) | |
file(GLOB IGRAPH_SOURCE_FILES src/*.c*) | |
add_library(igraph ${IGRAPH_SOURCE_FILES}) | |
target_link_libraries(igraph cs lapack prpack) | |
set_target_properties(igraph PROPERTIES COMPILE_DEFINITIONS | |
"PRPACK_IGRAPH_SUPPORT") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* config.h.in. Generated from configure.ac by autoheader. */ | |
/* Define to 1 if you have the <dlfcn.h> header file. */ | |
#cmakedefine HAVE_DLFCN_H | |
/* Define to 1 if you have the `expm1' function. */ | |
#cmakedefine HAVE_EXPM1 | |
/* Define to 1 if you have the `fabsl' function. */ | |
#cmakedefine HAVE_FABSL | |
/* Define to 1 if you have the `finite' function. */ | |
#cmakedefine HAVE_FINITE | |
/* Define to 1 if you have the `fmin' function. */ | |
#cmakedefine HAVE_FMIN | |
/* Define to 1 if you have the `ftruncate' function. */ | |
#cmakedefine HAVE_FTRUNCATE | |
/* Define to 1 if you have the GLPK library */ | |
#undef HAVE_GLPK | |
/* Define to 1 if you have the GMP library */ | |
#undef HAVE_GMP | |
/* Define to 1 if you have the <inttypes.h> header file. */ | |
#cmakedefine HAVE_INTTYPES_H | |
/* Define to 1 if you have the `isnan' function. */ | |
#cmakedefine HAVE_ISNAN | |
/* Define to 1 if you have the `arpack' library (-larpack). */ | |
#undef HAVE_LIBARPACK | |
/* Define to 1 if you have the `blas' library (-lblas). */ | |
#undef HAVE_LIBBLAS | |
/* Define to 1 if you have the `f2c' library (-lf2c). */ | |
#cmakedefine HAVE_LIBF2C | |
/* Define to 1 if you have the `lapack' library (-llapack). */ | |
#undef HAVE_LIBLAPACK | |
/* Define to 1 if you have the libxml2 libraries installed */ | |
#undef HAVE_LIBXML | |
/* Define to 1 if you have the `log1p' function. */ | |
#cmakedefine HAVE_LOG1P | |
/* Define to 1 if you have the `log2' function. */ | |
#cmakedefine HAVE_LOG2 | |
/* Define to 1 if you have the <memory.h> header file. */ | |
#cmakedefine HAVE_MEMORY_H | |
/* Define to 1 if you have the `rint' function. */ | |
#cmakedefine HAVE_RINT | |
/* Define to 1 if you have the `rintf' function. */ | |
#cmakedefine HAVE_RINTF | |
/* Define to 1 if you have the `round' function. */ | |
#cmakedefine HAVE_ROUND | |
/* Define to 1 if you have the `snprintf' function. */ | |
#cmakedefine HAVE_SNPRINTF | |
/* Define to 1 if you have the <stdarg.h> header file. */ | |
#cmakedefine HAVE_STDARG_H | |
/* Define to 1 if you have the <stdint.h> header file. */ | |
#cmakedefine HAVE_STDINT_H | |
/* Define to 1 if you have the <stdlib.h> header file. */ | |
#cmakedefine HAVE_STDLIB_H | |
/* Define to 1 if you have the `stpcpy' function. */ | |
#cmakedefine HAVE_STPCPY | |
/* Define to 1 if the stpcpy function has a signature */ | |
#undef HAVE_STPCPY_SIGNATURE | |
/* Define to 1 if you have the `strcasecmp' function. */ | |
#cmakedefine HAVE_STRCASECMP | |
/* Define to 1 if you have the `strdup' function. */ | |
#cmakedefine HAVE_STRDUP | |
/* Define to 1 if you have the <strings.h> header file. */ | |
#cmakedefine HAVE_STRINGS_H | |
/* Define to 1 if you have the <string.h> header file. */ | |
#cmakedefine HAVE_STRING_H | |
/* Define to 1 if you have the <sys/int_types.h> header file. */ | |
#cmakedefine HAVE_SYS_INT_TYPES_H | |
/* Define to 1 if you have the <sys/stat.h> header file. */ | |
#cmakedefine HAVE_SYS_STAT_H | |
/* Define to 1 if you have the <sys/types.h> header file. */ | |
#cmakedefine HAVE_SYS_TYPES_H | |
/* Define to 1 if you have the sys/times.h header */ | |
#cmakedefine HAVE_TIMES_H | |
/* Define to 1 if you have the <time.h> header file. */ | |
#cmakedefine HAVE_TIME_H | |
/* Define to 1 if you want to use thread-local storage for global igraph | |
structures */ | |
#undef HAVE_TLS | |
/* Define to 1 if you have the <unistd.h> header file. */ | |
#undef HAVE_UNISTD_H | |
/* Define to 1 if you have the `_strdup' function. */ | |
#cmakedefine HAVE__STRDUP | |
/* Keyword for thread local storage, or just static if not available */ | |
#cmakedefine IGRAPH_F77_SAVE @IGRAPH_F77_SAVE@ | |
/* Keyword for thread local storage, or empty if not available */ | |
#cmakedefine IGRAPH_THREAD_LOCAL @IGRAPH_THREAD_LOCAL@ | |
/* Define to 1 if you use the internal ARPACK library */ | |
#undef INTERNAL_ARPACK | |
/* Define to 1 if you use the internal BLAS library */ | |
#undef INTERNAL_BLAS | |
/* Define to 1 if you use the internal F2C library */ | |
#undef INTERNAL_F2C | |
/* Define to 1 if you use the internal GLPK library */ | |
#undef INTERNAL_GLPK | |
/* Define to 1 if you use the internal LAPACK library */ | |
#undef INTERNAL_LAPACK | |
/* Define to the sub-directory in which libtool stores uninstalled libraries. | |
*/ | |
#undef LT_OBJDIR | |
/* Name of package */ | |
#undef PACKAGE | |
/* Define to the address where bug reports for this package should be sent. */ | |
#undef PACKAGE_BUGREPORT | |
/* Define to the full name of this package. */ | |
#undef PACKAGE_NAME | |
/* Define to the full name and version of this package. */ | |
#undef PACKAGE_STRING | |
/* Define to the one symbol short name of this package. */ | |
#undef PACKAGE_TARNAME | |
/* Define to the home page for this package. */ | |
#undef PACKAGE_URL | |
/* Version number of package */ | |
#cmakedefine VERSION "@VERSION@" | |
/* Define to the version of this package. */ | |
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@" | |
/* Define to 1 if you have the ANSI C header files. */ | |
#undef STDC_HEADERS | |
/* If the compiler supports a TLS storage class define it to that here */ | |
#undef TLS | |
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a | |
`char[]'. */ | |
#undef YYTEXT_POINTER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment