Commit 753a3a53 authored by Ronan Trépos's avatar Ronan Trépos
Browse files

update cmake scripts

parent 29ba5082
IF (WIN32)
SET(CPACK_GENERATOR "ZIP")
SET(CPACK_SOURCE_GENERATOR "ZIP")
ENDIF (WIN32)
IF (UNIX)
SET(CPACK_GENERATOR "TGZ")
SET(CPACK_SOURCE_GENERATOR "TGZ")
ENDIF (UNIX)
SET(CPACK_GENERATOR "ZIP")
SET(CPACK_SOURCE_GENERATOR "ZIP")
SET(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
SET(CPACK_PACKAGE_VENDOR "VLE Development Team")
......@@ -16,13 +9,12 @@ SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/Readme.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/License.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "${MODEL_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${MODEL_MINOR}")
# CPack source configuration
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${MODEL_NAME}")
SET(CPACK_PACKAGE_FILE_NAME "${MODEL_NAME}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
# ancien SET(CPACK_SOURCE_IGNORE_FILES "\\\\.swp$;/\\\\.gitignore;/build/;/lib/;/\\\\.git/")
# ajout de .svn
SET(CPACK_SOURCE_IGNORE_FILES "\\\\.swp$;/\\\\.gitignore;/build/;/lib/;/\\\\.git/;/\\\\.svn/")
SET(CPACK_PACKAGE_VERSION_EXTRA "${MODEL_EXTRA}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${VLE_NAME}")
SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${VLE_NAME}")
SET(CPACK_PACKAGE_FILE_NAME "${VLE_NAME}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
SET(CPACK_SOURCE_IGNORE_FILES "\\\\.swp$;/\\\\.gitignore;/build/;/buildvle/;/plugins/;/lib/;/doc/html/;/output/;/\\\\.git/")
INCLUDE(CPack)
......
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(sunflo CXX C)
SET (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
ENABLE_TESTING()
SET(MODEL_MAJOR 0)
......@@ -13,9 +13,14 @@ SET(VLE_NAME "${PROJECT_NAME}-${MODEL_MAJOR}.${MODEL_MINOR}")
## Options for compilation of package
##
OPTION(WITH_TEST "will build the test [default: ON]" ON)
OPTION(WITH_DOC "will compile doc and install it [default: OFF]" OFF)
OPTION(WITH_WARNINGS "will compile with g++ warnings [default: ON]" ON)
option(WITH_TEST "will build the test [default: ON]" ON)
option(WITH_DOC "will compile doc and install it [default: OFF]" OFF)
option(WITH_WARNINGS "will compile with g++ warnings [default: ON]" ON)
option(WITH_GVLE "use the GVLE [default: on]" ON)
##
## Flags
##
if (CMAKE_BUILD_TYPE STREQUAL "")
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE)
......@@ -29,13 +34,13 @@ if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif (NOT WITH_WARNINGS)
if ("${CMAKE_BUILD_TYPE}" EQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" EQUAL "RelWithDebInfo")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb3")
endif ()
endif ()
##
## Modules
##
......@@ -58,6 +63,13 @@ else()
Please use a different C++ compiler.")
endif()
##
## cmake policy
##
if (COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0020 NEW)#for qt link
endif (COMMAND CMAKE_POLICY)
##
## Check VLE and package dependencies
......@@ -67,23 +79,63 @@ set(VLE_DEBUG 0)
set(VLE_ABI_VERSION 2.0)
find_package(VLE REQUIRED)
set (VleUtils_DIR "${VLE_SHARE_DIR}/cmake")
set (CMAKE_MODULE_PATH ${VLE_SHARE_DIR}/cmake ${CMAKE_MODULE_PATH})
find_package(VleUtils REQUIRED)
VleCheckDependencies()
##
## Check GVLE and package dependencies
##
if (WITH_GVLE)
set(GVLE_DEBUG 0)
find_package(GVLE)
if (GVLE_FOUND)
set (HAVE_GVLE 1 CACHE INTERNAL "" FORCE)
else ()
message (WARNING "GVLE not found!")
endif ()
endif ()
##
## Find boost
##
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREAD ON)
find_package(Boost COMPONENTS unit_test_framework date_time thread system)
find_package(Boost COMPONENTS unit_test_framework date_time thread
system filesystem)
##
## Find Qt
##
if (HAVE_GVLE)
set(QMAKE_QUERY_LIBPATH qmake -query QT_INSTALL_LIBS)
execute_process(COMMAND ${QMAKE_QUERY_LIBPATH} OUTPUT_VARIABLE
CMAKE_PREFIX_PATH)
find_package(Qt5 COMPONENTS Widgets Gui Xml)
if (NOT Qt5_FOUND)
message(FATAL_ERROR "Qt5 is required")
endif (NOT Qt5_FOUND)
if (NOT Qt5Widgets_FOUND)
message(FATAL_ERROR "Qt5Widgets is required")
endif (NOT Qt5Widgets_FOUND)
if (NOT Qt5Gui_FOUND)
message(FATAL_ERROR "Qt5Gui is required")
endif (NOT Qt5Gui_FOUND)
if (NOT Qt5Xml_FOUND)
message(FATAL_ERROR "Qt5Xml is required")
endif (NOT Qt5Xml_FOUND)
endif ()
##
## Generate the doxygen
##
FIND_PACKAGE(Doxygen)
IF (DOXYGEN AND WITH_DOC)
if (WITH_DOC)
FIND_PACKAGE(Doxygen)
if (DOXYGEN)
SET(DOXYGEN_SOURCE_DIR "${PROJECT_SOURCE_DIR}/src")
SET(DOXYGEN_OUTPUT_MODELING_DIR "${PROJECT_BINARY_DIR}/doxygen/modeling")
SET(DOXYGEN_OUTPUT_SOURCE_DIR "${PROJECT_BINARY_DIR}/doxygen/sources")
......@@ -118,21 +170,33 @@ IF (DOXYGEN AND WITH_DOC)
"doc/html/modeling")
INSTALL(DIRECTORY "${PROJECT_BINARY_DIR}/doxygen/sources/html" DESTINATION
"doc/html/sources")
ENDIF (DOXYGEN AND WITH_DOC)
endif (DOXYGEN)
endif ()
##
## Subdirectory
##
add_subdirectory(data)
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data")
add_subdirectory(data)
endif ()
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/metadata")
add_subdirectory(metadata)
endif ()
if (WITH_DOC)
add_subdirectory(doc)
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/doc")
add_subdirectory(doc)
endif ()
endif ()
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/exp")
add_subdirectory(exp)
endif ()
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src")
add_subdirectory(src)
endif ()
add_subdirectory(exp)
add_subdirectory(src)
if (Boost_UNIT_TEST_FRAMEWORK_FOUND AND WITH_TEST)
if (IS_DIRECTORY test)
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test")
add_subdirectory(test)
endif ()
endif (Boost_UNIT_TEST_FRAMEWORK_FOUND AND WITH_TEST)
......
......@@ -7,7 +7,6 @@ Maintainer: Pierre Casadebaig <pierre.casadebaig@toulouse.inra.fr>
Description: Still in progress
.
Tags: sunflo
Url: http://www.vle-project.org/1.3
Url: http://www.vle-project.org/2.0
Size: 0
MD5sum: xxxx
Requirements
============
vle 0.8.0 http://vle.univ-littoral.fr
glibmm 2.4.0 http://www.gtkmm.org
libxml++ 2.6.0 http://libxmlplusplus.sourceforge.net
boost 1.34 http://www.boost.org
cmake 2.6.0 http://www.cmake.org
vle 2.0 http://www.vle-project.org
boost 1.49 http://www.boost.org
cmake 2.8 http://www.cmake.org
VLE Installation
================
Just run the good command:
Installation
============
$ vle --package=yourpackage configure
$ vle --package=yourpackage build
$ vle --package=sunflo configure
$ vle --package=sunflo build
# FindGVLE.cmake
# ==============
#
# Try to find GVLE
#
# Copyright 2012-2014 INRA
# Gauthier Quesnel <quesnel@users.sourceforge.net>
# Ronan Trépos <ronan.trepos@toulouse.inra.fr>
#
# Distributed under the OS-approved BSD License (the "License");
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#
# Once done this will define:
#
# GVLE_FOUND - The system has GVLE
# GVLE_INCLUDE_DIR - The GVLE include directory
# GVLE_LIBRARY_DIRS - Directories containing libraries to link
# GVLE_LIBRARIES - Link these to use shared libraries of GVLE
#
# CMake variables used by this module:
#
# VLE_ABI_VERSION - gives the VLE version to search for (e.g 1.1, 1.2)
# (REQUIRED)
# GVLE_DEBUG - If true, prints debug traces
# (default OFF)
# GVLE_USING_CMAKE - If true, on windows, use cmake for finding GVLE,
# else use pkgconfig
# (default ON)
# VLE_BASEPATH_LOCAL - cmake variable for base path of vle
# (default NOT_DEFINED)
#
# Environment variables used by this module:
#
# VLE_BASEPATH - environment variable for base path of vle
#
#=============================================================================
#
# Notes :
# ---------
# FindGVLE will try to find GVLE, VLE and the gtkmm dependencies,
# finding GVLE does not require to call FindVLE before
#
#=============================================================================
#
# Usage
# -----
#
# set(VLE_ABI_VERSION 1.2)
# find_package(GVLE REQUIRED)
#
#=============================================================================
#
# Check VLE_ABI_VERSION
#
if (NOT DEFINED VLE_ABI_VERSION)
message (FATAL_ERROR "Cmake variable VLE_ABI_VERSION is not set")
endif ()
#
# Set default behavior of find gvle
#
if (WIN32)
if (DEFINED GVLE_USING_CMAKE)
set (_find_gvle_using_cmake ${GVLE_USING_CMAKE})
else ()
set (_find_gvle_using_cmake 1)
endif ()
else ()
set (_find_gvle_using_cmake 0)
endif ()
if (DEFINED GVLE_DEBUG)
set (_gvle_debug ${GVLE_DEBUG})
else ()
set (_gvle_debug 0)
endif ()
#
# Find GVLE
#
if (${_find_gvle_using_cmake})
find_path(_gvle_base_include zlib.h PATHS
$ENV{VLE_BASEPATH}/include
${VLE_BASEPATH_LOCAL}/include
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;Path]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\Wow6432Node\\VLE ${VLE_ABI_VERSION}.0;]/include")
find_path(_gvle_base_bin zlib1.dll PATHS
$ENV{VLE_BASEPATH}/bin
${VLE_BASEPATH_LOCAL}/bin
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;Path]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\Wow6432Node\\VLE ${VLE_ABI_VERSION}.0;]/bin")
find_path(_gvle_base_lib libz.dll.a PATHS
$ENV{VLE_BASEPATH}/lib
${VLE_BASEPATH_LOCAL}/lib
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;Path]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\Wow6432Node\\VLE ${VLE_ABI_VERSION}.0;]/lib")
if (${_gvle_debug})
message (" gvle_debug _gvle_base_include ${_gvle_base_include}")
message (" gvle_debug _gvle_base_bin ${_gvle_base_bin}")
message (" gvle_debug _gvle_base_lib ${_gvle_base_lib}")
endif ()
if(NOT _gvle_base_include OR NOT _gvle_base_bin OR NOT _gvle_base_lib)
message (FATAL_ERROR "Missing gvle dependencies")
endif ()
set(GVLE_INCLUDE_DIRS
${_gvle_base_include}/vle-${VLE_ABI_VERSION}; ${_gvle_base_include};
${_gvle_base_include}/gtkmm-2.4;${_gvle_base_lib}/gtkmm-2.4/include;
${_gvle_base_include}/cairomm-1.0;${_gvle_base_lib}/cairomm-1.0/include;
${_gvle_base_include}/atkmm-1.6;
${_gvle_base_include}/giomm-2.4;${_gvle_base_lib}/giomm-2.4/include;
${_gvle_base_include}/pangomm-1.4;${_gvle_base_lib}/pangomm-1.4/include;
${_gvle_base_include}/gdkmm-2.4;${_gvle_base_lib}/gdkmm-2.4/include;
${_gvle_base_include}/atk-1.0;
${_gvle_base_include}/glibmm-2.4;${_gvle_base_lib}/glibmm-2.4/include;
${_gvle_base_include}/glib-2.0;${_gvle_base_lib}/glib-2.0/include;
${_gvle_base_include}/sigc++-2.0;${_gvle_base_lib}/sigc++-2.0/include;
${_gvle_base_include}/pango-1.0;${_gvle_base_include}/cairo;
${_gvle_base_include}/freetype2;${_gvle_base_include}/libpgn14;
${_gvle_base_include}/gtk-2.0;${_gvle_base_lib}/gtk-2.0/include;
${_gvle_base_include}/gdk-pixbuf-2.0;
${_gvle_base_lib}/gdk-pixbuf-2.0/include;
${_gvle_base_include}/libxml2)
set (GVLE_LIBRARY_DIRS
${_gvle_base_bin}; ${_gvle_base_lib};
c:/devel/dist/win32/lipng-1.4.3-1/lib)
set (GVLE_LIBRARIES
gvle-${VLE_ABI_VERSION} gtkmm-2.4 vle-${VLE_ABI_VERSION} atkmm-1.6
gdkmm-2.4 giomm-2.4 pangomm-1.4 gtk-win32-2.0 cairomm-1.0 gdk-win32-2.0
atk-1.0 gio-2.0 pangowin32-1.0 gdi32 pangocairo-1.0 gdk_pixbuf-2.0 png14
pango-1.0 gmodule-2.0 cairo xml2 glibmm-2.4 gobject-2.0 sigc-2.0
gthread-2.0 glib-2.0 intl)
else () # find gvle using pkg-config
find_package(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GVLE gvle-${VLE_ABI_VERSION})
endif ()
# handle the QUIETLY and REQUIRED arguments and set GVLE_FOUND to TRUE if all
# listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GVLE REQUIRED_VARS
GVLE_INCLUDE_DIRS GVLE_LIBRARIES)
if (${_gvle_debug})
message (" gvle_debug GVLE_INCLUDE_DIRS ${GVLE_INCLUDE_DIRS}")
message (" gvle_debug GVLE_LIBRARY_DIRS ${GVLE_LIBRARY_DIRS}")
message (" gvle_debug GVLE_LIBRARIES ${GVLE_LIBRARIES}")
endif ()
#mark_as_advanced(GVLE_INCLUDE_DIRS GVLE_LIBRARIES GVLE_LIBRARY_DIRS)
......@@ -3,7 +3,7 @@
#
# Try to find VLE
#
# Copyright 2012-2014 INRA
# Copyright 2012-2016 INRA
# Gauthier Quesnel <quesnel@users.sourceforge.net>
# Ronan Trépos <ronan.trepos@toulouse.inra.fr>
#
......@@ -87,26 +87,30 @@ endif ()
#
if (${_find_vle_using_cmake})
find_path(_vle_base_include zlib.h PATHS
find_path(_vle_base_include vle-${VLE_ABI_VERSION}/vle/vle.hpp PATHS
$ENV{VLE_BASEPATH}/include
${VLE_BASEPATH_LOCAL}/include
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;Path]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\Wow6432Node\\VLE ${VLE_ABI_VERSION}.0;]/include")
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\Wow6432Node\\VLE ${VLE_ABI_VERSION}.0;]/include"
NO_DEFAULT_PATH)
find_path(_vle_base_bin zlib1.dll PATHS
find_path(_vle_base_bin vle.exe PATHS
$ENV{VLE_BASEPATH}/bin
${VLE_BASEPATH_LOCAL}/bin
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;Path]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\Wow6432Node\\VLE ${VLE_ABI_VERSION}.0;]/bin")
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\Wow6432Node\\VLE ${VLE_ABI_VERSION}.0;]/bin"
NO_DEFAULT_PATH)
find_path(_vle_base_lib libz.dll.a PATHS
find_path(_vle_base_lib libvle-${VLE_ABI_VERSION}.a PATHS
$ENV{VLE_BASEPATH}/lib
${VLE_BASEPATH_LOCAL}/lib
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;Path]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\Wow6432Node\\VLE ${VLE_ABI_VERSION}.0;]/lib")
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\Wow6432Node\\VLE ${VLE_ABI_VERSION}.0;]/lib"
NO_DEFAULT_PATH)
if (${_vle_debug})
message (" vle_debug _vle_base_include ${_vle_base_include}")
......@@ -119,25 +123,25 @@ if (${_find_vle_using_cmake})
endif ()
set(VLE_INCLUDE_DIRS
${_vle_base_include}/vle-${VLE_ABI_VERSION};
${_vle_base_include}; ${_vle_base_include}/libxml2;
${_vle_base_include}/glibmm-2.4;${_vle_base_lib}/glibmm-2.4/include;
${_vle_base_include}/sigc++-2.0;${_vle_base_lib}/sigc++-2.0/include;
${_vle_base_include}/glib-2.0;${_vle_base_lib}/glib-2.0/include)
${_vle_base_include}/vle-${VLE_ABI_VERSION}; ${_vle_base_include};
${_vle_base_include}/libxml2)
set(VLE_LIBRARY_DIRS
${_vle_base_bin};${_vle_base_lib})
set (VLE_LIBRARIES
vle-${VLE_ABI_VERSION} xml2 glibmm-2.4 gobject-2.0 sigc-2.0 gthread-2.0
glib-2.0 intl)
vle-${VLE_ABI_VERSION} xml2 intl)
set (VLE_SHARE_DIR "${_vle_base_include}/../share/vle-${VLE_ABI_VERSION}")
else (${_find_vle_using_cmake})
find_package(PkgConfig REQUIRED)
PKG_CHECK_MODULES(VLE vle-${VLE_ABI_VERSION})
set (VLE_SHARE_DIR "${VLE_LIBRARY_DIRS}/../share/vle-${VLE_ABI_VERSION}")
# select only the directory of vle, containing the pkgs directory
# to build VLE_SHARE_DIR
find_path(vle_lib_dir vle-${VLE_ABI_VERSION} PATHS
${VLE_LIBRARY_DIRS} NO_DEFAULT_PATH)
set (VLE_SHARE_DIR "${vle_lib_dir}/../share/vle-${VLE_ABI_VERSION}")
endif (${_find_vle_using_cmake})
......@@ -151,6 +155,7 @@ if (${_vle_debug})
message (" vle_debug VLE_INCLUDE_DIRS ${VLE_INCLUDE_DIRS}")
message (" vle_debug VLE_LIBRARY_DIRS ${VLE_LIBRARY_DIRS}")
message (" vle_debug VLE_LIBRARIES ${VLE_LIBRARIES}")
message (" vle_debug VLE_SHARE_DIR ${VLE_SHARE_DIR}")
endif ()
#mark_as_advanced(VLE_INCLUDE_DIRS VLE_LIBRARIES VLE_LIBRARY_DIRS)
This diff is collapsed.
This diff is collapsed.
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(sunflo_test CXX C)
SET (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
ENABLE_TESTING()
SET(MODEL_MAJOR 0)
......@@ -13,9 +13,14 @@ SET(VLE_NAME "${PROJECT_NAME}-${MODEL_MAJOR}.${MODEL_MINOR}")
## Options for compilation of package
##
OPTION(WITH_TEST "will build the test [default: ON]" ON)
OPTION(WITH_DOC "will compile doc and install it [default: OFF]" OFF)
OPTION(WITH_WARNINGS "will compile with g++ warnings [default: ON]" ON)
option(WITH_TEST "will build the test [default: ON]" ON)
option(WITH_DOC "will compile doc and install it [default: OFF]" OFF)
option(WITH_WARNINGS "will compile with g++ warnings [default: ON]" ON)
option(WITH_GVLE "use the GVLE [default: on]" ON)
##
## Flags
##
if (CMAKE_BUILD_TYPE STREQUAL "")
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE)
......@@ -29,13 +34,13 @@ if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif (NOT WITH_WARNINGS)
if ("${CMAKE_BUILD_TYPE}" EQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" EQUAL "RelWithDebInfo")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb3")
endif ()
endif ()
##
## Modules
##
......@@ -58,6 +63,13 @@ else()
Please use a different C++ compiler.")
endif()
##
## cmake policy
##
if (COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0020 NEW)#for qt link
endif (COMMAND CMAKE_POLICY)
##
## Check VLE and package dependencies
......@@ -67,9 +79,23 @@ set(VLE_DEBUG 0)
set(VLE_ABI_VERSION 2.0)
find_package(VLE REQUIRED)
set (VleUtils_DIR "${VLE_SHARE_DIR}/cmake")
set (CMAKE_MODULE_PATH ${VLE_SHARE_DIR}/cmake ${CMAKE_MODULE_PATH})
find_package(VleUtils REQUIRED)
VleCheckDependencies()
##
## Check GVLE and package dependencies
##
if (WITH_GVLE)
set(GVLE_DEBUG 0)
find_package(GVLE)
if (GVLE_FOUND)
set (HAVE_GVLE 1 CACHE INTERNAL "" FORCE)
else ()
message (WARNING "GVLE not found!")
endif ()
endif ()
##
## Find boost
......@@ -77,14 +103,39 @@ VleCheckDependencies()
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREAD ON)
find_package(Boost COMPONENTS unit_test_framework date_time thread system)
find_package(Boost COMPONENTS unit_test_framework date_time thread
system filesystem)
##
## Find Qt
##
if (HAVE_GVLE)
set(QMAKE_QUERY_LIBPATH qmake -query QT_INSTALL_LIBS)
execute_process(COMMAND ${QMAKE_QUERY_LIBPATH} OUTPUT_VARIABLE
CMAKE_PREFIX_PATH)
find_package(Qt5 COMPONENTS Widgets Gui Xml)
if (NOT Qt5_FOUND)
message(FATAL_ERROR "Qt5 is required")
endif (NOT Qt5_FOUND)
if (NOT Qt5Widgets_FOUND)
message(FATAL_ERROR "Qt5Widgets is required")
endif (NOT Qt5Widgets_FOUND)
if (NOT Qt5Gui_FOUND)
message(FATAL_ERROR "Qt5Gui is required")
endif (NOT Qt5Gui_FOUND)
if (NOT Qt5Xml_FOUND)
message(FATAL_ERROR "Qt5Xml is required")
endif (NOT Qt5Xml_FOUND)
endif ()
##
## Generate the doxygen
##
FIND_PACKAGE(Doxygen)
IF (DOXYGEN AND WITH_DOC)
if (WITH_DOC)
FIND_PACKAGE(Doxygen)
if (DOXYGEN)
SET(DOXYGEN_SOURCE_DIR "${PROJECT_SOURCE_DIR}/src")
SET(DOXYGEN_OUTPUT_MODELING_DIR "${PROJECT_BINARY_DIR}/doxygen/modeling")
SET(DOXYGEN_OUTPUT_SOURCE_DIR "${PROJECT_BINARY_DIR}/doxygen/sources")
......@@ -119,7 +170,8 @@ IF (DOXYGEN AND WITH_DOC)
"doc/html/modeling")
INSTALL(DIRECTORY "${PROJECT_BINARY_DIR}/doxygen/sources/html" DESTINATION
"doc/html/sources")
ENDIF (DOXYGEN AND WITH_DOC)
endif (DOXYGEN)
endif ()
##
## Subdirectory
......@@ -128,6 +180,9 @@ ENDIF (DOXYGEN AND WITH_DOC)
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data")
add_subdirectory(data)
endif ()
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/metadata")
add_subdirectory(metadata)
endif ()
if (WITH_DOC)
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/doc")