23 #include "../../DSM/SyntaxTree.h"
36 ::std::time_t Now = ::std::chrono::system_clock::to_time_t(::std::chrono::system_clock::now());
37 ::std::string SourceFile;
58 SourceFile = pRootGraph->
m_ID;
62 while (SourceFile.find(
" ") != std::string::npos)
65 SourceFile.replace(SourceFile.find(
" "), 1,
"_");
72 "# Copyright (C) 2010-2012\n"
73 "# Johannes Feuser <feuser@uni-bremen.de>\n"
74 "# This file is part of the openETCS project\n"
76 "# The openETCS library is free software: you can redistribute it and/or modify\n"
77 "# it under the terms of the GNU General Public License as published by\n"
78 "# the Free Software Foundation, either version 3 of the License, or\n"
79 "# any later version.\n"
81 "# The openETCS library is distributed in the hope that it will be useful,\n"
82 "# but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
83 "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
84 "# GNU General Public License for more details.\n"
86 "# You should have received a copy of the GNU General Public License\n"
87 "# along with the openETCS library. If not, see <http://www.gnu.org/licenses/>.\n"
89 "# cmake file for the EVC binary\n"
90 "# generated for openETCS EVC by build configuration generator\n"
91 "# time point (UTC) of generation: " << ::std::asctime(::std::gmtime(&Now)) <<
"\n"
94 "# set project settings\n"
95 "cmake_minimum_required(VERSION 2.8)\n"
96 "project(openETCS-EVC)\n"
98 "# append flags for compiling\n"
99 "set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -O3 -Wall -pthread -std=c++0x\")\n"
100 "set(CMAKE_CXX_FLAGS_DEBUG \"${CMAKE_CXX_FLAGS_DEBUG} -O0 -Wall -pthread -std=c++0x -D__DEBUG_OUTPUT__\")\n"
101 "set(CMAKE_CXX_FLAGS_MINSIZEREL \"${CMAKE_CXX_FLAGS_MINSIZEREL} -0s -Wall -pthread -std=c++0x\")\n"
102 "set(CMAKE_CXX_FLAGS_RELEASE \"${CMAKE_CXX_FLAGS_RELEASE} -O3 -Wall -pthread -std=c++0x\")\n"
104 "# release ist default type if not set\n"
105 "if(NOT CMAKE_BUILD_TYPE)\n"
106 "set(CMAKE_BUILD_TYPE Release)\n"
107 "endif(NOT CMAKE_BUILD_TYPE)\n"
109 "# verbose makefile is disabled if not explicitly set\n"
110 "if(NOT CMAKE_VERBOSE_MAKEFILE)\n"
111 "set(CMAKE_VERBOSE_MAKEFILE OFF)\n"
112 "endif(NOT CMAKE_VERBOSE_MAKEFILE)\n"
114 "# add Qt4 package\n"
115 "find_package(Qt4 COMPONENTS QtCore QtGui QtDBus QtGui REQUIRED)\n"
116 "include(${QT_USE_FILE})\n"
118 "# init compile flag\n"
119 "set(COMPILE_OKAY \"TRUE\")\n"
122 "# try to find path to domain framework headers\n"
123 "find_path(OPEN_ETCS_DF_DIR oETCS/DF/EVCStateMachine.h PATHS ../src/ ../src/oETCS ../src/oETCS/DF /usr/inlude /usr/include/oETCS)\n"
125 "# check if path was found\n"
126 "if (OPEN_ETCS_DF_DIR STREQUAL \"OPEN_ETCS_DF_DIR-NOTFOUND\")\n"
129 "message(SEND_ERROR \"openETCS domain framework header not found!\")\n"
131 "# set compile flag to false\n"
132 "set(COMPILE_OKAY \"FALSE\")\n"
134 "else (OPEN_ETCS_DF_DIR STREQUAL \"OPEN_ETCS_DF_DIR-NOTFOUND\")\n"
136 "# print found message\n"
137 "message (STATUS \"Found openETCS domain framework include directory: ${OPEN_ETCS_DF_DIR}\")\n"
139 "endif (OPEN_ETCS_DF_DIR STREQUAL \"OPEN_ETCS_DF_DIR-NOTFOUND\")\n"
143 "# try to find path to domain framework libraries\n"
144 "find_library(OPEN_ETCS_DF_LIB openETCSPIM PATHS ../release/src ../debug/src ../src ../lib /usr/lib HINTS ${OPEN_ETCS_DF_DIR}/../release/src ${OPEN_ETCS_DF_DIR}/../debug/src ../src ${OPEN_ETCS_DF_DIR})\n"
146 "# check if library was found\n"
147 "if (OPEN_ETCS_DF_LIB STREQUAL \"OPEN_ETCS_DF_LIB-NOTFOUND\")\n"
150 "message(SEND_ERROR \"openETCS domain framework shared library not found!\")\n"
152 "# set compile flag to false\n"
153 "set(COMPILE_OKAY \"FALSE\")\n"
155 "else (OPEN_ETCS_DF_LIB STREQUAL \"OPEN_ETCS_DF_LIB-NOTFOUND\")\n"
157 "# print found message\n"
158 "message (STATUS \"Found openETCS domain framework shared library: ${OPEN_ETCS_DF_LIB}\")\n"
160 "# get path of domain framework library\n"
161 "get_filename_component(OPEN_ETCS_DF_LIB_DIR ${OPEN_ETCS_DF_LIB} PATH)\n"
163 "endif (OPEN_ETCS_DF_LIB STREQUAL \"OPEN_ETCS_DF_LIB-NOTFOUND\")\n"
166 "# check if all preconditions were met\n"
167 "if (COMPILE_OKAY STREQUAL \"TRUE\")\n"
169 "# add domain framework directories to include\n"
170 "include_directories(${OPEN_ETCS_DF_DIR} ${OPEN_ETCS_DF_LIB_DIR})\n"
172 "# add EVC binary as target\n"
173 "add_executable(EVC \"" << SourceFile <<
"\")\n"
174 "target_link_libraries(EVC ${OPEN_ETCS_DF_LIB} ${QT_LIBRARIES})\n"
176 "endif (COMPILE_OKAY STREQUAL \"TRUE\")\n"
179 "# add custom target to remove all generated files\n"
180 "set(GENERATED_FILES CMakeFiles/ CMakeCache.txt Makefile cmake_install.cmake)\n"
181 "add_custom_target(distribclean COMMAND cmake -E remove -f ${GENERATED_FILES})";