Difference between revisions of "AnyWave:PrepareCMake"

From WikiMEG
Jump to: navigation, search
(Created page with "When it comes to college, you must face all kinds of different decisions. How you decide these things is going to determine how your time in college is spent and will impact y...")
 
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
When it comes to college, you must face all kinds of different decisions. How you decide these things is going to determine how your time in college is spent and will impact your post-college life. Use this advice to help you get through it.<br><br>Take a water bottle to class with you. Staying hydrated is something you need to do all day long. You need to do this if you are busy with class through the day and cannot eat. Being hydrated helps you to think clearly and learn more efficiently. Lots of water fountains allow for quick refills.<br><br>Learn your class schedule and where the courses are held well before you actually start. Plan your routes to get from class to class efficiently. If you have a map plan your route carefully!<br><br>If you find out that you cannot afford to go to the college you want to go to, consider the possibility of student loans. Once you graduate, you will have access to high-paying jobs and be able to pay your student loans back.<br><br>When it comes to succeeding in college, there are many influential factors. In fact, even your choice of seat can make a difference. Instead of ducking into class and taking a seat in the back of the room, show up on time and nab a seat up front. You will be able to concentrate and ask the professor about any questions you might have.<br><br>Catch the local transportation to your classes. It may be just as quicker or quicker than driving.  If you beloved this short article and you would like to acquire extra info with regards to phlebotomist classes online ([http://dkstudio.jp/YOURLS/onlinephlebotomytraining dkstudio.jp]) kindly check out the page. In fact, you can even save some time because you don't have to search for an available parking space. You will also save yourself money on both gas and parking passes. It is also great for the environment.<br><br>Take the school bus. Taking the bus to school is quick, easy and free in most college towns. You also save time from not having to search for somewhere on campus to park. You can even save a few bucks from gas and parking permits. If you are interested in "going green," this is a great opportunity to make that impact.<br><br>Deciding whether or not you need a car while you're in college is something you need to consider carefully. You may not find parking easily. The cost of your car and a parking spot can be too high for a student.<br><br>Try to purchase used textbooks to save money. New textbooks are prohibitively expensive. Most of the books you will need can be bought used, thus saving you a bit of money.<br><br>Interning is a great activity for college students. You can get a chance to experience what you will be doing after college. If you do well, a job offer is possible. The internship department can help you find a placement.<br><br>You need to socialize during orientation and at certain events. If you're new to the area, this is a great way to make more friends. The quicker you start meeting people, the sooner you can fit in.<br><br>Try not to buy coffee every morning. Coffeehouses charge too much. Brew coffee at home. Although you may be tempted to buy your morning cup of coffee to save time, it is best to save your money and make your own. You can even buy a fancy machine and save.<br><br>Many colleges offer work study programs. Although employers will consider your educational training, they also value experience. If you do well, it will help you monetarily as well as give you something good to put on your resume.<br><br>As previously mentioned, beginning college be overwhelming. But, by using the tips in this article, these will be the best, and most important years ahead of you. Keep in mind that college is likely to be one of the best times in your life.
+
=Basic CMake project=
 +
Create a folder that will be your plugin's project (for example MyPlugin).
 +
 
 +
Create the CMakeLists.txt file which is the CMake project file.<br />
 +
Here is an example of a [http://meg.univ-amu.fr/AnyWave/tuto/CMakeLists.txt CMakeLists.txt] file:
 +
<syntaxhighlight lang="cmake">
 +
# My plugin
 +
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
 +
PROJECT(MyPlugin)
 +
# Build in release mode
 +
SET(CMAKE_BUILD_TYPE "Release")
 +
# Flags for gcc compiler and macro definitions
 +
ADD_DEFINITIONS("-fPIC -O3")
 +
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
 +
 
 +
# Check for SDK
 +
SET(SDK_FOUND 0)
 +
IF( "$ENV{AWSDK}" STREQUAL "" )
 +
  MESSAGE(STATUS "AWSDK environment variable not set." )
 +
  MESSAGE(STATUS "On Linux or Mac OS X this can be done in your user .bashrc file by appending the corresponding line, e.g:" )
 +
  MESSAGE(STATUS "export AWSDK=/home/user/dev/SDK" )
 +
  RETURN()
 +
ELSE()
 +
  SET(SDK_FOUND 1)
 +
  SET(SDK_ROOT $ENV{AWSDK})
 +
  MESSAGE(STATUS "AWSDK found: ${SDK_ROOT}")
 +
ENDIF()
 +
 
 +
# Add the current folder as include directroy
 +
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
 +
 
 +
# Link using SDK libraries
 +
LINK_DIRECTORIES(${SDK_ROOT}/lib)
 +
# Include SDK headers
 +
INCLUDE_DIRECTORIES(${SDK_ROOT}/include)
 +
# Include current source dir as header dir
 +
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
 +
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_DIR})
 +
 
 +
# Find Qt
 +
FIND_PACKAGE(Qt4 REQUIRED)
 +
INCLUDE(${QT_USE_FILE})
 +
ADD_DEFINITIONS(${QT_DEFINITIONS})
 +
# Add some definitions to point out that the project must build a Qt plugin
 +
ADD_DEFINITIONS(-DQT_PLUGIN)
 +
ADD_DEFINITIONS(-DQT_SHARED)
 +
 
 +
# Define the output directory depending on platform
 +
IF (APPLE)
 +
  SET(LIBRARY_OUTPUT_PATH ${SDK_ROOT}/bin/Anywave_Plugins)
 +
ELSE()
 +
  SET(LIBRARY_OUTPUT_PATH ${SDK_ROOT}/bin/Plugins)
 +
ENDIF()
 +
 
 +
 
 +
# Plug-in specific part begins here
 +
# Add source files for your project here:
 +
# For example:
 +
# SET(SRCS myplugin.cpp
 +
#  mylib.cpp)
 +
 
 +
# Add headers that need to be parse for Qt Signal and Slots mechanism.
 +
# Those files need to be parse by the MOC tool of Qt to correctly compile signals and slots
 +
# Example:
 +
# SET(MOCS myplugin.h)
 +
# Note that header files which are not describing Qt Objects won't be parse by the MOC tool.
 +
 
 +
 
 +
# Depending on the plug-in type, your project may contain User Interfaces designed with the Qt Designer tool.
 +
# To add UI files to your project, simply define a variable that will contain all the .ui files of your project.
 +
# Example:
 +
# SET(UIS myplugin.ui)
 +
 
 +
# Depending on the plug-in, your project may contain a Qt Resource file (.qrc)
 +
# If so, add the file into a variable like this:
 +
# QT4_ADD_RESOURCES(MyPlugin_QRC myplugin.qrc)
 +
 
 +
# Now call the MOC tool for header files
 +
QT4_WRAP_CPP(MyPlugin_MOCS ${MOCS})
 +
 
 +
# If you have ui files, call the iuc tool:
 +
# QT4_WRAP_UI(MyPlugin_UIS ${UIS})
 +
 
 +
# If your plug-in is using external libraries, you may define them here:
 +
# Example of a plugin using the Qwt library
 +
# SET(QWT_INCLUDE /home/dev/qwt/include)
 +
# SET(QWT_LIB /home/dev/qwt/lib)
 +
# INCLUDE_DIRECTORIES(${QWT_INCLUDE})
 +
# LINK_DIRECTORIES(${QWT_LIB})
 +
 
 +
 
 +
# define the library to build (the Qt Plugin)
 +
ADD_LIBRARY(MyPlugin SHARED ${SRCS} ${MyPlugin_MOCS} ${MyPlugin_UIS} ${MyPlugin_QRC})
 +
 
 +
# remove ${MyPlugin_UIS} ${MyPlugin_QRC} if your project does not contain QRC or UI files
 +
 
 +
# Target
 +
TARGET_LINK_LIBRARIES(MyPlugin AwCoreLib ${QT_LIBRARIES})
 +
# This will tell cmake to link the plugin using AwCoreLib, which is the core library of AnyWave, and the Qt Libraries.
 +
# Depending on your plug-in, extras libraries should be added.
 +
# For example, if your plug-in is using graphics objects defined in the SDK, you must add AwGraphicsLib as a library.
 +
# If the plug-in is a reader or a writer plug-in, you must add AwReadWriteLib
 +
# If the plug-in is a signal processing plug-in, you must add AwProcessLib
 +
 
 +
# If your plugin must link with Qwt then the line should be:
 +
#TARGET_LINK_LIBRARIES(MyPlugin AwCoreLib qwt ${QT_LIBRARIES})
 +
</syntaxhighlight>

Latest revision as of 13:51, 3 August 2018

Basic CMake project

Create a folder that will be your plugin's project (for example MyPlugin).

Create the CMakeLists.txt file which is the CMake project file.
Here is an example of a CMakeLists.txt file:

# My plugin
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(MyPlugin)
# Build in release mode
SET(CMAKE_BUILD_TYPE "Release")
# Flags for gcc compiler and macro definitions 
ADD_DEFINITIONS("-fPIC -O3")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
 
# Check for SDK
SET(SDK_FOUND 0)
IF( "$ENV{AWSDK}" STREQUAL "" )
   MESSAGE(STATUS "AWSDK environment variable not set." )
   MESSAGE(STATUS "On Linux or Mac OS X this can be done in your user .bashrc file by appending the corresponding line, e.g:" )
   MESSAGE(STATUS "export AWSDK=/home/user/dev/SDK" )
   RETURN()
ELSE()
   SET(SDK_FOUND 1)
   SET(SDK_ROOT $ENV{AWSDK})
   MESSAGE(STATUS "AWSDK found: ${SDK_ROOT}")
ENDIF()
 
# Add the current folder as include directroy
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
 
# Link using SDK libraries
LINK_DIRECTORIES(${SDK_ROOT}/lib)
# Include SDK headers
INCLUDE_DIRECTORIES(${SDK_ROOT}/include)
# Include current source dir as header dir
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_DIR})
 
# Find Qt
FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
# Add some definitions to point out that the project must build a Qt plugin
ADD_DEFINITIONS(-DQT_PLUGIN)
ADD_DEFINITIONS(-DQT_SHARED)
 
# Define the output directory depending on platform
IF (APPLE)
   SET(LIBRARY_OUTPUT_PATH ${SDK_ROOT}/bin/Anywave_Plugins)
ELSE()
   SET(LIBRARY_OUTPUT_PATH ${SDK_ROOT}/bin/Plugins)
ENDIF()
 
 
# Plug-in specific part begins here
# Add source files for your project here:
# For example:
# SET(SRCS myplugin.cpp 
#   mylib.cpp)
 
# Add headers that need to be parse for Qt Signal and Slots mechanism.
# Those files need to be parse by the MOC tool of Qt to correctly compile signals and slots
# Example:
# SET(MOCS myplugin.h)
# Note that header files which are not describing Qt Objects won't be parse by the MOC tool.
 
 
# Depending on the plug-in type, your project may contain User Interfaces designed with the Qt Designer tool.
# To add UI files to your project, simply define a variable that will contain all the .ui files of your project.
# Example:
# SET(UIS myplugin.ui)
 
# Depending on the plug-in, your project may contain a Qt Resource file (.qrc)
# If so, add the file into a variable like this:
# QT4_ADD_RESOURCES(MyPlugin_QRC myplugin.qrc)
 
# Now call the MOC tool for header files
QT4_WRAP_CPP(MyPlugin_MOCS ${MOCS})
 
# If you have ui files, call the iuc tool:
# QT4_WRAP_UI(MyPlugin_UIS ${UIS})
 
# If your plug-in is using external libraries, you may define them here:
# Example of a plugin using the Qwt library
# SET(QWT_INCLUDE /home/dev/qwt/include)
# SET(QWT_LIB /home/dev/qwt/lib)
# INCLUDE_DIRECTORIES(${QWT_INCLUDE})
# LINK_DIRECTORIES(${QWT_LIB})
 
 
# define the library to build (the Qt Plugin)
ADD_LIBRARY(MyPlugin SHARED ${SRCS} ${MyPlugin_MOCS} ${MyPlugin_UIS} ${MyPlugin_QRC})
 
# remove ${MyPlugin_UIS} ${MyPlugin_QRC} if your project does not contain QRC or UI files
 
# Target
TARGET_LINK_LIBRARIES(MyPlugin AwCoreLib ${QT_LIBRARIES})
# This will tell cmake to link the plugin using AwCoreLib, which is the core library of AnyWave, and the Qt Libraries.
# Depending on your plug-in, extras libraries should be added.
# For example, if your plug-in is using graphics objects defined in the SDK, you must add AwGraphicsLib as a library.
# If the plug-in is a reader or a writer plug-in, you must add AwReadWriteLib
# If the plug-in is a signal processing plug-in, you must add AwProcessLib
 
# If your plugin must link with Qwt then the line should be:
#TARGET_LINK_LIBRARIES(MyPlugin AwCoreLib qwt ${QT_LIBRARIES})