Skip to content

Commit

Permalink
Use shared lib scotch
Browse files Browse the repository at this point in the history
This is based on cmake as in OpenCMISS-Dependencies/scotch with
fixes described in  OpenCMISS-Dependencies/scotch#5

Fixes laristra/flecsi#54 and #1
  • Loading branch information
junghans committed May 9, 2016
1 parent 17aa693 commit 2f39ccc
Showing 3 changed files with 13 additions and 38 deletions.
51 changes: 13 additions & 38 deletions cmake/scotch.cmake
Original file line number Diff line number Diff line change
@@ -1,54 +1,29 @@
set(SCOTCH_NAME scotch)
set(SCOTCH_URL ${PROJECT_SOURCE_DIR}/files)
set(SCOTCH_GZ scotch_6.0.4.tar.gz)
set(SCOTCH_MD5 "d58b825eb95e1db77efe8c6ff42d329f")
set(SCOTCH_GZ scotch_6.0.3-cmake.tar.gz)
set(SCOTCH_MD5 "90877bc3a6db6010e3587fe23bdac758")


find_program(FLEX flex)
if (NOT FLEX)
message( FATAL_ERROR
"'flex' lexical parser not found. Cannot build scotch." )
endif()

if (APPLE)
set(SCOTCH_MAKE Makefile.inc.i686_mac_darwin10)
set(SCOTCH_CFLAGS "-Drestrict=__restrict -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DCOMMON_TIMING_OLD -DSCOTCH_PTHREAD -DSCOTCH_RENAME -DCOMMON_PTHREAD_BARRIER -I${ZLIB_INCLUDE_DIR}")
set(SCOTCH_LDFLAGS "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib ${ZLIB_LIBRARIES} -lm -lpthread")
else ()
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(SCOTCH_MAKE Makefile.inc.x86-64_pc_linux2)
set(SCOTCH_CFLAGS "-DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_PTHREAD -Drestrict=__restrict -DIDXSIZE64 -I${ZLIB_INCLUDE_DIR}")
else ()
set(SCOTCH_MAKE Makefile.inc.i686_pc_linux2)
set(SCOTCH_CFLAGS "-DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_PTHREAD -Drestrict=__restrict -I${ZLIB_INCLUDE_DIR}")
endif ()
set(SCOTCH_LDFLAGS "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib ${ZLIB_LIBRARIES} -lm -lrt -lpthread")
endif ()

ExternalProject_Add( ${SCOTCH_NAME}
DEPENDS ${ZLIB_PACKAGE_NAME}

URL ${SCOTCH_URL}/${SCOTCH_GZ}
URL_MD5 ${SCOTCH_MD5}
UPDATE_COMMAND ""

BUILD_IN_SOURCE 1

CONFIGURE_COMMAND rm -f src/Makefile.inc

COMMAND ln -s Make.inc/${SCOTCH_MAKE}
src/Makefile.inc

BUILD_COMMAND
$(MAKE) -C src
"CCS=${CMAKE_C_COMPILER}"
"CCD=${CMAKE_C_COMPILER}"
"CFLAGS=${CMAKE_C_FLAGS} ${SCOTCH_CFLAGS}"
"LDFLAGS=${SCOTCH_LDFLAGS}"
"CLIBFLAGS=-fPIC"
scotch
INSTALL_COMMAND
$(MAKE) -C src
"MKDIR=mkdir -p"
prefix=${CMAKE_INSTALL_PREFIX}
install
CMAKE_ARGS
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DUSE_BZ2:BOOL=OFF
-DBUILD_PTSCOTCH:BOOL=OFF
-DZLIB_INCLUDE_DIR:PATH=${ZLIB_INCLUDE_DIR}
-DZLIB_LIBRARIES:FILEPATH=${ZLIB_LIBRARIES}
)
Binary file added files/scotch_6.0.3-cmake.tar.gz
Binary file not shown.
Binary file removed files/scotch_6.0.4.tar.gz
Binary file not shown.

0 comments on commit 2f39ccc

Please sign in to comment.