OpendTect development on MS WindowsVisual Studio 2017 | CMake | Building the Tutorial plugin | Building your own plugin | Building OpendTectVisual Studio 2017OpendTect 6.4 is built with Visual Studio 2017, and it also supports Visual Studio 2017 Community Edition. The Community Edition can be downloaded from Microsoft's official web site CMakeCMake is a cross-platform tool that takes care of generating system-dependent project files. It can be downloaded from CMake's web site. Building the Tutorial pluginTo get the whole process going we will first build the Tutorial plugin. This will set up the Visual studio project we need, and the plugin itself can be very useful for understanding several important OpendTect programming concepts. The basic idea is like this, first you have your OpendTect installation folder, where you actually download the developers package from the installation manager, then you have to create your own plugin development environment which should be outside the OpendTect installation folder, the reason for this is of course that these two environments should be different, and you do not want to mix up your own plugin development work along with your software installation.
CMake has now generated the projects and the solution file for the plugins. Now you can start Visual studio and load the OpendTect_Tutorial_Plugin.sln which has just been created by CMake, in your WORK directory. Debugging the Tutorial pluginOpen the plugin solution in Visual Studio, and right-click on the solution item, and open the solution properties window. Here you can specify the debug source file location, so in your case add the location of the OpendTect source files which are installed by the installation manager, i.e. C:\Program Files\OpendTect\6.4. Now select the "od_main" project which is a launcher project to launch od_main debug executable that comes with the developers package. Right click on this project and set to "Set as startup project". When you press F5 for debugging this project will be started. Ignore if you see any Visual studio warnings. The OpendTect main program, od_main.exe will be launched. From Utilities-Installation-Plugins OpendTect try to load your plugin by browsing to the WORK(D:\WORK)\bin\win64\Debug folder. To debug something, just set a break point in the code. So when the control comes to the break-point it will stop there and you can debug your code. You can also browse into OpendTect source files if you have specified the OpendTect source file location is the solution properties as mentioned above Building your own pluginIf you want to create your own plugin, you have to create a folder with the name of your plugin inside your plugin development environment and add the source files and CMakeLists.txt to this folder as done in the tutorial plugins. Procedure:
Debugging your own pluginThe process is exactly similar as described above, 1)start Visual Studio 2) build the plugin 3) start 'od_main' project 4) load and debug your plugin. Distributing your own pluginsYour plugin can be distributed with the new installation manager and OpendTect download site. You have to ship the plugin binaries and documentation to opendtect.org, where it will be available for download. Building OpendTect (only for die hards)To build OpendTect from source you need to pull the source code from https://github.com/OpendTect/OpendTect. Then build the solution with CMake. In this case launch CMake and browse to your OpendTect source folder and start configuring and generating from CMake. CMake will prompt for Qt and OpenSceneGraph directory location, select them from CMake itself and continue. Once the projects and solution are generated you can start building OpendTect. QtA Qt installation is only necessary when you want to build a plugin which is directly dependent on Qt or you want to build OpendTect from scratch. Download Windows Qt package from the Qt website. OpenSceneGraphA full OpenSceneGraph installation is only necessary when you want to build a plugin which is directly dependent on OpenSceneGraph or if you want to build OpendTect from scratch. Download an OpenSceneGraph installation, or get the source code from OpenSceneGraph repositories and build yourself using Visual Studio.
|