Start to build Scol using CMAKE » History » Revision 2
« Previous |
Revision 2/45
(diff)
| Next »
arkeon, 10/23/2014 07:33 PM
Start to build Scol using CMAKE¶
Get the Scol sources¶
Scol use Subversion for source control and you can use Tortoise SVN to get the source code.
So first retrieve the sources from "https://svn.scolring.org/trunk/", accept the certificate and go take some coffee.
The source directories contains most of the dependencies, and since some of them are modified they are provided in the sources.
Dependencies search paths¶
Once you get the sources, you can execute "setWindowsSearchPaths.bat" in the dependencies directory.
This will add needed environment variables and paths.
Build needed dependencies¶
Most of the dependencies are built for Visual Studio 2010.
But some build are to huge to put on the SVN, so you will have to build them manually. This is the case of Ogre3D to build the SO3Engine for example.
So this is not needed for the Scol kernel and most of the plugins.
BUild the projects using CMAKE¶
Download and install CMAKE, there is a GUI for windows called "cmake-gui".
Now launch CMAKE and build the project using the sources and build path, for example :
souces : trunk/scol
binaries : trunk/scol/build
Hit the "Configure" button and choose "Visual Studio 10" as project target.
Hit "Configure" again until you don't have red lines anymore.
Then you can hit the "Generate" button.
Build the sources¶
Open the Scol.sln file generated in the trunk/scol/build
And finally build the project.
The compiled binaries are exported under trunk/scol_sdk/bin/Release or Debug.
Start your new plugin¶
Source paths¶
Start by creating a directory with your new plugin name in the trunk/scol/plugins folder.
For example trunk/scol/plugins/myPlugin
Usually we prefer to separate the sources and the includes.
So creates a "src" and "include" directory in your plugin folder.
Creates the empty files you will need for your project, usually :
- include/myplugin.h for your classes definition
- src/myplugin.cpp for your classes
- src/scolplugin.cpp for the Scol binding functions
Dependencies¶
If your project need an external SDK or dependencies, add then in the trunk/dependencies directory.
Then create a findMydepname.cmake file in trunk\scol\CMake\Packages.
You can copy and change an existing Find.cmake file to make yours.
Start from a simple one like FindMyo.cmake for example.
Cmake files¶
It's time to creates the CMAKE script for your plugin.
Create a "CMakeLists.txt" file in the plugin directory.
trunk/scol/plugins/myPlugin/CMakeLists.txt
And edit the file with a text editor.
#------------------------------------------------------------------- # This file is part of the CMake build system for Scol # # The contents of this file are placed in the public domain. Feel # free to make use of it in any way you like. #------------------------------------------------------------------- ############################################################ # CmakeList file for Myplugin ############################################################ #Your project name PROJECT(myPLugin) # define header and source files for the library set (MYPLUGIN_HEADER_FILES include/myplugin.h ) set (MYPLUGIN_SOURCE_FILES src/myplugin.cpp src/scolplugin.cpp ) # Add includes directories from dependencies # include_directories(include ${MYDEP_INCLUDE_DIRS}) # Add definition for P4 optimizations, warnings removal. add_definitions(-DOPTI_P4 -D_CRT_SECURE_NO_WARNINGS -D) # Add dependencies libraries # set(LIBRARIES # ${MYDEP_LIBRARIES} # ${ZLIB_LIBRARIES} # ${PNG_LIBRARIES} # ) # setup Scol plugin target add_library(myPLugin ${Scol_LIB_TYPE} ${MYPLUGIN_HEADER_FILES} ${MYPLUGIN_SOURCE_FILES} ) add_dependencies(myPLugin kernel) # set the dll version. set_target_properties(myPLugin PROPERTIES VERSION ${Scol_VERSION} SOVERSION ${Scol_VERSION_MAJOR}) target_link_libraries(myPLugin ${LIBRARIES}) # install Scol scol_config_plugin(myPLugin) install(FILES ${MYPLUGIN_HEADER_FILES} DESTINATION include/SCOL/plugins/myPLugin)
Now we need to declare this new plugin in the common Scol cmake files.
Edit the trunk/scol/CMakeLists.txt file and add your plugin definition like the following.
If you don't have dependencies.
option(Scol_BUILD_MYPLUGIN "Build myPluginplugin, my library" TRUE)
If you have depencies
cmake_dependent_option(Scol_BUILD_MYPLUGIN "Build myPlugin, my library." TRUE "MYDEP_FOUND;ZLIB_FOUND;PNG_FOUND" FALSE)
Now edit the trunk/scol/plugin/CMakeLists.txt file and add the following.
# Configure myPlugin plugin build if (Scol_BUILD_MYPLUGIN) add_subdirectory(myPlugin) endif ()
Only if you have dependencies, edit the trunk/scol/CMake/ScolDependencies.cmake file and add the dependencies resolution as the following
# Find MyDep find_package(MYDEP) macro_log_feature(MYDEP_FOUND "Mydep" "MydepLibrary" "http://Mydep.org/" FALSE "" "")
Almost done¶
Open the CMAKE-gui again.
Hit the "Configure button" and check if you found your plugin in the scol group.
Then hit the generate button, and open the scol.sln project again.
You should have the project added in Visual Studio.
Updated by arkeon about 10 years ago · 2 revisions