-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.bak
1323 lines (1131 loc) · 49 KB
/
CMakeLists.bak
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
# CLEED - Computational Low Energy Electron Diffraction
# Copyright (C) 1994-2014 Georg Held
# Copyright (C) 2013-2014 Liam Deacon
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
INCLUDE(CheckCCompilerFlag)
INCLUDE(InstallRequiredSystemLibraries)
# allow more human readable "if then else" constructs
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
SET(CMAKE_COLOR_MAKEFILE ON)
SET(CMAKE_VERBOSE_MAKEFILE OFF)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# set default cmake build type to RelWithDebInfo (None Debug Release RelWithDebInfo MinSizeRel)
IF(CMAKE_BUILD_TYPE STREQUAL "")
SET(CMAKE_BUILD_TYPE "RelWithDebInfo")
ENDIF()
# set default install prefix to project root directory
IF(CMAKE_INSTALL_PREFIX STREQUAL "/usr/local")
SET(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}")
ENDIF()
##############################################################################
# Project section #
##############################################################################
PROJECT(CLEED)
SET(CPACK_PACKAGE_NAME "CLEED")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Automated Surface Structure determination from LEED-IV curves")
SET(CPACK_PACKAGE_VENDOR "Liam Deacon")
SET(CPACK_PACKAGE_CONTACT "liam.deacon@diamond.ac.uk")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/../LICENSE.txt")
SET(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}/../README.md")
SET(CPACK_RESOURCE_FILE_NOTES "${CMAKE_CURRENT_BINARY_DIR}/../RELEASE_NOTES.txt")
SET(CPACK_RESOURCE_FILE_CHANGELOG "${CMAKE_CURRENT_BINARY_DIR}/../ChangeLog.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "2014")
SET(CPACK_PACKAGE_VERSION_MINOR "04")
SET(CPACK_PACKAGE_VERSION_PATCH "27")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CLEED")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
"CLEED ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_PACKAGE_URL "http://www.reading.ac.uk/chemistry/about/staff/g-held.aspx")
SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
# Branch
SET(SOURCE_BRANCH "Development")
SET(LICENSE "")
# Program information
SET(AOI_LEED_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
SET(AOI_LEED_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
SET(AOI_LEED_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
SET(AOI_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/include/caoi_leed.h.in"
"${PROJECT_SOURCE_DIR}/src/include/caoi_leed.h" IMMEDIATE @ONLY )
SET(AOI_RFAC_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
SET(AOI_RFAC_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
SET(AOI_RFAC_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
SET(AOI_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/include/caoi_rfac.h.in"
"${PROJECT_SOURCE_DIR}/src/include/caoi_rfac.h" IMMEDIATE @ONLY )
SET(CLEED_NSYM_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
SET(CLEED_NSYM_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
SET(CLEED_NSYM_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
SET(CLEED_NSYM_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/include/leed_ver.h.in"
"${PROJECT_SOURCE_DIR}/src/include/leed_ver.h" IMMEDIATE @ONLY )
SET(CLEED_SYM_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
SET(CLEED_SYM_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
SET(CLEED_SYM_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
SET(CLEED_SYM_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/include/leed_ver_sym.h.in"
"${PROJECT_SOURCE_DIR}/src/include/leed_ver_sym.h" IMMEDIATE @ONLY )
SET(CRFAC_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
SET(CRFAC_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
SET(CRFAC_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
SET(CRFAC_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/include/rfac_ver.h.in"
"${PROJECT_SOURCE_DIR}/src/include/rfac_ver.h" IMMEDIATE @ONLY )
SET(CSEARCH_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
SET(CSEARCH_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
SET(CSEARCH_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
SET(CSEARCH_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/include/search_ver.h.in"
"${PROJECT_SOURCE_DIR}/src/include/search_ver.h" IMMEDIATE @ONLY )
SET(FTSMOOTH_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
SET(FTSMOOTH_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
SET(FTSMOOTH_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
SET(FTSMOOTH_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/include/ftsmooth.h.in"
"${PROJECT_SOURCE_DIR}/src/include/ftsmooth.h" IMMEDIATE @ONLY )
SET(LATT_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
SET(LATT_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
SET(LATT_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
SET(LATT_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/include/latt.h.in"
"${PROJECT_SOURCE_DIR}/src/include/latt.h" IMMEDIATE @ONLY )
SET(PATT_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
SET(PATT_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
SET(PATT_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
SET(PATT_MAINTAINER "Liam Deacon (liam.deacon@diamond.ac.uk)")
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/include/patt_ver.h.in"
"${PROJECT_SOURCE_DIR}/src/include/patt_ver.h" IMMEDIATE @ONLY )
SET(MKIV_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
SET(MKIV_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
SET(MKIV_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
SET(MKIV_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/mkiv/mkiv_ver.h.in"
"${PROJECT_SOURCE_DIR}/src/mkiv/mkiv_ver.h" IMMEDIATE @ONLY )
# Project options
OPTION(WITH_PHASESHIFTS "Set to ON to download and integrate PhaseShifts Python package" OFF)
OPTION(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON)
OPTION(USE_OPENMP "Set to OFF to have single threaded executables" OFF)
OPTION(WITH_QT "Set to ON to build Qt app frontends" OFF)
OPTION(WITH_OPENCL "Set to ON to enable OpenCL GPGPU support" OFF)
OPTION(INSTALL_DOC "Set to OFF to skip build/install Documentation" ON)
# set cmake module path
IF (NOT CMAKE_MODULE_PATH)
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules")
ENDIF (NOT CMAKE_MODULE_PATH)
IF (WITH_QT STREQUAL "ON")
IF (QT_VERSION STREQUAL "Qt5" OR QT_VERSION STREQUAL "qt5" )
FIND_PACKAGE(Qt5 REQUIRED)
ELSE ()
FIND_PACKAGE(Qt4 REQUIRED)
SET (QT_VERSION "Qt4")
ENDIF ()
# Instruct CMake to run moc automatically when needed.
SET(CMAKE_AUTOMOC ON)
INCLUDE(${QT_USE_FILE})
#MESSAGE ( STATUS ${QT_USE_FILE})
ENDIF ()
# This is only required for the script to work in the version control
IF (WITH_OPENCL STREQUAL "ON")
SET (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules")
FIND_PACKAGE( OpenCL REQUIRED )
INCLUDE_DIRECTORIES( ${OPENCL_INCLUDE_DIRS} )
IF (OPENCL_HAS_CPP_BINDINGS )
MESSAGE( STATUS "OpenCL has CPP bindings. Full include is: " ${OPENCL_INCLUDE_DIRS} )
ELSE (OPENCL_HAS_CPP_BINDINGS )
MESSAGE( "No OpenCL CPP bindings found" )
SET (WITH_OPENCL "OFF")
ENDIF (OPENCL_HAS_CPP_BINDINGS )
ENDIF()
##############################################################################
# Compiler section #
##############################################################################
#test for ANDROID and look for stuff not relevant to android.
# if(NOT ANDROID)
# #jni is available by default on android
# find_package(JNI)
# include_directories(${JNI_INCLUDE_DIRS})
# endif()
# find java
FIND_PACKAGE (Java
# REQUIRED
)
INCLUDE (UseJava)
# find Python libraries & commands
FIND_PACKAGE(PythonInterp)
FIND_PACKAGE(PythonLibs 2.7)
FIND_PROGRAM(PYTHON_PIP_EXECUTABLE pip)
FIND_PROGRAM(PYTHON_EASY_INSTALL easy_install)
# enable Fortran support
ENABLE_LANGUAGE (Fortran)
GET_FILENAME_COMPONENT (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
# enable resource compiler
ENABLE_LANGUAGE(RC)
# Set Warnings
IF (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID STREQUAL "Clang")
SET(WARNINGS "-pedantic -Wall -Wextra -Wfloat-equal -Wshadow -Wwrite-strings")
IF (PARANOID)
SET (WARNINGS "${WARNINGS} -W -Wconversion -Wcast-qual")
ENDIF (PARANOID)
# set list of files to copy for running of program
GET_FILENAME_COMPONENT(C_COMPILER_PARENT_DIR ${CMAKE_C_COMPILER} PATH)
FILE (GLOB RUNTIME_LIBRARIES ${C_COMPILER_PARENT_DIR}/*.dll)
ELSEIF("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
SET(WARNINGS "/W4 /WX /EHsc")
SET(RUNTIME_LIBRARIES
"C:/Program Files/Microsoft Visual Studio 9.0/VC/redist/x86/Microsoft.VC90.CRT/msvcm90.dll"
"C:/Program Files/Microsoft Visual Studio 9.0/VC/redist/x86/Microsoft.VC90.CRT/msvcp90.dll"
"C:/Program Files/Microsoft Visual Studio 9.0/VC/redist/x86/Microsoft.VC90.CRT/msvcr90.dll"
"C:/Program Files/Microsoft Visual Studio 9.0/VC/redist/x86/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest"
)
ENDIF()
# check compiler flags
SET(CMAKE_CXX_FLAGS ${WARNINGS}
CACHE STRING "Flags used by the compiler during all build types." FORCE)
SET(CMAKE_C_FLAGS ${WARNINGS}
CACHE STRING "Flags used by the compiler during all build types." FORCE)
IF (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID STREQUAL "Clang")
# check compiler flags
CHECK_C_COMPILER_FLAG(-fexceptions CC_HAS_EXCEPTIONS_FLAG)
CHECK_C_COMPILER_FLAG(-fbounds-check CC_HAS_BOUNDS_CHECK_FLAG)
CHECK_C_COMPILER_FLAG(-fstack-check CC_HAS_STACK_CHECK_FLAG)
CHECK_C_COMPILER_FLAG(-g CC_HAS_G_FLAG)
CHECK_C_COMPILER_FLAG(-g3 CC_HAS_G3_FLAG)
CHECK_C_COMPILER_FLAG(-O0 CC_HAS_O0_FLAG)
CHECK_C_COMPILER_FLAG(-O3 CC_HAS_O3_FLAG)
CHECK_C_COMPILER_FLAG(-mfpmath=sse CC_HAS_FPMATH_SSE_FLAG)
CHECK_C_COMPILER_FLAG(-ffast-math CC_HAS_FAST_MATH_FLAG)
CHECK_C_COMPILER_FLAG(-funroll-loops CC_HAS_UNROLL_LOOPS_FLAG)
CHECK_C_COMPILER_FLAG(-march=native CC_HAS_ARCH_NATIVE_FLAG)
CHECK_C_COMPILER_FLAG(-mtune=native CC_HAS_TUNE_NATIVE_FLAG)
CHECK_C_COMPILER_FLAG(-std=c99 CC_HAS_STD_C99_FLAG)
CHECK_C_COMPILER_FLAG(-std=gnu99 CC_HAS_STD_GNU99_FLAG)
CHECK_C_COMPILER_FLAG(-fdiagnostics-color=auto CC_HAS_DIAGNOSTICS_COLOR_FLAG)
# check for OpenMP usability
IF (USE_OPENMP STREQUAL "ON")
FIND_PACKAGE(OpenMP)
IF (OpenMP_FOUND)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
ADD_DEFINITIONS ("-D_USE_OPENMP")
ELSE (OpenMP_FOUND)
SET (USE_OPENMP OFF)
ENDIF (OpenMP_FOUND)
ENDIF(USE_OPENMP STREQUAL "ON")
IF (CC_HAS_STD_GNU99_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
ELSEIF (CC_HAS_C99_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
ENDIF(CC_HAS_STD_GNU99_FLAG)
IF (CC_HAS_DIAGNOSTICS_COLOR_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=auto")
ENDIF (CC_HAS_DIAGNOSTICS_COLOR_FLAG)
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
IF (CC_HAS_O0_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
ENDIF (CC_HAS_O0_FLAG)
ENDIF (CMAKE_BUILD_TYPE STREQUAL "Debug")
# use '-mtune=native' on all but 'MinSizeRel' build
IF (NOT CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
IF (CC_HAS_TUNE_NATIVE_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mtune=native")
ENDIF (CC_HAS_TUNE_NATIVE_FLAG)
ENDIF (NOT CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
# add debugging options or else fast code optimisations for 'MinSizeRel' build
IF (CMAKE_BUILD_TYPE STREQUAL "Debug" OR
CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
# optimise for debugging
IF (CC_HAS_EXCEPTIONS_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions")
ENDIF (CC_HAS_EXCEPTIONS_FLAG)
IF (CC_HAS_BOUNDS_CHECK_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fbounds-check")
ENDIF (CC_HAS_BOUNDS_CHECK_FLAG)
IF (CC_HAS_STACK_CHECK_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-check")
ENDIF (CC_HAS_STACK_CHECK_FLAG)
IF (CC_HAS_G3_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3")
ELSEIF (CC_HAS_G_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
ENDIF()
ELSEIF (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
# optimise for fast & lean code
IF (CC_HAS_O3_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
ENDIF (CC_HAS_O3_FLAG)
IF (CC_HAS_FAST_MATH_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
ENDIF (CC_HAS_FAST_MATH_FLAG)
IF (CC_HAS_UNROLL_LOOPS_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -funroll-loops")
ENDIF (CC_HAS_UNROLL_LOOPS_FLAG)
IF (CC_HAS_ARCH_NATIVE_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
ENDIF (CC_HAS_ARCH_NATIVE_FLAG)
IF (CC_HAS_FPMATH_SSE_FLAG)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse")
ENDIF (CC_HAS_FPMATH_SSE_FLAG)
ENDIF()
ENDIF()
# definitions
IF( CMAKE_BUILD_TYPE STREQUAL "Debug" OR
CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" )
ADD_DEFINITIONS( "-DDEBUG" )
ENDIF()
# include directories
INCLUDE_DIRECTORIES ( ${PROJECT_SOURCE_DIR}/src/include
${PROJECT_SOURCE_DIR}/src/mkiv
${PROJECT_SOURCE_DIR}/lib/libtiff/include
)
# LD flags
IF(WIN32)
SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
ELSE(WIN32)
SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
ENDIF(WIN32)
SET (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -lm")
#LIST (APPEND CMAKE_LIBRARY_PATH ${PROJECT_SOURCE_DIR}/lib)
FIND_LIBRARY(TIFF_LIBRARY NAME tiff)
IF(WIN32)
SET (TIFF_LIBRARY "${PROJECT_SOURCE_DIR}/lib/win32/libtiff3.dll")
GET_FILENAME_COMPONENT(TIFF_LIBRARY_DIR ${TIFF_LIBRARY} PATH)
ENDIF(WIN32)
# create uninstall configuration file
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${PROJECT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
# create uninstall target
ADD_CUSTOM_TARGET( uninstall "${CMAKE_COMMAND}"
-P "${PROJECT_BINARY_DIR}/cmake_uninstall.cmake"
)
# create configuration file from .in file
#CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in"
# "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" @ONLY
#)
# install configuration file
#INSTALL( FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" DESTINATION . )
# display status message for important variables
MESSAGE( STATUS )
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
MESSAGE( STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" )
MESSAGE( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )
MESSAGE( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" )
MESSAGE( STATUS "CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}" )
MESSAGE( STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}" )
MESSAGE( STATUS "CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}" )
#MESSAGE( STATUS "${PROJECT_NAME}_DEPENDS = \"${${PROJECT_NAME}_DEPENDS}\"" )
MESSAGE( STATUS "INSTALL_DOC = ${INSTALL_DOC}" )
MESSAGE( STATUS "WITH_OPENCL = ${WITH_OPENCL}" )
MESSAGE( STATUS "WITH_PHASESHIFTS = ${WITH_PHASESHIFTS}" )
MESSAGE( STATUS "WITH_QT = ${WITH_QT}")
MESSAGE( STATUS "USE_OPENMP = ${USE_OPENMP}" )
IF (WITH_PHASESHIFTS STREQUAL "ON")
MESSAGE (STATUS "PYTHON_PIP_EXECUTABLE = ${PYTHON_PIP_EXECUTABLE}" )
ENDIF (WITH_PHASESHIFTS STREQUAL "ON")
IF (WITH_QT STREQUAL "ON")
MESSAGE (STATUS "QT_QMAKE_EXECUTABLE = ${QT_QMAKE_EXECUTABLE}")
ENDIF (WITH_QT STREQUAL "ON")
MESSAGE( STATUS )
MESSAGE( STATUS "Change a value with: cmake -D<Variable>=<Value>" )
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
MESSAGE( STATUS )
#CHECK_INCLUDE_FILES(CheckIncludeFiles)
#CHECK_INCLUDE_FILES(malloc.h HAVE_MALLOC_H)
##############################################################################
# Sources section #
##############################################################################
SET (caoi_leed_SOURCE_DIR src/aoi_leed)
SET (caoi_rfac_SOURCE_DIR src/aoi_rfac)
SET (cleed_nsym_SOURCE_DIR src/leed_nsym)
SET (cleed_sym_SOURCE_DIR src/leed_sym)
SET (crfac_SOURCE_DIR src/rfac)
SET (csearch_SOURCE_DIR src/search)
SET (debye_SOURCE_DIR src/debye)
SET (ftsmooth_SOURCE_DIR src/ftsmooth)
SET (latt_SOURCE_DIR src/latt)
SET (mkiv_SOURCE_DIR src/mkiv)
SET (patt_SOURCE_DIR src/patt)
#
SET (CPLOBJ ${cleed_nsym_SOURCE_DIR}/cribasfun.c)
# basic qm functions
SET (QMOBJ
${cleed_nsym_SOURCE_DIR}/qmbessm.c
${cleed_nsym_SOURCE_DIR}/qmcgc.c
${cleed_nsym_SOURCE_DIR}/qmhank.c
${cleed_nsym_SOURCE_DIR}/qmylm.c
)
# matrix library
SET (MATOBJ
${cleed_nsym_SOURCE_DIR}/matabs.c
${cleed_nsym_SOURCE_DIR}/matalloc.c
${cleed_nsym_SOURCE_DIR}/matarralloc.c
${cleed_nsym_SOURCE_DIR}/matarrfree.c
${cleed_nsym_SOURCE_DIR}/matcgau.c
${cleed_nsym_SOURCE_DIR}/matcheck.c
${cleed_nsym_SOURCE_DIR}/matclu.c
${cleed_nsym_SOURCE_DIR}/matcol.c
${cleed_nsym_SOURCE_DIR}/matconj.c
${cleed_nsym_SOURCE_DIR}/matcop.c
${cleed_nsym_SOURCE_DIR}/matdiff.c
${cleed_nsym_SOURCE_DIR}/matext.c
${cleed_nsym_SOURCE_DIR}/matfree.c
${cleed_nsym_SOURCE_DIR}/matins.c
${cleed_nsym_SOURCE_DIR}/matinv.c
${cleed_nsym_SOURCE_DIR}/matmul.c
${cleed_nsym_SOURCE_DIR}/matnattovht.c
${cleed_nsym_SOURCE_DIR}/matread.c
${cleed_nsym_SOURCE_DIR}/matrlu.c
${cleed_nsym_SOURCE_DIR}/matrow.c
${cleed_nsym_SOURCE_DIR}/matrm.c
${cleed_nsym_SOURCE_DIR}/matscal.c
${cleed_nsym_SOURCE_DIR}/matshow.c
${cleed_nsym_SOURCE_DIR}/matshowabs.c
${cleed_nsym_SOURCE_DIR}/matshowpar.c
${cleed_nsym_SOURCE_DIR}/matsqmod.c
${cleed_nsym_SOURCE_DIR}/mattrace.c
${cleed_nsym_SOURCE_DIR}/mattrans.c
${cleed_nsym_SOURCE_DIR}/matwrite.c
)
# input for LEED programs
SET (DEBOBJ ${cleed_nsym_SOURCE_DIR}/linpdebtemp.c)
SET (INPOBJ
${cleed_nsym_SOURCE_DIR}/linpbullayer.c
${cleed_nsym_SOURCE_DIR}/linpovllayer.c
${cleed_nsym_SOURCE_DIR}/linpphasend.c
${cleed_nsym_SOURCE_DIR}/linprdbulnd.c
${cleed_nsym_SOURCE_DIR}/linprdpar.c
${cleed_nsym_SOURCE_DIR}/linprdovlnd.c
${cleed_nsym_SOURCE_DIR}/linpshowbop.c
${cleed_nsym_SOURCE_DIR}/linpmatlm.c
# include lindebtemp.c
${DEBOBJ}
)
SET (INPOBJSYM
${cleed_sym_SOURCE_DIR}/linpbullaysym.c
${cleed_sym_SOURCE_DIR}/linpovlaysym.c
${cleed_sym_SOURCE_DIR}/linprdbulsym.c
${cleed_sym_SOURCE_DIR}/linprdovlsym.c
${cleed_sym_SOURCE_DIR}/linpphase.c
${cleed_sym_SOURCE_DIR}/lwritepar.c
${cleed_sym_SOURCE_DIR}/lreadpar.c
${cleed_sym_SOURCE_DIR}/lsymcheck.c
)
# output for LEED programs
SET (OUTOBJ
${cleed_nsym_SOURCE_DIR}/loutbmlist.c
${cleed_nsym_SOURCE_DIR}/louthead.c
${cleed_nsym_SOURCE_DIR}/loutint.c
)
SET (OUTOBJSYM
${cleed_sym_SOURCE_DIR}/louthead2.c
${cleed_sym_SOURCE_DIR}/loutintsym.c
)
# beams:
SET (BEAMOBJ
${cleed_nsym_SOURCE_DIR}/lbmgen.c
${cleed_nsym_SOURCE_DIR}/lbmselect.c
${cleed_nsym_SOURCE_DIR}/lbmset.c
)
SET (BEAMOBJSYM
${cleed_sym_SOURCE_DIR}/lbmgensym.c
${cleed_sym_SOURCE_DIR}/lbmrotmat.c
)
# parameter control:
SET (PCOBJ
${cleed_nsym_SOURCE_DIR}/lpcmktlnd.c
${cleed_nsym_SOURCE_DIR}/lpctemtl.c
${cleed_nsym_SOURCE_DIR}/lpcupdatend.c
)
SET (PCOBJSYM
${cleed_sym_SOURCE_DIR}/lsymcheck.c
${cleed_sym_SOURCE_DIR}/lpcupdate.c
${cleed_sym_SOURCE_DIR}/lpcmktl.c
)
# layer doubling:
SET (LDOBJ
${cleed_nsym_SOURCE_DIR}/lld2n.c
${cleed_nsym_SOURCE_DIR}/lld2lay.c
${cleed_nsym_SOURCE_DIR}/lld2layrpm.c
${cleed_nsym_SOURCE_DIR}/lldpotstep.c
${cleed_nsym_SOURCE_DIR}/lldpotstep0.c
)
# multiple scattering:
SET (MSOBJ
${cleed_nsym_SOURCE_DIR}/lmsbravlnd.c
${cleed_nsym_SOURCE_DIR}/lmscomplnd.c
${cleed_nsym_SOURCE_DIR}/lmslsumii.c
${cleed_nsym_SOURCE_DIR}/lmslsumij.c
${cleed_nsym_SOURCE_DIR}/lmspartinv.c
${cleed_nsym_SOURCE_DIR}/lmstmatii.c
${cleed_nsym_SOURCE_DIR}/lmstmatndii.c
${cleed_nsym_SOURCE_DIR}/lmstmatij.c
${cleed_nsym_SOURCE_DIR}/lmsymat.c
${cleed_nsym_SOURCE_DIR}/lmsymatset.c
${cleed_nsym_SOURCE_DIR}/lmsymmat.c
${cleed_nsym_SOURCE_DIR}/lmsypy.c
)
SET (MSOBJSYM
${cleed_sym_SOURCE_DIR}/lmscomplsym.c
${cleed_sym_SOURCE_DIR}/lmscompksum.c
${cleed_sym_SOURCE_DIR}/lmsbravlsym.c
${cleed_sym_SOURCE_DIR}/lmsbravl.c
${cleed_sym_SOURCE_DIR}/lmscompl.c
${cleed_sym_SOURCE_DIR}/lmsltok.c
)
SET (PRGOBJ
${cleed_nsym_SOURCE_DIR}/prgcheck.c
${cleed_nsym_SOURCE_DIR}/lhelp.c
)
IF (WIN32)
LIST (APPEND PRGOBJ
${cleed_nsym_SOURCE_DIR}/getrusage_win32.c
${cleed_nsym_SOURCE_DIR}/getrusage_win32.h
)
ENDIF (WIN32)
SET (PRGOBJSYM
${cleed_sym_SOURCE_DIR}/lhelpsym.c
)
SET (TMAOBJ
${cleed_nsym_SOURCE_DIR}/lpccumtl.c
${cleed_nsym_SOURCE_DIR}/lpcmkms.c
)
SET (LEEDOBJ
${CPLOBJ}
${QMOBJ}
${MATOBJ}
${INPOBJ}
${PCOBJ}
${PRGOBJ}
${OUTOBJ}
${BEAMOBJ}
${LDOBJ}
${MSOBJ}
${TMAOBJ}
)
SET (SYMOBJ
${MSOBJSYM}
${OUTOBJSYM}
${INPOBJSYM}
${PCOBJSYM}
${PRGOBJSYM}
${BEAMOBJSYM}
)
# Specify list of sources for each target
SET (leedlib_SRCS
${LEEDOBJ}
${SYMOBJ}
)
SET (rfaclib_SRCS
${crfac_SOURCE_DIR}/bgets.c
${crfac_SOURCE_DIR}/file2buffer.c
${crfac_SOURCE_DIR}/rfhelp.c
${crfac_SOURCE_DIR}/rflines.c
${crfac_SOURCE_DIR}/rfctr2out.c
${crfac_SOURCE_DIR}/rfversion.c
${crfac_SOURCE_DIR}/crfinput.c
${crfac_SOURCE_DIR}/crfintindl.c
${crfac_SOURCE_DIR}/crflorentz.c
${crfac_SOURCE_DIR}/crfmklide.c
${crfac_SOURCE_DIR}/crfmklist.c
${crfac_SOURCE_DIR}/crfrdargs.c
${crfac_SOURCE_DIR}/crfrdcleed.c
${crfac_SOURCE_DIR}/crfrdexpt.c
${crfac_SOURCE_DIR}/crfrmin.c
${crfac_SOURCE_DIR}/crfrb.c
${crfac_SOURCE_DIR}/crfrp.c
${crfac_SOURCE_DIR}/crfr1.c
${crfac_SOURCE_DIR}/crfr2.c
${crfac_SOURCE_DIR}/crfsort.c
${crfac_SOURCE_DIR}/crfspline.c
${crfac_SOURCE_DIR}/crfsplint.c
)
SET (searchlib_SRCS
${csearch_SOURCE_DIR}/copy_file.c
${csearch_SOURCE_DIR}/nrrutil.c
${csearch_SOURCE_DIR}/nrrbrent.c
${csearch_SOURCE_DIR}/nrrlinmin.c
${csearch_SOURCE_DIR}/nrrmnbrak.c
${csearch_SOURCE_DIR}/nrrran1.c
${csearch_SOURCE_DIR}/sramoeba.c
${csearch_SOURCE_DIR}/sramebsa.c
${csearch_SOURCE_DIR}/srckgeo.c
${csearch_SOURCE_DIR}/srckrot.c
${csearch_SOURCE_DIR}/srevalrf.c
${csearch_SOURCE_DIR}/srhelp.c
${csearch_SOURCE_DIR}/srmkinp.c
${csearch_SOURCE_DIR}/srpo.c
${csearch_SOURCE_DIR}/srpowell.c
${csearch_SOURCE_DIR}/srrdinp.c
${csearch_SOURCE_DIR}/srrdver.c
${csearch_SOURCE_DIR}/srsa.c
${csearch_SOURCE_DIR}/srer.c
${csearch_SOURCE_DIR}/srsx.c
${cleed_nsym_SOURCE_DIR}/linpdebtemp.c
)
SET (caoi_leed_SRCS
${caoi_leed_SOURCE_DIR}/caoi_leed_bsr.c
${caoi_leed_SOURCE_DIR}/caoi_leed_help.c
${caoi_leed_SOURCE_DIR}/caoi_leed_main.c
)
SET (caoi_rfac_SRCS
${caoi_rfac_SOURCE_DIR}/caoi_rfac_ctr.c
${caoi_rfac_SOURCE_DIR}/caoi_rfac_help.c
${caoi_rfac_SOURCE_DIR}/caoi_rfac_main.c
)
SET (cleed_nsym_SRCS
${cleed_nsym_SOURCE_DIR}/cleed_nsym.c
)
SET (cleed_sym_SRCS
${cleed_sym_SOURCE_DIR}/cleed_sym.c
)
SET (csearch_SRCS
${csearch_SOURCE_DIR}/csearch.c
${searchlib_SRCS}
)
SET (crfac_SRCS
${crfac_SOURCE_DIR}/crfac.c
${rfaclib_SRCS}
)
SET (debye_SRCS
${debye_SOURCE_DIR}/debye.c
)
SET (ftsmoothlib_SRCS
${ftsmooth_SOURCE_DIR}/ftsmooth.c
${ftsmooth_SOURCE_DIR}/ftsmooth_debug.c
${ftsmooth_SOURCE_DIR}/ftsmooth_help.c
${ftsmooth_SOURCE_DIR}/ftsmooth_parse_args.c
${ftsmooth_SOURCE_DIR}/offset_data.c
${ftsmooth_SOURCE_DIR}/print_data.c
${ftsmooth_SOURCE_DIR}/read_data.c
${ftsmooth_SOURCE_DIR}/remove_negative_data.c
${ftsmooth_SOURCE_DIR}/trim_data.c
)
SET (ftsmooth_SRCS
${ftsmooth_SOURCE_DIR}/ftsmooth_main.c
${ftsmoothlib_SRCS}
)
SET (mkivlib_SRCS
${mkiv_SOURCE_DIR}/bsmooth.c
${mkiv_SOURCE_DIR}/calca.c
${mkiv_SOURCE_DIR}/calcbase.c
${mkiv_SOURCE_DIR}/calcoi.c
${mkiv_SOURCE_DIR}/calcspotpos.c
${mkiv_SOURCE_DIR}/convtif2xv.c
${mkiv_SOURCE_DIR}/convxv2tif.c
${mkiv_SOURCE_DIR}/drawbound.c
${mkiv_SOURCE_DIR}/drawell.c
${mkiv_SOURCE_DIR}/drawgrid.c
${mkiv_SOURCE_DIR}/filename.c
${mkiv_SOURCE_DIR}/file_functs.c
${mkiv_SOURCE_DIR}/fimax4.c
${mkiv_SOURCE_DIR}/getint.c
${mkiv_SOURCE_DIR}/markref.c
${mkiv_SOURCE_DIR}/mem4spots.c
${mkiv_SOURCE_DIR}/mkmask.c
${mkiv_SOURCE_DIR}/outtif.c
${mkiv_SOURCE_DIR}/plotind.c
${mkiv_SOURCE_DIR}/quicksort.c
${mkiv_SOURCE_DIR}/readinp.c
${mkiv_SOURCE_DIR}/readvar.c
${mkiv_SOURCE_DIR}/refinp.c
${mkiv_SOURCE_DIR}/setcontrol.c
${mkiv_SOURCE_DIR}/sign.c
${mkiv_SOURCE_DIR}/readtif.c
${mkiv_SOURCE_DIR}/writetif.c
${mkiv_SOURCE_DIR}/signs.h
${mkiv_SOURCE_DIR}/tiffio.h
${mkiv_SOURCE_DIR}/variables.h
${mkiv_SOURCE_DIR}/v_iorw.h
${mkiv_SOURCE_DIR}/vinclude.h
${mkiv_SOURCE_DIR}/mkiv.h
${mkiv_SOURCE_DIR}/mkiv_ver.h
)
SET (mkiv_SRCS
${mkiv_SOURCE_DIR}/mkiv_help.c
${mkivlib_SRCS}
)
SET (latt_SRCS
${latt_SOURCE_DIR}/latt.c
${latt_SOURCE_DIR}/latt_help.c
)
SET (patt_SRCS
${patt_SOURCE_DIR}/patt.c
${patt_SOURCE_DIR}/patt_help.c
)
SET(EXTRA_COMPONENTS "")
# Add list of targets to build
ADD_LIBRARY(leed SHARED ${leedlib_SRCS})
ADD_LIBRARY(leedStatic STATIC ${leedlib_SRCS})
ADD_LIBRARY(rfac SHARED ${rfaclib_SRCS})
ADD_LIBRARY(rfacStatic STATIC ${rfaclib_SRCS})
ADD_LIBRARY(search SHARED ${searchlib_SRCS})
ADD_LIBRARY(searchStatic STATIC ${searchlib_SRCS})
ADD_LIBRARY(ftsmoothLib SHARED ${ftsmoothlib_SRCS})
ADD_LIBRARY(ftsmoothLibStatic STATIC ${ftsmoothlib_SRCS})
ADD_LIBRARY(mkivLib SHARED ${mkivlib_SRCS})
ADD_LIBRARY(mkivLibStatic STATIC ${mkivlib_SRCS})
IF (USE_PHASESHIFTS STREQUAL "ON")
IF (NOT PYTHON_PIP_EXECUTABLE STREQUAL "PYTHON_PIP-NOTFOUND")
ADD_CUSTOM_COMMAND (TARGET ${PROJECT_NAME} POST_BUILD
COMMAND pip install phaseshifts
COMMENT "Install Python phaseshift package using pip"
)
ENDIF (NOT PYTHON_PIP STREQUAL "PYTHON_PIP-NOTFOUND")
ENDIF (USE_PHASESHIFTS STREQUAL "ON")
# install documents
IF (INSTALL_DOC STREQUAL "ON")
SET (EXTRA_COMPONENTS "${EXTRA_COMPONENTS} documentation")
FILE(GLOB_RECURSE DOCUMENTS RELATIVE ${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/doc/*.pdf)
INSTALL(FILES ${DOCUMENTS} DESTINATION doc COMPONENT documentation)
FILE(GLOB_RECURSE MAN_PAGES RELATIVE ${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/man/*.*)
INSTALL(FILES ${MAN_PAGES} DESTINATION man COMPONENT documentation)
SET (CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
ENDIF (INSTALL_DOC STREQUAL "ON")
IF (WIN32)
# ============ BUILD SETTINGS FOR WINDOWS ============
# ============ USING VISUAL STUDIO 2008 ============
# /Od -> disable optimization
# /W3 -> warning level
# /ZI -> program database for edit & continue
# /Gm -> enable minimal rebuild
# /RTC1 -> runtime checks: stack frames + uninitialized variables
# /MTd -> Multi-threaded Debug
# Given this bug in the NMake generator related to 'manifest files' in CMake 2.6
# http://www.cmake.org/Bug/view.php?id=7222
# it is recommended to use CMake 2.4.7 in Windows, so that both the
# application and the installer can be built from the command line.
# SET(CMAKE_CXX_FLAGS_DEBUG "/RTC1 /Gm /MTd /ZI /W3 /Od")
#SET(CMAKE_CXX_FLAGS_RELEASE "/RTC1 /Gm /MT /Zi")
#SET(CMAKE_EXE_LINKER_FLAGS "/MACHINE:X86 /DYNAMICBASE:NO /MANIFEST:NO /LTCG")
# configure resource files for Windows icons
CONFIGURE_FILE ("${caoi_leed_SOURCE_DIR}/res/windows/caoi_leed.rc.in"
"${caoi_leed_SOURCE_DIR}/res/windows/caoi_leed.rc" IMMEDIATE @ONLY )
CONFIGURE_FILE ("${caoi_rfac_SOURCE_DIR}/res/windows/caoi_rfac.rc.in"
"${caoi_rfac_SOURCE_DIR}/res/windows/caoi_rfac.rc" IMMEDIATE @ONLY )
CONFIGURE_FILE ("${cleed_nsym_SOURCE_DIR}/res/windows/cleed_nsym.rc.in"
"${cleed_nsym_SOURCE_DIR}/res/windows/cleed_nsym.rc" IMMEDIATE @ONLY )
CONFIGURE_FILE ("${cleed_sym_SOURCE_DIR}/res/windows/cleed_sym.rc.in"
"${cleed_sym_SOURCE_DIR}/res/windows/cleed_sym.rc" IMMEDIATE @ONLY )
CONFIGURE_FILE ("${crfac_SOURCE_DIR}/res/windows/crfac.rc.in"
"${crfac_SOURCE_DIR}/res/windows/crfac.rc" IMMEDIATE @ONLY )
CONFIGURE_FILE ("${csearch_SOURCE_DIR}/res/windows/csearch.rc.in"
"${csearch_SOURCE_DIR}/res/windows/csearch.rc" IMMEDIATE @ONLY )
CONFIGURE_FILE ("${ftsmooth_SOURCE_DIR}/res/windows/ftsmooth.rc.in"
"${ftsmooth_SOURCE_DIR}/res/windows/ftsmooth.rc" IMMEDIATE @ONLY )
CONFIGURE_FILE ("${latt_SOURCE_DIR}/res/windows/latt.rc.in"
"${latt_SOURCE_DIR}/res/windows/latt.rc" IMMEDIATE @ONLY )
CONFIGURE_FILE ("${mkiv_SOURCE_DIR}/res/windows/mkiv.rc.in"
"${mkiv_SOURCE_DIR}/res/windows/mkiv.rc" IMMEDIATE @ONLY )
CONFIGURE_FILE ("${patt_SOURCE_DIR}/res/windows/patt.rc.in"
"${patt_SOURCE_DIR}/res/windows/patt.rc" IMMEDIATE @ONLY )
# This sets up the exe icon for windows under mingw.
IF (MINGW)
SET(CMAKE_RC_COMPILER_INIT windres)
ENABLE_LANGUAGE(RC)
SET(CMAKE_RC_COMPILE_OBJECT
"<CMAKE_RC_COMPILER> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
ENDIF (MINGW)
# ADD_CUSTOM_TARGET(caoi_leed.res
# COMMAND ${CMAKE_RC_COMPILER}
# ${caoi_leed_SOURCE_DIR}/res/windows/caoi_leed.rc
# ${caoi_leed_SOURCE_DIR}/res/windows/caoi_leed.res
# DEPENDS ${caoi_leed_SOURCE_DIR}/res/windows/caoi_leed.ico
# SOURCES ${caoi_leed_SOURCE_DIR}/res/windows/caoi_leed.rc
# )
# ADD_CUSTOM_TARGET(caoi_rfac.res
# COMMAND ${CMAKE_RC_COMPILER}
# ${caoi_rfac_SOURCE_DIR}/res/windows/caoi_rfac.rc
# ${caoi_rfac_SOURCE_DIR}/res/windows/caoi_rfac.res
# DEPENDS ${caoi_rfac_SOURCE_DIR}/res/windows/caoi_rfac.ico
# SOURCES ${caoi_rfac_SOURCE_DIR}/res/windows/caoi_rfac.rc
# )
# ADD_CUSTOM_TARGET(crfac.res
# COMMAND ${CMAKE_RC_COMPILER}
# ${crfac_SOURCE_DIR}/res/windows/crfac.rc
# ${crfac_SOURCE_DIR}/res/windows/crfac.res
# DEPENDS ${crfac_SOURCE_DIR}/res/windows/crfac.ico
# SOURCES ${crfac_SOURCE_DIR}/res/windows/crfac.rc
# )
# ADD_CUSTOM_TARGET(cleed_nsym.res
# COMMAND ${CMAKE_RC_COMPILER}
# ${cleed_nsym_SOURCE_DIR}/res/windows/cleed_nsym.rc
# ${cleed_nsym_SOURCE_DIR}/res/windows/cleed_nsym.res
# DEPENDS ${cleed_nsym_SOURCE_DIR}/res/windows/cleed_nsym.ico
# SOURCES ${cleed_nsym_SOURCE_DIR}/res/windows/cleed_nsym.rc
# )
# ADD_CUSTOM_TARGET(cleed_sym.res
# COMMAND ${CMAKE_RC_COMPILER}
# ${cleed_sym_SOURCE_DIR}/res/windows/cleed_sym.rc
# ${cleed_sym_SOURCE_DIR}/res/windows/cleed_sym.res
# DEPENDS ${cleed_sym_SOURCE_DIR}/res/windows/cleed_sym.ico
# SOURCES ${cleed_sym_SOURCE_DIR}/res/windows/cleed_sym.rc
# )
# ADD_CUSTOM_TARGET(csearch.res
# COMMAND ${CMAKE_RC_COMPILER}
# ${csearch_SOURCE_DIR}/res/windows/csearch.rc
# ${csearch_SOURCE_DIR}/res/windows/csearch.res
# DEPENDS ${csearch_SOURCE_DIR}/res/windows/csearch.ico
# SOURCES ${csearch_SOURCE_DIR}/res/windows/csearch.rc
# )
# ADD_CUSTOM_TARGET(ftsmooth.res
# COMMAND ${CMAKE_RC_COMPILER}
# ${ftsmooth_SOURCE_DIR}/res/windows/ftsmooth.rc
# ${ftsmooth_SOURCE_DIR}/res/windows/ftsmooth.res
# DEPENDS ${ftsmooth_SOURCE_DIR}/res/windows/ftsmooth.ico
# SOURCES ${ftsmooth_SOURCE_DIR}/res/windows/ftsmooth.rc
# )
SET (caoi_leed_win_resources_SRCS
${caoi_leed_SOURCE_DIR}/res/windows/caoi_leed.rc
)
SET (caoi_rfac_win_resources_SRCS
${caoi_rfac_SOURCE_DIR}/res/windows/caoi_rfac.rc
)
SET (cleed_nsym_win_resources_SRCS
${cleed_nsym_SOURCE_DIR}/res/windows/cleed_nsym.rc
)
SET (cleed_sym_win_resources_SRCS
${cleed_sym_SOURCE_DIR}/res/windows/cleed_sym.rc
)
SET (crfac_win_resources_SRCS
${crfac_SOURCE_DIR}/res/windows/crfac.rc
)
SET (csearch_win_resources_SRCS
${csearch_SOURCE_DIR}/res/windows/csearch.rc
)
SET (ftsmooth_win_resources_SRCS
${ftsmooth_SOURCE_DIR}/res/windows/ftsmooth.rc
)
SET (latt_win_resources_SRCS
${latt_SOURCE_DIR}/res/windows/latt.rc
)
SET (patt_win_resources_SRCS
${patt_SOURCE_DIR}/res/windows/patt.rc
)
SET (mkiv_win_resources_SRCS
${mkiv_SOURCE_DIR}/res/windows/mkiv.rc
)
# Header files are located in these directories
INCLUDE_DIRECTORIES (
${PROJECT_SOURCE_DIR}/lib/win32/libtiff/include
)
ADD_EXECUTABLE(caoi_leed ${caoi_leed_SRCS}
${caoi_leed_win_resources_SRCS}
)
ADD_EXECUTABLE(caoi_rfac ${caoi_rfac_SRCS}
${caoi_rfac_win_resources_SRCS}
)
ADD_EXECUTABLE(cleed_nsym ${cleed_nsym_SRCS}
${cleed_nsym_win_resources_SRCS}
)
ADD_EXECUTABLE(cleed_sym ${cleed_sym_SRCS}
${cleed_sym_win_resources_SRCS}
)
ADD_EXECUTABLE(crfac WIN32
${crfac_SRCS}
${crfac_win_resources_SRCS}
)
ADD_EXECUTABLE(csearch
${csearch_SRCS}
${csearch_win_resources_SRCS}
)
ADD_EXECUTABLE(debye ${debye_SRCS})