forked from tpaviot/oce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
1246 lines (1104 loc) · 55 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# REQUIREMENTS: this script needs CMake 2.8 or higher. Downloads are available at http://www.cmake.org
# How to build OCE using CMake under Unix (Linux, Darwin etc.)?
# 1. Copy this file, as-is, to the top-level OCE folder
# 2. Make a build directory somewhere outside the OCE source tree
# 3. cmake "relative/path/to/OCE"
# 4. make
# 5. make install (or sudo make install)
# How to build OCE using CMake under Windows (Linux, Darwin etc.)?
# 1. Copy this file, as-is, to the top-level folder
# 2. Launch the cmake-gui, and select the top-level folder
# 3. You can choose whatever you want as an install directory
# 4. Click 'Configure'
# 5. Choose your generator
# 6. When configure is achived, you can change the variable with a red background
# 7. Click 'Generate'
# 8. From your IDE, open the generated makefile and run the compilation.
PROJECT(OCE)
SET(OCE_VERSION_MAJOR 0)
SET(OCE_VERSION_MINOR 12)
# OCE_VERSION_PATCH is used for bugfixes releases only
# (uncomment following line)
#SET(OCE_VERSION_PATCH 0)
# Empty for official releases, set to -dev, -rc1, etc for development releases
SET(OCE_VERSION_DEVEL -dev)
# bugfix release: add ${OCE_VERSION_PATCH} to OCE_VERSION
SET(OCE_VERSION ${OCE_VERSION_MAJOR}.${OCE_VERSION_MINOR}${OCE_VERSION_DEVEL})
SET(OCE_ABI_SOVERSION 5)
SET(OCE_ABI_VERSION ${OCE_ABI_SOVERSION}.0.0)
# Set the minimum version of cmake required to 2.6
CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
# Define helper macro OPTION_WITH_DEFAULT
MACRO( OPTION_WITH_DEFAULT OPTION_NAME OPTION_STRING OPTION_DEFAULT )
IF( NOT DEFINED ${OPTION_NAME} )
SET( ${OPTION_NAME} ${OPTION_DEFAULT} )
ENDIF( NOT DEFINED ${OPTION_NAME} )
OPTION( ${OPTION_NAME} "${OPTION_STRING}" ${${OPTION_NAME}} )
ENDMACRO( OPTION_WITH_DEFAULT OPTION_NAME OPTION_STRING OPTION_DEFAULT )
############################
# Check 32/64 bit platform #
############################
IF (${CMAKE_SIZEOF_VOID_P} MATCHES "8") # It is 64bit, otherwise 32 bit systems match 4
ADD_DEFINITIONS(-D_OCC64)
SET(BIT 64)
ELSE (${CMAKE_SIZEOF_VOID_P} MATCHES "8")
SET(BIT 32)
ENDIF(${CMAKE_SIZEOF_VOID_P} MATCHES "8")
MESSAGE(STATUS "Build ${BIT}bit")
IF (NOT MSVC)
IF( NOT DEFINED ${PROJECT_NAME}_BUILD_TYPE )
SET( ${PROJECT_NAME}_BUILD_TYPE "Release" CACHE STRING "Build type" ) # By default set release build
ENDIF( NOT DEFINED ${PROJECT_NAME}_BUILD_TYPE )
SET( CMAKE_BUILD_TYPE ${${PROJECT_NAME}_BUILD_TYPE} CACHE INTERNAL "Build type,
immutable" FORCE )
ENDIF(NOT MSVC)
IF(CMAKE_BUILD_TOOL STREQUAL "nmake")
SET(NMAKE TRUE)
ENDIF(CMAKE_BUILD_TOOL STREQUAL "nmake")
IF(MSVC)
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_INSTALL_PDB_FILES "Install PDB files (debug informations)" ON )
ENDIF(MSVC)
IF(MSVC)
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_USE_BUNDLE "Use OCE Windows Bundle" OFF )
ENDIF(MSVC)
IF(BORLAND)
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_INSTALL_TDS_FILES "Instal TDS files (debug informations)" ON )
ENDIF(BORLAND)
IF(${PROJECT_NAME}_USE_BUNDLE)
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_BUNDLE_AUTOINSTALL "Autoinstall bundle DLLs" ON )
MARK_AS_ADVANCED(${PROJECT_NAME}_BUNDLE_AUTOINSTALL)
ENDIF(${PROJECT_NAME}_USE_BUNDLE)
IF ((MSVC AND NOT NMAKE) OR CMAKE_COMPILER_IS_GNUCXX)
SET(${PROJECT_NAME}_COMPILER_SUPPORTS_PCH TRUE)
IF(MSVC)
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_USE_PCH "Use Precompiled Headers" ON )
ELSE()
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_USE_PCH "Use Precompiled Headers" OFF )
ENDIF()
MARK_AS_ADVANCED(${PROJECT_NAME}_USE_PCH)
ENDIF((MSVC AND NOT NMAKE) OR CMAKE_COMPILER_IS_GNUCXX)
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_BUILD_SHARED_LIB "Build shared ${PROJECT_NAME} libs" ON )
IF(NOT MSVC)
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_DISABLE_X11 "Disable components requiring X11 support" OFF )
IF(NOT APPLE AND NOT WIN32)
MARK_AS_ADVANCED(${PROJECT_NAME}_DISABLE_X11)
ENDIF(NOT APPLE AND NOT WIN32)
ENDIF(NOT MSVC)
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_MODEL "Build model components" ON )
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_OCAF "Build application framework" ON )
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_DATAEXCHANGE "Build data exchange" ON )
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_DRAW "Build test harness \(DRAW\)" OFF )
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_VISUALISATION "Build visualisation component" ON )
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_WITH_GL2PS "Build with GL2PS" OFF )
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_WITH_FREEIMAGE "Build with FreeImage" OFF )
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_EXTRA_WARNINGS "Enable Maximum Warnings Level" OFF )
MARK_AS_ADVANCED(${PROJECT_NAME}_EXTRA_WARNINGS)
IF( NOT "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8 )
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_TESTING "Enable unittesting framework" OFF )
MARK_AS_ADVANCED(${PROJECT_NAME}_TESTING)
ENDIF( NOT "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8 )
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_ADD_HEADERS "Add headers to project files" OFF )
MARK_AS_ADVANCED(${PROJECT_NAME}_ADD_HEADERS)
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_DISABLE_BSPLINE_MESHER "Disable BSpline Mesher" OFF )
MARK_AS_ADVANCED(${PROJECT_NAME}_DISABLE_BSPLINE_MESHER)
IF (NOT WIN32)
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_RPATH_FILTER_SYSTEM_PATHS "Filter out system paths from RPATH" ON )
MARK_AS_ADVANCED(${PROJECT_NAME}_RPATH_FILTER_SYSTEM_PATHS)
ENDIF (NOT WIN32)
# The default for the DEB define is ON for all the platforms , in debug mode.
# In MSVC it is not desirable to have it ON by default, since users must
# compile/use the OCE debug libraries to build it's own programs in DEBUG mode.
# DEB should be enabled by developers only, in this case
IF ((MSVC OR BORLAND) AND CMAKE_CONFIGURATION_TYPES)
SET (DEB_DEFAULT "OFF")
ELSE ()
SET (DEB_DEFAULT "ON")
ENDIF ((MSVC OR BORLAND) AND CMAKE_CONFIGURATION_TYPES)
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_ENABLE_DEB_FLAG "Enables DEB define in debug configuration" ${DEB_DEFAULT} )
MARK_AS_ADVANCED(${PROJECT_NAME}_ENABLE_DEB_FLAG)
IF(NOT MSVC)
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_COVERAGE "Build with coverage testing" OFF )
MARK_AS_ADVANCED(${PROJECT_NAME}_COVERAGE)
ENDIF(NOT MSVC)
IF( NOT DEFINED ${PROJECT_NAME}_MULTITHREAD_LIBRARY)
SET( ${PROJECT_NAME}_MULTITHREAD_LIBRARY "NONE" CACHE STRING "(values are: NONE TBB OPENMP)" )
ENDIF( NOT DEFINED ${PROJECT_NAME}_MULTITHREAD_LIBRARY)
IF( NOT "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8 )
SET_PROPERTY(CACHE ${PROJECT_NAME}_MULTITHREAD_LIBRARY PROPERTY STRINGS NONE TBB OPENMP)
ENDIF( NOT "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8 )
OPTION( ${PROJECT_NAME}_MULTITHREAD_LIBRARY "Multithread library" ${${PROJECT_NAME}_MULTITHREAD_LIBRARY} )
IF( ${PROJECT_NAME}_MULTITHREAD_LIBRARY STREQUAL "TBB" )
OPTION_WITH_DEFAULT( ${PROJECT_NAME}_TBB_MALLOC_SUPPORT "Use TBB for memory allocation" ON )
ENDIF( ${PROJECT_NAME}_MULTITHREAD_LIBRARY STREQUAL "TBB" )
IF( NOT DEFINED ${PROJECT_NAME}_INSTALL_PREFIX )
IF( WIN32 )
SET(${PROJECT_NAME}_INSTALL_PREFIX
"c:/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}")
ELSE( WIN32 )
SET(${PROJECT_NAME}_INSTALL_PREFIX
"/usr/local")
ENDIF( WIN32 )
ENDIF( NOT DEFINED ${PROJECT_NAME}_INSTALL_PREFIX )
SET( ${PROJECT_NAME}_INSTALL_PREFIX ${${PROJECT_NAME}_INSTALL_PREFIX} CACHE
PATH "Install prefix prepended to target to create install location" )
SET( CMAKE_INSTALL_PREFIX "${${PROJECT_NAME}_INSTALL_PREFIX}" CACHE INTERNAL "Prefix
prepended to install directories if target destination is not absolute,
immutable" FORCE )
IF( ${PROJECT_NAME}_BUILD_SHARED_LIB )
SET( ${PROJECT_NAME}_LIBRARY_TYPE SHARED )
SET( ${PROJECT_NAME}_BUILD_STATIC_LIB FALSE )
ELSE( ${PROJECT_NAME}_BUILD_SHARED_LIB )
SET( ${PROJECT_NAME}_LIBRARY_TYPE STATIC )
SET( ${PROJECT_NAME}_BUILD_STATIC_LIB TRUE )
IF ( WIN32 )
ADD_DEFINITIONS("-DHAVE_NO_DLL")
ENDIF( WIN32 )
ENDIF( ${PROJECT_NAME}_BUILD_SHARED_LIB )
# MSVC specific options
IF(MSVC_IDE)
IF (NOT DEFINED ${PROJECT_NAME}_USE_MSVC_EXPRESS )
SET (${PROJECT_NAME}_USE_MSVC_EXPRESS OFF)
ENDIF (NOT DEFINED ${PROJECT_NAME}_USE_MSVC_EXPRESS)
OPTION( ${PROJECT_NAME}_USE_MSVC_EXPRESS "Use a Visual C++ express IDE"
${${PROJECT_NAME}_USE_MSVC_EXPRESS} )
ENDIF(MSVC_IDE)
SET_DIRECTORY_PROPERTIES(PROPERTIES COMPILE_DEFINITIONS_RELEASE NDEBUG)
SET_DIRECTORY_PROPERTIES(PROPERTIES COMPILE_DEFINITIONS_MINSIZEREL NDEBUG)
SET_DIRECTORY_PROPERTIES(PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO NDEBUG)
IF(${PROJECT_NAME}_ENABLE_DEB_FLAG)
SET_DIRECTORY_PROPERTIES(PROPERTIES COMPILE_DEFINITIONS_DEBUG "DEB=1;_DEBUG")
ELSE ()
SET_DIRECTORY_PROPERTIES(PROPERTIES COMPILE_DEFINITIONS_DEBUG "_DEBUG")
ENDIF (${PROJECT_NAME}_ENABLE_DEB_FLAG)
#
# Check components dependencies
#
SET(${PROJECT_NAME}_FOUNDATION TRUE)
IF(${PROJECT_NAME}_OCAF OR ${PROJECT_NAME}_DATAEXCHANGE OR ${PROJECT_NAME}_VISUALISATION OR ${PROJECT_NAME}_DRAW)
SET(${PROJECT_NAME}_VISU_DEP TRUE)
ELSE(${PROJECT_NAME}_OCAF OR ${PROJECT_NAME}_DATAEXCHANGE OR ${PROJECT_NAME}_VISUALISATION OR ${PROJECT_NAME}_DRAW)
SET(${PROJECT_NAME}_VISU_DEP FALSE)
ENDIF(${PROJECT_NAME}_OCAF OR ${PROJECT_NAME}_DATAEXCHANGE OR ${PROJECT_NAME}_VISUALISATION OR ${PROJECT_NAME}_DRAW)
IF(${PROJECT_NAME}_DISABLE_X11)
SET(${PROJECT_NAME}_VISU_DEP FALSE)
ENDIF(${PROJECT_NAME}_DISABLE_X11)
IF(${PROJECT_NAME}_DISABLE_X11)
SET(${PROJECT_NAME}_DRAW OFF CACHE BOOL "Build DRAWEXE" FORCE)
SET(${PROJECT_NAME}_VISUALISATION OFF CACHE BOOL "Build visualisation component" FORCE)
ENDIF(${PROJECT_NAME}_DISABLE_X11)
IF(NOT ${PROJECT_NAME}_BUILD_SHARED_LIB AND ${PROJECT_NAME}_DRAW)
SET(${PROJECT_NAME}_DRAW OFF CACHE BOOL "Build DRAWEXE" FORCE)
MESSAGE("Warning : DRAW disabled when statically linking")
ENDIF(NOT ${PROJECT_NAME}_BUILD_SHARED_LIB AND ${PROJECT_NAME}_DRAW)
IF(${PROJECT_NAME}_DRAW AND NOT ${PROJECT_NAME}_DATAEXCHANGE)
SET(${PROJECT_NAME}_DATAEXCHANGE ON CACHE BOOL "Build data exchange" FORCE)
ENDIF(${PROJECT_NAME}_DRAW AND NOT ${PROJECT_NAME}_DATAEXCHANGE)
IF(${PROJECT_NAME}_DATAEXCHANGE AND NOT ${PROJECT_NAME}_OCAF)
SET(${PROJECT_NAME}_OCAF ON CACHE BOOL "Build application framework" FORCE)
ENDIF(${PROJECT_NAME}_DATAEXCHANGE AND NOT ${PROJECT_NAME}_OCAF)
IF(${PROJECT_NAME}_OCAF AND NOT ${PROJECT_NAME}_MODEL)
SET(${PROJECT_NAME}_MODEL ON CACHE BOOL "Build model components" FORCE)
ENDIF(${PROJECT_NAME}_OCAF AND NOT ${PROJECT_NAME}_MODEL)
IF(${PROJECT_NAME}_VISUALISATION AND NOT ${PROJECT_NAME}_MODEL)
SET(${PROJECT_NAME}_MODEL ON CACHE BOOL "Build model components" FORCE)
ENDIF(${PROJECT_NAME}_VISUALISATION AND NOT ${PROJECT_NAME}_MODEL)
IF(${PROJECT_NAME}_DRAW AND NOT ${PROJECT_NAME}_VISUALISATION)
SET(${PROJECT_NAME}_VISUALISATION ON CACHE BOOL "Build visualisation component" FORCE)
ENDIF(${PROJECT_NAME}_DRAW AND NOT ${PROJECT_NAME}_VISUALISATION)
SET(INSTALL_STDRESOURCE_FILES)
SET(INSTALL_RESOURCE_FILES)
FILE(GLOB OS_TCL_SCRIPTS RELATIVE ${${PROJECT_NAME}_SOURCE_DIR} src/OS/*.tcl)
SET(INSTALL_RESOURCE_FILES ${INSTALL_RESOURCE_FILES}
${OS_TCL_SCRIPTS}
src/UnitsAPI/Lexi_Expr.dat
src/UnitsAPI/Units.dat )
SET(INSTALL_STDRESOURCE_FILES ${INSTALL_STDRESOURCE_FILES}
src/UnitsAPI/CurrentUnits
src/UnitsAPI/MDTVBaseUnits
src/UnitsAPI/MDTVCurrentUnits )
FIND_PACKAGE(Threads)
IF(${PROJECT_NAME}_MULTITHREAD_LIBRARY STREQUAL "TBB")
FIND_PATH(TBB_INCLUDE_DIR tbb/tbb.h DOC "Location of header files for TBB (containing tbb/tbb.h)" ${CMAKE_SYSTEM_INCLUDE_PATH})
IF(TBB_INCLUDE_DIR)
IF(MSVC)
IF(CMAKE_CL_64)
SET(TBB_ARCH intel64)
ELSE(CMAKE_CL_64)
SET(TBB_ARCH ia32)
ENDIF(CMAKE_CL_64)
GET_FILENAME_COMPONENT(TBB_ROOT "${TBB_INCLUDE_DIR}/.." ABSOLUTE)
IF(OCE_BUILD_SHARED_LIB)
IF(MSVC80)
SET(TBB_BIN_DIR "${TBB_ROOT}/bin/${TBB_ARCH}/vc8")
SET(TBB_LIB_DIR "${TBB_ROOT}/lib/${TBB_ARCH}/vc8")
ELSEIF(MSVC90)
SET(TBB_BIN_DIR "${TBB_ROOT}/bin/${TBB_ARCH}/vc9")
SET(TBB_LIB_DIR "${TBB_ROOT}/lib/${TBB_ARCH}/vc9")
ELSEIF(MSVC10)
SET(TBB_BIN_DIR "${TBB_ROOT}/bin/${TBB_ARCH}/vc10")
SET(TBB_LIB_DIR "${TBB_ROOT}/lib/${TBB_ARCH}/vc10")
ENDIF()
ELSE(OCE_BUILD_SHARED_LIB)
SET(TBB_LIB_DIR "${TBB_ROOT}/lib/${TBB_ARCH}/vc_mt")
ENDIF(OCE_BUILD_SHARED_LIB)
ENDIF(MSVC)
FIND_LIBRARY( TBB_LIBRARY tbb PATHS "${TBB_LIB_DIR}" "Path to the TBB library" )
IF (${PROJECT_NAME}_TBB_MALLOC_SUPPORT)
FIND_LIBRARY( TBB_MALLOC_LIBRARY tbbmalloc PATHS "${TBB_LIB_DIR}" "Path to the TBB MALLOC library")
ENDIF (${PROJECT_NAME}_TBB_MALLOC_SUPPORT)
IF(CMAKE_CONFIGURATION_TYPES OR NMAKE)
FIND_LIBRARY( TBB_LIBRARY_DEBUG tbb_debug PATHS "${TBB_LIB_DIR}" "Path to the TBB debug library" )
IF (${PROJECT_NAME}_TBB_MALLOC_SUPPORT)
FIND_LIBRARY( TBB_MALLOC_LIBRARY_DEBUG tbbmalloc_debug PATHS "${TBB_LIB_DIR}" "Path to the TBB MALLOC debug library")
ENDIF (${PROJECT_NAME}_TBB_MALLOC_SUPPORT)
ENDIF(CMAKE_CONFIGURATION_TYPES OR NMAKE)
ENDIF(TBB_INCLUDE_DIR)
MARK_AS_ADVANCED(TBB_INCLUDE_DIR TBB_LIBRARY)
ENDIF(${PROJECT_NAME}_MULTITHREAD_LIBRARY STREQUAL "TBB")
IF(${PROJECT_NAME}_MULTITHREAD_LIBRARY STREQUAL "OPENMP")
FIND_PACKAGE(OpenMP)
ENDIF(${PROJECT_NAME}_MULTITHREAD_LIBRARY STREQUAL "OPENMP")
IF (${PROJECT_NAME}_USE_BUNDLE)
FIND_PATH(${PROJECT_NAME}_BUNDLE_ROOT_PATH oce-bundle-root.empty "Path for the OCE-win-bundle")
ENDIF(${PROJECT_NAME}_USE_BUNDLE)
IF(${PROJECT_NAME}_VISUALISATION)
IF(${PROJECT_NAME}_WITH_FREEIMAGE)
FIND_PATH(FREEIMAGE_INCLUDE_DIR FreeImagePlus.h DOC "Location of header files for FreeImage" ${CMAKE_SYSTEM_INCLUDE_PATH})
IF(FREEIMAGE_INCLUDE_DIR)
FIND_LIBRARY( FREEIMAGE_LIBRARY freeimageplus "Path to the freeimage library" )
IF(CMAKE_CONFIGURATION_TYPES OR NMAKE)
FIND_LIBRARY( FREEIMAGE_LIBRARY_DEBUG freeimageplusd "Path to the freeimage debug library" )
ENDIF(CMAKE_CONFIGURATION_TYPES OR NMAKE)
ENDIF(FREEIMAGE_INCLUDE_DIR)
MARK_AS_ADVANCED(FREEIMAGE_INCLUDE_DIR FREEIMAGE_LIBRARY)
ENDIF(${PROJECT_NAME}_WITH_FREEIMAGE)
IF (NOT WIN32)
FIND_PACKAGE(X11 REQUIRED)
FIND_LIBRARY( X11_Xmu_LIB Xmu PATHS /usr/openwin/lib )
ENDIF(NOT WIN32)
IF (NOT APPLE)
FIND_PACKAGE(OpenGL REQUIRED)
IF(NOT ${OPENGL_GLU_FOUND} STREQUAL "YES")
MESSAGE( FATAL_ERROR "GLU not found" )
ENDIF(NOT ${OPENGL_GLU_FOUND} STREQUAL "YES")
ELSE (NOT APPLE)
# under OSX, builtin FindOpenGl.cmake returns Cocoa OpenGL implementation
# oce requires the X11 based OpenGL
SET(OPENGL_INCLUDE_DIR /usr/X11R6/include/)
SET(OPENGL_LIBRARIES /usr/X11R6/lib/libGL.dylib /usr/X11R6/lib/libGLU.dylib)
ENDIF (NOT APPLE)
## FreeType / FTGL
IF(NOT ${PROJECT_NAME}_USE_BUNDLE)
FIND_PACKAGE(Freetype REQUIRED)
ELSE (NOT ${PROJECT_NAME}_USE_BUNDLE)
FIND_LIBRARY(FREETYPE_LIBRARY freetype)
ENDIF(NOT ${PROJECT_NAME}_USE_BUNDLE)
FIND_PATH(FTGL_INCLUDE_DIR FTGL/ftgl.h "Location of header files for FTGL" ${CMAKE_SYSTEM_INCLUDE_PATH})
FIND_LIBRARY(FTGL_LIBRARY ftgl "Location of ftgl library")
IF(CMAKE_CONFIGURATION_TYPES OR NMAKE)
FIND_LIBRARY(FTGL_LIBRARY_DEBUG ftgld "Location of ftgl debug library")
FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG freetyped "Location of freetype debug library")
ENDIF(CMAKE_CONFIGURATION_TYPES OR NMAKE)
MARK_AS_ADVANCED(X11_Xmu_LIB FTGL_INCLUDE_DIR FTGL_LIBRARY)
## GL2PS
IF(${PROJECT_NAME}_WITH_GL2PS)
FIND_PATH(GL2PS_INCLUDE_DIR gl2ps.h DOC "Location of header files for GL2PS (containing gl2ps.h)" ${CMAKE_SYSTEM_INCLUDE_PATH})
IF(GL2PS_INCLUDE_DIR)
FIND_LIBRARY( GL2PS_LIBRARY gl2ps "Path to the gl2ps library" )
IF(CMAKE_CONFIGURATION_TYPES OR NMAKE)
FIND_LIBRARY( GL2PS_LIBRARY_DEBUG gl2psd "Path to the gl2ps debug library" )
ENDIF(CMAKE_CONFIGURATION_TYPES OR NMAKE)
ENDIF(GL2PS_INCLUDE_DIR)
MARK_AS_ADVANCED(GL2PS_INCLUDE_DIR GL2PS_LIBRARY)
ENDIF(${PROJECT_NAME}_WITH_GL2PS)
MESSAGE(STATUS "X11 LIBS: ${X11_LIBRARIES}")
MESSAGE(STATUS "OPENGL LIBS: ${OPENGL_LIBRARIES}")
MESSAGE(STATUS "FREETYPE LIBS: ${FREETYPE_LIBRARIES}")
MESSAGE(STATUS "FREETYPE INCLUDES: ${FREETYPE_INCLUDE_DIRS}")
MESSAGE(STATUS "THREAD LIB: ${CMAKE_THREAD_LIBS_INIT}")
FILE(GLOB TEXTURES_RGB_FILES RELATIVE ${${PROJECT_NAME}_SOURCE_DIR} src/Textures/*.rgb)
SET(INSTALL_RESOURCE_FILES ${INSTALL_RESOURCE_FILES} ${TEXTURES_RGB_FILES})
ENDIF(${PROJECT_NAME}_VISUALISATION)
IF(${PROJECT_NAME}_OCAF)
FILE(GLOB XMLOCAFRESOURCE_XSD_FILES RELATIVE ${${PROJECT_NAME}_SOURCE_DIR} src/XmlOcafResource/*.xsd)
SET(INSTALL_RESOURCE_FILES ${INSTALL_RESOURCE_FILES}
${XMLOCAFRESOURCE_XSD_FILES}
src/StdResource/MigrationSheet.txt
src/StdResource/MDTV-Standard.xwd
src/StdResource/Plugin
src/StdResource/Standard
src/StdResource/Standard.us
src/StdResource/StandardLite
src/StdResource/TObj
src/StdResource/XCAF )
ENDIF(${PROJECT_NAME}_OCAF)
IF(${PROJECT_NAME}_DATAEXCHANGE)
SET(INSTALL_RESOURCE_FILES ${INSTALL_RESOURCE_FILES}
src/SHMessage/SHAPE.fr
src/SHMessage/SHAPE.us
src/XSMessage/IGES.fr
src/XSMessage/IGES.us
src/XSMessage/XSTEP.fr
src/XSMessage/XSTEP.us
src/XSTEPResource/IGES
src/XSTEPResource/STEP )
ENDIF(${PROJECT_NAME}_DATAEXCHANGE)
IF(${PROJECT_NAME}_DRAW)
IF (NOT APPLE)
FIND_PACKAGE(TCL REQUIRED)
ELSE(NOT APPLE)
# under OSX, should use a X11 based TCL/TK, for instance fink's implementation
SET(FINK_INSTALL_PATH /sw)
MARK_AS_ADVANCED(FINK_INSTALL_PATH)
SET(TCL_LIBRARY ${FINK_INSTALL_PATH}/lib/libtcl.dylib)
SET(TCL_INCLUDE_PATH ${FINK_INSTALL_PATH}/include)
SET(TCL_TCLSH ${FINK_INSTALL_PATH}/bin/tclsh)
SET(TK_LIBRARY ${FINK_INSTALL_PATH}/lib/libtk.dylib)
SET(TK_INCLUDE_PATH ${FINK_INSTALL_PATH}/include)
SET(TK_WISH ${FINK_INSTALL_PATH}/bin/wish)
MARK_AS_ADVANCED(TCL_INCLUDE_PATH TK_INCLUDE_PATH TCL_LIBRARY TK_LIBRARY)
ENDIF(NOT APPLE)
MESSAGE(STATUS "TCL LIB: ${TCL_LIBRARY}")
MESSAGE(STATUS "TK LIB: ${TK_LIBRARY}")
FILE(GLOB DRAWRESOURCES_TCL_FILES RELATIVE ${${PROJECT_NAME}_SOURCE_DIR} src/DrawResources/*.tcl)
SET(INSTALL_RESOURCE_FILES ${INSTALL_RESOURCE_FILES}
${DRAWRESOURCES_TCL_FILES}
src/DrawResources/DRAW.doc
src/DrawResources/DRAW.info
src/DrawResources/DrawDefault
src/DrawResources/DrawPlugin
src/DrawResources/idoc
src/DrawResources/lamp.ico
src/DrawResources/mdltest
src/DrawResources/mkdoc
src/DrawResources/tdoc
src/DrawResources/test2xl
src/DrawResources/vmdltest
src/DrawResources/dftree.tcl )
ENDIF(${PROJECT_NAME}_DRAW)
IF (${PROJECT_NAME}_USE_BUNDLE AND ${PROJECT_NAME}_BUNDLE_ROOT_PATH)
MESSAGE("Using OCE Bundle")
IF (${PROJECT_NAME}_VISUALISATION)
SET(FTGL_INCLUDE_DIR ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/include/FTGL CACHE PATH "" FORCE)
SET(FREETYPE_INCLUDE_DIR_freetype2 ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/include/freetype CACHE PATH "" FORCE)
SET(FREETYPE_INCLUDE_DIR_ft2build ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/include/freetype CACHE PATH "" FORCE)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR_freetype2} ${FREETYPE_INCLUDE_DIR_ft2build})
SET(FREETYPE_LIBRARY ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/Win${BIT}/lib/freetype.lib CACHE FILEPATH "" FORCE)
SET(FREETYPE_LIBRARIES ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/Win${BIT}/lib/freetype.lib CACHE FILEPATH "" FORCE)
SET(FREETYPE_LIBRARY_DEBUG ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/Win${BIT}/libd/freetyped.lib CACHE FILEPATH "" FORCE)
SET(FTGL_LIBRARY ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/Win${BIT}/lib/ftgl.lib CACHE FILEPATH "" FORCE)
SET(FTGL_LIBRARY_DEBUG ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/Win${BIT}/libd/ftgld.lib CACHE FILEPATH "" FORCE)
IF(${PROJECT_NAME}_WITH_GL2PS)
SET(GL2PS_LIBRARY ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/Win${BIT}/lib/gl2ps.lib CACHE FILEPATH "" FORCE)
SET(GL2PS_LIBRARY_DEBUG ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/Win${BIT}/libd/gl2psd.lib CACHE FILEPATH "" FORCE)
SET(GL2PS_INCLUDE_DIR ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/include/gl2ps CACHE PATH "" FORCE)
ENDIF(${PROJECT_NAME}_WITH_GL2PS)
IF(${PROJECT_NAME}_WITH_FREEIMAGE)
SET(FREEIMAGE_LIBRARY ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/Win${BIT}/lib/FreeImage.lib CACHE FILEPATH "" FORCE)
SET(FREEIMAGE_LIBRARY_DEBUG ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/Win${BIT}/libd/FreeImaged.lib CACHE FILEPATH "" FORCE)
SET(FREEIMAGE_INCLUDE_DIR ${${PROJECT_NAME}_BUNDLE_ROOT_PATH}/include/FreeImage CACHE PATH "" FORCE)
ENDIF(${PROJECT_NAME}_WITH_FREEIMAGE)
ENDIF (${PROJECT_NAME}_VISUALISATION)
ENDIF(${PROJECT_NAME}_USE_BUNDLE AND ${PROJECT_NAME}_BUNDLE_ROOT_PATH)
IF(MSVC)
SET( CMAKE_DEBUG_POSTFIX "d" )
ENDIF(MSVC)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/build_inc
${CMAKE_CURRENT_SOURCE_DIR}/inc)
###################################
# Architecture-specific libraries #
###################################
IF(WIN32)
SET(LM)
SET(CSF_gdi32_LIB gdi32)
SET(CSF_advapi32_LIB advapi32)
SET(CSF_user32_LIB user32)
SET(CSF_kernel32_LIB kernel32)
SET(CSF_SOCKETLibs_LIB ws2_32)
SET(CSF_wsock32_LIB ws2_32)
SET(CSF_psapi_LIB psapi)
ELSE(WIN32)
SET(LM "-lm")
SET(WIN32_LIBS "")
SET(CSF_gdi32_LIB "")
SET(CSF_advapi32_LIB "")
SET(CSF_user32_LIB "")
SET(CSF_kernel32_LIB "")
SET(CSF_SOCKETLibs_LIB "")
SET(CSF_wsock32_LIB "")
SET(CSF_psapi_LIB "")
ENDIF(WIN32)
###################################################
# Check required headers, functions and libraries #
###################################################
IF (NOT WIN32)
# Check headers
# I think these should all be check cxx headers, as I think there is no c
# compilation anywhere in ${PROJECT_NAME}
INCLUDE(CheckIncludeFile)
#INCLUDE(CheckIncludeFiles)
CHECK_INCLUDE_FILE(string.h HAVE_STRING_H)
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILE(dl.h HAVE_DL_H)
CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H)
CHECK_INCLUDE_FILE(time.h HAVE_TIME_H)
CHECK_INCLUDE_FILE(sys/time.h HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILE(pwd.h HAVE_PWD_H)
CHECK_INCLUDE_FILE(sys/statvfs.h HAVE_SYS_STATVFS_H)
CHECK_INCLUDE_FILE(sys/vfs.h HAVE_SYS_VFS_H)
CHECK_INCLUDE_FILE(sys/param.h HAVE_SYS_PARAM_H)
CHECK_INCLUDE_FILE(osfcn.h HAVE_OSFCN_H)
CHECK_INCLUDE_FILE(netdb.h HAVE_NETDB_H)
CHECK_INCLUDE_FILE(sys/ioctl.h HAVE_SYS_IOCTL_H)
CHECK_INCLUDE_FILE(net/if.h HAVE_NET_IF_H)
CHECK_INCLUDE_FILE(sys/systeminfo.h HAVE_SYS_SYSTEMINFO_H)
CHECK_INCLUDE_FILE(sys/utsname.h HAVE_SYS_UTSNAME_H)
CHECK_INCLUDE_FILE(sysent.h HAVE_SYSENT_H)
CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILE(sys/unistd.h HAVE_SYS_UNISTD_H)
CHECK_INCLUDE_FILE(sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILE(ndir.h HAVE_NDIR_H)
CHECK_INCLUDE_FILE(sys/ndir.h HAVE_SYS_NDIR_H)
CHECK_INCLUDE_FILE(sys/dir.h HAVE_SYS_DIR_H)
CHECK_INCLUDE_FILE(signal.h HAVE_SIGNAL_H)
CHECK_INCLUDE_FILE(sys/signal.h HAVE_SYS_SIGNAL_H)
CHECK_INCLUDE_FILE(sigfpe.h HAVE_SIGFPE_H)
CHECK_INCLUDE_FILE(floatingpoint.h HAVE_FLOATINGPOINT_H)
CHECK_INCLUDE_FILE(sys/machsig.h HAVE_SYS_MACHSIG_H)
CHECK_INCLUDE_FILE(sys/siginfo.h HAVE_SYS_SIGINFO_H)
CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILE(sys/sem.h HAVE_SYS_SEM_H)
CHECK_INCLUDE_FILE(sys/ipc.h HAVE_SYS_IPC_H)
CHECK_INCLUDE_FILE(sys/times.h HAVE_SYS_TIMES_H)
CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
INCLUDE(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX(iomanip.h OCE_HAVE_IOMANIP_H)
CHECK_INCLUDE_FILE_CXX(limits OCE_HAVE_LIMITS)
CHECK_INCLUDE_FILE_CXX(climits OCE_HAVE_CLIMITS)
CHECK_INCLUDE_FILE_CXX(limits.h OCE_HAVE_LIMITS_H)
CHECK_INCLUDE_FILE_CXX(values.h HAVE_VALUES_H)
CHECK_INCLUDE_FILE_CXX(fstream OCE_HAVE_FSTREAM)
CHECK_INCLUDE_FILE_CXX(ios HAVE_IOS)
CHECK_INCLUDE_FILE_CXX(iomanip OCE_HAVE_IOMANIP)
CHECK_INCLUDE_FILE_CXX(iostream OCE_HAVE_IOSTREAM)
CHECK_INCLUDE_FILE_CXX(fstream.h OCE_HAVE_FSTREAM_H)
CHECK_INCLUDE_FILE_CXX(ios.h HAVE_IOS_H)
CHECK_INCLUDE_FILE_CXX(iostream.h OCE_HAVE_IOSTREAM_H)
CHECK_INCLUDE_FILE_CXX(stdlib.h HAVE_STDLIB_H)
CHECK_INCLUDE_FILE_CXX(sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILE_CXX(sys/select.h HAVE_SYS_SELECT_H)
CHECK_INCLUDE_FILE_CXX(X11/extensions/readdisplay.h HAVE_X11_EXTENSIONS_READDISPLAY_H)
CHECK_INCLUDE_FILE_CXX(X11/extensions/multibuf.h HAVE_X11_EXTENSIONS_MULTIBUF_H)
CHECK_INCLUDE_FILE_CXX(sys/filio.h HAVE_SYS_FILIO_H)
CHECK_INCLUDE_FILE_CXX(sys/mman.h HAVE_SYS_MMAN_H)
CHECK_INCLUDE_FILE_CXX(libc.h HAVE_LIBC_H)
CHECK_INCLUDE_FILE_CXX(mm_malloc.h HAVE_MM_MALLOC_H)
# Check library functions
INCLUDE(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(alloca HAVE_ALLOCA)
CHECK_FUNCTION_EXISTS(memcmp HAVE_MEMCMP)
CHECK_FUNCTION_EXISTS(signal HAVE_SIGNAL)
CHECK_FUNCTION_EXISTS(statfs HAVE_STATFS)
CHECK_FUNCTION_EXISTS(statvfs HAVE_STATVFS)
CHECK_FUNCTION_EXISTS(finite HAVE_FINITE)
CHECK_FUNCTION_EXISTS(localtime_r HAVE_LOCALTIME_R)
CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
SET(CMAKE_REQUIRED_LIBRARIES sunmath)
CHECK_FUNCTION_EXISTS(ieee_handler HAVE_SUNMATH)
SET(CMAKE_REQUIRED_LIBRARIES)
INCLUDE(CheckTypeSize)
SET(CMAKE_EXTRA_INCLUDE_FILES sys/time.h)
CHECK_TYPE_SIZE(tm TM_IN_SYS_TIME)
SET(CMAKE_EXTRA_INCLUDE_FILES)
INCLUDE (CheckCSourceCompiles)
CHECK_C_SOURCE_COMPILES("
#include <sys/time.h>
#include <sys/sem.h>
int main(){union semun c;return 0;}
"
SEMUN_DEFINED)
IF (SEMUN_DEFINED)
CHECK_C_SOURCE_COMPILES("
#include <sys/time.h>
#include <sys/sem.h>
int main(){union semun c;c.__buf = 0;return 0;}
"
SEMUN_BUF_DEFINED)
ENDIF (SEMUN_DEFINED)
CHECK_C_SOURCE_COMPILES("
#include <sys/sem.h>
static struct sembuf event_flag;
int main(){int status; int *semid;status = semop(*semid,event_flag,1);return 0;}
"
SEMOP_NO_REFERENCE)
CHECK_C_SOURCE_COMPILES("
#include <sys/sem.h>
int get_semaphore(int *semid,int *event,int *value)
{
int status;
status = semctl((*semid),*event,GETVAL,value);
return 0;
}
int main(){ int *a,*b,*c;
if(get_semaphore(a,b,c))
return 0;
return 0;}
"
SEMCTL_NO_REFERENCE)
INCLUDE (CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES("
#include <ios>
int main(){static const int input = (std::ios::in)|(std::ios::nocreate);
static const int output = (std::ios::out);return 0;}
"
DEF_IOS_OK)
CHECK_CXX_SOURCE_COMPILES("
#include <iostream>
int main(){std::cout << std::cout.form(\"%9.3e\", 3.14159627e-4) << std::endl;return 0;}
"
OSTREAM_FORM_OK)
INCLUDE(TestBigEndian)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
SET(STDC_HEADERS TRUE) # Only for really old systems, being lazy
SET(STACK_DIRECTION 0) # Don't have a test for this, TODO?
# TODO: check all headers/functions/libraries that are checked in configure.ac original OCC script
ENDIF(NOT WIN32)
#######################################################
# Check compiler version - Determine Borland compiler #
#######################################################
IF(BORLAND AND NOT BORLAND_VERSION)
IF(EXISTS ${CMAKE_CXX_COMPILER})
EXECUTE_PROCESS(
COMMAND ${CMAKE_CXX_COMPILER} /?
OUTPUT_VARIABLE _output
ERROR_QUIET
)
string(REGEX MATCH "Embarcadero C[+][+] [0-9]+.[0-9]+"
_borland_version "${_output}")
if(_borland_version)
string(REGEX MATCHALL "[0-9]+" _borland_version_list "${_borland_version}")
list(GET _borland_version_list 0 _borland_major)
list(GET _borland_version_list 1 _borland_minor)
else()
string(REGEX MATCH "Borland C[+][+] [0-9]+].[0-9]+"
_borland_version "${_output}")
if(_borland_version)
string(REGEX MATCHALL "[0-9]+" _borland_version_list "${_borland_version}")
list(GET _borland_version_list 0 _borland_major)
list(GET _borland_version_list 1 _borland_minor)
endif()
endif()
# XE2 compiler?
if("v${_borland_major}.${_borland_minor}" STREQUAL "v6.41")
SET(BORLAND_VERSION "bcc32 v6.41 (RS XE2)")
SET(BORLAND_VERSION_RS_XE2 1)
# XE compiler?
elseif("v${_borland_major}.${_borland_minor}" STREQUAL "v6.30")
SET(BORLAND_VERSION "bcc32 v6.30 (RS XE)")
SET(BORLAND_VERSION_RS_XE 1)
# 2010 compiler?
elseif("v${_borland_major}.${_borland_minor}" STREQUAL "v6.20")
SET(BORLAND_VERSION "bcc32 v6.20 (RS 2010)")
SET(BORLAND_VERSION_RS_2010 1)
# TODO: 2009 compiler?
# TODO: 2007 compiler?
# 2006 compiler?
elseif("v${_borland_major}.${_borland_minor}" STREQUAL "v5.82")
SET(BORLAND_VERSION "bcc32 v5.82 (BDS 2006)")
SET(BORLAND_VERSION_BDS_2006 1)
#TODO: Older compilers?
else()
SET(BORLAND_VERSION "Unknown")
endif()
UNSET(_output)
UNSET(_borland_version)
UNSET(_borland_major)
UNSET(_borland_minor)
ENDIF()
ENDIF()
#######################################################
# Check platforms - Define specific compilation flags #
#######################################################
IF(UNIX)
IF(APPLE)
######### MacOSX ###########
MESSAGE(STATUS "MacOSX platform detected")
SET(PLATFORM Darwin)
ELSE(APPLE)
######### Unix/Linux ###########
MESSAGE(STATUS "Unix/Linux platform detected")
SET(PLATFORM Unix)
ENDIF(APPLE)
ADD_DEFINITIONS(-DHAVE_CONFIG_H -DCSFDB -DOCC_CONVERT_SIGNALS)
ELSE(UNIX)
IF(WIN32)
######### Windows ###########
MESSAGE(STATUS "Windows system detected")
ADD_DEFINITIONS(-DWNT -DWIN32 -D_WINDOWS -DCSFDB -DHAVE_CONFIG_H )
######### Borland ###########
IF(BORLAND)
MESSAGE(STATUS "Borland compiler detected: ${BORLAND_VERSION}")
ADD_DEFINITIONS(-DHAVE_IOS )
ENDIF(BORLAND)
SET(PLATFORM win)
ELSE(WIN32)
MESSAGE(STATUS "Unknown platform")
ENDIF(WIN32)
ENDIF(UNIX)
# TODO: better detection of different Unices (Linux, Solaris etc.)
# TODO: add CXX compiler flags for each platform
# Enable Extra warnings for each compiler
IF( ${PROJECT_NAME}_EXTRA_WARNINGS)
IF(MSVC)
ADD_DEFINITIONS("/W4 /wd4100 /wd4206 /wd4127")
ENDIF(MSVC)
IF(CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS("-Wall -Wextra")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
IF(CMAKE_CXX_COMPILER MATCHES ".*clang")
ADD_DEFINITIONS("-Weverything")
ENDIF(CMAKE_CXX_COMPILER MATCHES ".*clang")
IF(BORLAND)
#TODO
ENDIF(BORLAND)
ENDIF(${PROJECT_NAME}_EXTRA_WARNINGS)
################################################
# Define output path for generated libraries: #
# platform/compiler-build_type-bits #
# for instance: #
# ./win32/bin/vc7.1-release-64 #
# ./win32/bin/vc9-debug-32 #
# ./Unix/i386-debug-64 #
################################################
IF(WIN32)
IF(MSVC) # The compiler used is MSVC
MESSAGE(STATUS "Found MSVC compiler: ${MSVC} ${MSVC_VERSION}")
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin/)
ELSEIF (BORLAND) # The compiler used is BORLAND
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/win${BIT}/bin/${CMAKE_BUILD_TYPE})
ELSE()
SET(LIBRARY_OUTPUT_PATH win${BIT}/bin/${CMAKE_BUILD_TYPE})
ENDIF()
SET(EXECUTABLE_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
ELSE(WIN32)
SET(LIBRARY_OUTPUT_PATH ${PLATFORM}/${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_BUILD_TYPE}-${BIT})
ENDIF(WIN32)
MESSAGE(STATUS "output_path: ${LIBRARY_OUTPUT_PATH}")
# TODO: under win32/64, dlls and libs should not be in the same path (non MSVC)
IF(MINGW)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthreads")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthreads")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols")
# For the file Message_MsgFile.cxx of TKernel we must additionally set the __TCollection_DLL define to resolve the needed HashCode() method
SET_SOURCE_FILES_PROPERTIES("src/Message/Message_MsgFile.cxx" PROPERTIES COMPILE_FLAGS "-D__Message_DLL -D__TCollection_DLL")
ENDIF(MINGW)
# DISABLE SECURE CRT WARNINGS AND OTHER MS CRT SPECIFC THINGS
IF (MSVC)
ADD_DEFINITIONS("/D_CRT_SECURE_NO_WARNINGS")
ADD_DEFINITIONS("/D_CRT_NONSTDC_NO_WARNINGS")
ENDIF(MSVC)
IF(MSVC_IDE)
IF(NOT ${PROJECT_NAME}_USE_MSVC_EXPRESS)
#Use solution folders.
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
SET(USE_SOLUTION_FOLDERS TRUE)
ELSE( NOT ${PROJECT_NAME}_USE_MSVC_EXPRESS)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS OFF)
ENDIF( NOT ${PROJECT_NAME}_USE_MSVC_EXPRESS)
ENDIF(MSVC_IDE)
# Libraries are installed by default in /usr/local/lib on UNIX
# based platforms and c:/${PROJECT_NAME}-VERSION/Win[32|64]/lib on windows based
# platforms
IF(WIN32)
SET(_PSUFFIX "Win${BIT}/")
ELSE(WIN32)
SET(_PSUFFIX "")
ENDIF(WIN32)
STRING(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)
# Binaries
IF(NOT DEFINED ${PROJECT_NAME}_INSTALL_BIN_DIR)
SET(${PROJECT_NAME}_INSTALL_BIN_DIR ${_PSUFFIX}bin)
ENDIF(NOT DEFINED ${PROJECT_NAME}_INSTALL_BIN_DIR)
# Libraries
IF(NOT DEFINED ${PROJECT_NAME}_INSTALL_LIB_DIR)
SET(${PROJECT_NAME}_INSTALL_LIB_DIR ${_PSUFFIX}lib${LIB_SUFFIX})
ENDIF(NOT DEFINED ${PROJECT_NAME}_INSTALL_LIB_DIR)
IF(MSVC)
IF(NOT DEFINED ${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR)
SET(${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR ${${PROJECT_NAME}_INSTALL_LIB_DIR})
ENDIF(NOT DEFINED ${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR)
ELSE(MSVC)
IF(NOT DEFINED ${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR)
SET(${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR ${${PROJECT_NAME}_INSTALL_LIB_DIR}/${PROJECT_NAME_LOWERCASE}-${${PROJECT_NAME}_VERSION})
ENDIF(NOT DEFINED ${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR)
ENDIF(MSVC)
# RPATHS
IF(IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_LIB_DIR})
SET(${PROJECT_NAME}_INSTALL_LIB_DIR_RPATH ${${PROJECT_NAME}_INSTALL_LIB_DIR})
ELSE(IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_LIB_DIR})
SET(${PROJECT_NAME}_INSTALL_LIB_DIR_RPATH ${${PROJECT_NAME}_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_LIB_DIR})
ENDIF(IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_LIB_DIR})
IF(IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR})
SET(${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR_RPATH ${${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR})
ELSE(IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR})
SET(${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR_RPATH ${${PROJECT_NAME}_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR})
ENDIF(IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR})
# Includes
IF(NOT DEFINED ${PROJECT_NAME}_INSTALL_INCLUDE_DIR)
SET(${PROJECT_NAME}_INSTALL_INCLUDE_DIR include/${PROJECT_NAME_LOWERCASE})
ENDIF(NOT DEFINED ${PROJECT_NAME}_INSTALL_INCLUDE_DIR)
# Scripts
IF(NOT DEFINED ${PROJECT_NAME}_INSTALL_SCRIPT_DIR)
SET(${PROJECT_NAME}_INSTALL_SCRIPT_DIR ${${PROJECT_NAME}_INSTALL_PACKAGE_LIB_DIR})
ENDIF(NOT DEFINED ${PROJECT_NAME}_INSTALL_SCRIPT_DIR)
# Data
IF(NOT DEFINED ${PROJECT_NAME}_INSTALL_DATA_DIR)
IF(NOT MSVC)
SET(${PROJECT_NAME}_INSTALL_DATA_DIR share/${PROJECT_NAME_LOWERCASE}-${${PROJECT_NAME}_VERSION})
ELSE ()
SET(${PROJECT_NAME}_INSTALL_DATA_DIR "share/${PROJECT_NAME_LOWERCASE}")
ENDIF(NOT MSVC)
ENDIF(NOT DEFINED ${PROJECT_NAME}_INSTALL_DATA_DIR)
# Absolute path, written into oce-config.h
SET(${PROJECT_NAME}_ABSPATH_DATA_DIR ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_DATA_DIR})
# CMake
IF(NOT DEFINED ${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR)
# See http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_package
# and the definition of ${PROJECT_NAME}_INSTALL_PREFIX at the beginning.
# CMake files are installed under INSTALL_PREFIX/INSTALL_CMAKE_DATA_DIR.
IF(WIN32)
SET(${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR cmake)
ELSE(WIN32)
IF(APPLE)
SET(${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR
${PROJECT_NAME}.framework/Versions/${${PROJECT_NAME}_VERSION}/Resources)
ELSE(APPLE)
SET(${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR
lib${LIB_SUFFIX}/${PROJECT_NAME_LOWERCASE}-${${PROJECT_NAME}_VERSION})
ENDIF(APPLE)
ENDIF(WIN32)
ENDIF(NOT DEFINED ${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR)
# This relative path is written into OCEConfig.cmake to set OCE_INCLUDE_DIRS relative to OCEConfig.cmake
# There is no need to prepend ${PROJECT_NAME}_INSTALL_PREFIX, CMake convention is to use slashes.
# The first part is required if -DOCE_INSTALL_CMAKE_DATA_DIR and -DOCE_INSTALL_INCLUDE_DIR are not both absolute paths.
IF(IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR})
SET(_${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR ${${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR})
ELSE(IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR})
SET(_${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR})
ENDIF(IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR})
IF(IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR})
SET(_${PROJECT_NAME}_INSTALL_INCLUDE_DIR ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR})
ELSE(IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR})
SET(_${PROJECT_NAME}_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDE_DIR})
ENDIF(IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR})
# Now the relative path can be generated
FILE(RELATIVE_PATH ${PROJECT_NAME}_CMAKE_DATA_TO_INCLUDE_RELATIVE_DIR "${_${PROJECT_NAME}_INSTALL_CMAKE_DATA_DIR}" "${_${PROJECT_NAME}_INSTALL_INCLUDE_DIR}")
FOREACH(RESOURCE_FILE ${INSTALL_RESOURCE_FILES})
GET_FILENAME_COMPONENT(RESOURCE_PATH ${RESOURCE_FILE} PATH)
INSTALL(FILES ${RESOURCE_FILE}
DESTINATION ${${PROJECT_NAME}_INSTALL_DATA_DIR}/${RESOURCE_PATH})
ENDFOREACH(RESOURCE_FILE ${INSTALL_RESOURCE_FILES})
INSTALL(FILES ${INSTALL_STDRESOURCE_FILES}
DESTINATION ${${PROJECT_NAME}_INSTALL_DATA_DIR}/src/StdResource)
IF(WIN32)
SET(ENV_SCRIPTS
${${PROJECT_NAME}_SOURCE_DIR}/env.bat
${${PROJECT_NAME}_SOURCE_DIR}/msvc.bat
)
INSTALL(FILES ${ENV_SCRIPTS}
DESTINATION ${${PROJECT_NAME}_INSTALL_SCRIPT_DIR})
ENDIF(WIN32)
FILE(GLOB header_files ${${PROJECT_NAME}_SOURCE_DIR}/inc/*.*)
INSTALL(FILES ${header_files}
DESTINATION ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR} COMPONENT Development
)
SET(OCE_INSTALL_DATA_DIR ${${PROJECT_NAME}_INSTALL_DATA_DIR})
IF (NOT MSVC)
SET(OCE_DEFAULT_CSF_GraphicShr ${${PROJECT_NAME}_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_LIB_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}TKOpenGl${CMAKE_SHARED_LIBRARY_SUFFIX})
IF (NOT ${PROJECT_NAME}_NO_LIBRARY_VERSION)
SET(OCE_DEFAULT_CSF_GraphicShr ${OCE_DEFAULT_CSF_GraphicShr}.${OCE_ABI_SOVERSION})
ENDIF (NOT ${PROJECT_NAME}_NO_LIBRARY_VERSION)
ELSE(NOT MSVC)
SET(OCE_DEFAULT_CSF_GraphicShr ${CMAKE_SHARED_LIBRARY_PREFIX}TKOpenGl)
ENDIF(NOT MSVC)
#this is the header used to build OCE
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/oce_build_config.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/build_inc/oce-config.h )
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/build_inc/oce-config.h
RENAME oce_build_config.defs
DESTINATION ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR} COMPONENT Development )
#this is the header that is installed on the system
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/oce_install_config.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/install_inc/oce-config.h )
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/install_inc/oce-config.h
DESTINATION ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR} COMPONENT Development )
# Version information
IF(NOT ${PROJECT_NAME}_NO_LIBRARY_VERSION)
CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/Version.rc.cmake
${CMAKE_CURRENT_BINARY_DIR}/Version.rc)
ENDIF(NOT ${PROJECT_NAME}_NO_LIBRARY_VERSION)
MACRO(PROCESS_MODULE modulename modules_std)
set(modules ${modules_std})
IF(NOT ${PROJECT_NAME}_DISABLE_X11)
LIST(APPEND modules ${ARGN})
ENDIF(NOT ${PROJECT_NAME}_DISABLE_X11)
FOREACH(module ${modules})
LIST(APPEND ${PROJECT_NAME}_LIBRARIES ${module})
SET(TOOLKIT_MODULES "")
SET(TOOLKIT_DEPENDS "")
SET(TOOLKIT_INCLUDE_DIRECTORIES "")
SET(TOOLKIT_LIBS "")
ADD_SUBDIRECTORY( adm/cmake/${module} )
IF (USE_SOLUTION_FOLDERS)
SET_TARGET_PROPERTIES(${module} PROPERTIES FOLDER ${modulename} )
ENDIF(USE_SOLUTION_FOLDERS)
ENDFOREACH(module ${modules})
ENDMACRO(PROCESS_MODULE modulename modules_std)
####################################################################################
# Process modules of each ToolKit #
####################################################################################
# Foundation
PROCESS_MODULE( "Kernel" "TKernel;TKMath;TKAdvTools" )
# Modeling Data
IF (${PROJECT_NAME}_MODEL)
PROCESS_MODULE( "Modeling Data" "TKG2d;TKG3d;TKGeomBase;TKBRep" )
ENDIF (${PROJECT_NAME}_MODEL)
# Modeling Algorithms
IF (${PROJECT_NAME}_MODEL)
PROCESS_MODULE( "Modeling Algorithms" "TKGeomAlgo;TKTopAlgo;TKPrim;TKBO;TKHLR;TKMesh;TKShHealing;TKXMesh;TKBool;TKFillet;TKFeat;TKOffset" )
ENDIF (${PROJECT_NAME}_MODEL)
# Visualisation
IF(${PROJECT_NAME}_VISU_DEP)
PROCESS_MODULE( "Visualization" "" "TKService;TKV2d;TKV3d" )
ENDIF(${PROJECT_NAME}_VISU_DEP)
IF(${PROJECT_NAME}_VISUALISATION)
PROCESS_MODULE( "Visualization" "" "TKOpenGl;TKMeshVS;TKNIS;TKVoxel" )
ENDIF(${PROJECT_NAME}_VISUALISATION)
# Application framework
IF(${PROJECT_NAME}_OCAF)
PROCESS_MODULE( "OCAF" "TKCDF;PTKernel;TKLCAF;FWOSPlugin;TKPShape;TKBinL;TKXmlL;TKPLCAF;TKTObj;TKShapeSchema;TKStdLSchema" "TKCAF;TKBin;TKXml;TKPCAF;TKBinTObj;TKXmlTObj;TKStdSchema" )
ENDIF(${PROJECT_NAME}_OCAF)
# Data exchange
IF(${PROJECT_NAME}_DATAEXCHANGE)
PROCESS_MODULE( "Data Exchange" "TKSTL;TKXSBase;TKSTEPBase;TKIGES;TKSTEPAttr;TKSTEP209;TKSTEP" "TKVRML;TKXCAF;TKXCAFSchema;TKXmlXCAF;TKBinXCAF;TKXDEIGES;TKXDESTEP" )
ENDIF(${PROJECT_NAME}_DATAEXCHANGE)
# DRAWEXE application
IF(${PROJECT_NAME}_DRAW)
PROCESS_MODULE( "Draw" "" "TKDraw;TKTopTest;TKViewerTest;TKXSDRAW;TKDCAF;TKXDEDRAW;TKTObjDRAW;TKQADraw;DRAWEXE" )
ENDIF(${PROJECT_NAME}_DRAW)
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/ProjectConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake @ONLY )
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/ProjectConfigVersion.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake @ONLY )