Ubuntu generates bin files and. so files (Ubuntu. So file corresponds to Windows. dll file, all dynamic link library) # # title
When compiling a chain to deliver a. so file or executable file, note the following points:
Each project must contain these three files, and there are strict writing specifications.
Naoqi-sdk-xxx.xx.xx/doc/examples/vision/motionexample as an example to explain
1. The documents are as follows:
Cmake_minimum_required (VERSION 2.6.4 fatal_error)
project (motionexample[project name))
find_package (qibuild[fixed format, Qibuild]
option (motionexample[Capital project name]_is_remote
"module is compiled as a REMOTE module (on or off)"
on[ Whether this is off or on, it depends on whether you are preparing to generate an executable file under the Sdk/bin file or to generate the. So file in the NAIQI/SDK directory. If you choose on, next you will generate the executable file under the Dk/bin file, if you choose off, then you will have a. so file]
set (_srcs
main.cpp
almotionexample.h
almotionexample.cpp[here contains you engineering CPP file]
if (motionexample[Engineering University]_is_remote)
add_definitions ("-d[-d you don't have to tube, fixed form]motionexample[Engineering University]_is_remote")
Qi_create_bin (motionexample[project name lowercase] ${_srcs})
else ()
Qi_create_lib (motionexample[Engineering University) SHARED ${_srcs} Subfolder NAOqi)
endif ()
qi_use_lib (motionexample[project name lowercase] Alcommon almath)
2, Next is the Qiproject.xml file to explain:
<project name= "motionexample[here is your project name]"/>
3, Next is the Mian.cpp file to explain:
/** * @author Chris Kilner * Copyright (c) Aldebaran Robotics 2007 All Rights Reserved * * #include <signal.h> #incl Ude <boost/shared_ptr.hpp> #include <alcommon/albroker.h> #include <alcommon/almodule.h> #include <alcommon/albrokermanager.h> #include <alcommon/altoolsmain.h> #include "almotionexample.h" #ifdef Motionexample_is_remote # define Alcall #else # ifdef _WIN32 # define Alcall __declspec (dllexport) # else # define Alcal L # endif #endif extern "C" [external interface functions, providing convenience for Python programs to invoke C programs] {alcall int _createmodule (boost::shared_ptr<al::albroker> ; Pbroker) {//init broker with the main broker instance//from the parent executable Al::albrokermanager::setinstan
CE (Pbroker->fbrokermanager.lock ());
Al::albrokermanager::getinstance ()->addbroker (Pbroker); Al::almodule::createmodule<almotionexample> (Pbroker, "almotionexample[here is the name you provide to the external interface, through this interface,
Python programs can call inside functions] "");
return 0; } alcall int _closemodule () {return 0;} [External interfaceWriting format]}//extern "C" #ifdef motionexample_is_remote int main (int argc, char *argv[]) {//Pointer to Createmodule
Tmaintype Sig;
sig = &_createModule;
Call main Altools::mainfunction ("Motionexample", argc, Argv,sig); } #endif
The next step is how to compile the. so file
Open the CMake interface, where the source code imports your engineering path, where to build the binaries write you need to generate makefile file path. (It is recommended that you add/build to your engineering path just where is the source code)
Take my engineering path for example:
Where is the source code writes "Home/zou/desktop/motionexample"
Where to build the binaries writes "Home/zou/desktop/motionexample/build"
If you want to generate an executable file:
Point solution Configure, select Motionexample_is_remote, and then generate.
Enter the terminal, enter the project file under build directory, input make command, the system automatically generate executable files.
The executable file location is located in the Build/sdk/bin directory.
If you want to generate the. so file:
Point solution Configure, do not select Motionexample_is_remote, and then generate.
Enter the terminal, enter the project file under build directory, input make command, the system automatically generate. so file.
The. So file is located in the Naoqi-sdk/lib/naoqi directory.