2010-06-06 23:43:45 +02:00
|
|
|
PROJECT(projectM)
|
2021-04-17 07:08:31 +02:00
|
|
|
cmake_minimum_required(VERSION 3.0.0)
|
2010-06-06 23:43:45 +02:00
|
|
|
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)
|
2011-10-20 00:45:48 +02:00
|
|
|
|
|
|
|
# This policy was only added in cmake 2.8.4
|
|
|
|
if (CMAKE_VERSION VERSION_GREATER "2.8.3")
|
|
|
|
cmake_policy(SET CMP0017 OLD)
|
|
|
|
endif (CMAKE_VERSION VERSION_GREATER "2.8.3")
|
2010-06-06 23:43:45 +02:00
|
|
|
|
|
|
|
|
2010-06-11 00:48:23 +02:00
|
|
|
set(USE_DEVIL OFF)
|
|
|
|
set(USE_FBO ON)
|
|
|
|
set(USE_FTGL OFF)
|
|
|
|
set(USE_GLES1 OFF)
|
|
|
|
set(USE_THREADS OFF)
|
|
|
|
set(USE_OPENMP ON)
|
|
|
|
set(USE_NATIVE_GLEW OFF)
|
|
|
|
set(USE_CG OFF)
|
|
|
|
set(BUILD_PROJECTM_STATIC ON)
|
2011-11-29 15:55:15 +01:00
|
|
|
set(DISABLE_NATIVE_PRESETS ON)
|
2010-06-11 00:48:23 +02:00
|
|
|
set(DISABLE_MILKDROP_PRESETS OFF)
|
2010-06-06 23:43:45 +02:00
|
|
|
|
2020-05-14 15:18:20 +02:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
2016-05-09 11:55:34 +02:00
|
|
|
|
2017-11-21 13:38:57 +01:00
|
|
|
pkg_check_modules(GLEW glew)
|
|
|
|
|
2011-11-29 15:55:15 +01:00
|
|
|
if(DISABLE_NATIVE_PRESETS)
|
|
|
|
ADD_DEFINITIONS(-DDISABLE_NATIVE_PRESETS)
|
|
|
|
endif(DISABLE_NATIVE_PRESETS)
|
|
|
|
|
2010-06-06 23:43:45 +02:00
|
|
|
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)
|
2010-06-11 00:48:23 +02:00
|
|
|
SET(GLEW_LIBRARIES )
|
2010-06-06 23:43:45 +02:00
|
|
|
else(USE_NATIVE_GLEW)
|
2010-06-07 13:37:37 +02:00
|
|
|
SET(GLEW_SOURCES )
|
2018-11-25 23:11:06 +01:00
|
|
|
find_library(GLEW_LIBRARIES NAMES glew32.dll glew GLEW glew32)
|
2010-06-17 16:45:31 +02:00
|
|
|
find_path(GLEW_INCLUDE_DIRS GL/glew.h HINTS /sw/include)
|
|
|
|
include_directories(${GLEW_INCLUDE_DIRS})
|
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
|
|
|
|
timer.cpp wipemalloc.cpp PresetLoader.cpp PresetChooser.cpp PipelineMerger.cpp ConfigFile.cpp TimeKeeper.cpp PresetFactory.cpp PresetFactoryManager.cpp ${GLEW_SOURCES})
|
|
|
|
|
|
|
|
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)
|
2010-07-18 15:25:36 +02:00
|
|
|
ADD_DEFINITIONS(-DUSE_FTGL)
|
2010-06-06 23:43:45 +02:00
|
|
|
|
2010-07-18 15:25:36 +02:00
|
|
|
pkg_check_modules(FREETYPE2 freetype2)
|
|
|
|
pkg_check_modules(FTGL ftgl)
|
|
|
|
include_directories( ${FREETYPE2_INCLUDE_DIRS} )
|
2010-06-06 23:43:45 +02:00
|
|
|
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)
|
2010-07-27 15:57:31 +02:00
|
|
|
set_target_properties(projectM PROPERTIES COMPILE_FLAGS "-Wno-unused-value")
|
2010-06-06 23:43:45 +02:00
|
|
|
|
|
|
|
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}\\\"")
|
|
|
|
|
2011-11-29 12:27:35 +01:00
|
|
|
FIND_PACKAGE(X11)
|
2010-06-06 23:43:45 +02:00
|
|
|
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
|
|
|
|
2011-11-29 12:27:35 +01:00
|
|
|
INCLUDE_DIRECTORIES(${projectM_SOURCE_DIR} ${FTGL_INCLUDE_DIRS} ${X11_INCLUDE_DIR} ${Renderer_SOURCE_DIR} ${PRESET_FACTORY_SOURCES})
|
2010-07-18 15:25:36 +02:00
|
|
|
LINK_DIRECTORIES(${FTGL_LIBRARY_DIRS} ${Renderer_BINARY_DIR} ${PRESET_FACTORY_BINARY_DIR})
|
2010-06-06 23:43:45 +02:00
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
SET (MATH_LIBRARIES )
|
|
|
|
else(MSVC)
|
|
|
|
SET (MATH_LIBRARIES m)
|
|
|
|
endif(MSVC)
|
|
|
|
|
|
|
|
if(BUILD_PROJECTM_STATIC)
|
2010-07-18 15:25:36 +02:00
|
|
|
TARGET_LINK_LIBRARIES(projectM ${GLEW_LIBRARIES} ${MATH_LIBRARIES} ${FTGL_LIBRARIES} ${OPENGL_LIBRARIES} ${IMAGE_LINK_TARGETS} ${CG_LINK_TARGETS} ${PRESET_FACTORY_LINK_TARGETS})
|
2010-06-06 23:43:45 +02:00
|
|
|
else(BUILD_PROJECTM_STATIC)
|
2010-07-18 15:25:36 +02:00
|
|
|
TARGET_LINK_LIBRARIES(projectM ${GLEW_LIBRARIES} ${MATH_LIBRARIES} ${FTGL_LIBRARIES} ${OPENGL_LIBRARIES} ${IMAGE_LINK_TARGETS} ${CG_LINK_TARGETS} ${PRESET_FACTORY_LINK_TARGETS})
|
2010-06-06 23:43:45 +02:00
|
|
|
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-11 01:01:22 +02:00
|
|
|
if(BUNDLE_PROJECTM_PRESETS)
|
|
|
|
FILE(GLOB presets "presets/*.milk" "presets/*.prjm" "presets/*.tga")
|
|
|
|
if (APPLE)
|
|
|
|
foreach (preset ${presets})
|
|
|
|
get_filename_component(PRESET_NAME ${preset} NAME)
|
|
|
|
configure_file(
|
|
|
|
"${preset}"
|
|
|
|
"${CMAKE_BINARY_DIR}/clementine.app/Contents/Resources/projectm-presets/${PRESET_NAME}"
|
|
|
|
COPY_ONLY
|
|
|
|
)
|
|
|
|
endforeach (preset)
|
|
|
|
else (APPLE)
|
|
|
|
INSTALL(FILES ${presets} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/clementine/projectm-presets)
|
|
|
|
endif (APPLE)
|
|
|
|
endif(BUNDLE_PROJECTM_PRESETS)
|