Migrating your application from 0.15.0 to 0.16.0

Applications are supposed to be relatively self-contained. However some special cases occur that are necessary to handle in this migration.

Additionally please look at the guide on Migrating your code from 0.15.0 to 0.16.0 and Migrating your plugin from 0.15.0 to 0.16.0.

Copying files

The applications are now categorized. Currently there are four different categories:

  • platform : Core OpenViBE applications. Designer and Acquisition Server are here.
  • developer-tools : Tools for developers (may not be distributed with the binary distribution)
  • examples : Example applications for developers, they show how to use OpenViBE functionalities.
  • demos : Complete demo applications.

If we take the external-stimulation-connection program as an example then we would move files like this:

The structure was reworked a bit as well. Files from

OLD/openvibe-applications/external-stimulation-connection-example/trunc/src now go into NEW/applications/examples/external-stimulation-connection/src/.

If your application also has assets in the share folder then move them directly into NEW/applications/examples/external-stimulation-connection/share, the subpath openvibe-applications/APPLICATION_NAME was removed.

If your application provides any public interfaces, they should be moved to the include/ folder. In the case of the external-stimulation-connection, the reference implementation of the connection inside openvibeStimulationConnection.hpp was moved to the include/ folder and renamed to have a .h extension.

CMake

You will need to update your CMake file as well.

Let us compare the CMakeFiles.txt file of the stimulation-connection from the 0.15.0 version to the 0.16.0 version.

All of the project names are now lower-case.

OUT: PROJECT(OpenViBE-external-stimulation-connection-example)

IN: PROJECT(openvibe-external-stimulation-connection-example)

The version numbers of applications are now set by inheritance from the main CMake script.

OUT:	SET(PROJECT_VERSION_MAJOR x)
	SET(PROJECT_VERSION_MINOR x)

	SET(PROJECT_VERSION_PATCH x)

IN:	SET(PROJECT_VERSION_MAJOR ${OV_GLOBAL_VERSION_MAJOR})
	SET(PROJECT_VERSION_MINOR ${OV_GLOBAL_VERSION_MINOR})

	SET(PROJECT_VERSION_PATCH ${OV_GLOBAL_VERSION_PATCH})

Do not forget to include the include/ folder in the sources

OUT:	FILE(GLOB_RECURSE source_files src/*.cpp src/*.h src/*.hpp)
IN:	FILE(GLOB_RECURSE source_files src/*.cpp src/*.h src/*.hpp src/*.inl include/*.h)

If you use Boost_Thread you now have to include boost as well.

IN: INCLUDE("FindThirdPartyBoost")

There is no more -dynamic suffix.

OUT:	ADD_EXECUTABLE(${PROJECT_NAME}-dynamic ${source_files})

IN: ADD_EXECUTABLE(${PROJECT_NAME} ${source_files})

You can remove code concerning build type as this is now defined on a higher level.

OUT:	IF(${CMAKE_BUILD_TYPE} STREQUAL "Release")
	ADD_DEFINITIONS(-DTARGET_BUILDTYPE_Release)

	ENDIF(${CMAKE_BUILD_TYPE} STREQUAL "Release")

	IF(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")

		ADD_DEFINITIONS(-DTARGET_BUILDTYPE_Release)

	ENDIF(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")

	IF(${CMAKE_BUILD_TYPE} STREQUAL "Debug")

		ADD_DEFINITIONS(-DTARGET_BUILDTYPE_Debug)

	ENDIF(${CMAKE_BUILD_TYPE} STREQUAL "Debug")

We now have a new CMake function to generate launch scripts.

IN: OV_INSTALL_LAUNCH_SCRIPT(“openvibe-external-stimulation-connection-example”)

Installation directory handling is now deferred to CMake as well.

OUT:	INSTALL(TARGETS ${PROJECT_NAME}-dynamic
	RUNTIME DESTINATION bin
	LIBRARY DESTINATION lib
	ARCHIVE DESTINATION lib)

	INSTALL(DIRECTORY bin/   DESTINATION bin     PATTERN ".svn" EXCLUDE)
	INSTALL(DIRECTORY doc/   DESTINATION doc     PATTERN ".svn" EXCLUDE)
	INSTALL(DIRECTORY etc/   DESTINATION etc     PATTERN ".svn" EXCLUDE)
	INSTALL(DIRECTORY lib/   DESTINATION lib     PATTERN ".svn" EXCLUDE)
	INSTALL(DIRECTORY share/ DESTINATION share   PATTERN ".svn" EXCLUDE)

IN:	INSTALL(TARGETS ${PROJECT_NAME}
	RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
	LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
	ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})

Note: this installs binaries and libraries. If you need to install assets or additional files (inside share/ and bin/ for example) you have to invoke the INSTALL method manually.

Example from the Acquisition Server:

# Device driver .dlls
IF(WIN32)
 	INSTALL(DIRECTORY bin/	 DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}	PATTERN ".dll" PATTERN ".svn" EXCLUDE)	
ENDIF(WIN32)
INSTALL(DIRECTORY share/ DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/openvibe/applications/acquisition-server PATTERN ".svn" EXCLUDE)

As you can see the INSTALL method is handling the destination of the share/ folder, since we have removed this path from the actual folder structure.

The source code

The source code changes lie in the location of headers, folder handling with new tokens and OpenViBE::Directories. Please follow the tutorial on code replacement here: Migrating your plugin from 0.15.0 to 0.16.0

This entry was posted in Version migration instructions and tagged , , , , . Bookmark the permalink.