2010-06-06 23:43:45 +02:00
PROJECT ( projectM )
cmake_minimum_required ( VERSION 2.6.0 )
SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "The projectM core library." )
2010-06-07 12:18:35 +02:00
include ( CheckCXXCompilerFlag )
2010-06-06 23:43:45 +02:00
cmake_policy ( SET CMP0005 OLD )
OPTION ( USE_DEVIL "Use devIL for image loading rather than the builtin SOIL library" OFF )
OPTION ( USE_FBO "Use Framebuffer Objects for increased rendering quality. Disable this for OpenGL ES 1.x or if you are experiencing problems on older or poorly supported hardware." ON )
OPTION ( USE_FTGL "Use FTGL for on-screen fonts (found on your system)" OFF )
OPTION ( USE_GLES1 "Use OpenGL ES 1.x" OFF )
OPTION ( USE_THREADS "Use threads for parallelization" OFF )
OPTION ( USE_OPENMP "Use OpenMP and OMPTL for multi-core parallelization" ON )
OPTION ( USE_NATIVE_GLEW "Use projectM's native implemention of GLEW." OFF )
OPTION ( USE_CG "Use Cg for Pixel Shader support" OFF )
OPTION ( BUILD_PROJECTM_STATIC "Build the projectM target library in the platform's native static (NOT shared) format." ON )
OPTION ( DISABLE_NATIVE_PRESETS "Turn off support for native (C++ style) presets" OFF )
OPTION ( DISABLE_MILKDROP_PRESETS "Turn off support for Milkdrop (.milk / .prjm) presets" OFF )
ADD_DEFINITIONS ( -DCMAKE_INSTALL_PREFIX= "\\\" ${ CMAKE_INSTALL_PREFIX } \\\"")
if ( USE_NATIVE_GLEW )
2010-06-07 13:37:37 +02:00
ADD_DEFINITIONS ( -DUSE_NATIVE_GLEW )
SET ( GLEW_SOURCES glew.h glew.c )
SET ( GLEW_LINK_TARGETS )
2010-06-06 23:43:45 +02:00
else ( USE_NATIVE_GLEW )
2010-06-07 13:37:37 +02:00
SET ( GLEW_SOURCES )
find_library ( GLEW_LINK_TARGETS NAMES glew GLEW glew32 )
2010-06-06 23:43:45 +02:00
endif ( USE_NATIVE_GLEW )
SET ( projectM_SOURCES projectM.cpp PCM.cpp Preset.cpp fftsg.cpp KeyHandler.cpp
t i m e r . c p p w i p e m a l l o c . c p p P r e s e t L o a d e r . c p p P r e s e t C h o o s e r . c p p P i p e l i n e M e r g e r . c p p C o n f i g F i l e . c p p T i m e K e e p e r . c p p P r e s e t F a c t o r y . c p p P r e s e t F a c t o r y M a n a g e r . c p p $ { G L E W _ S O U R C E S } )
if ( MSVC )
SET ( projectM_SOURCES ${ projectM_SOURCES } dlfcn.c win32-dirent.cpp )
endif ( MSVC )
if ( NOT DISABLE_NATIVE_PRESETS )
add_subdirectory ( NativePresetFactory )
SET ( PRESET_FACTORY_SOURCES ${ PRESET_FACTORY_SOURCES } ${ NativePresetFactory_SOURCE_DIR } )
SET ( PRESET_FACTORY_BINARY_DIR ${ PRESET_FACTORY_BINARY_DIR } ${ NativePresetFactory_BINARY_DIR } )
SET ( PRESET_FACTORY_LINK_TARGETS ${ PRESET_FACTORY_LINK_TARGETS } NativePresetFactory )
endif ( NOT DISABLE_NATIVE_PRESETS )
if ( NOT DISABLE_MILKDROP_PRESETS )
add_subdirectory ( MilkdropPresetFactory )
SET ( PRESET_FACTORY_SOURCES ${ PRESET_FACTORY_SOURCES } ${ MilkdropPresetFactory_SOURCE_DIR } )
SET ( PRESET_FACTORY_BINARY_DIR ${ PRESET_FACTORY_BINARY_DIR } ${ MilkdropPrmaesetFactory_BINARY_DIR } )
SET ( PRESET_FACTORY_LINK_TARGETS ${ PRESET_FACTORY_LINK_TARGETS } MilkdropPresetFactory )
endif ( NOT DISABLE_MILKDROP_PRESETS )
if ( USE_DEVIL )
SET ( projectM_SOURCES ${ projectM_SOURCES } )
ADD_DEFINITIONS ( -DUSE_DEVIL )
SET ( IMAGE_LINK_TARGETS IL ILU ILUT )
else ( USE_DEVIL )
SET ( projectM_SOURCES ${ projectM_SOURCES } )
SET ( IMAGE_LINK_TARGETS )
endif ( USE_DEVIL )
if ( USE_CG )
ADD_DEFINITIONS ( -DUSE_CG )
SET ( CG_LINK_TARGETS Cg CgGL )
else ( USE_CG )
SET ( CG_LINK_TARGETS )
endif ( USE_CG )
if ( USE_GLES1 )
ADD_DEFINITIONS ( -DUSE_GLES1 )
endif ( USE_GLES1 )
if ( USE_FBO )
ADD_DEFINITIONS ( -DUSE_FBO )
endif ( USE_FBO )
if ( USE_FTGL )
ADD_DEFINITIONS ( -DUSE_FTGL )
find_package ( Freetype2 REQUIRED )
include_directories ( ${ FREETYPE2_INCLUDE_DIR } )
endif ( USE_FTGL )
if ( COMMAND cmake_policy )
cmake_policy ( SET CMP0003 NEW )
endif ( COMMAND cmake_policy )
if ( BUILD_PROJECTM_STATIC )
ADD_LIBRARY ( projectM STATIC ${ projectM_SOURCES } )
else ( BUILD_PROJECTM_STATIC )
ADD_LIBRARY ( projectM SHARED ${ projectM_SOURCES } )
endif ( BUILD_PROJECTM_STATIC )
SET_TARGET_PROPERTIES ( projectM PROPERTIES VERSION 2.00 SOVERSION 2 )
if ( USE_THREADS )
ADD_DEFINITIONS ( -DUSE_THREADS )
endif ( USE_THREADS )
if ( APPLE )
ADD_DEFINITIONS ( -DMACOS -DSTBI_NO_DDS )
set ( RESOURCE_PREFIX "Resources" )
else ( APPLE )
if ( WIN32 )
set ( RESOURCE_PREFIX "Resources" )
ADD_DEFINITIONS ( -DWIN32 -DSTBI_NO_DDS )
else ( WIN32 )
set ( RESOURCE_PREFIX "share/projectM" )
ADD_DEFINITIONS ( -DLINUX -DSTBI_NO_DDS )
endif ( WIN32 )
endif ( APPLE )
add_subdirectory ( Renderer )
#ADD_DEFINITIONS(-DCMAKE_INSTALL_PREFIX="\\\"${CMAKE_INSTALL_PREFIX}\\\"")
FIND_PACKAGE ( OpenGL )
#set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH};/opt/local/include;/Developer/SDKs/MACOSX10.5.sdk/usr/X11/include)
#set(CMAKE_LIBRARY_PATH /opt/local/lib;/Developer/SDKs/MACOSX10.5.sdk;/Developer/SDKs/MacOSX10.5.sdk/usr/X11/lib/)
2010-06-07 12:18:35 +02:00
CHECK_CXX_COMPILER_FLAG ( "-fopenmp" SUPPORTS_OPENMP )
2010-06-06 23:43:45 +02:00
2010-06-07 12:18:35 +02:00
IF ( USE_OPENMP AND SUPPORTS_OPENMP )
2010-06-06 23:43:45 +02:00
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp " )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp " )
2010-06-07 12:18:35 +02:00
ENDIF ( USE_OPENMP AND SUPPORTS_OPENMP )
2010-06-06 23:43:45 +02:00
INCLUDE_DIRECTORIES ( ${ projectM_SOURCE_DIR } ${ FTGL_INCLUDE_DIRS } ${ Renderer_SOURCE_DIR } ${ PRESET_FACTORY_SOURCES } )
LINK_DIRECTORIES ( ${ FTGL_LINK_DIRS } ${ Renderer_BINARY_DIR } ${ PRESET_FACTORY_BINARY_DIR } )
if ( MSVC )
SET ( MATH_LIBRARIES )
else ( MSVC )
SET ( MATH_LIBRARIES m )
endif ( MSVC )
if ( BUILD_PROJECTM_STATIC )
TARGET_LINK_LIBRARIES ( projectM ${ GLEW_LINK_TARGETS } ${ MATH_LIBRARIES } ${ FTGL_LINK_TARGETS } ${ OPENGL_LIBRARIES } ${ IMAGE_LINK_TARGETS } ${ CG_LINK_TARGETS } ${ PRESET_FACTORY_LINK_TARGETS } )
else ( BUILD_PROJECTM_STATIC )
TARGET_LINK_LIBRARIES ( projectM ${ GLEW_LINK_TARGETS } ${ MATH_LIBRARIES } ${ FTGL_LINK_TARGETS } ${ OPENGL_LIBRARIES } ${ IMAGE_LINK_TARGETS } ${ CG_LINK_TARGETS } ${ PRESET_FACTORY_LINK_TARGETS } )
endif ( BUILD_PROJECTM_STATIC )
CONFIGURE_FILE ( "${CMAKE_CURRENT_SOURCE_DIR}/libprojectM.pc.in" "${CMAKE_CURRENT_SOURCE_DIR}/libprojectM.pc" @ONLY )
CONFIGURE_FILE ( "${CMAKE_CURRENT_SOURCE_DIR}/config.inp.in" "${CMAKE_CURRENT_SOURCE_DIR}/config.inp" @ONLY )
2010-06-07 12:09:30 +02:00
2010-06-06 23:43:45 +02:00
FILE ( GLOB presets "presets/*.milk" "presets/*.prjm" "presets/*.tga" )
2010-06-07 12:09:30 +02:00
if ( APPLE )
foreach ( preset ${ presets } )
2010-06-07 13:38:43 +02:00
get_filename_component ( PRESET_NAME ${ preset } NAME )
2010-06-07 12:09:30 +02:00
configure_file (
" $ { p r e s e t } "
2010-06-07 13:38:43 +02:00
" $ { C M A K E _ B I N A R Y _ D I R } / c l e m e n t i n e . a p p / C o n t e n t s / R e s o u r c e s / p r o j e c t m - p r e s e t s / $ { P R E S E T _ N A M E } "
2010-06-07 12:09:30 +02:00
C O P Y _ O N L Y
)
endforeach ( preset )
else ( APPLE )
INSTALL ( FILES ${ presets } DESTINATION ${ CMAKE_INSTALL_PREFIX } /share/clementine/projectm-presets )
endif ( APPLE )