Commit d3d58c3a authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE #144] now the ow script supports external development properly

parent 1f2387fb
......@@ -31,7 +31,7 @@ PROJECT_NAME = OpenWalnut
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 1.2.5
PROJECT_NUMBER = 1.3.0
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
......
......@@ -43,6 +43,9 @@ SET( OW_TOOLS_DIR ${PROJECT_SOURCE_DIR}/../tools )
# append search path for FindModules:
LIST( APPEND CMAKE_MODULE_PATH ${OW_TOOLS_DIR}/cmake )
# use internally
SET( OW_EXTERNAL_MODULE false )
# These scripts contains all the needed tools to setup the build:
# * Compiler Setup
# * Common OpenWalnut Options
......@@ -127,14 +130,9 @@ ADD_DEPENDENCIES( install_devdoc core_devdoc )
#
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# to allow non-core code to access core and ext absolutely
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR} )
# -----------------------------------------------------------------------------------------------------------------------------------------------
# core library
SET( OWCoreName "openwalnut" )
# build core
ADD_SUBDIRECTORY( core )
......
......@@ -26,7 +26,7 @@
# Some common setup
# ---------------------------------------------------------------------------------------------------------------------------------------------------
SET( LibName ${OWCoreName} )
SET( LibName ${OW_LIB_OPENWALNUT} )
# Set the prefix and suffix of dynamically loadable modules to match
# CMAKEs naming of them. The quotes are necessary so the shell doesn't mess
......
......@@ -47,7 +47,7 @@ COLLECT_COMPILE_FILES( "${MODULE_SOURCE_DIR}" TARGET_CPP_FILES TARGET_H_FILES TA
IF( CUDA_FOUND AND OW_USE_CUDA )
FILE( GLOB_RECURSE CUDA_SRC "*.cu" )
CUDA_ADD_LIBRARY( ${MODULE_NAME} SHARED ${TARGET_CPP_FILES} ${TARGET_H_FILES} ${CUDA_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} ${OWCoreName} ${CUDA_LIBRARIES} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} ${OW_LIB_OPENWALNUT} ${CUDA_LIBRARIES} )
ELSE()
# Remove files that do including cuda stuff
LIST( REMOVE_ITEM TARGET_H_FILES ${CMAKE_CURRENT_SOURCE_DIR}/WCheckCudaError.h )
......@@ -58,7 +58,7 @@ ELSE()
# Build the module without the cuda codes
ADD_LIBRARY( ${MODULE_NAME} SHARED ${TARGET_CPP_FILES} ${TARGET_H_FILES} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} ${OWCoreName} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} ${OW_LIB_OPENWALNUT} )
ENDIF()
# Set the version of the library.
......
......@@ -70,7 +70,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
# Setup the target
ADD_EXECUTABLE( ${BinName} ${TARGET_CPP_FILES} ${TARGET_H_FILES} ${OW_VERSION_HEADER} )
TARGET_LINK_LIBRARIES( ${BinName} ${OWCoreName} ${QT_LIBS} ${Boost_LIBRARIES} )
TARGET_LINK_LIBRARIES( ${BinName} ${OW_LIB_OPENWALNUT} ${QT_LIBS} ${Boost_LIBRARIES} )
# Tell CMake that someone creates this file for us. See doc of SETUP_VERSION_HEADER for details why this is needed.
# NOTE: this needs to be placed AFTER ADD_EXECUTABLE or ADD_LIBRARY
......
......@@ -24,6 +24,48 @@
INCLUDE( OpenWalnutUtils )
# name of the core lib. Used when linking modules or other GUI
SET( OW_LIB_OPENWALNUT "openwalnut" )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
#
# External Building Support
#
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# if this is included for external module building, find OpenWalnut.
IF( NOT ${OW_EXTERNAL_MODULE} )
# to allow non-core code to access core and ext absolutely
MESSAGE( STATUS "This is OpenWalnut Build System." )
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR} )
ELSE()
MESSAGE( STATUS "This is OpenWalnut Build System configured for external use." )
FIND_PATH( OPENWALNUT_INCLUDE_DIR core/kernel/WKernel.h $ENV{OPENWALNUT_INCLUDEDIR} /usr/include/openwalnut /usr/local/include/openwalnut )
FIND_LIBRARY( OPENWALNUT_LIBRARIES NAMES ${OW_LIB_OPENWALNUT} lib${OW_LIB_OPENWALNUT} HINTS $ENV{OPENWALNUT_LIBDIR} /usr/lib /usr/local/lib )
SET( OPENWALNUT_FOUND FALSE )
# provide some output
IF( OPENWALNUT_INCLUDE_DIR )
MESSAGE( STATUS "Found OpenWalnut include files in ${OPENWALNUT_INCLUDE_DIR}." )
ENDIF()
IF( OPENWALNUT_LIBRARIES )
MESSAGE( STATUS "Found OpenWalnut libs in ${OPENWALNUT_LIBRARIES}." )
ENDIF()
# really found?
IF( OPENWALNUT_INCLUDE_DIR AND OPENWALNUT_LIBRARIES )
SET( OPENWALNUT_FOUND TRUE )
MESSAGE( STATUS "Found OpenWalnut." )
ELSE()
MESSAGE( FATAL_ERROR "Could not find OpenWalnut." )
ENDIF()
# include
INCLUDE_DIRECTORIES( ${OPENWALNUT_INCLUDE_DIR} )
SET( OW_LIB_OPENWALNUT ${OPENWALNUT_LIBRARIES} )
ENDIF()
# ---------------------------------------------------------------------------------------------------------------------------------------------------
#
# This is mandatory. Defines the target paths for building all elements in OpenWalnut
......@@ -82,10 +124,6 @@ FUNCTION( BUILD_SYSTEM_COMPILER )
SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DDEBUG -O2" CACHE STRING "" FORCE )
ENDFUNCTION( BUILD_SYSTEM_COMPILER )
# This finds all the needed third-party libs for you and sets them up properly. Usually, you will not need to call this explicitly.
FUNCTION( BUILD_SYSTEM_DEPENDENCIES )
ENDFUNCTION( BUILD_SYSTEM_DEPENDENCIES )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
#
# This is executed on inclusion. It sets up everything needed. Beginning with compiler and OpenWalnut options and the third-party dependencies.
......
......@@ -654,7 +654,7 @@ FUNCTION( SETUP_MODULE _MODULE_NAME _MODULE_SOURCE_DIR _MODULE_DEPENDENCIES _MOD
# Setup the target
ADD_LIBRARY( ${MODULE_NAME} SHARED ${TARGET_CPP_FILES} ${TARGET_H_FILES} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} ${OWCoreName} ${Boost_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENSCENEGRAPH_LIBRARIES} ${_MODULE_DEPENDENCIES} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} ${OW_LIB_OPENWALNUT} ${Boost_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENSCENEGRAPH_LIBRARIES} ${_MODULE_DEPENDENCIES} )
# Set the version of the library.
SET_TARGET_PROPERTIES( ${MODULE_NAME} PROPERTIES
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment