CMakeLists.txt 8.8 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 8

#Project Info
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
9 10
SET(CPACK_PACKAGE_VERSION_MINOR "2")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
Ludovic Fauvet's avatar
Ludovic Fauvet committed
11
SET(COMPLETE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
12 13 14

# Codename of the Project :-)
SET(RELEASE_NAME "alpha")
Ludovic Fauvet's avatar
Ludovic Fauvet committed
15 16 17
# version: 0.0.1
SET(PROJECT_VERSION ${COMPLETE_VERSION})
#Name of the project
18 19 20 21
SET(PROJECT_NAME_SHORT "VLMC")
SET(PROJECT_NAME_LONG "VideoLAN Movie Creator")
STRING(TOLOWER ${PROJECT_NAME_SHORT} PROJECT_NAME_SHORT_LOWER)
PROJECT(${PROJECT_NAME_SHORT_LOWER}-${PROJECT_VERSION})
Ludovic Fauvet's avatar
Ludovic Fauvet committed
22

Ludovic Fauvet's avatar
Ludovic Fauvet committed
23 24
SITE_NAME(HOSTNAME)

Ludovic Fauvet's avatar
Ludovic Fauvet committed
25 26 27 28 29 30 31
#CMake Settings
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
SET(CMAKE_COLOR_MAKEFILE ON)
SET(CMAKE_VERBOSE_MAKEFILE OFF)
# set path to additional CMake modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

32 33 34 35 36 37 38 39 40 41
# 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)

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

50
# Optionally allow embedding libvlc into the binary as
Ludovic Fauvet's avatar
Ludovic Fauvet committed
51
# VLMC requires libVLC
52
#SET (WITH_LIBVLC FALSE CACHE BOOL "Compile LibVLC in VLMC")
Ludovic Fauvet's avatar
Ludovic Fauvet committed
53

54 55
IF (UNIX)
    SET(WITH_PROFILING FALSE CACHE BOOL "Build with profiling support" )
56
    SET(CMAKE_INSTALL_PREFIX /usr)
57 58
ENDIF(UNIX)

59
SET(WITH_GUI TRUE CACHE BOOL "Enable the VLMC's GUI")
60 61 62 63 64 65 66 67 68 69
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")
70
    SET(CMAKE_OSX_ARCHITECTURES i386 ppc ) # Make a universal binary
71 72
#   SET(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}")
ENDIF(NOT APPLE)
73

Ludovic Fauvet's avatar
Ludovic Fauvet committed
74 75 76 77 78 79 80
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})

81 82 83 84 85 86 87
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
88
# search for Qt4
89
IF (WITH_GUI)
90
    FIND_PACKAGE (Qt4 4.5.1 COMPONENTS QtCore QtGui QtNetwork QtSvg QtXml REQUIRED)
91
ELSE(WITH_GUI)
92
    # Search for QtGui as the effets engine requires QImage.
93
    FIND_PACKAGE (Qt4 4.5.1 COMPONENTS QtCore QtGui QtNetwork QtXml REQUIRED)
94
ENDIF(WITH_GUI)
Ludovic Fauvet's avatar
Ludovic Fauvet committed
95

96 97 98 99 100 101 102 103
SET (VLMC_LIBS ${QT_QTCORE_LIBRARY}
          ${QT_QTGUI_LIBRARY}
          ${QT_QTNETWORK_LIBRARY}
          ${QT_QTSVG_LIBRARY}
          ${QT_QTXML_LIBRARY}
          ${LIBVLC_LIBRARY}
          ${LIBVLCCORE_LIBRARY})

104
INCLUDE(${QT_USE_FILE})
Ludovic Fauvet's avatar
Ludovic Fauvet committed
105 106 107 108
ADD_DEFINITIONS(${QT_DEFINITIONS})

# layout of VLMC installation
# (default values are platform-specific)
109 110
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
111

112 113
# Copy the sh launcher
IF (NOT WIN32)
114
    CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/vlmc.sh" "${CMAKE_CURRENT_BINARY_DIR}/vlmc" COPYONLY)
115 116
ENDIF(NOT WIN32)

Ludovic Fauvet's avatar
Ludovic Fauvet committed
117 118 119 120 121 122 123
# 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)

124 125 126 127 128 129
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
130
# full paths for the installation
131 132 133 134 135 136 137
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/)
138
SET (VLMC_PIXMAPS_DIR ${CMAKE_INSTALL_PREFIX}/${VLMC_DATA_SUBDIR}/pixmaps/)
Ludovic Fauvet's avatar
Ludovic Fauvet committed
139 140 141

# manual page - makes sense only on unix systems
IF (UNIX)
142 143 144 145
    SET (DEFAULT_MANUAL_SUBDIR  man)
    SET (VLMC_MANUAL_SUBDIR  ${DEFAULT_MANUAL_SUBDIR}  CACHE STRING "Subdirectory where manual files will be installed")
    MARK_AS_ADVANCED (VLMC_MANUAL_SUBDIR)
    SET (VLMC_MANUAL_DIR  ${CMAKE_INSTALL_PREFIX}/${VLMC_MANUAL_SUBDIR})
Ludovic Fauvet's avatar
Ludovic Fauvet committed
146 147
ENDIF (UNIX)

148
SUBDIRS(ts)
Ludovic Fauvet's avatar
Ludovic Fauvet committed
149
SUBDIRS(src)
150
SUBDIRS(nsis)
Ludovic Fauvet's avatar
Ludovic Fauvet committed
151

152
# Copy stuff to doc subdirectory
Ludovic Fauvet's avatar
Ludovic Fauvet committed
153
INSTALL (FILES AUTHORS COPYING INSTALL NEWS README TRANSLATORS
154
         DESTINATION ${VLMC_DOC_DIR})
Ludovic Fauvet's avatar
Ludovic Fauvet committed
155

156 157 158
# Copy .desktop file
INSTALL (FILES share/vlmc.desktop DESTINATION ${VLMC_DESKTOP_DIR})

159 160 161
# Copy the VLMC pixmap
INSTALL (FILES share/vlmc.png DESTINATION ${VLMC_PIXMAPS_DIR})

162
# Copy the share directory
163
INSTALL (DIRECTORY share/ DESTINATION ${VLMC_DATA_DIR}
164
         PATTERN "*.desktop" EXCLUDE
165
         PATTERN "*.ico" EXCLUDE
166
         PATTERN "*.icns" EXCLUDE
167
         PATTERN "vlmc.png" EXCLUDE)
168

Ludovic Fauvet's avatar
Ludovic Fauvet committed
169 170 171 172 173
#############################################################
# Enable packaging

INCLUDE(InstallRequiredSystemLibraries)

174 175 176
SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME_SHORT})
SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
177 178
# Force package name
SET(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME})
179 180
SET(CPACK_PACKAGE_DESCRIPTION "VideoLan Movie Creator")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY  
181
"VLMC \n VideoLAN Movie Creator is a cross-platform, non-linear video editing software based on the VLC Media Player.")
Ludovic Fauvet's avatar
Ludovic Fauvet committed
182
SET(CPACK_PACKAGE_VENDOR "VLMC Team")
183
SET(CPACK_PACKAGE_CONTACT "vlmc-devel@videolan.org")
Ludovic Fauvet's avatar
Ludovic Fauvet committed
184 185
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
186 187
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

Ludovic Fauvet's avatar
Ludovic Fauvet committed
188
IF(WIN32 AND NOT UNIX)
189 190 191 192 193 194 195 196 197 198
    # 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")
    SET(CPACK_NSIS_CONTACT "vlmc-devel@vlmc.org")
    SET(CPACK_NSIS_MODIFY_PATH ON)
    #SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "  !include \\\"${CMAKE_SOURCE_DIR}\\\\win_build\\\\extra.nsh\\\"")
Ludovic Fauvet's avatar
Ludovic Fauvet committed
199
ELSE(WIN32 AND NOT UNIX)
200 201
    #SET(CPACK_STRIP_FILES "VLMC")
    #SET(CPACK_SOURCE_STRIP_FILES "")
Ludovic Fauvet's avatar
Ludovic Fauvet committed
202 203
ENDIF(WIN32 AND NOT UNIX)

204 205 206 207 208 209 210
# RPM packages
INCLUDE ( ${CMAKE_MODULE_PATH}/RpmBuild.cmake )
IF ( RPMBUILD_FOUND )
    SET(CPACK_GENERATOR "RPM")
    SET(CPACK_SET_DESTDIR TRUE)
ENDIF ( RPMBUILD_FOUND )

211 212 213 214 215 216 217 218 219
# Debian packages
INCLUDE ( ${CMAKE_MODULE_PATH}/DpkgBuild.cmake )
IF ( DPKG_FOUND )
    SET(CPACK_GENERATOR "DEB")
    SET(CPACK_SET_DESTDIR TRUE)
    # FIXME: Check stuff: libvlc2 etc. in future as VLC 1.1+ releases
    SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-gui ( >= 4.6 ), libqt4-network ( >= 4.6 ), libqt4-svg ( >= 4.6 ), libqt4-xml ( >= 4.6 )")
ENDIF ( DPKG_FOUND )

220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
#Mac
IF( APPLE )
    SET(CPACK_GENERATOR "DragNDrop")

    #Libraries are bundled directly
    SET(CPACK_COMPONENT_LIBRARIES_HIDDEN TRUE)

    # Bundle Properties
    SET(MACOSX_BUNDLE_BUNDLE_NAME vlmc)
    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)