2013-09-17 01:18:22 +02:00
|
|
|
|
2015-11-22 10:45:41 +01:00
|
|
|
# Detect platform
|
|
|
|
EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
|
|
|
|
message( STATUS "Architecture: ${ARCHITECTURE}" )
|
|
|
|
|
2013-09-17 01:39:15 +02:00
|
|
|
# Find depend libraries
|
2013-09-17 01:18:22 +02:00
|
|
|
find_package(PkgConfig)
|
|
|
|
|
2013-12-12 12:26:32 +01:00
|
|
|
pkg_check_modules(CAIRO cairo REQUIRED)
|
2013-09-17 01:18:22 +02:00
|
|
|
include_directories( ${CAIRO_INCLUDE_DIRS} )
|
|
|
|
link_directories ( ${CAIRO_LIBRARY_DIRS} )
|
|
|
|
|
2013-12-12 12:26:32 +01:00
|
|
|
pkg_check_modules(NTK ntk REQUIRED)
|
2013-09-17 01:18:22 +02:00
|
|
|
include_directories( ${NTK_INCLUDE_DIRS} )
|
|
|
|
link_directories ( ${NTK_LIBRARY_DIRS} )
|
|
|
|
|
2013-12-12 12:26:32 +01:00
|
|
|
pkg_check_modules(LIBLO liblo REQUIRED)
|
2013-10-23 18:03:54 +02:00
|
|
|
include_directories( ${LIBLO_INCLUDE_DIRS} )
|
|
|
|
link_directories ( ${LIBLO_LIBRARY_DIRS} )
|
|
|
|
|
2013-12-12 12:26:32 +01:00
|
|
|
pkg_check_modules(JACK jack REQUIRED)
|
2013-09-17 01:18:22 +02:00
|
|
|
include_directories( ${JACK_INCLUDE_DIRS} )
|
|
|
|
link_directories ( ${JACK_LIBRARY_DIRS} )
|
|
|
|
|
2013-12-12 12:26:32 +01:00
|
|
|
pkg_check_modules(SNDFILE sndfile REQUIRED)
|
2013-09-17 01:18:22 +02:00
|
|
|
include_directories( ${SNDFILE_INCLUDE_DIRS} )
|
|
|
|
link_directories ( ${SNDFILE_LIBRARY_DIRS} )
|
|
|
|
|
2013-12-12 12:26:32 +01:00
|
|
|
pkg_check_modules(SAMPLERATE samplerate REQUIRED)
|
2013-09-23 11:53:58 +02:00
|
|
|
include_directories( ${SAMPLERATE_INCLUDE_DIRS} )
|
|
|
|
link_directories ( ${SAMPLERATE_LIBRARY_DIRS} )
|
|
|
|
|
2014-08-09 00:12:36 +02:00
|
|
|
# needed for setting icon in WM
|
|
|
|
pkg_check_modules(X11 x11 REQUIRED)
|
|
|
|
include_directories( ${X11_INCLUDE_DIRS} )
|
|
|
|
link_directories ( ${X11_LIBRARY_DIRS} )
|
|
|
|
|
2013-09-18 01:31:07 +02:00
|
|
|
# Check build type, adding coverage flags if needed
|
|
|
|
IF(BUILD_TESTS)
|
|
|
|
ADD_DEFINITIONS(-DBUILD_TESTS)
|
|
|
|
ADD_DEFINITIONS(-DBUILD_COVERAGE_TEST)
|
|
|
|
|
2017-04-09 17:10:27 +02:00
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -Wno-unused-variable -fprofile-arcs -ftest-coverage ")
|
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Wextra -W -Wno-unused-variable -fprofile-arcs -ftest-coverage ")
|
|
|
|
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}-fprofile-arcs -ftest-coverage")
|
2013-09-18 01:31:07 +02:00
|
|
|
ENDIF(BUILD_TESTS)
|
|
|
|
|
2013-09-18 10:34:49 +02:00
|
|
|
IF(RELEASE_BUILD)
|
2017-04-09 17:10:27 +02:00
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wno-unused-variable ")
|
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -W -Wno-unused-variable ")
|
2013-09-18 10:34:49 +02:00
|
|
|
ENDIF(RELEASE_BUILD)
|
|
|
|
|
2015-11-22 10:45:41 +01:00
|
|
|
if( ${ARCHITECTURE} STREQUAL "x86_64" )
|
2017-03-27 22:37:29 +02:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -msse2")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -msse2")
|
2015-11-22 10:45:41 +01:00
|
|
|
else()
|
|
|
|
# Can set i686 / ARM stuff here
|
|
|
|
endif()
|
2013-09-18 01:31:07 +02:00
|
|
|
|
|
|
|
# Add all files
|
2013-09-17 11:17:33 +02:00
|
|
|
FILE(GLOB sources *.cxx avtk/*.cxx cjson/*.c controller/*.cxx dsp/*.cxx observer/*.cxx state/*.cxx tests/*.cxx)
|
2013-09-17 01:18:22 +02:00
|
|
|
|
2013-09-18 01:31:07 +02:00
|
|
|
# Compile binary
|
2014-02-23 19:16:53 +01:00
|
|
|
add_executable (luppp version.hxx ${sources} )
|
2013-09-17 01:18:22 +02:00
|
|
|
|
2013-09-18 01:31:07 +02:00
|
|
|
|
2013-09-17 01:39:15 +02:00
|
|
|
# Linking
|
2013-11-07 23:42:28 +01:00
|
|
|
target_link_libraries( luppp ${JACK_LIBRARIES} )
|
|
|
|
target_link_libraries( luppp ${LIBLO_LIBRARIES} )
|
|
|
|
target_link_libraries( luppp ${NTK_LIBRARIES} )
|
|
|
|
target_link_libraries( luppp ${CAIRO_LIBRARIES} )
|
|
|
|
target_link_libraries( luppp ${SNDFILE_LIBRARIES} )
|
|
|
|
target_link_libraries( luppp ${SAMPLERATE_LIBRARIES} )
|
2014-08-09 00:12:36 +02:00
|
|
|
target_link_libraries( luppp ${X11_LIBRARIES} )
|
2013-09-17 11:17:33 +02:00
|
|
|
|
2013-09-18 01:31:07 +02:00
|
|
|
# Check build type, linking with gcov for code analysis if needed
|
|
|
|
IF(BUILD_TESTS)
|
|
|
|
target_link_libraries(luppp gcov)
|
|
|
|
ENDIF(BUILD_TESTS)
|
2014-02-23 18:26:43 +01:00
|
|
|
|
|
|
|
# add the install targets
|
|
|
|
install (TARGETS luppp DESTINATION bin)
|
|
|
|
|