Commit 136a31c9 authored by partyd's avatar partyd
Browse files

ENH: Build libarchive as an external project.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@15525 3bd1e089-480b-0410-8dfb-8563597acbee
parent 9a283bfa
......@@ -32,7 +32,6 @@ ENDFOREACH()
# --------------------------------------------------------------------------
# Include dirs
set(include_dirs
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
......@@ -52,8 +51,7 @@ set(include_dirs
${FreeSurfer_BINARY_DIR}
${RemoteIO_SOURCE_DIR}
${RemoteIO_BINARY_DIR}
${libarchive_SOURCE_DIR}
${libarchive_BINARY_DIR}
${LibArchive_INCLUDE_DIR}
)
IF(Slicer_USE_PYTHONQT)
......@@ -170,7 +168,7 @@ SET(libs
FreeSurfer
${VTK_LIBRARIES}
RemoteIO
cmlibarchive
${LibArchive_LIBRARY}
)
IF(Slicer_USE_PYTHONQT)
......
......@@ -13,8 +13,8 @@
#include "vtkArchive.h"
// LibArchive includes
#include <libarchive/archive.h>
#include <libarchive/archive_entry.h>
#include <archive.h>
#include <archive_entry.h>
// Std includes
#include <cstdio>
......
......@@ -491,6 +491,11 @@ INCLUDE(${Teem_USE_FILE})
FIND_PACKAGE(SLICERLIBCURL REQUIRED)
INCLUDE(${SLICERLIBCURL_USE_FILE})
#-----------------------------------------------------------------------------
# LibArchive
#-----------------------------------------------------------------------------
FIND_PACKAGE(LibArchive REQUIRED)
#-----------------------------------------------------------------------------
# BatchMake
#-----------------------------------------------------------------------------
......@@ -533,18 +538,6 @@ IF(Slicer_USE_OPENCV)
#INCLUDE(${OPENCV_USE_FILE})
ENDIF()
#-----------------------------------------------------------------------------
# libarchive
#-----------------------------------------------------------------------------
SET(HAVE_LIBZ TRUE)
SET(HAVE_ZLIB_H TRUE)
SET(ZLIB_INCLUDE_DIR ${VTK_SOURCE_DIR}/Utilities/vtkzLib)
SET(ZLIB_LIBRARIES ${VTK_ZLIB_LIBRARIES})
SET(ZLIB_LIBRARY ${VTK_ZLIB_LIBRARIES})
SET(BUILD_ARCHIVE_WITHIN_CMAKE TRUE)
ADD_DEFINITIONS(-DLIBARCHIVE_STATIC)
ADD_SUBDIRECTORY(Utilities/libarchive)
#-----------------------------------------------------------------------------
# Need some Tcl/Tk info
#-----------------------------------------------------------------------------
......
......@@ -102,7 +102,8 @@ set(BatchMake_DEPENDENCIES Insight)
set(OpenIGTLink_DEPENDENCIES)
set(teem_DEPENDENCIES VTK)
set(cmcurl_DEPENDENCIES)
set(slicer_DEPENDENCIES VTK Insight BatchMake OpenIGTLink teem cmcurl)
set(libarchive_DEPENDENCIES)
set(slicer_DEPENDENCIES VTK Insight BatchMake OpenIGTLink teem cmcurl libarchive)
#------------------------------------------------------------------------------
# Conditionnaly include ExternalProject Target
......@@ -150,6 +151,7 @@ include(SuperBuild/External_teem.cmake)
include(SuperBuild/External_OpenIGTLink.cmake)
include(SuperBuild/External_BatchMake.cmake)
include(SuperBuild/External_cmcurl.cmake)
include(SuperBuild/External_libarchive.cmake)
#-----------------------------------------------------------------------------
# Update external project dependencies
......@@ -281,6 +283,9 @@ ExternalProject_Add(${proj}
-DSlicer_TCL_DIR:PATH=${tcl_build}
# cmcurl
-DSLICERLIBCURL_DIR:PATH=${SLICERLIBCURL_DIR}
# libarchive
-DLibArchive_INCLUDE_DIR:PATH=${LIBARCHIVE_INCLUDE_DIR}
-DLibArchive_LIBRARY:PATH=${LIBARCHIVE_LIBRARY}
# Python
-DSlicer_USE_SYSTEM_PYTHON:BOOL=OFF
-DPYTHON_EXECUTABLE:FILEPATH=${slicer_PYTHON_EXECUTABLE}
......
#-----------------------------------------------------------------------------
# Get and build LIBARCHIVE (libarchive)
set(libarchive_URL http://libarchive.googlecode.com/files/libarchive-2.8.4.tar.gz)
set(libarchive_MD5 83b237a542f27969a8d68ac217dc3796)
set(proj libarchive)
ExternalProject_Add(${proj}
URL http://libarchive.googlecode.com/files/libarchive-2.8.4.tar.gz
URL_MD5 ${libarchive_MD5}
SOURCE_DIR libarchive
BINARY_DIR libarchive-build
INSTALL_DIR libarchive-install
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
${ep_common_args}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
-DCMAKE_C_FLAGS:STRING=${ep_common_c_flags}
-DBUILD_SHARED_LIBS:BOOL=ON
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
DEPENDS
${libarchive_DEPENDENCIES}
)
set(LIBARCHIVE_DIR ${CMAKE_BINARY_DIR}/libarchive-install)
set(LIBARCHIVE_INCLUDE_DIR ${LIBARCHIVE_DIR}/include)
set(LIBARCHIVE_LIBRARY)
if(WIN32)
set(LIBARCHIVE_LIBRARY ${LIBARCHIVE_DIR}/lib/archive.lib)
elseif(APPLE)
set(LIBARCHIVE_LIBRARY ${LIBARCHIVE_DIR}/lib/libarchive.dylib)
else()
set(LIBARCHIVE_LIBRARY ${LIBARCHIVE_DIR}/lib/libarchive.so)
endif()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment