migrated build-system to CMAKE
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1352 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
72
cmake/modules/BuildPlugin.cmake
Normal file
72
cmake/modules/BuildPlugin.cmake
Normal file
@@ -0,0 +1,72 @@
|
||||
# BuildPlugin.cmake - Copyright (c) 2008 Tobias Doerffel
|
||||
#
|
||||
# description: build LMMS-plugin
|
||||
# usage: BUILD_PLUGIN(<PLUGIN_NAME> <PLUGIN_SOURCES> MOCFILES <HEADERS_FOR_MOC> EMBEDDED_RESOURCES <LIST_OF_FILES_TO_EMBED> UICFILES <UI_FILES_TO_COMPILE> )
|
||||
|
||||
MACRO(CAR var)
|
||||
SET(${var} ${ARGV1})
|
||||
ENDMACRO(CAR)
|
||||
|
||||
MACRO(CDR var junk)
|
||||
SET(${var} ${ARGN})
|
||||
ENDMACRO(CDR)
|
||||
|
||||
MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
|
||||
SET(DEFAULT_ARGS)
|
||||
FOREACH(arg_name ${arg_names})
|
||||
SET(${prefix}_${arg_name})
|
||||
ENDFOREACH(arg_name)
|
||||
FOREACH(option ${option_names})
|
||||
SET(${prefix}_${option} FALSE)
|
||||
ENDFOREACH(option)
|
||||
|
||||
SET(current_arg_name DEFAULT_ARGS)
|
||||
SET(current_arg_list)
|
||||
FOREACH(arg ${ARGN})
|
||||
SET(larg_names ${arg_names})
|
||||
LIST(FIND larg_names "${arg}" is_arg_name)
|
||||
IF (is_arg_name GREATER -1)
|
||||
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
||||
SET(current_arg_name ${arg})
|
||||
SET(current_arg_list)
|
||||
ELSE (is_arg_name GREATER -1)
|
||||
SET(loption_names ${option_names})
|
||||
LIST(FIND loption_names "${arg}" is_option)
|
||||
IF (is_option GREATER -1)
|
||||
SET(${prefix}_${arg} TRUE)
|
||||
ELSE (is_option GREATER -1)
|
||||
SET(current_arg_list ${current_arg_list} ${arg})
|
||||
ENDIF (is_option GREATER -1)
|
||||
ENDIF (is_arg_name GREATER -1)
|
||||
ENDFOREACH(arg)
|
||||
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
||||
ENDMACRO(PARSE_ARGUMENTS)
|
||||
|
||||
MACRO(BUILD_PLUGIN)
|
||||
PARSE_ARGUMENTS(PLUGIN "MOCFILES;EMBEDDED_RESOURCES;UICFILES" "" ${ARGN} )
|
||||
CAR(PLUGIN_NAME ${PLUGIN_DEFAULT_ARGS})
|
||||
CDR(PLUGIN_SOURCES ${PLUGIN_DEFAULT_ARGS})
|
||||
|
||||
INCLUDE_DIRECTORIES(. ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/gui)
|
||||
|
||||
ADD_DEFINITIONS(-DPLUGIN_NAME=${PLUGIN_NAME})
|
||||
|
||||
LIST(LENGTH PLUGIN_EMBEDDED_RESOURCES ER_LEN)
|
||||
IF(ER_LEN)
|
||||
SET(ER_H embedded_resources.h)
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${ER_H}
|
||||
COMMAND ${BIN2RES}
|
||||
ARGS ${PLUGIN_EMBEDDED_RESOURCES} > ${ER_H})
|
||||
ENDIF(ER_LEN)
|
||||
|
||||
QT4_WRAP_CPP(plugin_MOC_out ${PLUGIN_MOCFILES})
|
||||
QT4_WRAP_UI(plugin_UIC_out ${PLUGIN_UICFILES})
|
||||
FOREACH(f ${PLUGIN_SOURCES})
|
||||
ADD_FILE_DEPENDENCIES(${f} ${ER_H} ${plugin_MOC_out} ${plugin_UIC_out})
|
||||
ENDFOREACH(f)
|
||||
ADD_LIBRARY( ${PLUGIN_NAME} SHARED ${PLUGIN_SOURCES})
|
||||
INSTALL(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION ${PLUGIN_DIR})
|
||||
SET(ADDITIONAL_MAKE_CLEAN_FILES ${ER_H} ${plugin_MOC_out})
|
||||
ENDMACRO(BUILD_PLUGIN)
|
||||
|
||||
76
cmake/modules/ChecksForLibSamplerate.cmake
Normal file
76
cmake/modules/ChecksForLibSamplerate.cmake
Normal file
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# some tests migrated from libsamplerate's acinclude.m4 - Tobias Doerffel, 2008
|
||||
#
|
||||
|
||||
INCLUDE(CheckCSourceCompiles)
|
||||
INCLUDE(CheckCSourceRuns)
|
||||
|
||||
SET(CMAKE_REQUIRED_LIBRARIES_ORIG ${CMAKE_REQUIRED_LIBRARIES})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -lm)
|
||||
SET(C99_MATH " #define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
|
||||
#include <math.h>
|
||||
")
|
||||
SET(TEST_LRINT "int main( void )
|
||||
{
|
||||
if (!lrint(3.14159)) lrint(2.7183);
|
||||
return( 0 );
|
||||
}")
|
||||
SET(TEST_LRINTF "int main( void )
|
||||
{
|
||||
if (!lrintf(3.14159)) lrintf(2.7183);
|
||||
return( 0 );
|
||||
}")
|
||||
CHECK_C_SOURCE_COMPILES("${C99_MATH}${TEST_LRINT}" HAVE_LRINT)
|
||||
CHECK_C_SOURCE_COMPILES("${C99_MATH}${TEST_LRINTF}" HAVE_LRINTF)
|
||||
|
||||
|
||||
CHECK_C_SOURCE_RUNS("
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
#include <math.h>
|
||||
int main (void)
|
||||
{ double fval ;
|
||||
int k, ival ;
|
||||
|
||||
fval = 1.0 * 0x7FFFFFFF ;
|
||||
for (k = 0 ; k < 100 ; k++)
|
||||
{ ival = (lrint (fval)) >> 24 ;
|
||||
if (ival != 127)
|
||||
return 1 ;
|
||||
|
||||
fval *= 1.2499999 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
" CPU_CLIPS_POSITIVE)
|
||||
CHECK_C_SOURCE_RUNS("
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
#include <math.h>
|
||||
int main (void)
|
||||
{ double fval ;
|
||||
int k, ival ;
|
||||
|
||||
fval = -8.0 * 0x10000000 ;
|
||||
for (k = 0 ; k < 100 ; k++)
|
||||
{ ival = (lrint (fval)) >> 24 ;
|
||||
if (ival != -128)
|
||||
return 1 ;
|
||||
|
||||
fval *= 1.2499999 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
" CPU_CLIPS_NEGATIVE)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_ORIG})
|
||||
|
||||
69
cmake/modules/FindAlsa.cmake
Normal file
69
cmake/modules/FindAlsa.cmake
Normal file
@@ -0,0 +1,69 @@
|
||||
# Alsa check, based on libkmid/configure.in.in.
|
||||
# Only the support for Alsa >= 0.9.x was included; 0.5.x was dropped (but feel free to re-add it if you need it)
|
||||
# It defines ...
|
||||
# It offers the following macros:
|
||||
# ALSA_CONFIGURE_FILE(config_header) - generate a config.h, typical usage:
|
||||
# ALSA_CONFIGURE_FILE(${CMAKE_BINARY_DIR}/config-alsa.h)
|
||||
# ALSA_VERSION_STRING(version_string) looks for alsa/version.h and reads the version string into
|
||||
# the first argument passed to the macro
|
||||
|
||||
# Copyright (c) 2006, David Faure, <faure@kde.org>
|
||||
# Copyright (c) 2007, Matthias Kretz <kretz@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckIncludeFileCXX)
|
||||
include(CheckLibraryExists)
|
||||
|
||||
# Already done by toplevel
|
||||
find_library(ASOUND_LIBRARY asound)
|
||||
set(ASOUND_LIBRARY_DIR "")
|
||||
if(ASOUND_LIBRARY)
|
||||
get_filename_component(ASOUND_LIBRARY_DIR ${ASOUND_LIBRARY} PATH)
|
||||
endif(ASOUND_LIBRARY)
|
||||
|
||||
check_library_exists(asound snd_seq_create_simple_port "${ASOUND_LIBRARY_DIR}" HAVE_LIBASOUND2)
|
||||
if(HAVE_LIBASOUND2)
|
||||
message(STATUS "Found ALSA: ${ASOUND_LIBRARY}")
|
||||
else(HAVE_LIBASOUND2)
|
||||
message(STATUS "ALSA not found")
|
||||
endif(HAVE_LIBASOUND2)
|
||||
set(ALSA_FOUND ${HAVE_LIBASOUND2})
|
||||
|
||||
find_path(ALSA_INCLUDES alsa/version.h)
|
||||
|
||||
macro(ALSA_VERSION_STRING _result)
|
||||
# check for version in alsa/version.h
|
||||
if(ALSA_INCLUDES)
|
||||
file(READ "${ALSA_INCLUDES}/alsa/version.h" _ALSA_VERSION_CONTENT)
|
||||
string(REGEX REPLACE ".*SND_LIB_VERSION_STR.*\"(.*)\".*" "\\1" ${_result} ${_ALSA_VERSION_CONTENT})
|
||||
else(ALSA_INCLUDES)
|
||||
message(STATUS "ALSA version not known. ALSA output will probably not work correctly.")
|
||||
endif(ALSA_INCLUDES)
|
||||
endmacro(ALSA_VERSION_STRING _result)
|
||||
|
||||
|
||||
get_filename_component(_FIND_ALSA_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
macro(ALSA_CONFIGURE_FILE _destFile)
|
||||
check_include_files(sys/soundcard.h LMMS_HAVE_SYS_SOUNDCARD_H)
|
||||
check_include_files(machine/soundcard.h LMMS_HAVE_MACHINE_SOUNDCARD_H)
|
||||
|
||||
check_include_files(linux/awe_voice.h LMMS_HAVE_LINUX_AWE_VOICE_H)
|
||||
check_include_files(awe_voice.h LMMS_HAVE_AWE_VOICE_H)
|
||||
check_include_files(/usr/src/sys/i386/isa/sound/awe_voice.h LMMS_HAVE__USR_SRC_SYS_I386_ISA_SOUND_AWE_VOICE_H)
|
||||
check_include_files(/usr/src/sys/gnu/i386/isa/sound/awe_voice.h LMMS_HAVE__USR_SRC_SYS_GNU_I386_ISA_SOUND_AWE_VOICE_H)
|
||||
|
||||
check_include_file_cxx(sys/asoundlib.h LMMS_HAVE_SYS_ASOUNDLIB_H)
|
||||
check_include_file_cxx(alsa/asoundlib.h LMMS_HAVE_ALSA_ASOUNDLIB_H)
|
||||
|
||||
check_library_exists(asound snd_pcm_resume "${ASOUND_LIBRARY_DIR}" ASOUND_HAS_SND_PCM_RESUME)
|
||||
if(ASOUND_HAS_SND_PCM_RESUME)
|
||||
set(HAVE_SND_PCM_RESUME 1)
|
||||
endif(ASOUND_HAS_SND_PCM_RESUME)
|
||||
|
||||
configure_file(${_FIND_ALSA_MODULE_DIR}/config-alsa.h.cmake ${_destFile})
|
||||
endmacro(ALSA_CONFIGURE_FILE _destFile)
|
||||
|
||||
mark_as_advanced(ALSA_INCLUDES ASOUND_LIBRARY)
|
||||
86
cmake/modules/FindOggVorbis.cmake
Normal file
86
cmake/modules/FindOggVorbis.cmake
Normal file
@@ -0,0 +1,86 @@
|
||||
# - Try to find the OggVorbis libraries
|
||||
# Once done this will define
|
||||
#
|
||||
# OGGVORBIS_FOUND - system has OggVorbis
|
||||
# OGGVORBIS_VERSION - set either to 1 or 2
|
||||
# OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory
|
||||
# OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis
|
||||
# OGG_LIBRARY - The Ogg library
|
||||
# VORBIS_LIBRARY - The Vorbis library
|
||||
# VORBISFILE_LIBRARY - The VorbisFile library
|
||||
# VORBISENC_LIBRARY - The VorbisEnc library
|
||||
|
||||
# Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
include (CheckLibraryExists)
|
||||
|
||||
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
|
||||
find_path(OGG_INCLUDE_DIR ogg/ogg.h)
|
||||
|
||||
find_library(OGG_LIBRARY NAMES ogg)
|
||||
find_library(VORBIS_LIBRARY NAMES vorbis)
|
||||
find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
|
||||
find_library(VORBISENC_LIBRARY NAMES vorbisenc)
|
||||
|
||||
|
||||
if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
|
||||
set(OGGVORBIS_FOUND TRUE)
|
||||
|
||||
set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBISENC_LIBRARY})
|
||||
|
||||
set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES})
|
||||
check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP})
|
||||
|
||||
if (HAVE_LIBVORBISENC2)
|
||||
set (OGGVORBIS_VERSION 2)
|
||||
else (HAVE_LIBVORBISENC2)
|
||||
set (OGGVORBIS_VERSION 1)
|
||||
endif (HAVE_LIBVORBISENC2)
|
||||
|
||||
else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
|
||||
set (OGGVORBIS_VERSION)
|
||||
set(OGGVORBIS_FOUND FALSE)
|
||||
endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
|
||||
|
||||
|
||||
if (OGGVORBIS_FOUND)
|
||||
if (NOT OggVorbis_FIND_QUIETLY)
|
||||
message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}")
|
||||
endif (NOT OggVorbis_FIND_QUIETLY)
|
||||
else (OGGVORBIS_FOUND)
|
||||
if (OggVorbis_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could NOT find OggVorbis libraries")
|
||||
endif (OggVorbis_FIND_REQUIRED)
|
||||
if (NOT OggVorbis_FIND_QUITELY)
|
||||
message(STATUS "Could NOT find OggVorbis libraries")
|
||||
endif (NOT OggVorbis_FIND_QUITELY)
|
||||
endif (OGGVORBIS_FOUND)
|
||||
|
||||
#check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H)
|
||||
#check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG)
|
||||
#check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS)
|
||||
#check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE)
|
||||
#check_library_exists(vorbisenc vorbis_info_clear "" HAVE_LIBVORBISENC)
|
||||
#check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
|
||||
|
||||
#if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
|
||||
# message(STATUS "Ogg/Vorbis found")
|
||||
# set (VORBIS_LIBS "-lvorbis -logg")
|
||||
# set (VORBISFILE_LIBS "-lvorbisfile")
|
||||
# set (VORBISENC_LIBS "-lvorbisenc")
|
||||
# set (OGGVORBIS_FOUND TRUE)
|
||||
# if (HAVE_LIBVORBISENC2)
|
||||
# set (HAVE_VORBIS 2)
|
||||
# else (HAVE_LIBVORBISENC2)
|
||||
# set (HAVE_VORBIS 1)
|
||||
# endif (HAVE_LIBVORBISENC2)
|
||||
#else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
|
||||
# message(STATUS "Ogg/Vorbis not found")
|
||||
#endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
|
||||
|
||||
127
cmake/modules/FindPCHSupport.cmake
Normal file
127
cmake/modules/FindPCHSupport.cmake
Normal file
@@ -0,0 +1,127 @@
|
||||
# - Try to find precompiled headers support for GCC 3.4 and 4.x
|
||||
# Once done this will define:
|
||||
#
|
||||
# Variable:
|
||||
# PCHSupport_FOUND
|
||||
#
|
||||
# Macro:
|
||||
# ADD_PRECOMPILED_HEADER
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
EXEC_PROGRAM(
|
||||
${CMAKE_CXX_COMPILER}
|
||||
ARGS --version
|
||||
OUTPUT_VARIABLE _compiler_output)
|
||||
STRING(REGEX REPLACE ".* ([0-9]\\.[0-9]\\.[0-9]) .*" "\\1"
|
||||
gcc_compiler_version ${_compiler_output})
|
||||
#MESSAGE("GCC Version: ${gcc_compiler_version}")
|
||||
IF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ELSE(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]")
|
||||
IF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]")
|
||||
ENDIF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]")
|
||||
IF(PCHSupport_FOUND)
|
||||
ADD_DEFINITIONS( -DUSE_PCH=1 )
|
||||
ELSE(PCHSupport_FOUND)
|
||||
ADD_DEFINITIONS( -DUSE_PCH=0 )
|
||||
ENDIF(PCHSupport_FOUND)
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
|
||||
# ADD_PRECOMPILED_HEADER( targetName HEADERS _inputs )
|
||||
MACRO(ADD_PRECOMPILED_HEADER _targetName _inputs )
|
||||
FOREACH (_current_FILE ${ARGN})
|
||||
|
||||
GET_FILENAME_COMPONENT(_name ${_current_FILE} NAME)
|
||||
SET(_source "${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE}")
|
||||
SET(_outdir "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gch")
|
||||
MAKE_DIRECTORY(${_outdir})
|
||||
SET(_output "${_outdir}/${CMAKE_BUILD_TYPE}.c++")
|
||||
STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
|
||||
SET(_compiler_FLAGS ${${_flags_var_name}})
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
|
||||
FOREACH(item ${_directory_flags})
|
||||
LIST(APPEND _compiler_FLAGS "-I${item}")
|
||||
ENDFOREACH(item)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
LIST(APPEND _compiler_FLAGS ${_directory_flags})
|
||||
|
||||
# some hacks for Qt4 - Tobias Doerffel, 2008
|
||||
STRING(TOUPPER "COMPILE_DEFINITIONS_${CMAKE_BUILD_TYPE}" CD)
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags ${CD} )
|
||||
FOREACH(item ${_directory_flags})
|
||||
LIST(APPEND _compiler_FLAGS "-D${item}")
|
||||
ENDFOREACH(item)
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags COMPILE_DEFINITIONS)
|
||||
FOREACH(item ${_directory_flags})
|
||||
LIST(APPEND _compiler_FLAGS "-D${item}")
|
||||
ENDFOREACH(item)
|
||||
|
||||
SEPARATE_ARGUMENTS(_compiler_FLAGS)
|
||||
#MESSAGE("_compiler_FLAGS: ${_compiler_FLAGS}")
|
||||
#message("${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header -o ${_output} ${_source}")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${_output}
|
||||
COMMAND ${CMAKE_CXX_COMPILER}
|
||||
${_compiler_FLAGS}
|
||||
${COMPILE_DEFINITIONS}
|
||||
-x c++-header
|
||||
-o ${_output} ${_source}
|
||||
DEPENDS ${_source} )
|
||||
ADD_CUSTOM_TARGET(${_targetName}_gch DEPENDS ${_output})
|
||||
ADD_DEPENDENCIES(${_targetName} ${_targetName}_gch)
|
||||
#SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-include ${_name} -Winvalid-pch -H")
|
||||
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${_name} -Winvalid-pch")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES
|
||||
COMPILE_FLAGS "-include ${_name} -Winvalid-pch"
|
||||
)
|
||||
ENDFOREACH (_current_FILE)
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER)
|
||||
|
||||
# ADD_PRECOMPILED_HEADER_INPLACE( targetName HEADERS _inputs )
|
||||
MACRO(ADD_PRECOMPILED_HEADER_INPLACE _targetName _inputs )
|
||||
STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
|
||||
SET(_compiler_FLAGS ${${_flags_var_name}})
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
|
||||
FOREACH(item ${_directory_flags})
|
||||
LIST(APPEND _compiler_FLAGS "-I${item}")
|
||||
ENDFOREACH(item)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
LIST(APPEND _compiler_FLAGS ${_directory_flags})
|
||||
|
||||
SEPARATE_ARGUMENTS(_compiler_FLAGS)
|
||||
#MESSAGE("_compiler_FLAGS: ${_compiler_FLAGS}")
|
||||
MAKE_DIRECTORY("${CMAKE_CURRENT_BINARY_DIR}/gch")
|
||||
FOREACH (_current_FILE ${ARGN})
|
||||
|
||||
GET_FILENAME_COMPONENT(_name ${_current_FILE} NAME)
|
||||
SET(_source "${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE}")
|
||||
SET(_output "${CMAKE_CURRENT_BINARY_DIR}/gch/${_name}.gch")
|
||||
#message("${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header -o ${_output} ${_source}")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${_output}
|
||||
COMMAND ${CMAKE_CXX_COMPILER}
|
||||
${_compiler_FLAGS}
|
||||
-x c++-header
|
||||
-fPIC
|
||||
-o ${_output} ${_source}
|
||||
DEPENDS ${_source} )
|
||||
LIST(APPEND GCH_FILES ${_output})
|
||||
ENDFOREACH (_current_FILE)
|
||||
|
||||
#MESSAGE("GCH_FILES: ${GCH_FILES}")
|
||||
FOREACH (GCH_FILE ${GCH_FILES})
|
||||
SET_DIRECTORY_PROPERTIES( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${GCH_FILE} )
|
||||
ENDFOREACH (GCH_FILE)
|
||||
SEPARATE_ARGUMENTS(GCH_FILES)
|
||||
ADD_CUSTOM_TARGET(${_targetName}_gch DEPENDS ${GCH_FILES})
|
||||
ADD_DEPENDENCIES(${_targetName} ${_targetName}_gch)
|
||||
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/gch/)
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "-Winvalid-pch")
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER_INPLACE)
|
||||
59
cmake/modules/FindPulseAudio.cmake
Normal file
59
cmake/modules/FindPulseAudio.cmake
Normal file
@@ -0,0 +1,59 @@
|
||||
# - Try to find PulseAudioSimple
|
||||
# Once done this will define
|
||||
#
|
||||
# PULSEAUDIO_FOUND - system has PulseAudioSimple
|
||||
# PULSEAUDIO_INCLUDE_DIR - the PulseAudioSimple include directory
|
||||
# PULSEAUDIO_LIBRARIES - the libraries needed to use PulseAudioSimple
|
||||
# PULSEAUDIO_DEFINITIONS - Compiler switches required for using PulseAudioSimple
|
||||
#
|
||||
IF(NO_PULSE)
|
||||
message(status "<disabled per request>")
|
||||
ELSE(NO_PULSE)
|
||||
|
||||
IF (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARIES)
|
||||
# in cache already
|
||||
SET(PULSEAUDIO_FIND_QUIETLY TRUE)
|
||||
ENDIF (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARIES)
|
||||
|
||||
IF (NOT WIN32)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
INCLUDE(FindPkgConfig)
|
||||
pkg_check_modules(PA libpulse)
|
||||
set(_PASIncDir ${PA_INCLUDE_DIRS})
|
||||
set(_PASLinkDir ${PA_LIBRARY_DIRS})
|
||||
set(_PASLinkFlags ${PA_LDFLAGS})
|
||||
set(_PASCflags ${PA_CFLAGS})
|
||||
SET(PULSEAUDIO_DEFINITIONS ${_PASCflags})
|
||||
ENDIF (NOT WIN32)
|
||||
|
||||
FIND_PATH(PULSEAUDIO_INCLUDE_DIR pulse/pulseaudio.h
|
||||
PATHS
|
||||
${_PASIncDir}
|
||||
PATH_SUFFIXES pulse
|
||||
)
|
||||
|
||||
FIND_LIBRARY(PULSEAUDIO_LIBRARIES NAMES pulse libpulse
|
||||
PATHS
|
||||
${_PASLinkDir}
|
||||
)
|
||||
|
||||
IF (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARIES)
|
||||
SET(PULSEAUDIO_FOUND TRUE)
|
||||
ELSE (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARIES)
|
||||
SET(PULSEAUDIO_FOUND FALSE)
|
||||
ENDIF (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARIES)
|
||||
|
||||
IF (PULSEAUDIO_FOUND)
|
||||
IF (NOT PULSEAUDIO_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found PulseAudio Simple: ${PULSEAUDIO_LIBRARIES}")
|
||||
ENDIF (NOT PULSEAUDIO_FIND_QUIETLY)
|
||||
SET(USE_PULSE_ 1)
|
||||
ELSE (PULSEAUDIO_FOUND)
|
||||
MESSAGE(STATUS "Could NOT find LibXml2")
|
||||
ENDIF (PULSEAUDIO_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARIES)
|
||||
|
||||
ENDIf(NO_PULSE)
|
||||
|
||||
20
cmake/modules/FindSTK.cmake
Normal file
20
cmake/modules/FindSTK.cmake
Normal file
@@ -0,0 +1,20 @@
|
||||
FIND_PATH(STK_INCLUDE_DIR Stk.h /usr/include/stk /usr/local/include/stk)
|
||||
|
||||
FIND_LIBRARY(STK_LIBRARY NAMES stk PATH /usr/lib /usr/local/lib)
|
||||
|
||||
IF (STK_INCLUDE_DIR AND STK_LIBRARY)
|
||||
SET(STK_FOUND TRUE)
|
||||
ENDIF (STK_INCLUDE_DIR AND STK_LIBRARY)
|
||||
|
||||
|
||||
IF (STK_FOUND)
|
||||
IF (NOT STK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found STK: ${STK_LIBRARY}")
|
||||
SET(HAVE_STK TRUE)
|
||||
ENDIF (NOT STK_FIND_QUIETLY)
|
||||
ELSE (STK_FOUND)
|
||||
IF (STK_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find STK")
|
||||
ENDIF (STK_FIND_REQUIRED)
|
||||
ENDIF (STK_FOUND)
|
||||
|
||||
45
cmake/modules/InstallHelpers.cmake
Normal file
45
cmake/modules/InstallHelpers.cmake
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# install all files matching certain wildcards below ${LMMS_DATA_DIR}/<subdir>
|
||||
#
|
||||
# example:
|
||||
#
|
||||
# INSTALL_DATA_SUBDIRS("samples" "*.ogg;*.wav;*.flac")
|
||||
#
|
||||
# Copyright (c) 2008 Tobias Doerffel
|
||||
#
|
||||
|
||||
|
||||
# helper-macro
|
||||
MACRO(LIST_CONTAINS var value)
|
||||
SET(${var})
|
||||
FOREACH (value2 ${ARGN})
|
||||
IF (${value} STREQUAL ${value2})
|
||||
SET(${var} TRUE)
|
||||
ENDIF (${value} STREQUAL ${value2})
|
||||
ENDFOREACH (value2)
|
||||
ENDMACRO(LIST_CONTAINS)
|
||||
|
||||
|
||||
MACRO(INSTALL_DATA_SUBDIRS _subdir _wildcards)
|
||||
FOREACH(_wildcard ${_wildcards})
|
||||
FILE(GLOB_RECURSE files ${_wildcard})
|
||||
SET(SUBDIRS)
|
||||
|
||||
FOREACH(_item ${files})
|
||||
GET_FILENAME_COMPONENT(_file "${_item}" PATH)
|
||||
STRING(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" _file "${_file}")
|
||||
LIST_CONTAINS(contains _file ${SUBDIRS})
|
||||
IF(NOT contains)
|
||||
LIST(APPEND SUBDIRS "${_file}")
|
||||
ENDIF(NOT contains)
|
||||
ENDFOREACH(_item ${files})
|
||||
|
||||
FOREACH(_item ${SUBDIRS})
|
||||
FILE(GLOB files "${_item}/${_wildcard}")
|
||||
FOREACH(_file ${files})
|
||||
INSTALL(FILES "${_file}" DESTINATION "${LMMS_DATA_DIR}/${_subdir}/${_item}/")
|
||||
ENDFOREACH(_file ${files})
|
||||
ENDFOREACH(_item ${SUBDIRS})
|
||||
ENDFOREACH(_wildcard ${_wildcards})
|
||||
ENDMACRO(INSTALL_DATA_SUBDIRS)
|
||||
|
||||
34
cmake/modules/config-alsa.h.cmake
Normal file
34
cmake/modules/config-alsa.h.cmake
Normal file
@@ -0,0 +1,34 @@
|
||||
/* Define to 1 if you have the <linux/awe_voice.h> header file. */
|
||||
#cmakedefine LMMS_HAVE_LINUX_AWE_VOICE_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/awe_voice.h> header file. */
|
||||
#cmakedefine LMMS_HAVE_SYS_AWE_VOICE_H 1
|
||||
|
||||
/* Define to 1 if you have the </usr/src/sys/gnu/i386/isa/sound/awe_voice.h>
|
||||
header file. */
|
||||
#cmakedefine LMMS_HAVE__USR_SRC_SYS_GNU_I386_ISA_SOUND_AWE_VOICE_H 1
|
||||
|
||||
/* Define to 1 if you have the </usr/src/sys/i386/isa/sound/awe_voice.h>
|
||||
header file. */
|
||||
#cmakedefine LMMS_HAVE__USR_SRC_SYS_I386_ISA_SOUND_AWE_VOICE_H 1
|
||||
|
||||
/* Define to 1 if you have the <awe_voice.h> header file. */
|
||||
#cmakedefine LMMS_HAVE_AWE_VOICE_H 1
|
||||
|
||||
/* Define if you have libasound.so.2 (required for ALSA 0.9.x support) */
|
||||
#cmakedefine LMMS_HAVE_LIBASOUND2 1
|
||||
|
||||
/* Define if libasound has snd_pcm_resume() */
|
||||
#cmakedefine LMMS_HAVE_SND_PCM_RESUME 1
|
||||
|
||||
/* Define to 1 if you have the <alsa/asoundlib.h> header file. */
|
||||
#cmakedefine LMMS_HAVE_ALSA_ASOUNDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/asoundlib.h> header file. */
|
||||
#cmakedefine LMMS_HAVE_SYS_ASOUNDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/soundcard.h> header file. */
|
||||
#cmakedefine LMMS_HAVE_SYS_SOUNDCARD_H 1
|
||||
|
||||
/* Define to 1 if you have the <machine/soundcard.h> header file. */
|
||||
#cmakedefine LMMS_HAVE_MACHINE_SOUNDCARD_H 1
|
||||
Reference in New Issue
Block a user