Skip to content
Permalink
Browse files

dawg now builds with cmake

git-svn-id: svn://scit.us/dawg/stable@315 7e5b8c5c-87e2-0310-a459-8d91125b37d5
  • Loading branch information...
reedacartwright committed Apr 2, 2009
1 parent 69e1d77 commit 3f6fe0b5d361bff3a1760d220d0c610aafb872d7
@@ -0,0 +1,181 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
SET(CMAKE_BUILD_TYPE_INIT "RelWithDebInfo")
SET(CMAKE_VERBOSE_MAKEFILE ON)

PROJECT(dawg)

SET(PROJ_NAME "dawg")
SET(PROJ_EMAIL "reed@scit.us")
SET(PROJ_VERSION_BRANCH STABLE)
SET(PROJ_VERSION_MAJOR 1)
#SET(PROJ_VERSION_MINOR 2)
#SET(PROJ_VERSION_PATCH 0)

SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Modules")

FIND_PACKAGE(Subversion)
IF(Subversion_FOUND)
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} PROJ)
SET(VERSION_REV "${PROJ_WC_LAST_CHANGED_REV}")
ENDIF(Subversion_FOUND)

SET(PROJ_VERSION "${PROJ_VERSION_MAJOR}")
IF(${VERSION_MINOR})
SET(PROJ_VERSION "${PROJ_VERSION}.${PROJ_VERSION_MINOR}")
ENDIF(${VERSION_MINOR})
IF(${VERSION_PATCH})
SET(PROJ_VERSION "${PROJ_VERSION}.${PROJ_VERSION_PATCH}")
ENDIF(${VERSION_PATCH})
IF(DEFINED VERSION_BRANCH)
SET(PROJ_VERSION "${PROJ_VERSION}-${PROJ_VERSION_BRANCH}")
ENDIF(DEFINED VERSION_BRANCH)
IF(NOT ${VERSION_BRANCH} MATCHES RELEASE)
SET(PROJ_VERSION "${PROJ_VERSION}-r${PROJ_VERSION_REV}")
ENDIF(NOT ${VERSION_BRANCH} MATCHES RELEASE)

IF(APPLE)
IF(NOT DEFINED APPLE_BUNDLE)
SET(APPLE_BUNDLE ON)
ENDIF(NOT DEFINED APPLE_BUNDLE)
IF(NOT DEFINED APPLE_BUNDLE_APP)
SET(APPLE_BUNDLE_APP OFF)
ENDIF(NOT DEFINED APPLE_BUNDLE_APP)
ELSE(APPLE)
SET(APPLE_BUNDLE OFF)
SET(APPLE_BUNDLE_APP OFF)
ENDIF(APPLE)

IF(APPLE_BUNDLE)
# Create 32-bit Universal Binary
# SET(CMAKE_OSX_ARCHITECTURES "ppc;i386")
# SET(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-universal")
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX "/Applications")
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
ENDIF(APPLE_BUNDLE)

IF(WIN32 AND NOT UNIX)
SET(PROJ_DIR)
ELSEIF(APPLE_BUNDLE)
SET(PROJ_DIR)
ELSE(WIN32 AND NOT UNIX)
SET(PROJ_DIR "/${PROJ_NAME}-${PROJ_VERSION}")
ENDIF(WIN32 AND NOT UNIX)

SET(CMAKE_DATA_DIR "share${PROJ_DIR}" CACHE STRING
"Install location for data (relative to prefix).")
SET(CMAKE_DOC_DIR "doc${PROJ_DIR}" CACHE STRING
"Install location for documentation (relative to prefix).")
SET(CMAKE_MAN_DIR "man" CACHE STRING
"Install location for man pages (relative to prefix).")
MARK_AS_ADVANCED(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR)

SET(CPACK_SOURCE_IGNORE_FILES
"/CVS/" "/\\\\.svn/" "\\\\.swp$" "\\\\.#" "/#" ".*~$"
"/CMakeFiles/" "CMakeCache\\\\.txt"
"CPack.*Config\\\\.cmake" "cmake_install\\\\.cmake"
"install_manifest\\\\.txt$"
"_CPACK_PACKAGES" "_CPack_Packages"
"\\\\.vcproj" "\\\\.dir" "\\\\.ncb$" "\\\\.sln$" "\\\\.suo$"
"Makefile$" "\\\\.ilk" "\\\\.pdb"
"/releng/"
"${PROJ_NAME}[-]" "${PROJ_NAME}$" "${PROJ_NAME}\\\\.exe"
)

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simulator of Sequence Evolution")
SET(CPACK_PACKAGE_VENDOR "Reed A. Cartwright, PhD <reed@scit.us>")
SET(CPACK_PACKAGE_EXECUTABLES "dawg" "Dawg")

SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJ_NAME}")
SET(CPACK_PACKAGE_VERSION ${PROJ_VERSION})
SET(CPACK_PACKAGE_VERSION_MAJOR ${PROJ_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${PROJ_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${PROJ_VERSION_PATCH})
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/readme.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/copying.txt")

SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")

IF(NOT DEFINED CPACK_SYSTEM_NAME)
# make sure package is not Cygwin-unknown, for Cygwin just
# cygwin is good for the system name
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
SET(CPACK_SYSTEM_NAME Cygwin)
ELSE("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
ENDIF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
IF(CMAKE_CL_64)
SET(CPACK_SYSTEM_NAME win64-${CMAKE_SYSTEM_PROCESSOR})
ELSE(CMAKE_CL_64)
SET(CPACK_SYSTEM_NAME win32-${CMAKE_SYSTEM_PROCESSOR})
ENDIF(CMAKE_CL_64)
ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)

IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
# if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
# default to source package - system, on cygwin system is not
# needed
IF(CYGWIN)
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
ELSE(CYGWIN)
SET(CPACK_PACKAGE_FILE_NAME
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
ENDIF(CYGWIN)
ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)

IF(WIN32 AND NOT UNIX)
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
#SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\dawg.exe")
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\scit.us\\\\projects\\\\dawg\\\\")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\scit.us\\\\projects\\\\dawg\\\\")
SET(CPACK_NSIS_CONTACT "reed@scit.us")
SET(CPACK_NSIS_DISPLAY_NAME "${PROJ_NAME} ${PROJ_VERSION}")
SET(CPACK_NSIS_MODIFY_PATH ON)
ELSEIF(APPLE)
SET(CPACK_GENERATOR "PackageMaker")
SET(CPACK_SOURCE_GENERATOR "TGZ")
IF(APPLE_BUNDLE)
# make sure CMAKE_INSTALL_PREFIX ends in /
STRING(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN)
MATH(EXPR LEN "${LEN} -1" )
STRING(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH)
IF(NOT "${ENDCH}" STREQUAL "/")
SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
ENDIF(NOT "${ENDCH}" STREQUAL "/")
SET(CPACK_PACKAGE_DEFAULT_LOCATION ${CMAKE_INSTALL_PREFIX})
SET(PROJ_BUNDLE_NAME "${PROJ_NAME} ${PROJ_VERSION}")
IF(APPLE_BUNDLE_APP)
SET(PROJ_BUNDLE_LOCATION "../..")
SET(CPACK_PACKAGING_INSTALL_PREFIX "/${PROJ_BUNDLE_NAME}.app/Contents")
SET(CMAKE_INSTALL_PREFIX
"${CMAKE_INSTALL_PREFIX}${CMAKE_BUNDLE_NAME}.app/Contents")
ELSE(APPLE_BUNDLE_APP)
SET(CPACK_PACKAGING_INSTALL_PREFIX "/${PROJ_BUNDLE_NAME}")
SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}${CMAKE_BUNDLE_NAME}")
ENDIF(APPLE_BUNDLE_APP)
CONFIGURE_FILE("postflight.sh.in" "postflight.sh")
SET(CPACK_POSTFLIGHT_SCRIPT "postflight.sh")
ELSE(APPLE_BUNDLE)
ENDIF(APPLE_BUNDLE)
ELSE(WIN32 AND NOT UNIX)
SET(CPACK_GENERATOR "TGZ")
SET(CPACK_SOURCE_GENERATOR "TGZ")
SET(CPACK_STRIP_FILES "bin/spagedi")
ENDIF(WIN32 AND NOT UNIX)

INCLUDE(CPack)

INSTALL(FILES copying.txt readme.txt changelog.txt install.txt DESTINATION ${CMAKE_DOC_DIR})
INSTALL(FILES lambda.pl outsplit.pl nexus2fasta.pl varrep.pl DESTINATION ${CMAKE_DOC_DIR})

ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(examples)
ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(tests)

#INCLUDE(InstallRequiredSystemLibraries)

@@ -0,0 +1,75 @@
# - Look for GNU Bison, the parser generator
# Based off a news post from Andy Cedilnik at Kitware
# Defines the following:
# BISON_EXECUTABLE - path to the bison executable
# BISON_FILE - parse a file with bison
# BISON_PREFIX_OUTPUTS - Set to true to make BISON_FILE produce prefixed
# symbols in the generated output based on filename.
# So for ${filename}.y, you'll get ${filename}parse(), etc.
# instead of yyparse().
# BISON_GENERATE_DEFINES - Set to true to make BISON_FILE output the matching
# .h file for a .c file. You want this if you're using
# flex.

IF(NOT DEFINED BISON_PREFIX_OUTPUTS)
SET(BISON_PREFIX_OUTPUTS FALSE)
ENDIF(NOT DEFINED BISON_PREFIX_OUTPUTS)

IF(NOT DEFINED BISON_GENERATE_DEFINES)
SET(BISON_GENERATE_DEFINES FALSE)
ENDIF(NOT DEFINED BISON_GENERATE_DEFINES)

IF(NOT BISON_EXECUTABLE)
MESSAGE(STATUS "Looking for bison")
FIND_PROGRAM(BISON_EXECUTABLE bison)
IF(BISON_EXECUTABLE)
MESSAGE(STATUS "Looking for bison -- ${BISON_EXECUTABLE}")
ENDIF(BISON_EXECUTABLE)
ENDIF(NOT BISON_EXECUTABLE)

IF(BISON_EXECUTABLE)
MACRO(BISON_FILE FILENAME)
GET_FILENAME_COMPONENT(PATH "${FILENAME}" PATH)
IF("${PATH}" STREQUAL "")
SET(PATH_OPT "")
ELSE("${PATH}" STREQUAL "")
SET(PATH_OPT "/${PATH}")
ENDIF("${PATH}" STREQUAL "")
GET_FILENAME_COMPONENT(HEAD "${FILENAME}" NAME_WE)
IF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")
FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")
ENDIF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")
GET_FILENAME_COMPONENT(EXT "${FILENAME}" EXT)
STRING(REGEX REPLACE "y" "c" EXT "${EXT}")
STRING(REGEX REPLACE "c" "h" HEXT "${EXT}")
IF(BISON_PREFIX_OUTPUTS)
SET(PREFIX "${HEAD}")
ELSE(BISON_PREFIX_OUTPUTS)
SET(PREFIX "yy")
ENDIF(BISON_PREFIX_OUTPUTS)
SET(OUTFILE "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}/${HEAD}.tab${EXT}")
IF(BISON_GENERATE_DEFINES)
SET(HEADER "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}/${HEAD}.tab${HEXT}")
ADD_CUSTOM_COMMAND(
OUTPUT "${OUTFILE}" "${HEADER}"
COMMAND "${BISON_EXECUTABLE}"
ARGS "--name-prefix=${PREFIX}"
"--defines"
"--output-file=${OUTFILE}"
"${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")
SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" "${HEADER}" PROPERTIES GENERATED TRUE)
SET_SOURCE_FILES_PROPERTIES("${HEADER}" PROPERTIES HEADER_FILE_ONLY TRUE)
ELSE(BISON_GENERATE_DEFINES)
ADD_CUSTOM_COMMAND(
OUTPUT "${OUTFILE}"
COMMAND "${BISON_EXECUTABLE}"
ARGS "--name-prefix=${PREFIX}"
"--output-file=${OUTFILE}"
"${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")
SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" PROPERTIES GENERATED TRUE)
ENDIF(BISON_GENERATE_DEFINES)
ENDMACRO(BISON_FILE)
ENDIF(BISON_EXECUTABLE)

@@ -0,0 +1,49 @@
# - Look for GNU flex, the lexer generator.
# Defines the following:
# FLEX_EXECUTABLE - path to the flex executable
# FLEX_FILE - parse a file with flex
# FLEX_PREFIX_OUTPUTS - Set to true to make FLEX_FILE produce outputs of
# lex.${filename}.c, not lex.yy.c . Passes -P to flex.

IF(NOT DEFINED FLEX_PREFIX_OUTPUTS)
SET(FLEX_PREFIX_OUTPUTS FALSE)
ENDIF(NOT DEFINED FLEX_PREFIX_OUTPUTS)

IF(NOT FLEX_EXECUTABLE)
MESSAGE(STATUS "Looking for flex")
FIND_PROGRAM(FLEX_EXECUTABLE flex)
IF(FLEX_EXECUTABLE)
MESSAGE(STATUS "Looking for flex -- ${FLEX_EXECUTABLE}")
ENDIF(FLEX_EXECUTABLE)
ENDIF(NOT FLEX_EXECUTABLE)

IF(FLEX_EXECUTABLE)
MACRO(FLEX_FILE FILENAME)
GET_FILENAME_COMPONENT(PATH "${FILENAME}" PATH)
IF("${PATH}" STREQUAL "")
SET(PATH_OPT "")
ELSE("${PATH}" STREQUAL "")
SET(PATH_OPT "/${PATH}")
ENDIF("${PATH}" STREQUAL "")
IF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")
FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")
ENDIF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")
GET_FILENAME_COMPONENT(EXT "${FILENAME}" EXT)
STRING(REGEX REPLACE "l" "c" EXT "${EXT}")
IF(FLEX_PREFIX_OUTPUTS)
GET_FILENAME_COMPONENT(PREFIX "${FILENAME}" NAME_WE)
ELSE(FLEX_PREFIX_OUTPUTS)
SET(PREFIX "yy")
ENDIF(FLEX_PREFIX_OUTPUTS)
SET(OUTFILE "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}/lex.${PREFIX}${EXT}")
ADD_CUSTOM_COMMAND(
OUTPUT "${OUTFILE}"
COMMAND "${FLEX_EXECUTABLE}"
ARGS "-P${PREFIX}"
"-o${OUTFILE}"
"${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")
SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" PROPERTIES GENERATED TRUE)
ENDMACRO(FLEX_FILE)
ENDIF(FLEX_EXECUTABLE)

File renamed without changes.
File renamed without changes.
No changes.
@@ -0,0 +1,8 @@
INSTALL(FILES
example0.dawg
example1.dawg
example2.dawg
example3.dawg
example4.dawg
DESTINATION "${CMAKE_DATA_DIR}/examples")

File renamed without changes.
File renamed without changes.

0 comments on commit 3f6fe0b

Please sign in to comment.
You can’t perform that action at this time.