Clean up CMakeFiles and make most libs optional
This will disable building various tools when the libraries that they require are missing. The only absolutely mandatory dependencies now are JACK and pthreads (both required for libol).for-marcan
parent
0f8fb28592
commit
4699fef4ff
|
@ -16,14 +16,20 @@
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
PROJECT(openlase)
|
project(openlase)
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/Modules/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/Modules/")
|
||||||
|
|
||||||
find_package(Qt4 REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
find_package(JACK REQUIRED)
|
find_package(JACK REQUIRED)
|
||||||
|
find_package(Qt4)
|
||||||
|
find_package(FFmpeg)
|
||||||
|
find_package(OpenGL)
|
||||||
|
find_package(GLUT)
|
||||||
|
find_package(ALSA)
|
||||||
|
find_package(Curses)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-Wall -O3 -g")
|
set(CMAKE_C_FLAGS "-Wall -O3 -g")
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
# - Try to find ffmpeg
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# FFMPEG_FOUND - system has ffmpeg
|
||||||
|
# FFMPEG_INCLUDE_DIR - Include directory necessary for using the ffmpeg headers
|
||||||
|
# FFMPEG_LIBRARIES - Link these to use ffmpeg
|
||||||
|
# FFMPEG_DEFINITIONS - Compiler switches required for using ffmpeg
|
||||||
|
|
||||||
|
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org>
|
||||||
|
# Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
|
||||||
|
if (FFMPEG_LIBRARIES)
|
||||||
|
|
||||||
|
# in cache already
|
||||||
|
set(FFMPEG_FOUND TRUE)
|
||||||
|
|
||||||
|
else (FFMPEG_LIBRARIES)
|
||||||
|
|
||||||
|
if (NOT WIN32)
|
||||||
|
# use pkg-config to get the directories and then use these values
|
||||||
|
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(PC_LIBAVCODEC libavcodec)
|
||||||
|
set(FFMPEG_DEFINITIONS ${PC_LIBAVCODEC_CFLAGS_OTHER})
|
||||||
|
|
||||||
|
endif (NOT WIN32)
|
||||||
|
|
||||||
|
#
|
||||||
|
# #include <libXXXX/XXXX.h> is the new style for FFMPEG headers
|
||||||
|
# This has been verified at least since 0.4.9
|
||||||
|
# Please do not change to the old format, since this will break for
|
||||||
|
# people who are using newer versions. Instead, upgrade your ffmpeg
|
||||||
|
# installation.
|
||||||
|
#
|
||||||
|
find_path(FFMPEG_INCLUDE_DIR libavcodec/avcodec.h
|
||||||
|
HINTS
|
||||||
|
${PC_LIBAVCODEC_INCLUDEDIR}
|
||||||
|
${PC_LIBAVCODEC_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
# also search for the old style include dir, just for the purpose
|
||||||
|
# of giving a useful error message if an old libavcodec is installed
|
||||||
|
# and the user might wonder why it is not found
|
||||||
|
find_path(FFMPEG_INCLUDE_DIR_OLD_STYLE ffmpeg/avcodec.h
|
||||||
|
HINTS
|
||||||
|
${PC_LIBAVCODEC_INCLUDEDIR}
|
||||||
|
${PC_LIBAVCODEC_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(AVCODEC_LIBRARIES NAMES avcodec
|
||||||
|
HINTS
|
||||||
|
${PC_LIBAVCODEC_LIBDIR}
|
||||||
|
${PC_LIBAVCODEC_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(AVFORMAT_LIBRARIES NAMES avformat
|
||||||
|
HINTS
|
||||||
|
${PC_LIBAVCODEC_LIBDIR}
|
||||||
|
${PC_LIBAVCODEC_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(AVUTIL_LIBRARIES NAMES avutil
|
||||||
|
HINTS
|
||||||
|
${PC_LIBAVCODEC_LIBDIR}
|
||||||
|
${PC_LIBAVCODEC_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
set(FFMPEG_LIBRARIES )
|
||||||
|
if (AVCODEC_LIBRARIES)
|
||||||
|
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVCODEC_LIBRARIES})
|
||||||
|
endif (AVCODEC_LIBRARIES)
|
||||||
|
|
||||||
|
if (AVFORMAT_LIBRARIES)
|
||||||
|
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVFORMAT_LIBRARIES})
|
||||||
|
endif (AVFORMAT_LIBRARIES)
|
||||||
|
|
||||||
|
if (AVUTIL_LIBRARIES)
|
||||||
|
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVUTIL_LIBRARIES})
|
||||||
|
endif (AVUTIL_LIBRARIES)
|
||||||
|
|
||||||
|
if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
|
||||||
|
set(FFMPEG_FOUND TRUE)
|
||||||
|
endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if (FFMPEG_FOUND)
|
||||||
|
if (NOT FFmpeg_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES} ${FFMPEG_INCLUDE_DIR}")
|
||||||
|
endif (NOT FFmpeg_FIND_QUIETLY)
|
||||||
|
else (FFMPEG_FOUND)
|
||||||
|
# only an old libavcodec was found ?
|
||||||
|
if (FFMPEG_INCLUDE_DIR_OLD_STYLE AND NOT FFMPEG_INCLUDE_DIR AND NOT FFmpeg_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found old version of libavcodec, but a newer version is required.")
|
||||||
|
endif (FFMPEG_INCLUDE_DIR_OLD_STYLE AND NOT FFMPEG_INCLUDE_DIR AND NOT FFmpeg_FIND_QUIETLY)
|
||||||
|
|
||||||
|
if (FFmpeg_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Could NOT find FFMPEG")
|
||||||
|
else (FFmpeg_FIND_REQUIRED)
|
||||||
|
if (NOT FFmpeg_FIND_QUIETLY)
|
||||||
|
message(STATUS "Could NOT find FFMPEG")
|
||||||
|
endif (NOT FFmpeg_FIND_QUIETLY)
|
||||||
|
endif (FFmpeg_FIND_REQUIRED)
|
||||||
|
endif (FFMPEG_FOUND)
|
||||||
|
|
||||||
|
mark_as_advanced(AVCODEC_LIBRARIES
|
||||||
|
AVFORMAT_LIBRARIES
|
||||||
|
AVUTIL_LIBRARIES
|
||||||
|
FFMPEG_INCLUDE_DIR
|
||||||
|
FFMPEG_INCLUDE_DIR_OLD_STYLE)
|
||||||
|
|
||||||
|
endif (FFMPEG_LIBRARIES)# AND FFMPEG_DEFINITIONS)
|
|
@ -1,30 +1,48 @@
|
||||||
|
# OpenLase - a realtime laser graphics toolkit
|
||||||
|
#
|
||||||
|
# Copyright (C) 2009-2011 Hector Martin "marcan" <hector@marcansoft.com>
|
||||||
|
#
|
||||||
|
# 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 2 or version 3.
|
||||||
|
#
|
||||||
|
# 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, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
if(CURSES_FOUND AND FFMPEG_FOUND)
|
||||||
|
include_directories(${CMAKE_SOURCE_DIR}/tools ${CURSES_INCLUDE_DIR})
|
||||||
|
|
||||||
find_package(Curses REQUIRED)
|
add_executable(slides
|
||||||
|
main.c 3ddemos.c static.c metaballs.c circlescope.c avstream.c video.c pong.c
|
||||||
|
${CMAKE_SOURCE_DIR}/tools/trace.c
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/tools ${CURSES_INCLUDE_DIR})
|
${CMAKE_CURRENT_BINARY_DIR}/openlase-logo.ild
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/27c3-logo.ild
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/jack-logo.ild
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/output.ild
|
||||||
|
)
|
||||||
|
|
||||||
add_executable(slides
|
target_link_libraries(slides openlase ${FFMPEG_LIBRARIES} ${CURSES_LIBRARIES})
|
||||||
main.c 3ddemos.c static.c metaballs.c circlescope.c avstream.c video.c pong.c
|
|
||||||
${CMAKE_SOURCE_DIR}/tools/trace.c
|
|
||||||
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/openlase-logo.ild
|
function(svg2ild NAME)
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/27c3-logo.ild
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.ild
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/jack-logo.ild
|
DEPENDS ${CMAKE_SOURCE_DIR}/tools/svg2ild.py
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/output.ild
|
MAIN_DEPENDENCY ${NAME}.svg
|
||||||
)
|
DEPENDS ${NAME}.svg ${NAME}.cfg
|
||||||
|
COMMAND python ${CMAKE_SOURCE_DIR}/tools/svg2ild.py -q ${ARGN} -cfg ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}.cfg ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}.svg ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.ild)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
target_link_libraries(slides openlase avformat avcodec ${CURSES_LIBRARIES})
|
svg2ild(openlase-logo -noopt)
|
||||||
|
svg2ild(27c3-logo)
|
||||||
function(svg2ild NAME)
|
svg2ild(jack-logo)
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.ild
|
svg2ild(output)
|
||||||
DEPENDS ${CMAKE_SOURCE_DIR}/tools/svg2ild.py
|
else()
|
||||||
MAIN_DEPENDENCY ${NAME}.svg
|
message(STATUS "Will NOT build 27c3_slides (curses or FFmpeg missing)")
|
||||||
DEPENDS ${NAME}.svg ${NAME}.cfg
|
endif()
|
||||||
COMMAND python ${CMAKE_SOURCE_DIR}/tools/svg2ild.py -q ${ARGN} -cfg ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}.cfg ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}.svg ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.ild)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
svg2ild(openlase-logo -noopt)
|
|
||||||
svg2ild(27c3-logo)
|
|
||||||
svg2ild(jack-logo)
|
|
||||||
svg2ild(output)
|
|
||||||
|
|
|
@ -28,9 +28,12 @@ target_link_libraries(simple openlase)
|
||||||
add_executable(pong pong.c)
|
add_executable(pong pong.c)
|
||||||
target_link_libraries(pong openlase)
|
target_link_libraries(pong openlase)
|
||||||
|
|
||||||
find_package(ALSA REQUIRED)
|
if(ALSA_FOUND)
|
||||||
add_executable(midiview midiview.c)
|
add_executable(midiview midiview.c)
|
||||||
target_link_libraries(midiview openlase ${ALSA_LIBRARIES})
|
target_link_libraries(midiview openlase ${ALSA_LIBRARIES})
|
||||||
|
else()
|
||||||
|
message(STATUS "Will NOT build midiview (ALSA missing)")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(harp harp.c)
|
add_executable(harp harp.c)
|
||||||
target_link_libraries(harp openlase)
|
target_link_libraries(harp openlase)
|
||||||
|
|
|
@ -17,10 +17,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
include_directories (${CMAKE_SOURCE_DIR}/include)
|
include_directories (${CMAKE_SOURCE_DIR}/include)
|
||||||
find_package(Threads)
|
|
||||||
|
|
||||||
add_library (openlase libol.c text.c ilda.c ${CMAKE_CURRENT_BINARY_DIR}/fontdef.c)
|
add_library (openlase libol.c text.c ilda.c ${CMAKE_CURRENT_BINARY_DIR}/fontdef.c)
|
||||||
find_library (PTHREAD pthread)
|
|
||||||
target_link_libraries (openlase ${CMAKE_THREAD_LIBS_INIT} m jack)
|
target_link_libraries (openlase ${CMAKE_THREAD_LIBS_INIT} m jack)
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fontdef.c
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fontdef.c
|
||||||
|
|
|
@ -16,13 +16,16 @@
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
include(${QT_USE_FILE})
|
if(QT4_FOUND)
|
||||||
|
include(${QT_USE_FILE})
|
||||||
|
|
||||||
QT4_WRAP_UI(output_UIS_H output_settings.ui)
|
QT4_WRAP_UI(output_UIS_H output_settings.ui)
|
||||||
QT4_AUTOMOC(output_settings.cpp output.cpp)
|
QT4_AUTOMOC(output_settings.cpp output.cpp)
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
add_executable(output output.cpp output_settings.cpp ${output_UIS_H})
|
|
||||||
target_link_libraries(output ${JACK_LIBRARIES} ${QT_LIBRARIES})
|
|
||||||
|
|
||||||
|
add_executable(output output.cpp output_settings.cpp ${output_UIS_H})
|
||||||
|
target_link_libraries(output ${JACK_LIBRARIES} ${QT_LIBRARIES})
|
||||||
|
else()
|
||||||
|
message(STATUS "Will NOT build output (Qt4 missing)")
|
||||||
|
endif()
|
||||||
|
|
|
@ -22,16 +22,17 @@ link_directories (${CMAKE_BINARY_DIR}/libol)
|
||||||
add_executable(playilda playilda.c)
|
add_executable(playilda playilda.c)
|
||||||
target_link_libraries(playilda ${JACK_LIBRARIES})
|
target_link_libraries(playilda ${JACK_LIBRARIES})
|
||||||
|
|
||||||
add_executable(playvid playvid.c trace.c)
|
if(FFMPEG_FOUND)
|
||||||
target_link_libraries(playvid openlase avformat avcodec)
|
add_executable(playvid playvid.c trace.c)
|
||||||
|
target_link_libraries(playvid openlase ${FFMPEG_LIBRARIES})
|
||||||
|
else()
|
||||||
|
message(STATUS "Will NOT build playvid (FFmpeg missing)")
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories (${CMAKE_SOURCE_DIR}/include)
|
if(OPENGL_FOUND AND GLUT_FOUND)
|
||||||
link_directories (${CMAKE_BINARY_DIR}/libol)
|
add_executable(simulator simulator.c)
|
||||||
|
include_directories(${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS})
|
||||||
find_package(OpenGL REQUIRED)
|
target_link_libraries(simulator m ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${JACK_LIBRARIES})
|
||||||
find_package(GLUT REQUIRED)
|
else()
|
||||||
|
message(STATUS "Will NOT build simulator (OpenGL or GLUT missing)")
|
||||||
add_executable(simulator simulator.c)
|
endif()
|
||||||
|
|
||||||
include_directories(${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(simulator ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${JACK_LIBRARIES})
|
|
||||||
|
|
Loading…
Reference in New Issue