Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Set up build system for cmake

  • Loading branch information...
commit aba28dafc3ce187038906b48f7610b0d648f0c52 1 parent ddb6218
@pjotrp pjotrp authored
View
112 CMakeLists.txt
@@ -0,0 +1,112 @@
+# CMakeLists.txt root folder for ASCiLib (see http://biolib.open-bio.org/)
+#
+# Build everything:
+#
+# cmake .
+#
+# Conditionals:
+#
+# Build the libraries without language interfaces:
+#
+# cmake -DBUILD_LIBS:BOOLEAN=TRUE .
+# cmake -DBUILD_DOCS:BOOLEAN=TRUE .
+#
+# Build the Ruby/Python/Perl interface and libraries:
+#
+# cmake -DBUILD_RUBY:BOOLEAN=TRUE .
+# cmake -DBUILD_PYTHON:BOOLEAN=TRUE .
+# cmake -DBUILD_PERL:BOOLEAN=TRUE .
+#
+# To build specific libraries, for example
+#
+# cmake -DGSL_LIB:BOOLEAN=TRUE
+#
+# See ./INSTALL for more information
+
+cmake_minimum_required(VERSION 2.6)
+
+project (ASCILIB)
+
+ENABLE_TESTING()
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
+message("CMake modules: ${CMAKE_MODULE_PATH}")
+include(CheckIncludeFiles)
+
+message("Building ASciLib:")
+
+if(BUILD_ALL)
+ set(BUILD_RUBY TRUE)
+ set(BUILD_PERL TRUE)
+ set(BUILD_PYTHON TRUE)
+endif(BUILD_ALL)
+
+if(BUILD_RUBY)
+ message(" Ruby interface")
+ set(BUILD_LIBS TRUE)
+endif(BUILD_RUBY)
+
+if(BUILD_PYTHON)
+ message(" Python interface")
+ set(BUILD_LIBS TRUE)
+endif(BUILD_PYTHON)
+
+if(BUILD_PERL)
+ message(" Perl interface")
+ set(BUILD_LIBS TRUE)
+endif(BUILD_PERL)
+
+if(NOT BUILD_DOCS)
+ if(NOT BUILD_LIBS)
+ set(BUILD_LIBS TRUE)
+ message(" Building libraries only")
+ set(BUILD_RUBY TRUE)
+ message(" Ruby interface")
+ # set(BUILD_PYTHON TRUE)
+ # set(BUILD_PERL TRUE)
+ endif(NOT BUILD_LIBS)
+endif(NOT BUILD_DOCS)
+
+set(BLD_GSL TRUE)
+message(" ASciLib libraries")
+message(STATUS "Install GSL ${BLD_GSL}")
+
+FIND_PACKAGE(ASciLib)
+
+# SET(CMAKE_BUILD_TYPE Debug) Release is on by default
+if(DEBUG)
+ SET(CMAKE_BUILD_TYPE Debug)
+else(DEBUG)
+ SET(CMAKE_BUILD_TYPE Release)
+endif(DEBUG)
+SET(DEFAULT_BUILD_SHARED_LIBS ON)
+SET(BUILD_SHARED_LIBS ${DEFAULT_BUILD_SHARED_LIBS} CACHE BOOL "Building shared or static libraries")
+
+# Documentation
+if (BUILD_DOCS)
+INCLUDE (cmake_modules/APIDoc.cmake)
+endif (BUILD_DOCS)
+
+# Turn off chatty makefiles by default. To make them chatty again,
+# call make with VERBOSE=1 like this:
+#
+# make VERBOSE=1
+
+SET(CMAKE_VERBOSE_MAKEFILE OFF)
+
+############################################################
+# Set default search directory prefixes for third party libraries.
+
+SET(THIRD_PARTY_LIBRARY_PATH "" CACHE PATH "Default search path for third-party libraries")
+SET(THIRD_PARTY_INCLUDE_PATH "" CACHE PATH "Default search path for third-party headers")
+
+add_subdirectory (src)
+include(src)
+
+# Some status information at build time
+message("CMake: ${CMAKE_CACHE_MAJOR_VERSION}.${CMAKE_CACHE_MINOR_VERSION}-${CMAKE_CACHE_RELEASE_VERSION}")
+message("SWIG: ${SWIG_EXECUTABLE} ${SWIG_VERSION}")
+message("System: ${CMAKE_SYSTEM_PROCESSOR} ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}")
+message(" Build type: ${CMAKE_BUILD_TYPE} for ${CMAKE_HOST_SYSTEM_PROCESSOR}")
+EXECUTE_PROCESS(COMMAND /bin/date)
+
+
View
44 LICENSE
@@ -0,0 +1,44 @@
+Biolib consists of packages and acts like a distribution of libraries. All
+libraries are free software existing under an open source license, such as the
+GPL2, GPL3, BSD or artistic license. Each individual library has its own
+license - please check the root folder of the clib, usually in
+./src/clib/libraryname/ and the information that is in the original source tree
+of the project. We try to take care of compatibility between licenses in
+BioLib. If you find a conflict between licenses, or missing information, please
+report this to the BioLib project.
+
+If a license is not specified the code contributed to BioLib defaults to the
+BSD license:
+
+Copyright (c) 2008, 2009 The BioLib Project
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name of the The BioLib Project nor the names of
+ its contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+For more information on opensource software licenses see
+http://www.opensource.org/licenses/bsd-license.php,
+http://www.gnu.org/licenses/gpl.html and http://www.fsf.org/.
View
58 cmake_modules/FindASciLib.cmake
@@ -0,0 +1,58 @@
+# - Find ASCILIB settings
+#
+
+# ---- Get ASCILIB root
+get_filename_component(ASCILIB_ROOT ${CMAKE_MODULE_PATH} PATH)
+SET(ASCILIB_CLIBS_PATH ${ASCILIB_ROOT}/src/clibs)
+
+# ---- Get info from ./VERSION file
+SET(cat_prog cat)
+IF(WIN32)
+ IF(NOT UNIX)
+ SET(cat_prog type)
+ ENDIF(NOT UNIX)
+ENDIF(WIN32)
+
+EXEC_PROGRAM(${cat_prog} ARGS ${ASCILIB_ROOT}/VERSION OUTPUT_VARIABLE ASCILIB_VERSION)
+
+# ---- Add a predefinde build variable
+add_definitions(-DASCILIB_BUILD)
+
+# ---- Set default installation prefix
+
+IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ SET(CMAKE_INSTALL_PREFIX /usr)
+ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+message("PREFIX: ${CMAKE_INSTALL_PREFIX}")
+
+# ---- RPATH handling
+
+# use, i.e. don't skip the full RPATH for the build tree
+SET(CMAKE_SKIP_BUILD_RPATH FALSE)
+
+# when building, don't use the install RPATH already
+# (but later on when installing)
+SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+# the RPATH to be used when installing
+SET(CMAKE_INSTALL_RPATH "#{CMAKE_INSTALL_PREFIX}/lib")
+
+# don't add the automatically determined parts of the RPATH
+# which point to directories outside the build tree to the install RPATH
+SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
+
+MESSAGE("CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
+MESSAGE("ASCILIB_ROOT=${ASCILIB_ROOT}")
+MESSAGE("ASCILIB_CLIBS_PATH=${ASCILIB_CLIBS_PATH}")
+MESSAGE("ASCILIB_VERSION=${ASCILIB_VERSION}")
+
+# handle the QUIETLY and REQUIRED arguments and set RLIBS_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(xRLibs DEFAULT_MSG ASCILIB_VERSION)
+
+MARK_AS_ADVANCED(
+ ASCILIB_ROOT
+ ASCILIB_CLIBS_PATH
+ ASCILIB_VERSION
+ )
View
85 cmake_modules/FindPerlLibs.cmake
@@ -0,0 +1,85 @@
+# - Find Perl libraries
+#
+# This module finds if PERL is installed and determines where the include files
+# and libraries are (using the Config module first). It also determines what
+# the name of the library is. This code sets the following variables:
+#
+# PERL_INCLUDE_PATH = path to where perl.h is found
+# PERL_LIB_PATH = path where to install modules
+# PERL_SLIB_PATH = path where to install shared libraries (auto)
+# PERL_EXECUTABLE = full path to the perl binary
+#
+
+# ---- find the perl interpreter on the PATH
+FIND_PROGRAM(PERL_EXECUTABLE perl)
+
+IF (NOT PERL_EXECUTABLE)
+ FIND_PROGRAM(PERL_EXECUTABLE
+ NAMES perl
+ PATHS
+ /usr/bin
+ /usr/local/bin
+ /opt/local/bin
+ )
+ELSE (NOT PERL_EXECUTABLE)
+ message("Found Perl on PATH")
+ENDIF (NOT PERL_EXECUTABLE)
+
+message(STATUS "PERL_EXECUTABLE=${PERL_EXECUTABLE}")
+
+IF(PERL_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{version}" OUTPUT_VARIABLE PVERSION)
+ EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{archname}" OUTPUT_VARIABLE PARCH)
+ EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{archlib}" OUTPUT_VARIABLE PARCHLIB)
+ EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{sitearch}" OUTPUT_VARIABLE PSITEARCH)
+ EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{libperl}" OUTPUT_VARIABLE PLIBPERL)
+
+MESSAGE(STATUS "PLIBPERL=${PLIBPERL}")
+ # ---- Find perl.h and set PERL_INCLUDE_PATH
+ SET(PERL_POSSIBLE_INCLUDE_PATHS
+ ${PARCHLIB}
+ /usr/lib/perl5/${PVERSION}/${PARCH}/CORE
+ /usr/lib/perl/${PVERSION}/${PARCH}/CORE
+ /usr/lib/perl5/${PVERSION}/CORE
+ /usr/lib/perl/${PVERSION}/CORE
+ /usr/lib/perl5/5.8/CORE
+ /usr/lib/perl/5.8/CORE
+ /opt/local/lib/perl5/${PVERSION}/${PARCH}/CORE
+ /opt/local/lib/perl/${PVERSION}/${PARCH}/CORE
+ /opt/local/lib/perl5/${PVERSION}/CORE
+ /opt/local/lib/perl/${PVERSION}/CORE
+ )
+
+ FIND_PATH(PERL_INCLUDE_PATH perl.h ${PERL_POSSIBLE_INCLUDE_PATHS})
+ GET_FILENAME_COMPONENT(PERL_LIB_PATH ${PERL_INCLUDE_PATH} PATH)
+
+ # ---- Find location for installing shared libraries FIXME!
+ SET(PERL_LIB_PATH ${PSITEARCH})
+ SET(PERL_SLIB_PATH ${PSITEARCH})
+
+ FIND_FILE(PERLLIB_LIBRARY ${PLIBPERL}
+ ${PERL_POSSIBLE_INCLUDE_PATHS}
+ ${NIX_LIB_PATH}
+ /lib
+ /usr/lib
+ )
+ MESSAGE("PERLLIB_LIBRARY=${PERLLIB_LIBRARY}")
+
+ SET(PERL_LIBRARY ${PERLLIB_LIBRARY})
+ENDIF(PERL_EXECUTABLE)
+
+message(STATUS "PERL_INCLUDE_PATH=${PERL_INCLUDE_PATH}")
+message(STATUS "PERL_LIB_PATH=${PERL_LIB_PATH}")
+message(STATUS "PERL_SLIB_PATH=${PERL_SLIB_PATH}")
+message(STATUS "PERL_LIBRARY=${PERL_LIBRARY}")
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PERL DEFAULT_MSG PERL_INCLUDE_PATH PERL_LIB_PATH PERL_SLIB_PATH PERL_LIBRARY)
+
+MARK_AS_ADVANCED(
+ PERL_INCLUDE_PATH
+ PERL_EXECUTABLE
+ PERL_LIB_PATH
+ PERL_SLIB_PATH
+ PERL_LIBRARY
+ )
View
104 cmake_modules/FindPythonLibs.cmake
@@ -0,0 +1,104 @@
+# Find Python interpreter and libs. Original version by:
+#
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# - Find Python
+# This module finds if Python is installed and determines where the include files
+# and libraries are. It also determines what the name of the library is. This
+# code sets the following variables:
+#
+# PYTHON_EXECUTABLE = full path to the python binary
+# PYTHON_INCLUDE_PATH = path to where python.h can be found
+# PYTHON_LIBRARY = path to where libpython.so* can be found
+# PYTHON_LIB_PATH = install location for libraries
+# PYTHON_LFLAGS = python compiler options for linking
+
+IF(PYTHON_FOUND)
+ # Already in cache, be silent
+ SET(PYTHON_FIND_QUIETLY TRUE)
+ENDIF(PYTHON_FOUND)
+
+FIND_PROGRAM(PYTHON_EXECUTABLE
+ NAMES python python2.5 python2.4 python2.3 python2.2
+ PATHS /usr/bin /usr/local/bin /usr/pkg/bin
+ )
+
+IF(PYTHON_EXECUTABLE)
+ EXEC_PROGRAM(${PYTHON_EXECUTABLE}
+ ARGS -c "\"import sys; print sys.version[:3]\""
+ OUTPUT_VARIABLE PYTHON_VERSION
+ RETURN_VALUE PYTHON_INCLUDE_PATH_RET
+ )
+ message("Python version=" ${PYTHON_VERSION})
+
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_config_var('CONFINCLUDEPY')"
+ OUTPUT_VARIABLE PYTHON_INC_DIR
+ )
+
+ message("PYTHON_INC_DIR="${PYTHON_INC_DIR})
+
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_config_var('LINKFORSHARED')"
+ OUTPUT_VARIABLE PYTHON_LFLAGS
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_python_lib()"
+ OUTPUT_VARIABLE PYTHON_POSSIBLE_LIB_PATH
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_config_var('LIBPL')"
+ OUTPUT_VARIABLE PYTHON_POSSIBLE_LIBRARY
+ )
+
+ # remove the new lines from the output by replacing them with empty strings
+ STRING(REPLACE "\n" "" PYTHON_INC_DIR "${PYTHON_INC_DIR}")
+ STRING(REPLACE "\n" "" PYTHON_POSSIBLE_LIB_PATH "${PYTHON_POSSIBLE_LIB_PATH}")
+ STRING(REPLACE "\n" "" PYTHON_LFLAGS "${PYTHON_LFLAGS}")
+ STRING(REPLACE "\n" "" PYTHON_POSSIBLE_LIBRARY "${PYTHON_POSSIBLE_LIBRARY}")
+
+ FIND_PATH(PYTHON_INCLUDE_PATH
+ NAMES Python.h
+ PATHS ${PYTHON_INC_DIR}
+ )
+
+ FIND_LIBRARY(PYTHON_LIBRARY
+ NAMES python${PYTHON_VERSION} python python2.5 python2.4 python2.3 python2.2
+ PATHS ${PYTHON_POSSIBLE_LIBRARY}
+ )
+
+ SET(PYTHON_LIB_PATH ${PYTHON_POSSIBLE_LIB_PATH})
+
+ IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_PATH)
+ SET(PYTHON_FOUND TRUE)
+ ENDIF(PYTHON_LIBRARY AND PYTHON_INCLUDE_PATH)
+
+ message("PYTHON_EXECUTABLE="${PYTHON_EXECUTABLE})
+ message("PYTHON_INCLUDE_PATH="${PYTHON_INCLUDE_PATH})
+ message("PYTHON_LIB_PATH="${PYTHON_LIB_PATH})
+ message("PYTHON_LIBRARY="${PYTHON_LIBRARY})
+
+ MARK_AS_ADVANCED(
+ PYTHON_EXECUTABLE
+ PYTHON_INCLUDE_PATH
+ PYTHON_LIB_PATH
+ PYTHON_LFLAGS
+ )
+
+ENDIF(PYTHON_EXECUTABLE)
Please sign in to comment.
Something went wrong with that request. Please try again.