CMakeLists.txt 3.22 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
IF(${_hrp210optimized_FOUND})
 
 MESSAGE(STATUS "A MODIFIER")
 
  LIST(APPEND libs dynamic-hrp2_10)
  SET (dynamic-hrp2_10_plugins_dependencies dynamic)
  SET(dynamic-hrp2_10_plugins_compile_flags 
       ${_dynamicsJRLJapan_CFLAGS} ${_hrp210optimized_CFLAGS})
  SET(dynamic-hrp2_10_plugins_link_flags 
       ${_dynamicsJRLJapan_LDFLAGS} ${_hrp210optimized_LDFLAGS})

  LIST(APPEND libs dynamic-hrp2_10_old)
  SET (dynamic-hrp2_10_plugins_dependencies dynamic)
  SET(dynamic-hrp2_10_old_plugins_compile_flags 
       ${_dynamicsJRLJapan_CFLAGS} ${_hrp210optimized_CFLAGS})
  SET(dynamic-hrp2_10_old_plugins_link_flags 
       ${_dynamicsJRLJapan_LDFLAGS} ${_hrp210optimized_LDFLAGS})

ENDIF(${_hrp210optimized_FOUND})

Francois Bleibel's avatar
Francois Bleibel committed
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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})
91
		TARGET_LINK_LIBRARIES(${lib} ${HRP2DYNAMICS_LIBRARIES})
Francois Bleibel's avatar
Francois Bleibel committed
92
93
94
95
96
97
98
99
100
		TARGET_LINK_LIBRARIES(${lib} ${DYNAMICSJRLJAPAN_LIBRARIES})
	ENDIF(UNIX)
	
	IF(WIN32)
		SET_TARGET_PROPERTIES(${lib}
		  PROPERTIES
		  LINK_FLAGS "${${PROJECT_NAME}_src_LDFLAGS}"
		)
	ENDIF(WIN32)
101
102
103
104
	SET_TARGET_PROPERTIES(${lib}
		PROPERTIES
		COMPILE_FLAGS "${${lib}_plugins_compile_flags}"
		LINK_FLAGS "${${lib}_plugins_link_flags}")
Francois Bleibel's avatar
Francois Bleibel committed
105
	
Francois Keith's avatar
Francois Keith committed
106
107
	IF(${lib}_plugins_dependencies)
		ADD_DEPENDENCIES(${lib} "${${lib}_plugins_dependencies}")
108
		TARGET_LINK_LIBRARIES(${lib} "${${lib}_plugins_dependencies}")
Francois Keith's avatar
Francois Keith committed
109
	ENDIF(${lib}_plugins_dependencies)
Francois Bleibel's avatar
Francois Bleibel committed
110
111
112
113
114
	
	INSTALL(TARGETS ${lib}
  	DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/plugin)
ENDFOREACH(lib)

115