forked from CoolProp/CoolProp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
2122 lines (1871 loc) · 77.5 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
cmake_minimum_required(VERSION 2.8.11)
include(CheckIncludeFileCXX)
if(DEFINED COOLPROP_INSTALL_PREFIX)
#set(COOLPROP_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/install_root)
message(STATUS "COOLPROP_INSTALL_PREFIX=${COOLPROP_INSTALL_PREFIX}")
else()
set(COOLPROP_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/install_root)
message(STATUS "COOLPROP_INSTALL_PREFIX=${COOLPROP_INSTALL_PREFIX}")
endif()
set(CMAKE_INSTALL_PREFIX
${COOLPROP_INSTALL_PREFIX}
CACHE PATH "default install path" FORCE)
#######################################
# BUILD OPTIONS #
#-------------------------------------#
# These options are available to be #
# modified in the build process. #
# packages may want to modify these #
# to suit, or just leave as defaults. #
#######################################
option(COOLPROP_STATIC_LIBRARY "Build CoolProp as a static library (.lib, .a)"
OFF)
option(COOLPROP_SHARED_LIBRARY "Build CoolProp as a shared library (.dll, .so)"
OFF)
option(COOLPROP_OBJECT_LIBRARY
"Build CoolProp objects, but do not link them (.obj, .o)" OFF)
option(COOLPROP_EES_MODULE "Build the EES module" OFF)
option(COOLPROP_WINDOWS_PACKAGE "Build the Windows installer" OFF)
option(BUILD_TESTING "Enable testing for this given builder" OFF)
option(FORCE_BITNESS_32 "Force a 32bit build regardless of the host" OFF)
option(FORCE_BITNESS_64 "Force a 64bit build regardless of the host" OFF)
option(FORCE_BITNESS_NATIVE
"Force a native bitness build regardless of the host" OFF)
option(COOLPROP_RELEASE "Optimize the builds with the release specs" OFF)
option(COOLPROP_DEBUG "Make a debug build" OFF)
option(COOLPROP_SMATH_WORK_INPLACE "Build SMath wrapper in source directory"
OFF)
option(
COOLPROP_MSVC_STATIC
"Statically link Microsoft Standard library removes dependency on MSVCRXXX.dll."
OFF)
option(
COOLPROP_MSVC_DYNAMIC
"Dynamically link Microsoft Standard library to integrate with other builds."
OFF)
option(
COOLPROP_MSVC_DEBUG
"Link the debug version of Microsoft Standard library to the debug builds."
ON)
option(COOLPROP_NO_EXAMPLES
"Do not generate example code, does only apply to some wrappers." OFF)
#option (DARWIN_USE_LIBCPP
# "On Darwin systems, compile and link with -std=libc++ instead of the default -std=libstdc++"
# ON)
# Force C++11 since lambdas are used in CPStrings.h
set(CMAKE_CXX_STANDARD 11)
# see
# https://stackoverflow.com/questions/52509602/cant-compile-c-program-on-a-mac-after-upgrade-to-mojave
# https://support.enthought.com/hc/en-us/articles/204469410-OS-X-GCC-Clang-and-Cython-in-10-9-Mavericks
# https://github.com/pandas-dev/pandas/pull/24274/files
# https://github.com/explosion/thinc/pull/84/files
# https://github.com/jlfaucher/builder/commit/d144d3a695949f90c5e2acff4dfd94fdcf8dcdfa
# https://github.com/CoolProp/CoolProp/issues/1778
# https://gitlab.kitware.com/cmake/cmake/issues/18396
if(DEFINED DARWIN_USE_LIBCPP)
if(DARWIN_USE_LIBCPP)
set(CMAKE_OSX_DEPLOYMENT_TARGET
"10.9"
CACHE STRING "Minimum OS X deployment version")
set(OSX_COMPILE_FLAGS "${OSX_COMPILE_FLAGS} -stdlib=libc++")
set(OSX_COMPILE_FLAGS "${OSX_COMPILE_FLAGS} -mmacosx-version-min=10.9")
set(OSX_COMPILE_FLAGS "${OSX_COMPILE_FLAGS} -std=c++11")
set(OSX_LINK_FLAGS "${OSX_LINK_FLAGS} -lc++")
set(OSX_LINK_FLAGS "${OSX_LINK_FLAGS} -nodefaultlibs")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
else(DARWIN_USE_LIBCPP)
set(CMAKE_OSX_DEPLOYMENT_TARGET
"10.5"
CACHE STRING "Minimum OS X deployment version") # Default is 10.7
set(OSX_COMPILE_FLAGS "${OSX_COMPILE_FLAGS} -stdlib=libstdc++")
set(OSX_COMPILE_FLAGS "${OSX_COMPILE_FLAGS} -mmacosx-version-min=10.5")
set(OSX_LINK_FLAGS "${OSX_LINK_FLAGS} -lstdc++")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++")
endif(DARWIN_USE_LIBCPP)
message(STATUS "DARWIN_USE_LIBCPP was set added some flags:")
message(STATUS " OSX_COMPILE_FLAGS: ${OSX_COMPILE_FLAGS}")
message(STATUS " OSX_LINK_FLAGS: ${OSX_LINK_FLAGS}")
else(DEFINED DARWIN_USE_LIBCPP)
if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
message(STATUS "OSX build detected:")
message(
STATUS " You might want to pass the -DDARWIN_USE_LIBCPP=ON/OFF parameter"
)
message(STATUS " to enable or disable different C++ standard libraries.")
message(
STATUS
" You can also specify the environment variable MACOSX_DEPLOYMENT_TARGET=10.9 to force clang builds."
)
endif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
endif(DEFINED DARWIN_USE_LIBCPP)
#if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}${OSX_COMPILE_FLAGS}")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${OSX_COMPILE_FLAGS}")
#endif()
# Alternatively you could use
# set_target_properties(TARGET_NAME PROPERTIES APPEND_STRING PROPERTY COMPILE_FLAGS "-mmacosx-version-min=10.5")
# set_target_properties(TARGET_NAME PROPERTIES APPEND_STRING PROPERTY LINK_FLAGS "-mmacosx-version-min=10.5")
#######################################
# PROJECT INFORMATION #
#-------------------------------------#
# This CMakeLists.txt file is for the #
# CoolProp thermodynamic library #
# written by Ian Bell. The following #
# section contains project and #
# version information. #
#######################################
# Project name
set(project_name "CoolProp")
set(app_name ${project_name})
project(${project_name})
# Project version
set(COOLPROP_VERSION_MAJOR 6)
set(COOLPROP_VERSION_MINOR 5)
set(COOLPROP_VERSION_PATCH 1)
set(COOLPROP_VERSION_REVISION pre)
set(COOLPROP_VERSION
"${COOLPROP_VERSION_MAJOR}.${COOLPROP_VERSION_MINOR}.${COOLPROP_VERSION_PATCH}${COOLPROP_VERSION_REVISION}"
)
message(STATUS "CoolProp version: ${COOLPROP_VERSION}")
string(TIMESTAMP COOLPROP_YEAR 2010-%Y)
#set ( COOLPROP_YEAR "2010-2016" )
set(COOLPROP_PUBLISHER "The CoolProp developers")
# Add definitions to silence warnings in MSVC2017 related to shared ptr code.
#if (MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS_EQUAL 1919) # OR MSVC_TOOLSET_VERSION EQUAL 141) # This requuires CMake >= 3.7
# add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
#endif (MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS_EQUAL 1919)
if(MSVC
AND NOT (MSVC_VERSION LESS 1910)
AND NOT (MSVC_VERSION GREATER 1919))
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
endif()
if(COOLPROP_RELEASE AND COOLPROP_DEBUG)
message(FATAL_ERROR "You can only make a release OR and debug build.")
endif()
if(COOLPROP_RELEASE)
set(CMAKE_BUILD_TYPE Release)
elseif(COOLPROP_DEBUG)
set(CMAKE_BUILD_TYPE Debug)
#ELSEIF ("${CMAKE_BUILD_TYPE}" STREQUAL "")
# IF("${COOLPROP_VERSION_REVISION}" STREQUAL "dev")
# SET(CMAKE_BUILD_TYPE Debug)
# ELSE ()
# SET(CMAKE_BUILD_TYPE Release)
# ENDIF()
endif()
if(COOLPROP_MSVC_STATIC)
set(COOLPROP_MSVC_REL "/MT")
if(COOLPROP_MSVC_DEBUG)
set(COOLPROP_MSVC_DBG "/MTd")
else()
set(COOLPROP_MSVC_DBG "/MT")
endif()
elseif(COOLPROP_MSVC_DYNAMIC)
set(COOLPROP_MSVC_REL "/MD")
if(COOLPROP_MSVC_DEBUG)
set(COOLPROP_MSVC_DBG "/MDd")
else()
set(COOLPROP_MSVC_DBG "/MD")
endif()
else(COOLPROP_MSVC_DYNAMIC)
set(COOLPROP_MSVC_REL "IGNORE")
set(COOLPROP_MSVC_DBG "IGNORE")
endif()
set(COOLPROP_MSVC_ALL "/MTd" "/MT" "/MDd" "/MD"
)# order matters "/MXd" before "/MX"
#######################################
# FIND ALL SOURCES #
#-------------------------------------#
# The project is organised with #
# split includes and source folders #
# this makes it easier for developers #
# to quickly find relevant includes. #
# This section finds all sources, #
# headers and corresponding dirs. #
#######################################
# These backends will be compiled in
set(COOLPROP_ENABLED_BACKENDS
Cubics
IF97
Helmholtz
REFPROP
Incompressible
Tabular
PCSAFT)
# Get everything in the src/ directory (always), but not recursive
file(GLOB APP_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
# For each enabled backend, grab its files
foreach(backend ${COOLPROP_ENABLED_BACKENDS})
file(GLOB_RECURSE BACKEND_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/src/Backends/${backend}/*.cpp")
list(APPEND APP_SOURCES ${BACKEND_SOURCES})
endforeach()
## You can exclude this file, in case you want to run your own tests or use Catch
list(REMOVE_ITEM APP_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/Tests/Tests.cpp")
list(REMOVE_ITEM APP_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/src/Tests/CoolProp-Tests.cpp")
## This file is only needed for the library, normal builds do not need it.
list(REMOVE_ITEM APP_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/CoolPropLib.cpp")
set(APP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
list(APPEND APP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/externals/Eigen")
list(APPEND APP_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/externals/msgpack-c/include")
list(APPEND APP_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/externals/fmtlib/include")
list(APPEND APP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/externals/fmtlib"
)# should be deprecated
list(APPEND APP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include")
list(APPEND APP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
## Set endianess for msgpack on ARM64 with MSVC
#if(MSVC)
# if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "ARM64")
# message(STATUS "Forcing msgpack-c to use little endian configuration")
# add_compile_definitions(MSGPACK_ENDIAN_LITTLE_BYTE)
# endif()
#endif()
include_directories(${APP_INCLUDE_DIRS})
set(SWIG_DEPENDENCIES
${CMAKE_CURRENT_SOURCE_DIR}/include/DataStructures.h
${CMAKE_CURRENT_SOURCE_DIR}/include/CoolProp.h
${CMAKE_CURRENT_SOURCE_DIR}/include/AbstractState.h
${CMAKE_CURRENT_SOURCE_DIR}/include/Configuration.h
${CMAKE_CURRENT_SOURCE_DIR}/include/PhaseEnvelope.h)
set(COOLPROP_APP_SOURCES
${APP_SOURCES}
CACHE LIST "List of CPP sources needed for CoolProp")
set(COOLPROP_INCLUDE_DIRECTORIES
${APP_INCLUDE_DIRS}
CACHE LIST "List of include directories needed for CoolProp")
#######################################
# REQUIRED MODULES #
#-------------------------------------#
# CoolProp requires some standard OS #
# features, these include: #
# DL (CMAKE_DL_LIBS) for REFPROP #
#######################################
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/dev/cmake/Modules/")
set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5 2.4)
find_package(PythonInterp 2.7)
if(NOT PYTHON_EXECUTABLE)
message(STATUS "Looking for Python")
find_package(Python COMPONENTS Interpreter)
endif()
if(NOT PYTHON_EXECUTABLE)
message(STATUS "Looking for Python2")
find_package(Python2 COMPONENTS Interpreter)
if(Python2_Interpreter_FOUND)
set(PYTHON_EXECUTABLE ${Python2_EXECUTABLE})
endif()
endif()
if(NOT PYTHON_EXECUTABLE)
message(STATUS "Looking for Python3")
find_package(Python3 COMPONENTS Interpreter)
if(Python3_Interpreter_FOUND)
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
endif()
endif()
if(NOT PYTHON_EXECUTABLE)
message(WARNING "Could not find Python, be prepared for errors.")
endif()
if(CMAKE_DL_LIBS)
find_package(${CMAKE_DL_LIBS} REQUIRED)
endif()
include(FlagFunctions) # Is found since it is in the module path.
macro(modify_msvc_flag_release flag_new) # Use a macro to avoid a new scope
foreach(flag_old IN LISTS COOLPROP_MSVC_ALL)
remove_compiler_flag_release("${flag_old} ") # add a space
remove_compiler_flag_release(" ${flag_old}") # add a space
endforeach()
add_compiler_flag_release("${flag_new}")
endmacro()
macro(modify_msvc_flag_debug flag_new) # Use a macro to avoid a new scope
foreach(flag_old IN LISTS COOLPROP_MSVC_ALL)
remove_compiler_flag_debug("${flag_old} ") # add a space
remove_compiler_flag_debug(" ${flag_old}") # add a space
endforeach()
add_compiler_flag_debug("${flag_new}")
endmacro()
macro(modify_msvc_flags flag_default) # Use a macro to avoid a new scope
if(NOT "${COOLPROP_MSVC_REL}" STREQUAL "IGNORE")
modify_msvc_flag_release("${COOLPROP_MSVC_REL}")
else()
modify_msvc_flag_release("${flag_default}")
endif()
if(NOT "${COOLPROP_MSVC_DBG}" STREQUAL "IGNORE")
modify_msvc_flag_debug("${COOLPROP_MSVC_DBG}")
else()
modify_msvc_flag_debug("${flag_default}d")
endif()
endmacro()
#if(MSVC)
# add_compiler_flag_release("/EHsc")
# add_compiler_flag_debug("/EHsc")
#endif()
#######################################
# BITNESS #
#-------------------------------------#
# Calculate if 32 or 64 #
#######################################
if(WIN32)
if(CMAKE_CL_64)
set(BITNESS "64")
else()
set(BITNESS "32")
endif()
else()
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
set(BITNESS "64")
else()
set(BITNESS "32")
endif()
endif()
if(MSVC AND (FORCE_BITNESS_32 OR FORCE_BITNESS_64))
message(
STATUS
"You cannot force a certain bitness for Visual Studio, use the generator settings for this purpose."
)
message(
STATUS
"Pass '-G \"Visual Studio 10 2010 Win64\"' to CMake to make a 64bit binary using VS2010."
)
message(
STATUS
"Pass '-G \"Visual Studio 10 2010\"' to CMake to make a 32bit binary using VS2010."
)
message(
STATUS
"Pass '-G \"Visual Studio 9 2008 Win64\"' to CMake to make a 64bit binary using VS2008."
)
message(
STATUS
"Pass '-G \"Visual Studio 9 2008\"' to CMake to make a 32bit binary using VS2008."
)
message(FATAL_ERROR "Fix that and try again...")
endif()
if(FORCE_BITNESS_32)
set(BITNESS "32")
elseif(FORCE_BITNESS_64)
set(BITNESS "64")
elseif(FORCE_BITNESS_NATIVE)
set(BITNESS "NATIVE")
endif()
#######################################
# SHARED POINTER #
#-------------------------------------#
# In this section we define the #
# flags needed to use shared_ptr #
# reliably #
#######################################
include("${CMAKE_CURRENT_SOURCE_DIR}/dev/cmake/Modules/FindSharedPtr.cmake")
find_shared_ptr()
if(NOT SHARED_PTR_FOUND)
message(FATAL_ERROR "Must be able to find shared_ptr")
else()
if(SHARED_PTR_TR1_MEMORY_HEADER)
add_definitions("-DSHARED_PTR_TR1_MEMORY_HEADER")
endif()
if(SHARED_PTR_TR1_NAMESPACE)
add_definitions("-DSHARED_PTR_TR1_NAMESPACE")
endif()
endif()
#######################################
# MAKE ARTEFACTS #
#-------------------------------------#
# In this section we define the #
# artefacts (exes, libs) that will be #
# made for CoolProp, these include #
# customisation from earlier options. #
#######################################
### FLUIDS, MIXTURES JSON ###
add_custom_target(
generate_headers
COMMAND "${PYTHON_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/dev/generate_headers.py")
if(NOT COOLPROP_NO_EXAMPLES)
add_custom_target(
generate_examples
COMMAND "${PYTHON_EXECUTABLE}" example_generator.py Python
"${CMAKE_CURRENT_BINARY_DIR}/Example.py"
COMMAND "${PYTHON_EXECUTABLE}" example_generator.py Octave
"${CMAKE_CURRENT_BINARY_DIR}/Example.m"
COMMAND "${PYTHON_EXECUTABLE}" example_generator.py R
"${CMAKE_CURRENT_BINARY_DIR}/Example.R"
#COMMAND "${PYTHON_EXECUTABLE}" example_generator.py MATLAB "${CMAKE_CURRENT_BINARY_DIR}/Example.m"
COMMAND "${PYTHON_EXECUTABLE}" example_generator.py Java
"${CMAKE_CURRENT_BINARY_DIR}/Example.java"
COMMAND "${PYTHON_EXECUTABLE}" example_generator.py Csharp
"${CMAKE_CURRENT_BINARY_DIR}/Example.cs"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/dev/scripts/examples")
else()
add_custom_target(
generate_examples
COMMAND
echo
"Example generation has been disabled with the COOLPROP_NO_EXAMPLES option."
)
endif()
### Library options ###
# We already know the bitness from the earlier
# settings. Let us rely on that and only handle
# calling conventions and shared/static issues.
option(COOLPROP_STDCALL_LIBRARY
"Build CoolProp as a 32bit shared library with stdcall" OFF)
option(COOLPROP_CDECL_LIBRARY
"Build CoolProp as a 32bit shared library with cdecl" OFF)
option(COOLPROP_EXTERNC_LIBRARY
"Overwrite the export settings to force extern C" OFF)
set(COOLPROP_LIBRARY_SOURCE
"src/CoolPropLib.cpp"
CACHE STRING "The file that contains the exported functions")
set(COOLPROP_LIBRARY_HEADER
"include/CoolPropLib.h"
CACHE STRING "The file that contains the export header")
set(COOLPROP_LIBRARY_NAME
"${app_name}"
CACHE STRING "The name of the generated library")
set(COOLPROP_LIBRARY_EXPORTS
""
CACHE STRING "The file that contains the export alias list")
# Rule out cases that do not make sense
if("${BITNESS}" STREQUAL "32")
if(COOLPROP_CDECL_LIBRARY)
set(CONVENTION "__cdecl")
elseif(COOLPROP_STDCALL_LIBRARY)
set(CONVENTION "__stdcall")
else()
set(CONVENTION "")
endif()
elseif("${BITNESS}" STREQUAL "64")
if(COOLPROP_CDECL_LIBRARY)
message(WARNING "You cannot use cdecl conventions in a 64-bit library.")
elseif(COOLPROP_STDCALL_LIBRARY)
message(WARNING "You cannot use stdcall conventions in a 64-bit library.")
endif()
set(CONVENTION "")
elseif("${BITNESS}" STREQUAL "NATIVE")
set(CONVENTION "")
else()
message(FATAL_ERROR "Bitness is not defined. Set it and run cmake again.")
endif()
if((COOLPROP_OBJECT_LIBRARY AND COOLPROP_STATIC_LIBRARY)
OR (COOLPROP_OBJECT_LIBRARY AND COOLPROP_SHARED_LIBRARY)
OR (COOLPROP_STATIC_LIBRARY AND COOLPROP_SHARED_LIBRARY))
message(FATAL_ERROR "You can only use one of the library switches!")
endif()
if(COOLPROP_OBJECT_LIBRARY
OR COOLPROP_STATIC_LIBRARY
OR COOLPROP_SHARED_LIBRARY)
# Project name
set(LIB_NAME ${COOLPROP_LIBRARY_NAME})
# Object, static or shared?
if(COOLPROP_OBJECT_LIBRARY)
add_library(${LIB_NAME} OBJECT ${APP_SOURCES})
set(COOLPROP_LIBRARY_SOURCE "")
set(COOLPROP_LIBRARY_HEADER "")
elseif(COOLPROP_STATIC_LIBRARY)
list(APPEND APP_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/${COOLPROP_LIBRARY_SOURCE}")
add_library(${LIB_NAME} STATIC ${APP_SOURCES} ${COOLPROP_LIBRARY_EXPORTS})
if(MSVC)
# Add postfix for debugging
set_property(TARGET ${LIB_NAME} PROPERTY DEBUG_POSTFIX d)
set_property(TARGET ${LIB_NAME} PROPERTY RELEASE_POSTFIX)
modify_msvc_flags("/MD")
# Note that the default is not used if ${COOLPROP_MSVC_REL} or ${COOLPROP_MSVC_DBG} is set
endif(MSVC)
install(
TARGETS ${LIB_NAME}
DESTINATION
static_library/${CMAKE_SYSTEM_NAME}/${BITNESS}bit_${CMAKE_CXX_COMPILER_ID}_${CMAKE_CXX_COMPILER_VERSION}
)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COOLPROP_LIBRARY_HEADER}
DESTINATION static_library)
elseif(COOLPROP_SHARED_LIBRARY)
list(APPEND APP_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/${COOLPROP_LIBRARY_SOURCE}")
add_library(${LIB_NAME} SHARED ${APP_SOURCES} ${COOLPROP_LIBRARY_EXPORTS})
install(
TARGETS ${LIB_NAME}
DESTINATION shared_library/${CMAKE_SYSTEM_NAME}/${BITNESS}bit${CONVENTION}
)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COOLPROP_LIBRARY_HEADER}
DESTINATION shared_library)
set_property(
TARGET ${LIB_NAME}
APPEND_STRING
PROPERTY COMPILE_FLAGS " -DCOOLPROP_LIB")
# Now all the compiler specific settings for Visual Studio
if(MSVC)
# Add postfix for debugging
set_property(TARGET ${LIB_NAME} PROPERTY DEBUG_POSTFIX d)
set_property(TARGET ${LIB_NAME} PROPERTY RELEASE_POSTFIX)
# No lib prefix for the shared library
set_property(TARGET ${LIB_NAME} PROPERTY PREFIX "")
modify_msvc_flags("/MT")
# Note that the default is not used if ${COOLPROP_MSVC_REL} or ${COOLPROP_MSVC_DBG} is set
add_custom_command(
TARGET ${LIB_NAME}
POST_BUILD
COMMAND dumpbin /EXPORTS $<TARGET_FILE:${LIB_NAME}> >
${CMAKE_CURRENT_BINARY_DIR}/exports.txt)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/exports.txt
DESTINATION
shared_library/${CMAKE_SYSTEM_NAME}/${BITNESS}bit${CONVENTION})
endif()
# For Linux
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set_property(TARGET ${LIB_NAME} PROPERTY VERSION ${COOLPROP_VERSION})
set_property(TARGET ${LIB_NAME} PROPERTY SOVERSION
${COOLPROP_VERSION_MAJOR})
endif()
else()
message(FATAL_ERROR "You have to build a static or shared library.")
endif()
if(NOT COOLPROP_OBJECT_LIBRARY)
target_link_libraries(${LIB_NAME} ${CMAKE_DL_LIBS})
endif()
# For windows systems, bug workaround for Eigen
if(MSVC90)
message(STATUS "EIGEN WORKAROUND ACTIVE!!")
set_property(
TARGET ${LIB_NAME}
APPEND_STRING
PROPERTY COMPILE_FLAGS " -DEIGEN_DONT_VECTORIZE")
endif()
# For mac systems, explicitly set the c++ libraries
if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
if(DEFINED OSX_COMPILE_FLAGS)
set_target_properties(
${LIB_NAME} PROPERTIES APPEND_STRING PROPERTY COMPILE_FLAGS
"${OSX_COMPILE_FLAGS}")
endif(DEFINED OSX_COMPILE_FLAGS)
if(DEFINED OSX_COMPILE_FLAGS)
set_target_properties(
${LIB_NAME} PROPERTIES APPEND_STRING PROPERTY LINK_FLAGS
"${OSX_LINK_FLAGS}")
endif(DEFINED OSX_COMPILE_FLAGS)
endif()
# Name mangling settings
if(COOLPROP_EXTERNC_LIBRARY)
set_property(
TARGET ${LIB_NAME}
APPEND_STRING
PROPERTY COMPILE_FLAGS " -DEXTERNC")
endif()
### All options are set, we are building a library ###
add_dependencies(${LIB_NAME} generate_headers)
#
if(CMAKE_VERSION VERSION_GREATER 3.0)
# Add target include directories for easy linking with other applications
target_include_directories(${LIB_NAME} PUBLIC ${APP_INCLUDE_DIRS})
endif()
# Set the bitness
if(NOT MSVC)
if(NOT "${BITNESS}" STREQUAL "NATIVE")
message(STATUS "Setting bitness flag -m${BITNESS}")
set_property(
TARGET ${LIB_NAME}
APPEND_STRING
PROPERTY COMPILE_FLAGS " -m${BITNESS}")
set_property(
TARGET ${LIB_NAME}
APPEND_STRING
PROPERTY LINK_FLAGS " -m${BITNESS}")
endif()
endif()
# ADD -fPIC flag if needed
if(COOLPROP_FPIC)
message(STATUS "Setting fPIC flag")
set_property(
TARGET ${LIB_NAME}
APPEND_STRING
PROPERTY COMPILE_FLAGS " -fPIC")
endif()
#
# calling conventions
if(("${CONVENTION}" STREQUAL "NULL") OR ("${CONVENTION}" STREQUAL ""))
#MESSAGE(STATUS "Skipping unknown calling convention.")
else()
set_property(
TARGET ${LIB_NAME}
APPEND_STRING
PROPERTY COMPILE_FLAGS " -DCONVENTION=${CONVENTION}")
endif()
#
#set_property(SOURCE MyFile.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -msse4.1 ")
message(STATUS "Library compilation detected:")
message(STATUS "Creating ${LIB_NAME}, a ${BITNESS}-bit library")
message(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
message(STATUS "COOLPROP_STATIC_LIBRARY: ${COOLPROP_STATIC_LIBRARY}")
message(STATUS "COOLPROP_SHARED_LIBRARY: ${COOLPROP_SHARED_LIBRARY}")
message(STATUS "COOLPROP_OBJECT_LIBRARY: ${COOLPROP_OBJECT_LIBRARY}")
message(STATUS "CONVENTION: ${CONVENTION}")
message(STATUS "COOLPROP_LIBRARY_HEADER: ${COOLPROP_LIBRARY_HEADER}")
message(STATUS "COOLPROP_LIBRARY_SOURCE: ${COOLPROP_LIBRARY_SOURCE}")
#
get_property(
tmpVar
TARGET ${LIB_NAME}
PROPERTY COMPILE_FLAGS)
message(STATUS "COMPILE_FLAGS: ${tmpVar}")
get_property(
tmpVar
TARGET ${LIB_NAME}
PROPERTY LINK_FLAGS)
message(STATUS "LINK_FLAGS: ${tmpVar}")
#
endif()
if(COOLPROP_IOS_TARGET)
# Set the Base SDK (only change the SDKVER value, if for instance, you are building for iOS 5.0):
set(SDKVER "9.2")
set(DEVROOT
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer"
)
set(SDKROOT "${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk")
if(EXISTS ${SDKROOT})
set(CMAKE_OSX_SYSROOT "${SDKROOT}")
else()
message("Warning, iOS Base SDK path not found: " ${SDKROOT})
endif()
# Will resolve to "Standard (armv6 armv7)" on Xcode 4.0.2 and to "Standard (armv7)" on Xcode 4.2:
set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_BIT)")
# seamless toggle between device and simulator
set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(COOLPROP_DEBIAN_PACKAGE)
if(NOT UNIX)
message(
FATAL_ERROR "COOLPROP_DEBIAN_PACKAGE can only be used on linux host")
endif()
list(APPEND APP_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/CoolPropLib.cpp")
add_library(${app_name} SHARED ${APP_SOURCES})
set_target_properties(
${app_name} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DCOOLPROP_LIB")
set_target_properties(
${app_name} PROPERTIES VERSION ${COOLPROP_VERSION}
SOVERSION ${COOLPROP_VERSION_MAJOR})
add_dependencies(${app_name} generate_headers)
install(TARGETS ${app_name} DESTINATION "${CMAKE_INSTALL_PREFIX}/usr/lib")
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/CoolPropLib.h
DESTINATION "${CMAKE_INSTALL_PREFIX}/usr/include")
endif()
if(COOLPROP_VXWORKS_MAKEFILE)
set(INCLUDE_DIRECTORIES)
foreach(_srcFile ${APP_INCLUDE_DIRS})
string(CONCAT _el "-I\"" ${_srcFile} "\"")
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "$(COOLPROP_ROOT)" _el
"${_el}")
list(APPEND INCLUDE_DIRECTORIES ${_el})
endforeach()
string(REPLACE ";" " " INCLUDE_DIRECTORIES "${INCLUDE_DIRECTORIES}")
set(OLD_ROOT /home/ian/.wine/drive_c/)
set(NEW_ROOT c:/)
string(REPLACE ${OLD_ROOT} ${NEW_ROOT} INCLUDE_DIRECTORIES
"${INCLUDE_DIRECTORIES}")
set(SRC "${CMAKE_CURRENT_SOURCE_DIR}/src")
string(REPLACE ${OLD_ROOT} ${NEW_ROOT} SRC "${SRC}")
file(RELATIVE_PATH COOLPROP_ROOT "${CMAKE_CURRENT_BINARY_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/wrappers/Labview/vxWorks/Makefile.in"
"vxWorksMakefile")
endif()
if(COOLPROP_VXWORKS_LIBRARY_MODULE OR COOLPROP_VXWORKS_LIBRARY)
list(APPEND APP_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/CoolPropLib.cpp")
add_executable(${app_name} ${APP_SOURCES})
set_target_properties(
${app_name} PROPERTIES SUFFIX ".out" COMPILE_FLAGS
"${COMPILE_FLAGS} -DEXTERNC")
add_dependencies(${app_name} generate_headers)
install(TARGETS ${app_name}
DESTINATION "${COOLPROP_INSTALL_PREFIX}/shared_library/VxWorks")
endif()
if(COOLPROP_PRIME_MODULE)
if(NOT WIN32)
message(
FATAL_ERROR "COOLPROP_PRIME_MODULE can only be used on windows host")
endif()
if("${COOLPROP_PRIME_ROOT}" STREQUAL "")
message(
FATAL_ERROR
"You must provide the path to MathCAD Prime Root directory using something like -DCOOLPROP_PRIME_ROOT=\"C:/Program Files/PTC/Mathcad Prime 3.1\""
)
else()
message(STATUS "COOLPROP_PRIME_ROOT: ${COOLPROP_PRIME_ROOT}")
endif()
list(APPEND APP_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/CoolPropLib.cpp")
list(APPEND APP_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/wrappers/MathCAD/CoolPropMathcad.cpp")
add_library(CoolPropMathcadWrapper SHARED ${APP_SOURCES})
include_directories("${COOLPROP_PRIME_ROOT}/Custom Functions")
target_link_libraries(CoolPropMathcadWrapper
"${COOLPROP_PRIME_ROOT}/Custom Functions/mcaduser.lib")
set_target_properties(CoolPropMathcadWrapper
PROPERTIES LINK_FLAGS "/ENTRY:\"DllEntryPoint\"")
add_dependencies(CoolPropMathcadWrapper generate_headers)
set_target_properties(CoolPropMathcadWrapper PROPERTIES SUFFIX ".dll" PREFIX
"")
install(TARGETS CoolPropMathcadWrapper
DESTINATION "${COOLPROP_INSTALL_PREFIX}/MathCADPrime")
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/wrappers/MathCAD/Prime/CoolPropFluidProperties.mcdx"
DESTINATION MathCADPrime)
endif()
if(COOLPROP_MATHCAD15_MODULE)
if(NOT WIN32)
message(
FATAL_ERROR "COOLPROP_MATHCAD15_MODULE can only be used on windows host")
endif()
if("${COOLPROP_MATHCAD15_ROOT}" STREQUAL "")
message(
FATAL_ERROR
"You must provide the path to MathCAD 15 Root directory using something like -DCOOLPROP_MATHCAD15_ROOT=\"C:/Program Files (x86)/Mathcad/Mathcad 15\""
)
else()
message(STATUS "COOLPROP_MATHCAD15_ROOT: ${COOLPROP_MATHCAD15_ROOT}")
endif()
list(APPEND APP_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/CoolPropLib.cpp")
list(APPEND APP_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/wrappers/MathCAD/CoolPropMathcad.cpp")
add_library(CoolPropMathcadWrapper SHARED ${APP_SOURCES})
include_directories("${COOLPROP_MATHCAD15_ROOT}/userefi/microsft/include")
target_link_libraries(
CoolPropMathcadWrapper
"${COOLPROP_MATHCAD15_ROOT}/userefi/microsft/lib/mcaduser.lib")
set_target_properties(CoolPropMathcadWrapper
PROPERTIES LINK_FLAGS "/ENTRY:\"DllEntryPoint\"")
add_dependencies(CoolPropMathcadWrapper generate_headers)
set_target_properties(CoolPropMathcadWrapper PROPERTIES SUFFIX ".dll" PREFIX
"")
install(TARGETS CoolPropMathcadWrapper
DESTINATION "${COOLPROP_INSTALL_PREFIX}/MathCAD15")
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/wrappers/MathCAD/CoolPropFluidProperties.xmcdz"
DESTINATION MathCAD15)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/wrappers/MathCAD/CoolProp_EN.xml"
DESTINATION MathCAD15)
endif()
# EES is only compiled for 32bit Windows
if(COOLPROP_EES_MODULE)
if(NOT "${BITNESS}" STREQUAL "32")
message(FATAL_ERROR "You cannot build the EES wrapper as a 64-bit library.")
endif()
# Prepare the sources
include_directories(${APP_INCLUDE_DIRS})
list(APPEND APP_SOURCES "wrappers/EES/main.cpp")
list(APPEND APP_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/${COOLPROP_LIBRARY_SOURCE}")
add_library(COOLPROP_EES SHARED ${APP_SOURCES})
# Modify the target and add dependencies
add_dependencies(COOLPROP_EES generate_headers)
set_target_properties(
COOLPROP_EES
PROPERTIES COMPILE_FLAGS
"${COMPILE_FLAGS} -DCOOLPROP_LIB -DCONVENTION=__cdecl")
set_target_properties(COOLPROP_EES PROPERTIES SUFFIX ".dlf" PREFIX "")
# Creates "COOLPROP_EES.dlf"
if(NOT MSVC)
set_target_properties(COOLPROP_EES PROPERTIES COMPILE_FLAGS "-m32"
LINK_FLAGS "-m32")
elseif(MSVC)
set_target_properties(COOLPROP_EES PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(COOLPROP_EES PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(
COOLPROP_EES PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
${CMAKE_CURRENT_BINARY_DIR})
# etc for the other available configuration types (MinSizeRel, RelWithDebInfo)
endif()
# copy required files
add_custom_command(
TARGET COOLPROP_EES
PRE_BUILD
COMMAND
${CMAKE_COMMAND} ARGS "-E" "copy"
"${CMAKE_CURRENT_SOURCE_DIR}/wrappers/EES/CoolProp.htm"
"${CMAKE_CURRENT_BINARY_DIR}/."
COMMAND
${CMAKE_COMMAND} ARGS "-E" "copy"
"${CMAKE_CURRENT_SOURCE_DIR}/wrappers/EES/CoolProp.LIB"
"${CMAKE_CURRENT_BINARY_DIR}/."
COMMAND
${CMAKE_COMMAND} ARGS "-E" "copy"
"${CMAKE_CURRENT_SOURCE_DIR}/wrappers/EES/CoolProp_EES_Sample.EES"
"${CMAKE_CURRENT_BINARY_DIR}/."
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Copying the EES files to the build directory"
VERBATIM)
# install the generated library and the other files
install(TARGETS COOLPROP_EES
DESTINATION "${CMAKE_INSTALL_PREFIX}/EES/${CMAKE_SYSTEM_NAME}")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/wrappers/EES/CoolProp.htm"
DESTINATION "${CMAKE_INSTALL_PREFIX}/EES/${CMAKE_SYSTEM_NAME}")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/wrappers/EES/CoolProp.LIB"
DESTINATION "${CMAKE_INSTALL_PREFIX}/EES/${CMAKE_SYSTEM_NAME}")
install(
FILES "${CMAKE_CURRENT_SOURCE_DIR}/wrappers/EES/CoolProp_EES_Sample.EES"
DESTINATION "${CMAKE_INSTALL_PREFIX}/EES/${CMAKE_SYSTEM_NAME}")
endif()
# Windows package
if(COOLPROP_WINDOWS_PACKAGE)
message(
STATUS "Creating Windows installer for COOLPROP_VERSION=${COOLPROP_VERSION}"
)
# Setting some basic build paths
set(COOLPROP_WINDOWS_PACKAGE_32B_DIR "${CMAKE_CURRENT_BINARY_DIR}/32bitDLL")
set(COOLPROP_WINDOWS_PACKAGE_32B_DIR_STDCALL
"${CMAKE_CURRENT_BINARY_DIR}/32bitDLL_stdcall")
set(COOLPROP_WINDOWS_PACKAGE_32B_DIR_CDECL
"${CMAKE_CURRENT_BINARY_DIR}/32bitDLL_cdecl")
set(COOLPROP_WINDOWS_PACKAGE_64B_DIR "${CMAKE_CURRENT_BINARY_DIR}/64bitDLL")
set(COOLPROP_WINDOWS_PACKAGE_EES_DIR "${CMAKE_CURRENT_BINARY_DIR}/EES")
set(COOLPROP_WINDOWS_PACKAGE_TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/InnoScript")
# Pointers to the sources
set(COOLPROP_WINDOWS_PACKAGE_EXCEL_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/wrappers/Excel")
set(COOLPROP_WINDOWS_PACKAGE_ISS_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/externals/ExcelAddinInstaller")
# Generator for DLLs
set(COOLPROP_WINDOWS_PACKAGE_DLL_GEN "${CMAKE_GENERATOR}"
)# Use the currently selected generator, architecture is hard-coded below
# Configure variables like version number and build year
configure_file(
"${COOLPROP_WINDOWS_PACKAGE_ISS_DIR}/cmake-templates/config.iss"
"${COOLPROP_WINDOWS_PACKAGE_ISS_DIR}/config.iss")
# Find the installer generator executable
set(BINDIR32_ENV_NAME "ProgramFiles(x86)")
set(BINDIR32 $ENV{${BINDIR32_ENV_NAME}})
set(BINDIR64_ENV_NAME "ProgramFiles")
set(BINDIR64 $ENV{${BINDIR64_ENV_NAME}})
find_program(
COOLPROP_WINDOWS_PACKAGE_ISS_EXE
NAMES iscc.exe
HINTS "${BINDIR32}/Inno Setup 6" "${BINDIR64}/Inno Setup 6")
# ******************************************************************
# Add the targets that prepare the build directory for the subbuilds
# ******************************************************************
add_custom_target(COOLPROP_WINDOWS_PACKAGE_PREPARE)
# Prepare directories
add_custom_command(
TARGET COOLPROP_WINDOWS_PACKAGE_PREPARE
PRE_BUILD
COMMAND ${CMAKE_COMMAND} ARGS "-E" "make_directory"
"${COOLPROP_WINDOWS_PACKAGE_32B_DIR}"
COMMAND ${CMAKE_COMMAND} ARGS "-E" "make_directory"
"${COOLPROP_WINDOWS_PACKAGE_32B_DIR_STDCALL}"
COMMAND ${CMAKE_COMMAND} ARGS "-E" "make_directory"
"${COOLPROP_WINDOWS_PACKAGE_32B_DIR_CDECL}"
COMMAND ${CMAKE_COMMAND} ARGS "-E" "make_directory"
"${COOLPROP_WINDOWS_PACKAGE_64B_DIR}"
COMMAND ${CMAKE_COMMAND} ARGS "-E" "make_directory"
"${COOLPROP_WINDOWS_PACKAGE_EES_DIR}"
COMMAND ${CMAKE_COMMAND} ARGS "-E" "make_directory"
"${COOLPROP_WINDOWS_PACKAGE_TMP_DIR}"
COMMAND ${CMAKE_COMMAND} ARGS "-E" "make_directory"
"${COOLPROP_WINDOWS_PACKAGE_TMP_DIR}/source"
#COMMAND ${CMAKE_COMMAND} ARGS "-E" "remove_directory" "${COOLPROP_WINDOWS_PACKAGE_TMP_DIR}/deploy"
COMMAND ${CMAKE_COMMAND} ARGS "-E" "make_directory"
"${COOLPROP_WINDOWS_PACKAGE_TMP_DIR}/deploy"
#COMMAND ${CMAKE_COMMAND} ARGS "-E" "remove_directory" "${COOLPROP_WINDOWS_PACKAGE_TMP_DIR}/bin"
COMMAND ${CMAKE_COMMAND} ARGS "-E" "make_directory"
"${COOLPROP_WINDOWS_PACKAGE_TMP_DIR}/bin"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Preparing the directories for the Windows installer"
VERBATIM)
add_custom_target(COOLPROP_WINDOWS_PACKAGE_DELETE)
# Delete directories
add_custom_command(
TARGET COOLPROP_WINDOWS_PACKAGE_DELETE
PRE_BUILD
COMMAND ${CMAKE_COMMAND} ARGS "-E" "make_directory"
"${COOLPROP_WINDOWS_PACKAGE_TMP_DIR}/source"
COMMAND ${CMAKE_COMMAND} ARGS "-E" "remove_directory"
"${COOLPROP_WINDOWS_PACKAGE_TMP_DIR}/deploy"
COMMAND ${CMAKE_COMMAND} ARGS "-E" "make_directory"
"${COOLPROP_WINDOWS_PACKAGE_TMP_DIR}/deploy"
COMMAND ${CMAKE_COMMAND} ARGS "-E" "remove_directory"
"${COOLPROP_WINDOWS_PACKAGE_TMP_DIR}/bin"
COMMAND ${CMAKE_COMMAND} ARGS "-E" "make_directory"
"${COOLPROP_WINDOWS_PACKAGE_TMP_DIR}/bin"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Removing the old build directories for the Windows installer"
VERBATIM)
# **************************************************************
# Add the target for the shared libraries, 2x 32bit and 1x 64bit
# **************************************************************
add_custom_target(COOLPROP_WINDOWS_PACKAGE_SHARED_LIBRARIES)
add_dependencies(COOLPROP_WINDOWS_PACKAGE_SHARED_LIBRARIES
COOLPROP_WINDOWS_PACKAGE_PREPARE)
# Copy the header file
add_custom_command(