CMakeLists.txt 3.44 KB
Newer Older
Francois Bleibel's avatar
Francois Bleibel committed
1
2
3
4
5
6
7
8
9
10
# 
#  Copyright 
# 

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)

IF(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
	ADD_DEFINITIONS(-DDEBUG=2)
ENDIF(CMAKE_BUILD_TYPE STREQUAL "DEBUG")

Francois Keith's avatar
Francois Keith committed
11
# provide path to libraries
Francois Bleibel's avatar
Francois Bleibel committed
12
13
14
15
16
17
LINK_DIRECTORIES(${DYNAMICSJRLJAPAN_LIBRARY_DIRS})
LINK_DIRECTORIES(${HRP2DYNAMICS_LIBRARY_DIRS})
LINK_DIRECTORIES(${DYNAMIC_GRAPH_LIBRARY_DIRS})
LINK_DIRECTORIES(${SOT_CORE_LIBRARY_DIRS})
LINK_DIRECTORIES(${MATRIXABSTRACTLAYER_LIBRARY_DIRS})

Francois Keith's avatar
Francois Keith committed
18
# Add compilation flags
Francois Bleibel's avatar
Francois Bleibel committed
19
20
21
22
23
24
ADD_DEFINITIONS(${DYNAMICSJRLJAPAN_CFLAGS})
ADD_DEFINITIONS(${HRP2DYNAMICS_CFLAGS})
ADD_DEFINITIONS(${DYNAMIC_GRAPH_CFLAGS})
ADD_DEFINITIONS(${SOT_CORE_CFLAGS})
ADD_DEFINITIONS(${MATRIXABSTRACTLAYER_CFLAGS})

Francois Keith's avatar
Francois Keith committed
25
26
27
28
29
30
foreach(dlink 	${DYNAMICSJRLJAPAN_LDFLAGS} 
				${HRP2DYNAMICS_LDFLAGS} 
				${DYNAMIC_GRAPH_LDFLAGS} 
				${SOT_CORE_LDFLAGS} 
				${MATRIXABSTRACTLAYER_LDFLAGS}
		)
Francois Bleibel's avatar
Francois Bleibel committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
	SET ( ${PROJECT_NAME}_src_LDFLAGS "${${PROJECT_NAME}_src_LDFLAGS}  ${dlink}")
endforeach(dlink)

SET(libs
	zmpreffromcom
	force-compensation
	integrator-force-exact
	mass-apparent
	integrator-force-rk4
	integrator-force
	angle-estimator
	waist-attitude-from-sensor
)

45
IF(${DYNAMICSJRLJAPAN_FOUND})
Francois Bleibel's avatar
Francois Bleibel committed
46
  LIST(APPEND libs dynamic)
47
	IF(${HRP2DYNAMICS_FOUND})
48
49
	  LIST(APPEND libs dynamic-hrp2)
	  SET (dynamic-hrp2_plugins_dependencies dynamic)
50
	ENDIF(${HRP2DYNAMICS_FOUND})
51
ENDIF(${DYNAMICSJRLJAPAN_FOUND})
52

53
54
IF(${_hrp210optimized_FOUND})
  LIST(APPEND libs dynamic-hrp2_10)
55
  SET (dynamic-hrp2_10_additional_libs ${_hrp210optimized_LIBRARIES})
56
57
58
59
60
  SET (dynamic-hrp2_10_plugins_dependencies dynamic)
  SET(dynamic-hrp2_10_plugins_compile_flags 
       ${_dynamicsJRLJapan_CFLAGS} ${_hrp210optimized_CFLAGS})

  LIST(APPEND libs dynamic-hrp2_10_old)
61
62
  SET (dynamic-hrp2_10_old_additional_libs ${_hrp210optimized_LIBRARIES})
  SET (dynamic-hrp2_10_old_plugins_dependencies dynamic)
63
64
65
66
67
  SET(dynamic-hrp2_10_old_plugins_compile_flags 
       ${_dynamicsJRLJapan_CFLAGS} ${_hrp210optimized_CFLAGS})

ENDIF(${_hrp210optimized_FOUND})

68
IF(NOT UNIX)
69
70
71
72
	foreach(dlink ${_hrp210optimized_LDFLAGS})
		SET ( dynamic-hrp2_10_plugins_link_flags "${dynamic-hrp2_10_plugins_link_flags}  ${dlink}")
		SET ( dynamic-hrp2_10_old_plugins_link_flags "${dynamic-hrp2_10_old_plugins_link_flags}  ${dlink}")
	endforeach(dlink)
73
74
ENDIF(NOT UNIX)

Francois Bleibel's avatar
Francois Bleibel committed
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
SET(integrator-force-rk4_plugins_dependencies integrator-force)
SET(integrator-force-exact_plugins_dependencies integrator-force)

FOREACH(lib ${libs})
	ADD_LIBRARY(${lib}
	  SHARED
	  ${lib}.cpp)
	
	SET_TARGET_PROPERTIES(${lib} 
	  PROPERTIES 
	  SOVERSION ${PROJECT_VERSION}
	  PREFIX ""
	  INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib/plugin)
	  
	IF (UNIX)  
		TARGET_LINK_LIBRARIES(${lib} ${DYNAMIC_GRAPH_LIBRARIES})
		TARGET_LINK_LIBRARIES(${lib} ${SOT_CORE_LIBRARIES})
		TARGET_LINK_LIBRARIES(${lib} ${MATRIXABSTRACTLAYER_LIBRARIES})
93
		TARGET_LINK_LIBRARIES(${lib} ${HRP2DYNAMICS_LIBRARIES})
Francois Bleibel's avatar
Francois Bleibel committed
94
		TARGET_LINK_LIBRARIES(${lib} ${DYNAMICSJRLJAPAN_LIBRARIES})
95
		TARGET_LINK_LIBRARIES(${lib} "${${lib}_additional_libs}")
Francois Bleibel's avatar
Francois Bleibel committed
96
97
98
	ENDIF(UNIX)
	
	IF(WIN32)
99
		SET(${lib}_plugins_link_flags "${${PROJECT_NAME}_src_LDFLAGS} ${${lib}_plugins_link_flags}")
Francois Bleibel's avatar
Francois Bleibel committed
100
	ENDIF(WIN32)
101
	
102
103
104
105
	SET_TARGET_PROPERTIES(${lib}
		PROPERTIES
		COMPILE_FLAGS "${${lib}_plugins_compile_flags}"
		LINK_FLAGS "${${lib}_plugins_link_flags}")
Francois Bleibel's avatar
Francois Bleibel committed
106
	
Francois Keith's avatar
Francois Keith committed
107
108
	IF(${lib}_plugins_dependencies)
		ADD_DEPENDENCIES(${lib} "${${lib}_plugins_dependencies}")
109
		TARGET_LINK_LIBRARIES(${lib} "${${lib}_plugins_dependencies}")
Francois Keith's avatar
Francois Keith committed
110
	ENDIF(${lib}_plugins_dependencies)
Francois Bleibel's avatar
Francois Bleibel committed
111
112
	
	INSTALL(TARGETS ${lib}
113
  	DESTINATION lib/plugin)
Francois Bleibel's avatar
Francois Bleibel committed
114
115
ENDFOREACH(lib)

116