CMakeLists.txt 2.08 KB
Newer Older
1
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6)
2 3 4
INCLUDE(CheckIncludeFiles)
INCLUDE(TestBigEndian)
INCLUDE(CheckCSourceCompiles)
5
INCLUDE(cmake/macros.cmake)
6 7
PROJECT(libaec)
SET(libaec_VERSION_MAJOR 0)
8
SET(libaec_VERSION_MINOR 3)
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
9
SET(libaec_VERSION_PATCH 2)
10 11 12 13 14 15
SET(CMAKE_BUILD_TYPE Release)
ENABLE_TESTING()

CHECK_INCLUDE_FILES(malloc.h HAVE_MALLOC_H)
CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
16 17 18 19 20 21
CHECK_CLZLL(HAVE_DECL___BUILTIN_CLZLL)
IF(NOT HAVE_DECL___BUILTIN_CLZLL)
  CHECK_BSR64(HAVE_BSR64)
ENDIF(NOT HAVE_DECL___BUILTIN_CLZLL)
FIND_INLINE_KEYWORD()
FIND_RESTRICT_KEYWORD()
22 23

CONFIGURE_FILE(
24
  ${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.h.in
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
25 26
  ${CMAKE_CURRENT_BINARY_DIR}/config.h
  )
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
27 28 29
ADD_DEFINITIONS("-DHAVE_CONFIG_H")

# Allow the developer to select if Dynamic or Static libraries are built
30 31
OPTION(BUILD_SHARED_LIBS "Build Shared Libraries" ON)
IF(BUILD_SHARED_LIBS)
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
32
  SET (LIB_TYPE SHARED)
33
ELSE(BUILD_SHARED_LIBS)
34 35 36 37 38
  IF(WIN32)
    MESSAGE(WARNING "You will have to modify libaec.h for static libs.")
  ENDIF(WIN32)
  SET(LIB_TYPE STATIC)
ENDIF(BUILD_SHARED_LIBS)
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
39

40
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}")
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
41
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}/src")
42 43
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/src")

44
ADD_SUBDIRECTORY(src)
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
45 46
# EXCLUDE_FROM_ALL doesn't seem to be working in VS
ADD_SUBDIRECTORY(tests)
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
47 48 49 50 51 52 53

SET(CPACK_PACKAGE_NAME "libaec")
SET(CPACK_PACKAGE_VENDOR "dkrz.de")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
  "libaec - Adaptive Entropy Coding library")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "3")
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
54
SET(CPACK_PACKAGE_VERSION_PATCH "3")
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "libaec")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README")

IF(CMAKE_CL_64)
  SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
  SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
    "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION} (Win64)")
ELSE(CMAKE_CL_64)
  SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
  SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
    "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
ENDIF(CMAKE_CL_64)

INCLUDE(CPack)