################################################################################ ## ## Copyright (c) 2007-2009 Illumina, Inc. ## ## This software is covered by the "Illumina Genome Analyzer Software ## License Agreement" and the "Illumina Source Code License Agreement", ## and certain third party copyright/licenses, and any user of this ## source file is bound by the terms therein (see accompanying files ## Illumina_Genome_Analyzer_Software_License_Agreement.pdf and ## Illumina_Source_Code_License_Agreement.pdf and third party ## copyright/license notices). ## ## This file is part of the Consensus Assessment of Sequence And VAriation ## (CASAVA) software package. ## ## file CMakeLists.txt ## ## Configuration file for the opt subfolder (external tools) ## ## author Come Raczy ## ################################################################################ macro (resetFindBoost) unset (Boost_FOUND CACHE) unset (Boost_INCLUDE_DIRS CACHE) unset (Boost_INCLUDE_DIR CACHE) unset (Boost_LIBRARIES CACHE) unset (Boost_LIBRARY_DIRS CACHE) unset (Boost_VERSION CACHE) unset (Boost_LIB_VERSION CACHE) unset (Boost_MAJOR_VERSION CACHE) unset (Boost_MINOR_VERSION CACHE) unset (Boost_SUBMINOR_VERSION CACHE) unset (Boost_USE_STATIC_LIBS CACHE) unset (ENV{BOOST_LIBRARYDIR}) unset (Boost_USE_MULTITHREADED CACHE) foreach (COMPONENT ${CASAVA_BOOST_COMPONENTS}) STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT) unset (Boost_${UPPERCOMPONENT}_FOUND CACHE) unset (Boost_${UPPERCOMPONENT}_LIBRARY CACHE) unset (Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE CACHE) unset (Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG CACHE) endforeach (COMPONENT ${CASAVA_BOOST_COMPONENTS}) unset (Boost_FOUND) unset (Boost_INCLUDE_DIRS) unset (Boost_INCLUDE_DIR) unset (Boost_LIBRARIES) unset (Boost_LIBRARY_DIRS) unset (Boost_VERSION) unset (Boost_LIB_VERSION) unset (Boost_MAJOR_VERSION) unset (Boost_MINOR_VERSION) unset (Boost_SUBMINOR_VERSION) unset (Boost_USE_STATIC_LIBS) foreach (COMPONENT ${CASAVA_BOOST_COMPONENTS}) STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT) unset (Boost_${UPPERCOMPONENT}_FOUND) unset (Boost_${UPPERCOMPONENT}_LIBRARY) unset (Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE) unset (Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG) endforeach (COMPONENT ${CASAVA_BOOST_COMPONENTS}) endmacro (resetFindBoost) message(STATUS "Creating external tools in subdirectory opt") include ("${CASAVA_GLOBALS_CMAKE}") set (SAMTOOLS_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/${SAMTOOLS}") set (SAMTOOLS_LIB "${SAMTOOLS_LIB_DIR}/libbam.a") set (SAMTOOLS_DFLAGS "DFLAGS:=-D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE") set (SAMTOOLS_CFLAGS "") if (CASAVA_FORCE_STATIC_LINK) # Disable the interactive samtools functionality in case of --static # as the static linking of ncurses library is problemmatic on FedoraCore 10. set(SAMTOOLS_DFLAGS "${SAMTOOLS_DFLAGS} -D_CURSES_LIB=0 -static") set(SAMTOOLS_CFLAGS "CFLAGS:=-g -static -Wall -O2") endif (CASAVA_FORCE_STATIC_LINK) add_custom_command(OUTPUT "${SAMTOOLS_LIB}" COMMAND rm -rf "${CMAKE_CURRENT_BINARY_DIR}/${SAMTOOLS}" COMMAND tar -jxf "${SAMTOOS_REDIST_DIR}/${SAMTOOLS}.tar.bz2" COMMAND $(MAKE) -C "${CMAKE_CURRENT_BINARY_DIR}/${SAMTOOLS}" "${SAMTOOLS_DFLAGS}" "${SAMTOOLS_CFLAGS}" -f Makefile all MAIN_DEPENDENCY "${SAMTOOS_REDIST_DIR}/${SAMTOOLS}.tar.bz2" COMMENT "Building the SAM/BAM library and tools") add_custom_target(CASAVA_SAMTOOLS DEPENDS "${SAMTOOLS_LIB}") add_dependencies(CASAVA_OPT CASAVA_SAMTOOLS) set (SAMTOOLS_PROGRAM "${SAMTOOLS_DIR}/samtools") install(PROGRAMS "${SAMTOOLS_PROGRAM}" DESTINATION "${CASAVA_LIBEXECDIR}") # illumina_samtools_extensions: add_custom_target(CASAVA_ILMNSAMTOOLS COMMAND rm -rf "${CMAKE_CURRENT_BINARY_DIR}/${ILMNSAMTOOLS}" COMMAND tar -xzf "${ILMNSAMTOOLS_REDIST_DIR}/${ILMNSAMTOOLS}.tar.gz" COMMAND SAMTOOLS_DIR="${SAMTOOLS_LIB_DIR}" $(MAKE) -C "${CMAKE_CURRENT_BINARY_DIR}/${ILMNSAMTOOLS}" -f makefile all COMMENT "Building illumina_samtools_extensions") add_dependencies(CASAVA_ILMNSAMTOOLS CASAVA_SAMTOOLS) add_dependencies(CASAVA_OPT CASAVA_ILMNSAMTOOLS) set (BAM_CAT_PROGRAM "${ILMNSAMTOOLS_DIR}/bam_cat") install(PROGRAMS "${BAM_CAT_PROGRAM}" DESTINATION "${CASAVA_LIBEXECDIR}") set (EXPORT2SAM_PROGRAM "${ILMNSAMTOOLS_DIR}/illumina_export2sam.pl") install(PROGRAMS "${EXPORT2SAM_PROGRAM}" DESTINATION "${CASAVA_BINDIR}") # merge.xslt add_custom_target(CASAVA_MERGE_XSLT COMMAND rm -rf "${CMAKE_CURRENT_BINARY_DIR}/${MERGE_XSLT}" COMMAND tar -xzf "${MERGE_XSLT_REDIST_DIR}/${MERGE_XSLT}.tar.gz" COMMAND mv "${CMAKE_CURRENT_BINARY_DIR}/${MERGE_XSLT}/${MERGE_XSLT}" "${CMAKE_CURRENT_BINARY_DIR}/${MERGE_XSLT}/MergeXmlDocuments.xsl" COMMENT "Unpacking merge.xslt") add_dependencies(CASAVA_OPT CASAVA_MERGE_XSLT) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${MERGE_XSLT}/MergeXmlDocuments.xsl" DESTINATION "${CASAVA_DATADIR}/") # make sure unpacking happens regardless of whether ${CHART_DIRECTOR_DIR} exists add_custom_target(CASAVA_CHART_DIRECTOR COMMAND tar -zxf "${CHART_DIRECTOR_REDIST_DIR}/${CHART_DIRECTOR}.tar.gz" COMMAND rm -f "${CHART_DIRECTOR_DIR}/Linux/i686" COMMAND ln -s i386 "${CHART_DIRECTOR_DIR}/Linux/i686" COMMAND touch "${CHART_DIRECTOR_DIR}" COMMENT "Extracting the Chart director library and tools") add_dependencies(CASAVA_OPT CASAVA_CHART_DIRECTOR) # make sure unpacking happens regardless of whether ${CODE_MIN_DIR} exists add_custom_target(CASAVA_CODE_MIN COMMAND tar -zxf "${CODE_MIN_REDIST_DIR}/${CODE_MIN}.tar.gz" COMMAND touch "${CODE_MIN_DIR}" COMMENT "Extracting the CodeMin headers and examples") add_dependencies(CASAVA_OPT CASAVA_CODE_MIN) if (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") set (CHART_DIRECTOR_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CHART_DIRECTOR}/${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}") install (DIRECTORY "${CHART_DIRECTOR_DIR}/lib/fonts" DESTINATION "${CASAVA_PERL_LIBDIR}") else (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") set (CHART_DIRECTOR_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CHART_DIRECTOR}/${CMAKE_SYSTEM_NAME}") install (DIRECTORY ${CHART_DIRECTOR_DIR}/lib/ DESTINATION "${CASAVA_PERL_LIBDIR}" FILES_MATCHING PATTERN "*.dylib") endif(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") install (DIRECTORY ${CHART_DIRECTOR_DIR}/lib/ DESTINATION "${CASAVA_PERL_LIBDIR}" FILES_MATCHING PATTERN "*.pm") install (DIRECTORY ${CHART_DIRECTOR_DIR}/lib/ DESTINATION "${CASAVA_PERL_LIBDIR}" FILES_MATCHING PATTERN "*.so") install (FILES "${CHART_DIRECTOR_DIR}/lib/chartdir.lic" DESTINATION "${CASAVA_PERL_LIBDIR}") if (CASAVA_FORCE_STATIC_LINK) set(Boost_USE_STATIC_LIBS ON) endif (CASAVA_FORCE_STATIC_LINK) find_package(Boost ${CASAVA_BOOST_VERSION} COMPONENTS ${CASAVA_BOOST_COMPONENTS}) # # If the right version of boost is not found, it will be built from the distribution # if (NOT Boost_FOUND) if (BOOSTROOT) message (STATUS "BOOSTROOT is set to ${BOOSTROOT} but boost ${CASAVA_BOOST_VERSION} was not found.") message (FATAL_ERROR "Unset BOOSTROOT or set it to the root location of boost ${CASAVA_BOOST_VERSION}.") endif(BOOSTROOT) if (BOOST_ROOT) message (STATUS "BOOST_ROOT is set to ${BOOST_ROOT} but boost ${CASAVA_BOOST_VERSION} was not found.") message (FATAL_ERROR "Unset BOOST_ROOT or set it to the root location of boost ${CASAVA_BOOST_VERSION}.") endif(BOOST_ROOT) # Try to find it in target installation location resetFindBoost() message(STATUS "Boost ${CASAVA_BOOST_VERSION} not found. Boost will be built from the distribution...") set(ENV{CASAVA_BOOST_COMPONENTS} "${CASAVA_BOOST_COMPONENTS}") set(ENV{CASAVA_BOOST_VERSION} "${CASAVA_BOOST_VERSION}") execute_process(COMMAND "/bin/bash" "${CMAKE_SOURCE_DIR}/cmake/bootstrap/installBoost.sh" "${BOOST_REDIST_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/bootstrap" RESULT_VARIABLE TMP_RESULT ) if (NOT TMP_RESULT) message(STATUS "Successfuly built boost ${CASAVA_BOOST_VERSION} from the distribution package...") else (NOT TMP_RESULT) message (FATAL_ERROR "Failed to build boost ${CASAVA_BOOST_VERSION}") endif (NOT TMP_RESULT) set (BOOST_ROOT "${CMAKE_CURRENT_BINARY_DIR}/bootstrap" PARENT_SCOPE) #the re-distributed boost uses system layout which means no -mt in file names. set (Boost_USE_MULTITHREADED OFF PARENT_SCOPE) #force static linking with redistributed boost. set (Boost_USE_STATIC_LIBS ON PARENT_SCOPE) endif (NOT Boost_FOUND) add_subdirectory(RAMM)