-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
103 lines (76 loc) · 3.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
cmake_minimum_required (VERSION 2.6)
project (sorcer)
set(SORCER_VERSION_MAJOR "1")
set(SORCER_VERSION_MINOR "1")
set(SORCER_VERSION_PATCH "3")
set(SORCER_VERSION "${SORCER_VERSION_MAJOR}.${SORCER_VERSION_MINOR}.${SORCER_VERSION_PATCH}")
option(RELEASE_BUILD "Build for production usage" ON )
option(BUILD_SSE "Build with SSE flags" ON )
find_package(PkgConfig)
#SET(CMAKE_INSTALL_PREFIX "/usr" )
pkg_check_modules(NTK ntk REQUIRED)
include_directories( ${NTK_INCLUDE_DIRS} )
link_directories ( ${NTK_LIBRARY_DIRS} )
pkg_check_modules(LV2 lv2 REQUIRED)
include_directories( ${LV2_INCLUDE_DIRS} )
pkg_check_modules(CAIRO cairo REQUIRED)
include_directories( ${CAIRO_INCLUDE_DIRS} )
link_directories ( ${CAIRO_LIBRARY_DIRS} )
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fPIC -shared -Wl,-z,nodelete -Wl,--no-undefined")
SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Wno-unused-variable -ffast-math")
SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -W -Wno-unused-variable -ffast-math")
IF(BUILD_SSE)
IF(NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm|ppc")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -mfpmath=sse")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -mfpmath=sse")
ENDIF()
ENDIF()
## The following commands will re-generate the .cpp files from the FAUST .dsp,
## and extract the .ttl info from them, patch the custom UI URI's in, and copy
## them to the sorcer.lv2 folder.
##
## Note: This is *NOT* necessary for packaging, as the generated files are commited
## in the repo to remove the dependency on FAUST, and to easy packaging.
##
# cd faust/
# g++ -fPIC -shared -ffast-math -O3 -DPLUGIN_URI='"http://www.openavproductions.com/sorcer"' -Wl,-z,nodelete main.cpp -o sorcer.so
# g++ -DPLUGIN_URI='"http://www.openavproductions.com/sorcer"' main.cpp
# ./a.out > sorcer.ttl
# patch -u sorcer.ttl ../addUiRdf.patch
# cp sorcer.so ../sorcer.lv2/
# cp sorcer.ttl ../sorcer.lv2/
# cd ..
# tells FAUST to use the following URI for the plugin
ADD_DEFINITIONS( -DPLUGIN_URI="http://www.openavproductions.com/sorcer" )
# print config
string( ASCII 27 _esc)
function(COLOR_MESSAGE TEXT)
if(CMAKE_COLOR_MAKEFILE)
MESSAGE(${TEXT})
else()
string(REGEX REPLACE "${_esc}.[0123456789;]*m" "" __TEXT ${TEXT} )
MESSAGE(${__TEXT})
endif()
endfunction()
SET(green "${_esc}[1;32m")
SET(blue "${_esc}[1;34m")
SET(reset "${_esc}[1;0m")
COLOR_MESSAGE( "
${blue}Sorcer Configuration : ${SORCER_VERSION}${reset}
-----------------------
* ${green}Install Directory${reset} : ${CMAKE_INSTALL_PREFIX}\n" )
# /print config
FILE(GLOB sources faust/main.cpp +
gui/sorcer_widget.cxx +
gui/sorcer_ui.cxx )
ADD_LIBRARY(sorcer SHARED ${sources})
target_link_libraries( sorcer ${NTK_LIBRARIES} )
#target_link_libraries( sorcer ${SNDFILE_LIBRARIES} )
target_link_libraries( sorcer ${CAIRO_LIBRARIES} )
# Remove "lib" part before name (sorcer.so, not libsorcer.so)
set_target_properties(sorcer PROPERTIES PREFIX "")
# add the install targets
install (TARGETS sorcer DESTINATION lib/lv2/sorcer.lv2/)
# install .ttl files
install(FILES "sorcer.lv2/sorcer.ttl" DESTINATION lib/lv2/sorcer.lv2/)
install(FILES "sorcer.lv2/manifest.ttl" DESTINATION lib/lv2/sorcer.lv2/)