root/simulator/trunk/src/utilities/msts2blender/CMakeLists.txt

Revision 1449, 12.8 kB (checked in by sehenley, 7 months ago)

Clean tabs, line endings - etc.

  • Property WBS set to 1.4.4.6
  • Property svn:keywords set to
    Url
    Rev
    Author
    Date
    Id
Line 
1 #    OSRail -- a network enabled railroad operations simulator and utilities
2 #    Copyright (C) 2007,2008,2009 Samuel E. Henley sehenley@comcast.net
3 #
4 #    This program is free software; you can redistribute it and/or modify
5 #    it under the terms of the GNU General Public License as published by
6 #    the Free Software Foundation; either version 2 of the License, or
7 #    (at your option) any later version.
8 #
9 #    This program is distributed in the hope that it will be useful,
10 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 #    GNU General Public License for more details.
13 #
14 #    You should have received a copy of the GNU General Public License along
15 #    with this program; if not, write to the Free Software Foundation, Inc.,
16 #    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 #
18 #
19 #----------------------------------------------------------------------
20 # Cmake script will build a project with everything - sets below
21 # the working directory of trunk, tag or branch in the source tree.
22 #----------------------------------------------------------------------
23 # Sets
24 #   SIMULATOR_WORKING_DIRECTORY
25 #
26 # Builds
27 #   All Documentation (html)
28 #----------------------------------------------------------------------
29 #
30 ## \file
31 ## \page msts2blendercmakelists MSTS2Blender CMakeLists.txt File.
32 ## This is the top cmakelist.txt, it builds the documentation.
33
34 PROJECT( Msts2Blender )
35
36 # FILE( TO_NATIVE_PATH ... -- requires 2.4
37 CMAKE_MINIMUM_REQUIRED( VERSION 2.6.3 )
38
39 # Get Working Directory trunk tag branch
40
41 IF( NOT SIMULATOR_WORKING_DIRECTORY )
42
43     STRING( REGEX REPLACE "/src/utilities/msts2blender/?$" ""
44         SIMULATOR_WORKING_DIRECTORY
45         ${Msts2Blender_SOURCE_DIR}
46     )
47
48     FIND_PATH( SIMULATOR_WORKING_DIRECTORY
49             Modules/prerequisite.cmake
50             ${SIMULATOR_WORKING_DIRECTORY}
51             DOC "The working directory is trunk, or a tag or a branch name."
52     )
53
54     STRING( REGEX REPLACE "/utilities/msts2blender/?$" "/bin"
55         SIMULATOR_WORKING_BINARY_DIRECTORY
56         ${Msts2Blender_BINARY_DIR}
57     )
58
59     INCLUDE( ${SIMULATOR_WORKING_DIRECTORY}/Modules/prerequisite.cmake )
60
61 ENDIF( NOT SIMULATOR_WORKING_DIRECTORY )
62
63 ## \remarks
64 ## Prebuild step for vc produces msts2blenderresources.cpp
65 ## Custom command for pre-build event must be done after target (msts2blender) is added
66 ## There is no pre-build event for msvc 6.0
67 ## CommandLine=wxrc -g msts2blender.xrc --uncompressed --cpp-code --output msts2blenderresources.cpp
68
69
70
71
72
73
74 SET( RESOURCE_SOURCES
75     msts2blender.xrc
76     mstscolorspage.xrc
77     mstsfilespage.xrc
78     mstsmatricespage.xrc
79     mstsnormalspage.xrc
80     mstspointspage.xrc
81     mstsshadernamespage.xrc
82     mstsshapeheaderpage.xrc
83     mstssortvectorspage.xrc
84     mststexturefilternamespage.xrc
85     mstsuvpointspage.xrc
86     mstsvolumespage.xrc
87     mststexturespage.xrc
88     mstslightmaterialspage.xrc
89     mstslightmodelcfgspage.xrc
90     mstsvtxstatespage.xrc
91     mstsprimitivestatespage.xrc
92     mstslodcontrolspage.xrc
93     mstssubobjectspage.xrc
94     mstsgeometryinfopage.xrc
95     blenderscenespage.xrc
96 )
97
98 ADD_CUSTOM_COMMAND(  OUTPUT ${PROJECT_BINARY_DIR}/msts2blenderresources.cpp
99                      COMMAND ${OSRAILWXWIDGETS_WXRC_EXECUTABLE}
100                      ARGS --cpp-code ${RESOURCE_SOURCES}
101                           --output=${PROJECT_BINARY_DIR}/msts2blenderresources.cpp
102                      DEPENDS ${RESOURCE_SOURCES}
103                      WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
104                      COMMENT "Build msts2blenderresources.cpp"
105 )
106
107 ## \note Global/Director/Target  property CODEBLOCKS_CONFIGURED_FILES = is a list
108 ## of files  that are the source for a generated source file or script - this is a clue
109 ## to programmer not to edit a generate${CMAKE_CURRENT_SOURCE_DIR} file but edit it's source and re-configure.
110 ## Files are cumulative from global, directory to target.
111
112 SET_PROPERTY( DIRECTORY ${PROJECT_SOURCE_DIR}
113               PROPERTY CODEBLOCKS_GENERATED_FILES ${PROJECT_BINARY_DIR}/msts2blenderresources.cpp
114 )
115
116
117 SET_DIRECTORY_PROPERTIES( PROPERTIES
118                           ADDITIONAL_MAKE_CLEAN_FILES ${PROJECT_BINARY_DIR}/msts2blenderresources.cpp
119 )
120
121 SET( PCH_HEADER premsts2blender.h )
122
123 SET_SOURCE_FILES_PROPERTIES( ${PROJECT_BINARY_DIR}/shape.h
124                     PROPERTIES GENERATED TRUE )
125
126 SET_SOURCE_FILES_PROPERTIES( ${PROJECT_BINARY_DIR}/dna.h
127                     PROPERTIES GENERATED TRUE )
128
129 SET( HEADERS
130     ${PCH_HEADER}
131     msts2blender.h
132     msts2blenderframe.h
133     mstsstreams.h
134     mstsfilespanel.h
135     mstsshapeheaderpanel.h
136     mstsvolumespanel.h
137     mstsshadernamespanel.h
138     mststexturefilternamespanel.h
139     mstspointspanel.h
140     mstsuvpointspanel.h
141     mstsnormalspanel.h
142     mstssortvectorspanel.h
143     mstscolorspanel.h
144     mstsmatricespanel.h
145     mststexturespanel.h
146     mststexturescanvas.h
147     mstspointslistctrl.h
148     mstsuvpointslistctrl.h
149     mstsnormalslistctrl.h
150     mstssortvectorslistctrl.h
151     mstscolorslistctrl.h
152     mstslightmaterialspanel.h
153     shape.h
154     mstsace.h
155     blenderscenespanel.h
156     blenderfile.h
157     blenderstreams.h
158     blenderfileblock.h
159     dna.h
160 )
161
162 SET( SOURCES
163     msts2blender.cpp
164     msts2blenderframe.cpp
165     mstsstreams.cpp
166     mstsfilespanel.cpp
167     mstsshapeheaderpanel.cpp
168     mstsvolumespanel.cpp
169     mstsshadernamespanel.cpp
170     mststexturefilternamespanel.cpp
171     mstspointspanel.cpp
172     mstsuvpointspanel.cpp
173     mstsnormalspanel.cpp
174     mstssortvectorspanel.cpp
175     mstscolorspanel.cpp
176     mstsmatricespanel.cpp
177     mststexturespanel.cpp
178     mststexturescanvas.cpp
179     mstspointslistctrl.cpp
180     mstsuvpointslistctrl.cpp
181     mstsnormalslistctrl.cpp
182     mstssortvectorslistctrl.cpp
183     mstscolorslistctrl.cpp
184     mstslightmaterialspanel.cpp
185     mstsace.cpp
186     blenderscenespanel.cpp
187     blenderfile.cpp
188     blenderstreams.cpp
189 )
190
191 # The Build is divided into source and binary paths
192 SET( MSTS2BLENDER_SOURCES
193      ${SOURCES}
194      ${HEADERS}
195 )
196
197 ADD_DEFINITIONS( -DFREE_WINDOWS )
198
199 # WIN32 has no effect on any system other than Windows -
200 # on Windows uses WinMain rather then main.
201 ADD_EXECUTABLE( Msts2Blender WIN32
202     ${MSTS2BLENDER_SOURCES}
203 )
204
205 INCLUDE_DIRECTORIES( blender_SOURCE_DIR
206                      ${SIMULATOR_THIRD_PARTY_ROOT_DIRECTORY}/${BLENDER_VERSION_DIRECTORY_NAME}/source/blender/makesdna
207                      ${SIMULATOR_THIRD_PARTY_ROOT_DIRECTORY}/${BLENDER_VERSION_DIRECTORY_NAME}/source/blender/blenkernel
208                      ${SIMULATOR_THIRD_PARTY_ROOT_DIRECTORY}/${BLENDER_VERSION_DIRECTORY_NAME}/source/blender/blenlib
209                      ${SIMULATOR_THIRD_PARTY_ROOT_DIRECTORY}/${BLENDER_VERSION_DIRECTORY_NAME}/source/blender/include
210                      ${SIMULATOR_THIRD_PARTY_ROOT_DIRECTORY}/${BLENDER_VERSION_DIRECTORY_NAME}/source/blender/blenloader
211                      ${SIMULATOR_THIRD_PARTY_ROOT_DIRECTORY}/${BLENDER_VERSION_DIRECTORY_NAME}/source/blender/readblenfile
212 )
213
214 PACKAGE_CONFIGURE( Msts2Blender
215                   Debug wx-config ${WXPREFIX} ${WXCFG_DEBUG} --unicode=no --debug=yes --static=no --cflags
216                   debug wx-config ${WXPREFIX} ${WXCFG_DEBUG} --unicode=no --debug=yes --static=no --libs
217                   RelWithDebInfo Release MinSizeRel wx-config ${WXPREFIX} ${WXCFG} --unicode=no --debug=no --static=no --cflags
218                   optimized wx-config ${WXPREFIX} ${WXCFG} --unicode=no --debug=no --static=no --libs
219                   paths.pc
220                   boost.pc
221                   ipc.pc
222                   mststokens.pc
223                   zlib.pc
224                   osrail.pc
225 )
226
227
228 ADD_LIBRARY( msts2blenderxrcresources STATIC
229     ${PROJECT_BINARY_DIR}/msts2blenderresources.cpp
230 )
231
232 PACKAGE_CONFIGURE( msts2blenderxrcresources
233                   Debug wx-config ${WXPREFIX} ${WXCFG_DEBUG} --unicode=no --debug=yes --static=no --cflags
234                   RelWithDebInfo Release MinSizeRel wx-config ${WXPREFIX} ${WXCFG} --unicode=no --debug=no --static=no --cflags
235                   osrail.pc
236 )
237
238
239 TARGET_LINK_LIBRARIES( Msts2Blender
240     optimized msts2blenderxrcresources
241     debug msts2blenderxrcresources_d
242 )
243
244
245
246 INCLUDE_DIRECTORIES( ${SIMULATOR_WORKING_DIRECTORY}/vendor/wxwidgets/src/zlib )
247
248 PRECOMPILED_HEADER( "Unix Makefiles" Msts2Blender ${PCH_HEADER} ${SIMULATOR_WORKING_INCLUDE_DIRECTORY} )
249 PRECOMPILED_HEADER( "CodeBlocks" Msts2Blender ${PCH_HEADER} "1" )
250 PRECOMPILED_HEADER( "MinGW Makefiles" Msts2Blender ${PCH_HEADER} ${SIMULATOR_WORKING_INCLUDE_DIRECTORY} )
251
252
253 ADD_DEPENDENCIES( Msts2Blender
254     msts2blenderxrcresources
255     ipc
256     paths
257     ${SIMULATOR_WORKING_INCLUDE_DIRECTORY}/${PCH_HEADER}.gch
258 )
259
260
261 ## \par Win32 Resource
262 ## Resource required for application icon on windows.
263 ## Resource are a custom command because the vc ide world leave
264 ## unwanted binary files in the source tree if the rc file is
265 ## added to the project source. The resulting res file is named as a library file
266 ## so that it will go into TARGET_LINK_LIBRARIES without a name change.
267 ## RC can figure out that it's really a resource file or maybe it really is a library?
268 IF( WIN32 )
269
270     # If we call it a library then cmake will not changes its name - cmake is so helpfull?
271     FILE( TO_NATIVE_PATH ${PROJECT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}msts2blenderwin32resources${CMAKE_STATIC_LIBRARY_SUFFIX} ONE )
272     FILE( TO_NATIVE_PATH ${PROJECT_SOURCE_DIR}/msts2blender.rc TWO )
273
274     ADD_CUSTOM_COMMAND( TARGET Msts2Blender
275                         PRE_BUILD
276                         COMMAND ${RC_EXECUTABLE}
277                         ARGS -fo${SIMULATOR_WORKING_ARCHIVE_DIRECTORY}/libmsts2blenderwin32resources.a
278                              ${PROJECT_SOURCE_DIR}/msts2blender.rc
279                         MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/msts2blender.rc
280                         COMMENT "Windows Application Icon"
281     )
282
283     TARGET_LINK_LIBRARIES( Msts2Blender
284                            msts2blenderwin32resources
285     )
286
287     INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR} )
288
289 ENDIF( WIN32 )
290
291 IF( MSTS_BUILD_SHAPE AND MSTS_DIRECTORY )
292
293     ADD_CUSTOM_COMMAND( TARGET Msts2Blender
294                         PRE_BUILD
295                         COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/debug/EbnfClassGenerator
296                          ARGS "${MSTS_DIRECTORY}/UTILS/FFEDIT/newshape.bnf"
297                          --output-directory \"${SIMULATOR_WORKING_INCLUDE_DIRECTORY}\"
298                          --treat-count-as-vector
299                          --single-header shape
300                          --replace
301                          --generate-input-streams mstsstreams::InStream
302                          --generate-output-streams mstsstreams::OutStream
303                          MAIN_DEPENDENCY "${MSTS_DIRECTORY}/UTILS/FFEDIT/newshape.bnf"
304                          COMMENT "Build shape.h"
305     )
306
307     SET_PROPERTY( DIRECTORY ${PROJECT_SOURCE_DIR}
308                   PROPERTY CODEBLOCKS_GENERATED_FILES ${SIMULATOR_WORKING_INCLUDE_DIRECTORY}/shape.h
309     )
310
311
312 ELSE( MSTS_BUILD_SHAPE AND MSTS_DIRECTORY )
313
314     SET( WARNING " !!!Don't Edit this generated file - edit /src/include/shape.h.in and run cmake for OSRail sdk. !!! " )
315     CONFIGURE_FILE( ${SIMULATOR_WORKING_DIRECTORY}/src/include/shape.h.in
316                     ${SIMULATOR_WORKING_INCLUDE_DIRECTORY}/shape.h
317                     IMMEDIATE
318     )
319
320     SET_PROPERTY( DIRECTORY ${PROJECT_SOURCE_DIR}
321                   PROPERTY CODEBLOCKS_CONFIGURED_FILES ${SIMULATOR_WORKING_INCLUDE_DIRECTORY}/shape.h
322     )
323
324 ENDIF( MSTS_BUILD_SHAPE AND MSTS_DIRECTORY )
325
326 IF( BLENDER_BUILD_DNA )
327
328     ADD_CUSTOM_COMMAND( TARGET Msts2Blender
329                         PRE_BUILD
330                         COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/debug/BlenderClassGenerator
331                          ARGS
332                          --output-directory \"${SIMULATOR_WORKING_INCLUDE_DIRECTORY}\"
333                          --namespace blender
334                          --single-header dna.h
335                          --generate-input-streams blenderstreams::InStream
336                          --generate-output-streams blenderstreams::OutStream
337                          --change-to-class-names
338                          MAIN_DEPENDENCY "dna.c"
339                          COMMENT "Build dna.h"
340     )
341
342     SET_PROPERTY( DIRECTORY ${PROJECT_SOURCE_DIR}
343                   PROPERTY CODEBLOCKS_GENERATED_FILES ${SIMULATOR_WORKING_INCLUDE_DIRECTORY}/dna.h
344     )
345
346
347 ELSE(  BLENDER_BUILD_DNA  )
348
349     SET( WARNING " !!!Don't Edit this generated file - edit /src/include/dna.h.in and run cmake for OSRail sdk. !!! " )
350     CONFIGURE_FILE( ${SIMULATOR_WORKING_DIRECTORY}/src/include/dna.h.in
351                     ${SIMULATOR_WORKING_INCLUDE_DIRECTORY}/dna.h
352                     IMMEDIATE
353     )
354
355     SET_PROPERTY( DIRECTORY ${PROJECT_SOURCE_DIR}
356                   PROPERTY CODEBLOCKS_CONFIGURED_FILES ${SIMULATOR_WORKING_INCLUDE_DIRECTORY}/dna.h
357     )
358
359 ENDIF(  BLENDER_BUILD_DNA  )
360
361
362
363
364
365
366
367 ## \par Subdirectories Scripts.
368 ## installer test
369 ## The installer is a part of the build and integration test
370 ## The installer has its own unit tests. The test sub-directory is the
371 ## unit tests for Msts2BlenderTest.
372 SUBDIRS( test )
Note: See TracBrowser for help on using the browser.