CMakeLists.txt 12.2 KB
Newer Older
1 2 3 4 5
#
# VLMC build system
# Authors: Rohit Yadav <rohityadav89@gmail.com>
#          Ludovic Fauvet <etix@vlmc.org>
#
Ludovic Fauvet's avatar
Ludovic Fauvet committed
6

7
# Project Info
8 9 10 11 12 13 14 15
SET(PROJECT_NAME_SHORT   "VLMC")
SET(PROJECT_NAME_LONG    "VideoLAN Movie Creator")
SET(PROJECT_DESCRIPTION  "VLMC (VideoLAN Movie Creator) is a cross-platform, non-linear video editing software based on the VLC Media Player.")
SET(PROJECT_COPYRIGHT    "Copyright (C) 2008-2010 VideoLAN")
SET(PROJECT_CONTACT      "vlmc-devel@videolan.org")
SET(PROJECT_VENDOR       "VLMC Team")
SET(ORG_WEBSITE          "videolan.org")

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
# Configuring build type
IF(NOT CMAKE_BUILD_TYPE)
    SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING
        "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
        FORCE)
    MESSAGE("Setting build type to '${CMAKE_BUILD_TYPE}'")
ELSE(NOT CMAKE_BUILD_TYPE)
    MESSAGE("Build type set to '${CMAKE_BUILD_TYPE}'")
ENDIF(NOT CMAKE_BUILD_TYPE)

IF(WIN32)
    # Building in release for WIN32
    SET(CMAKE_BUILD_TYPE "Release")
    SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
    # Use mingw's sprintf instead of windows's
    ADD_DEFINITIONS( -D__USE_MINGW_ANSI_STDIO=1 )
ENDIF(WIN32)

34 35 36 37 38 39 40 41 42 43
# Find Git Version Patch   
FIND_PROGRAM(GIT git)
IF(GIT)
    EXECUTE_PROCESS(
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        COMMAND ${GIT} rev-parse --short HEAD 
        OUTPUT_VARIABLE GIT_OUT OUTPUT_STRIP_TRAILING_WHITESPACE
    )
    SET(GIT_PATCH "git${GIT_OUT}")
ENDIF(GIT)
44 45

# version: 0.2.x
Ludovic Fauvet's avatar
Ludovic Fauvet committed
46
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
47
SET(CPACK_PACKAGE_VERSION_MINOR "2")
48
SET(CPACK_PACKAGE_VERSION_PATCH "0")
49
SET(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
50
SET(PROJECT_VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR})
51 52
SET(PROJECT_VERSION ${CPACK_PACKAGE_VERSION})

53 54
MESSAGE(STATUS "VLMC Version: ${PROJECT_VERSION}")

55 56
STRING(TOLOWER ${PROJECT_NAME_SHORT} PROJECT_NAME_SHORT_LOWER)
PROJECT(${PROJECT_NAME_SHORT_LOWER}-${PROJECT_VERSION})
57 58

# Codename of the Project :-)
59 60 61
SET(CODENAME "alpha")

# System Information
Ludovic Fauvet's avatar
Ludovic Fauvet committed
62
SITE_NAME(HOSTNAME)
63
SET(SYSNAME ${CMAKE_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR})
Ludovic Fauvet's avatar
Ludovic Fauvet committed
64

65
# CMake Settings
Ludovic Fauvet's avatar
Ludovic Fauvet committed
66 67 68
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
SET(CMAKE_COLOR_MAKEFILE ON)
SET(CMAKE_VERBOSE_MAKEFILE OFF)
69 70

# Set path to additional CMake modules
Ludovic Fauvet's avatar
Ludovic Fauvet committed
71 72
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

73 74 75
# Path to contribs
SET(CONTRIBS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/contribs)

76
# Optionally allow embedding libvlc into the binary as
Ludovic Fauvet's avatar
Ludovic Fauvet committed
77
# VLMC requires libVLC
78
# SET (WITH_LIBVLC FALSE CACHE BOOL "Compile LibVLC in VLMC")
Ludovic Fauvet's avatar
Ludovic Fauvet committed
79

80 81
IF (UNIX)
    SET(WITH_PROFILING FALSE CACHE BOOL "Build with profiling support" )
82
    SET(CMAKE_INSTALL_PREFIX /usr)
83
    SET(CPACK_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
84 85
ENDIF(UNIX)

86
SET(WITH_GUI TRUE CACHE BOOL "Enable the VLMC's GUI")
87 88 89 90 91 92 93 94 95 96
SET(WITH_CRASHBUTTON FALSE CACHE BOOL "Enable the crash button")

IF(NOT APPLE)
    SET(WITH_CRASHHANDLER_GUI TRUE CACHE BOOL "Enable the crash handler GUI (with backtrace and restart capabilities)")
    SET(WITH_CRASHHANDLER TRUE CACHE BOOL "Enable the crash handler")
ELSE(NOT APPLE)
    #FIXME: Mac OS port does n't start if crash handler is enabled.
    SET(WITH_CRASHHANDLER_GUI FALSE CACHE BOOL "Disable crash handler gui...")
    SET(WITH_CRASHHANDLER False CACHE BOOL "Disable the crash handler")
    SET(CMAKE_BUILD_TYPE "Release")
97 98
    #SET(CMAKE_OSX_ARCHITECTURES i386)
    #SET(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}")
99
ENDIF(NOT APPLE)
100

Ludovic Fauvet's avatar
Ludovic Fauvet committed
101 102 103 104 105 106 107
FIND_PACKAGE(LIBVLC)
  IF (NOT LIBVLC_FOUND)
    MESSAGE (SEND_ERROR "LibVLC dependency was not found (please get libvlc)!")
  ENDIF (NOT LIBVLC_FOUND)

INCLUDE_DIRECTORIES(${LIBVLC_INCLUDE_DIR})

108 109 110 111 112 113 114
FIND_PACKAGE(frei0r)
IF (NOT FREI0R_FOUND)
  MESSAGE (SEND_ERROR "frei0r not found! It is required for effects engine to work.")
ENDIF (NOT FREI0R_FOUND)

INCLUDE_DIRECTORIES(${FREI0R_INCLUDE_DIR})

Ludovic Fauvet's avatar
Ludovic Fauvet committed
115
# search for Qt4
116
IF (WITH_GUI)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
117 118
    IF(WIN32)
        #FindQt4.cmake is so brain-dead when Xcompiling
119 120 121 122 123 124 125
        SET(QT_LIBRARY_DIR ${CONTRIBS_PATH}/lib)
        SET(QT_INCLUDE_DIR ${CONTRIBS_PATH}/include/qt4)
        ADD_DEFINITIONS( -I${CONTRIBS_PATH}/include/qt4/QtCore)
        ADD_DEFINITIONS( -I${CONTRIBS_PATH}/include/qt4/QtGui)
        ADD_DEFINITIONS( -I${CONTRIBS_PATH}/include/qt4/QtXml)
        ADD_DEFINITIONS( -I${CONTRIBS_PATH}/include/qt4/QtNetwork)
        ADD_DEFINITIONS( -I${CONTRIBS_PATH}/include/qt4/)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
126 127 128 129
        FIND_PACKAGE(Qt4 4.5.1 COMPONENTS QtCore QtXml QtGui QtNetwork REQUIRED )
    ELSE(WIN32)
        FIND_PACKAGE(Qt4 4.5.1 COMPONENTS QtCore QtXml QtGui QtNetwork REQUIRED )
    ENDIF(WIN32)
130 131
ELSE(WITH_GUI)
    FIND_PACKAGE (Qt4 4.5.1 COMPONENTS QtCore QtNetwork QtXml REQUIRED)
132
ENDIF(WITH_GUI)
Ludovic Fauvet's avatar
Ludovic Fauvet committed
133

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
134 135 136
IF (NOT WIN32)
    #FindQt4.cmake is so brain-dead when Xcompiling
    SET (VLMC_LIBS ${QT_QTCORE_LIBRARY}
137 138 139 140 141 142 143
          ${QT_QTGUI_LIBRARY}
          ${QT_QTNETWORK_LIBRARY}
          ${QT_QTSVG_LIBRARY}
          ${QT_QTXML_LIBRARY}
          ${LIBVLC_LIBRARY}
          ${LIBVLCCORE_LIBRARY})

144 145 146
    IF (APPLE) # Fails to link to Cocoa framework automatically
        SET (VLMC_LIBS ${VLMC_LIBS}
                       ${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/Cocoa.framework)
147 148 149 150
    ELSE (APPLE)
        IF (WITH_GUI)
            SET (VLMC_LIBS ${VLMC_LIBS} -lX11)
        ENDIF (WITH_GUI)
151 152
    ENDIF(APPLE)

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
153 154
    INCLUDE(${QT_USE_FILE})
    ADD_DEFINITIONS(${QT_DEFINITIONS})
155
ELSE (NOT WIN32)
156 157 158 159
    SET (VLMC_LIBS -L${CONTRIBS_PATH}/lib
            ${CONTRIBS_PATH}/lib/libQtNetwork.a
            ${CONTRIBS_PATH}/lib/libQtXml.a
            ${CONTRIBS_PATH}/lib/libQtGui.a
160 161 162
            ${CONTRIBS_PATH}/lib/libQtCore.a
            ${CONTRIBS_PATH}/lib/libvlccore.dll.a
            ${CONTRIBS_PATH}/lib/libvlc.dll.a
163
            ws2_32 winmm imm32 libeay32 ssleay32 crypt32 gdi32)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
164
ENDIF(NOT WIN32)
Ludovic Fauvet's avatar
Ludovic Fauvet committed
165 166 167

# layout of VLMC installation
# (default values are platform-specific)
168 169
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/effects)
Ludovic Fauvet's avatar
Ludovic Fauvet committed
170

171 172
# Copy the sh launcher
IF (NOT WIN32)
173
    CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/vlmc.sh" "${CMAKE_CURRENT_BINARY_DIR}/vlmc" COPYONLY)
174 175
ENDIF(NOT WIN32)

Ludovic Fauvet's avatar
Ludovic Fauvet committed
176 177 178 179 180 181 182
# common for MAC and UNIX
SET (DEFAULT_BIN_SUBDIR     bin)
SET (DEFAULT_LIB_SUBDIR     lib)
SET (DEFAULT_DATA_SUBDIR    share)
SET (DEFAULT_SRC_SUBDIR     src)
SET (DEFAULT_INCLUDE_SUBDIR include)

183 184 185 186 187 188
SET (VLMC_BIN_SUBDIR     "${DEFAULT_BIN_SUBDIR}"        CACHE STRING "Subdirectory where executables will be installed")
SET (VLMC_LIB_SUBDIR     "${DEFAULT_LIB_SUBDIR}"        CACHE STRING "Subdirectory where libraries will be installed")
SET (VLMC_DATA_SUBDIR    "${DEFAULT_DATA_SUBDIR}"       CACHE STRING "Subdirectory where VLMC data will be installed")
SET (VLMC_SRC_SUBDIR     "${DEFAULT_SRC_SUBDIR}"        CACHE STRING "Subdirectory where VLMC source is")
SET (VLMC_INCLUDE_SUBDIR "${DEFAULT_INCLUDE_SUBDIR}"    CACHE STRING "Subdirectory where header files will be installed")

Ludovic Fauvet's avatar
Ludovic Fauvet committed
189
# full paths for the installation
190 191 192 193 194 195 196
SET (VLMC_BIN_DIR     ${CMAKE_INSTALL_PREFIX}/${VLMC_BIN_SUBDIR})
SET (VLMC_LIB_DIR     ${CMAKE_INSTALL_PREFIX}/${VLMC_LIB_SUBDIR})
SET (VLMC_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/${VLMC_INCLUDE_SUBDIR})
SET (VLMC_DATA_DIR    ${CMAKE_INSTALL_PREFIX}/${VLMC_DATA_SUBDIR}/vlmc/)
SET (VLMC_DOC_DIR     ${CMAKE_INSTALL_PREFIX}/${VLMC_DATA_SUBDIR}/doc/vlmc/)
SET (VLMC_EFFECTS_DIR ${CMAKE_INSTALL_PREFIX}/${VLMC_LIB_SUBDIR}/vlmc/effects/)
SET (VLMC_DESKTOP_DIR ${CMAKE_INSTALL_PREFIX}/${VLMC_DATA_SUBDIR}/applications/)
197
SET (VLMC_PIXMAPS_DIR ${CMAKE_INSTALL_PREFIX}/${VLMC_DATA_SUBDIR}/pixmaps/)
Ludovic Fauvet's avatar
Ludovic Fauvet committed
198 199 200

# manual page - makes sense only on unix systems
IF (UNIX)
201 202
    SET (DEFAULT_MANUAL_SUBDIR  ${VLMC_DATA_SUBDIR}/man)
    SET (VLMC_MANUAL_SUBDIR  "${DEFAULT_MANUAL_SUBDIR}"  CACHE STRING "Subdirectory where manual files will be installed")
203 204
    MARK_AS_ADVANCED (VLMC_MANUAL_SUBDIR)
    SET (VLMC_MANUAL_DIR  ${CMAKE_INSTALL_PREFIX}/${VLMC_MANUAL_SUBDIR})
Ludovic Fauvet's avatar
Ludovic Fauvet committed
205 206
ENDIF (UNIX)

207
SUBDIRS(ts)
Ludovic Fauvet's avatar
Ludovic Fauvet committed
208
SUBDIRS(src)
209
SUBDIRS(nsis)
210
SUBDIRS(effects)
Ludovic Fauvet's avatar
Ludovic Fauvet committed
211

212
# Copy stuff to doc subdirectory
213
INSTALL (FILES AUTHORS COPYING INSTALL NEWS README THANKS TRANSLATORS
214
         DESTINATION ${VLMC_DOC_DIR})
Ludovic Fauvet's avatar
Ludovic Fauvet committed
215

216 217 218
# Copy .desktop file
INSTALL (FILES share/vlmc.desktop DESTINATION ${VLMC_DESKTOP_DIR})

219 220 221
# Copy the VLMC pixmap
INSTALL (FILES share/vlmc.png DESTINATION ${VLMC_PIXMAPS_DIR})

222 223 224 225 226 227
# On UNIX copy the man page
IF (UNIX)
    INSTALL (FILES ${CMAKE_SOURCE_DIR}/doc/vlmc.1
             DESTINATION ${VLMC_MANUAL_DIR}/man1)
ENDIF (UNIX)

228 229 230 231 232 233
# Copy the share directory (TODO: add checks if the dir is empty, don't install)
# INSTALL (DIRECTORY share/ DESTINATION ${VLMC_DATA_DIR}
#         PATTERN "*.desktop" EXCLUDE
#         PATTERN "*.ico" EXCLUDE
#         PATTERN "*.icns" EXCLUDE
#         PATTERN "vlmc.png" EXCLUDE)
234

Ludovic Fauvet's avatar
Ludovic Fauvet committed
235
#############################################################
236
# Package Settings
Ludovic Fauvet's avatar
Ludovic Fauvet committed
237 238 239

INCLUDE(InstallRequiredSystemLibraries)

240 241
SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME_SHORT})
242 243 244 245
SET(CPACK_PACKAGE_DESCRIPTION ${PROJECT_NAME_LONG})
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME_SHORT} \n ${PROJECT_DESCRIPTION}")
SET(CPACK_PACKAGE_VENDOR ${PROJECT_VENDOR})
SET(CPACK_PACKAGE_CONTACT ${PROJECT_CONTACT})
246 247 248
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README)
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
249 250
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

251
# Force Package Name
252
SET(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}${GIT_PATCH}-${CPACK_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
253 254

# NSIS Windows Installer
Ludovic Fauvet's avatar
Ludovic Fauvet committed
255
IF(WIN32 AND NOT UNIX)
256 257 258 259 260 261 262
    # 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) backslashes.
    SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/share\\\\vlmc.png")
    SET(CPACK_NSIS_INSTALLED_ICON_NAME "\\\\vlmc.exe")
    SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} VLMC")
    SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\vlmc.org")
    SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\vlmc.org")
263
    SET(CPACK_NSIS_CONTACT ${PROJECT_CONTACT})
264
    SET(CPACK_NSIS_MODIFY_PATH ON)
Ludovic Fauvet's avatar
Ludovic Fauvet committed
265
ELSE(WIN32 AND NOT UNIX)
266 267
    #SET(CPACK_STRIP_FILES "VLMC")
    #SET(CPACK_SOURCE_STRIP_FILES "")
Ludovic Fauvet's avatar
Ludovic Fauvet committed
268 269
ENDIF(WIN32 AND NOT UNIX)

270
SET(PACKAGE_REQUIRES "libvlc-dev ( >= 1.1.4 ), frei0r-plugins, libqt4-gui ( >= 4.6 ), libqt4-network ( >= 4.6 ), libqt4-svg ( >= 4.6 ), libqt4-xml ( >= 4.6 )")
271

272 273
# RPM packages
INCLUDE ( ${CMAKE_MODULE_PATH}/RpmBuild.cmake )
274
IF ( RPMBUILD_FOUND AND NOT WIN32 )
275
    SET(CPACK_GENERATOR "RPM")
276 277 278 279 280 281 282 283 284
    SET(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
    SET(CPACK_RPM_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
    SET(CPACK_RPM_PACKAGE_VERSION ${PROJECT_VERSION})
    SET(CPACK_RPM_PACKAGE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
    SET(CPACK_RPM_PACKAGE_GROUP ${PROJECT_VENDOR})
    SET(CPACK_RPM_PACKAGE_VENDOR ${PROJECT_VENDOR})
    SET(CPACK_RPM_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION})
    SET(CPACK_RPM_PACKAGE_ARCHITECTURE i386) # Change to your architecture here
    SET(CPACK_RPM_PACKAGE_DEPENDS "qt ( >= 4.6 ), qt-x11 ( >= 4.6 )") # Specify dependencies here
285
    SET(CPACK_SET_DESTDIR TRUE)
286
ENDIF ( RPMBUILD_FOUND AND NOT WIN32 )
287

288 289
# Debian packages
INCLUDE ( ${CMAKE_MODULE_PATH}/DpkgBuild.cmake )
290
IF ( DPKG_FOUND AND NOT WIN32 )
291
    SET(CPACK_GENERATOR "DEB")
292 293 294 295 296 297
    SET(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
    SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
    SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
    SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
    SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
    SET(CPACK_DEBIAN_PACKAGE_DEBUG ON)
298
    SET(CPACK_DEBIAN_PACKAGE_DEPENDS ${PACKAGE_REQUIRES})
299
    SET(CPACK_SET_DESTDIR TRUE)
300
ENDIF ( DPKG_FOUND AND NOT WIN32 )
301

302
# Mac Bundle
303 304 305 306 307
IF( APPLE )
    SET(CPACK_GENERATOR "DragNDrop")
    #Libraries are bundled directly
    SET(CPACK_COMPONENT_LIBRARIES_HIDDEN TRUE)
    # Bundle Properties
308
    SET(MACOSX_BUNDLE_BUNDLE_NAME VLMC)
309 310 311 312 313 314 315 316
    SET(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
    SET(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION})
    SET(MACOSX_BUNDLE_LONG_VERSION_STRING "Version ${PROJECT_VERSION}")
    #SET(CPACK_STRIP_FILES TRUE)
ENDIF( APPLE )

SET(CPACK_PACKAGE_EXECUTABLES "vlmc" "VLMC")
INCLUDE(CPack)