forked from ooRexx/ooRexx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
2265 lines (2069 loc) · 116 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
#/*----------------------------------------------------------------------------*/
#/* */
#/* Copyright (c) 2014-2019 Rexx Language Association. All rights reserved. */
#/* */
#/* This program and the accompanying materials are made available under */
#/* the terms of the Common Public License v1.0 which accompanies this */
#/* distribution. A copy is also available at the following address: */
#/* http://www.oorexx.org/license.html */
#/* */
#/* Redistribution and use in source and binary forms, with or */
#/* without modification, are permitted provided that the following */
#/* conditions are met: */
#/* */
#/* Redistributions of source code must retain the above copyright */
#/* notice, this list of conditions and the following disclaimer. */
#/* Redistributions in binary form must reproduce the above copyright */
#/* notice, this list of conditions and the following disclaimer in */
#/* the documentation and/or other materials provided with the distribution. */
#/* */
#/* Neither the name of Rexx Language Association nor the names */
#/* of its contributors may be used to endorse or promote products */
#/* derived from this software without specific prior written permission. */
#/* */
#/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
#/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
#/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
#/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
#/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
#/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
#/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
#/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
#/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
#/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
#/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
#/* */
#/*----------------------------------------------------------------------------*/
#/*----------------------------------------------------------------------------*/
#/* Global settings */
#/*----------------------------------------------------------------------------*/
message(STATUS "CMake version is ${CMAKE_VERSION}")
if (APPLE)
# apple build with lower cmake version have an @rpath problem
cmake_minimum_required (VERSION 3.12)
else()
#for other platforms
cmake_minimum_required (VERSION 2.8)
endif()
cmake_policy(VERSION 2.8...3.3)
include(CheckIncludeFile)
include(CheckLibraryExists)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
include(CheckStructHasMember)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set (CMAKE_PDB_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
set (CMAKE_SAMPLES_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/samples)
#/*----------------------------------------------------------------------------*/
#/* Project settings */
#/*----------------------------------------------------------------------------*/
project (ooRexx)
# The version of ooRexx to make
set (ORX_MAJOR 5)
set (ORX_MINOR 0)
set (ORX_MOD_LVL 0)
set (ORX_BLD_LVL 0)
set (ORX_VERSION ${ORX_MAJOR}.${ORX_MINOR}.${ORX_MOD_LVL})
set (ORX_NODOT_VERSION ${ORX_MAJOR}${ORX_MINOR}${ORX_MOD_LVL})
set (ORX_VER_STR ${ORX_MAJOR}.${ORX_MINOR}.${ORX_MOD_LVL})
string(TIMESTAMP ORX_YEAR %Y)
set (ORX_COPY_YEAR 2005-${ORX_YEAR})
string(TOUPPER ${CMAKE_SYSTEM_NAME} ORX_SYS_STR)
# Platform independent architecture test
if (CMAKE_SIZEOF_VOID_P MATCHES 8)
set(ORX_ARCHITECTURE "64")
message(STATUS "Building for a 64-bit architecture")
else ()
set(ORX_ARCHITECTURE "32")
message(STATUS "Building for a 32-bit architecture")
endif ()
# Unix: used in macro create_install_symlink()
set(SYM_LINK_CREATE_FROM 3) # define lower bound
math(EXPR SYM_LINK_CREATE_TO "${ORX_MAJOR}-1") # define upper bound is dependent on ${ORX_MAJOR}
# OOREXX_SHEBANG_PROGRAM default:
set (OOREXX_SHEBANG_PROGRAM "/usr/bin/env rexx")
# if ORX_SHEBANG defined change default shebang accordingly
if (ORX_SHEBANG)
if (${ORX_SHEBANG} STREQUAL "1")
# set hard coded path to installation directory
if (WIN32)
# Windows does not use the shebang, let the default stay
message(STATUS "OOREXX_SHEBANG_PROGRAM: \"${OOREXX_SHEBANG_PROGRAM}\" (default: \"-DORX_SHEBANG=1\" gets ignored on Windows)")
else ()
if (APPLE)
# APPLE-special: install into homedirectory's Applications folder
set (OOREXX_SHEBANG_PROGRAM "$ENV{HOME}/Applications/ooRexx${ORX_VER_STR}/bin/rexx")
else ()
set (OOREXX_SHEBANG_PROGRAM "${CMAKE_INSTALL_PREFIX}/bin/rexx")
endif ()
message(STATUS "OOREXX_SHEBANG_PROGRAM: \"${OOREXX_SHEBANG_PROGRAM}\" (ORX_SHEBANG=1 hence hardcoded to installation directory)")
endif ()
else()
# use supplied string verbatim; note: the shebang "#!" is already supplied in the sample Rexx file
set (OOREXX_SHEBANG_PROGRAM "${ORX_SHEBANG}")
message(STATUS "OOREXX_SHEBANG_PROGRAM: \"${OOREXX_SHEBANG_PROGRAM}\" (value supplied via ORX_SHEBANG)")
endif ()
else ()
message(STATUS "OOREXX_SHEBANG_PROGRAM: \"${OOREXX_SHEBANG_PROGRAM}\" (default)")
endif()
find_package(Subversion)
if(SUBVERSION_FOUND)
set(ORX_WC_REVISION 0)
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} ORX)
set(ORX_BLD_LVL ${ORX_WC_REVISION})
endif()
message(STATUS "SVN Revision Number is ${ORX_BLD_LVL}")
if (WIN32)
# find a xalan executable, but only on windows for now.
FIND_PROGRAM(XALAN_EXECUTABLE xalan
DOC "xalan command line xslt converter")
endif()
# The following supports the versioning of the rexx shared libraries
# This defines the oorexx library version. For ooRexx this should always be the
# same as the ORX_MAJOR number.
set (ORX_CURRENT ${ORX_MAJOR})
# Each public release of ooRexx should increment this number by one except
# when the ORX_MINOR goes back to zero. If that is the case then this entry
# should also be set to zero.
set (ORX_REVISION 0)
# For ooRexx, this number should ALWAYS be zero. This will force the linker to
# utilize all previous releases for linking.
set (ORX_AGE 0)
# Please note that the version-info has nothing to do with the release version.
# You need to know exactly what you are doing in order to get this correct.
set (VERSION_INFO "-version-info ${ORX_CURRENT}:${ORX_REVISION}:${ORX_AGE}")
# This is version information set on library properties
set (ORX_VERSION ${ORX_CURRENT}.${ORX_AGE}.${ORX_REVISION})
# The following are general settings
# Always create shared libraries (DLLs)
set (CMAKE_CXX_CREATE_SHARED_MODULE 1)
# Set the platform subdirectory name
if (WIN32)
set (ORX_PLATFORM_DIR platform/windows)
set (ORX_IMAGE_OUTPUT_LOCATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
else ()
set (ORX_PLATFORM_DIR platform/unix)
set (ORX_IMAGE_OUTPUT_LOCATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
endif ()
# Set path to look for include files
include_directories(BEFORE api api/${ORX_PLATFORM_DIR})
# Rexx search path
set (CMAKE_REXXPATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
if (ORX_REXXPATH)
message(STATUS "Setting REXX search path to ${ORX_REXXPATH}")
set (CMAKE_REXXPATH ${ORX_REXXPATH})
endif()
# Common install variables
SET(CPACK_PACKAGE_VERSION_MAJOR ${ORX_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${ORX_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${ORX_MOD_LVL})
set(CPACK_PACKAGE_NAME "ooRexx")
set(CPACK_PACKAGE_LONG_NAME "Open Object Rexx")
set(CPACK_PACKAGE_VENDOR "Rexx Language Association")
set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/ReleaseNotes)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Object Rexx Interpreter")
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/CPLv1.0.txt)
set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/ReleaseNotes)
# Set install variables
if (WIN32)
# NOTE: specifying "." for the destination will place the files in the
# root directory of the NSIS install. This needs to be a "." to get
# the files in the correct location.
set (INSTALL_EXECUTABLE_DIR .)
set (INSTALL_LIB_DIR .)
set (INSTALL_CLS_DIR .)
set (INSTALL_DOC_DIR doc)
set (INSTALL_INCLUDE_DIR api)
set (INSTALL_SAMPLES_DIR samples)
# NSIS builder locations
# locations of NSIS directories. The first is where we build from,
# the second is source for any template files for configuring the build.
set(NSIS_INSTALLER_DIR ${CMAKE_CURRENT_BINARY_DIR}/NSIS)
set(NSIS_INSTALLER_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${ORX_PLATFORM_DIR}/install)
# NSIS version identifier that includes the build level
set (ORX_VERSION_NSIS ${ORX_MAJOR}.${ORX_MINOR}.${ORX_MOD_LVL}-${ORX_BLD_LVL})
# The DOC source dir is usually specified in native form...need to convert it
# to the CMAKE format for the install commands.
if (DOC_SOURCE_DIR)
file(TO_CMAKE_PATH ${DOC_SOURCE_DIR} DOC_SOURCE_DIR)
endif()
# location where we assemble everything to build the installer
set (NSIS_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/NSIS)
# location for pulling together the install file set
set (NSIS_FILE_DIR ${CMAKE_CURRENT_BINARY_DIR}/NSIS/files)
# Create and add a shortcut item to the list for a component
# This also adds entries to delete the equivalent shortcut
MACRO(install_component_shortcut component name prog arg icon icon_index)
set(NSIS_COMPONENT_SHORTCUTS_${component} "${NSIS_COMPONENT_SHORTCUTS_${component}}\n!insertmacro ConfigureShortCut \"${name}\" ${prog} \"${arg}\" ${icon} \"${icon_index}\"")
ENDMACRO ()
# Create and add a shortcut item to the list for a component for running a rexx program
# This also adds entries to delete the equivalent shortcut
MACRO(install_rexx_shortcut component name launcher program)
set(NSIS_COMPONENT_SHORTCUTS_${component} "${NSIS_COMPONENT_SHORTCUTS_${component}}\n!insertmacro ConfigureRexxShortCut \"${name}\" ${launcher} \"${program}\"")
ENDMACRO ()
# Create and add a shortcut for a documentation element
# This also adds entries to delete the equivalent shortcut
MACRO(install_doc_shortcut name file)
set(NSIS_COMPONENT_SHORTCUTS_Docs "${NSIS_COMPONENT_SHORTCUTS_Docs}\n!insertmacro ConfigureDocShortCut \"${name}\" \"${file}\"")
ENDMACRO ()
else ()
# ------------->
# 2019-01-08, as per Enrico Sorichetti's advice about applying the RPATH settings for maximum flexibility
# do not skip the full RPATH for the build tree
SET( CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH
# only later on when installing
SET( CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
if( APPLE )
SET( CMAKE_INSTALL_RPATH "@executable_path/../lib")
else()
SET( CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
endif()
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# <------------
# if the user didn't specify a CMAKE_INSTALL_PREFIX
# we override the CMake default of /usr/local, instead using:
# * $HOME/Applications/ooRexxV.R.M on macOS
# * /usr on other Unix-like systems
if (APPLE)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX $ENV{HOME}/Applications/ooRexx${ORX_VERSION}
CACHE PATH "Default install path" FORCE)
endif()
set (INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib)
else ()
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX /usr CACHE PATH "Default install path" FORCE)
endif()
find_path(INSTALL_LIB_DIR libc.so PATHS ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64)
# at least on Ubuntu above doesn't seem to work; use fallback:
if (${INSTALL_LIB_DIR} STREQUAL "INSTALL_LIB_DIR-NOTFOUND")
set (INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib)
endif ()
endif ()
message(STATUS "CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX}")
message(STATUS "INSTALL_LIB_DIR is ${INSTALL_LIB_DIR}")
set (INSTALL_EXECUTABLE_DIR ${CMAKE_INSTALL_PREFIX}/bin)
set (INSTALL_CLS_DIR ${INSTALL_EXECUTABLE_DIR})
set (INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
set (INSTALL_SAMPLES_DIR ${CMAKE_INSTALL_PREFIX}/share/${CMAKE_PROJECT_NAME})
set (INSTALL_MAN_DIR ${CMAKE_INSTALL_PREFIX}/share/man)
endif ()
# Set compiler and linker flags common to all build environments
# current trunk uses the C++ "override" keyword, which requires C++11
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif ()
else ()
set (CMAKE_CXX_STANDARD 11)
endif ()
include_directories(${PROJECT_BINARY_DIR})
if (WIN32)
add_definitions(/DORX_VER=${ORX_MAJOR}
/DORX_REL=${ORX_MINOR}
/DORX_MOD=${ORX_MOD_LVL}
/DORX_BLD=${ORX_BLD_LVL}
/DORX_VER_STR=${ORX_VER_STR}
/DOOREXX_COPY_YEAR="${ORX_COPY_YEAR}"
/DORX_SYS_STR="${ORX_SYS_STR}"
/DORX_SHARED_LIBRARY_EXT="${CMAKE_SHARED_LIBRARY_SUFFIX}"
/DORX_REXXPATH="${CMAKE_REXXPATH}"
# suppress CRT_SECURE warnings
# (we might instead use the secure versions, by using these two DEFINEs:
# /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1
# /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1
/D_CRT_SECURE_NO_DEPRECATE
/D_CRT_SECURE_NO_WARNINGS
/D_CRT_NONSTDC_NO_DEPRECATE
/DNOMINMAX
# suppress warning C4291: no matching operator delete found; memory will not be freed if initialization throws an exception
/wd4291
# give errors for missing override specifications or method hiding with warning level 3
# /w34263 /w34266
/DWIN32 /D_WINDOWS /DHAVE_CONFIG_H)
if (${ORX_ARCHITECTURE} STREQUAL "64")
set (EXE_MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${ORX_PLATFORM_DIR}/rexx64.exe.manifest)
set (NSIS_CPU "x86_64")
else ()
set (EXE_MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${ORX_PLATFORM_DIR}/rexx32.exe.manifest)
set (NSIS_CPU "x86_32")
endif ()
file(TO_NATIVE_PATH ${EXE_MANIFEST_FILE} EXE_MANIFEST_FILE)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:524288")
else ()
add_definitions(-DORX_VER=${ORX_MAJOR} -DORX_REL=${ORX_MINOR} -DORX_MOD=${ORX_MOD_LVL} -DORX_BLD=${ORX_BLD_LVL}
-DOOREXX_COPY_YEAR="${ORX_COPY_YEAR}"
-DORX_SYS_STR="${ORX_SYS_STR}"
-D_GNU_SOURCE
-DORX_SHARED_LIBRARY_EXT="${CMAKE_SHARED_LIBRARY_SUFFIX}"
-DORX_REXXPATH="${CMAKE_REXXPATH}"
-D${ORX_SYS_STR} -DOPSYS_${ORX_SYS_STR} -DHAVE_CONFIG_H)
set (ORX_SYSLIB_DL dl)
set (ORX_SYSLIB_PTHREAD pthread)
endif ()
# Check header files and functions. These are all defined to the config.h file.
check_include_file(ctype.h HAVE_CTYPE_H)
check_include_file(float.h HAVE_FLOAT_H)
check_include_file(limits.h HAVE_LIMITS_H)
check_include_file(locale.h HAVE_LOCALE_H)
check_include_file(malloc.h HAVE_MALLOC_H)
check_include_file(memory.h HAVE_MEMORY_H)
check_function_exists(memset HAVE_MEMSET)
check_function_exists(nsleep HAVE_NSLEEP)
check_function_exists(setlocale HAVE_SETLOCALE)
check_include_file(signal.h HAVE_SIGNAL_H)
check_include_file(stdarg.h HAVE_STDARG_H)
check_include_file(stddef.h HAVE_STDDEF_H)
check_include_file(stdio.h HAVE_STDIO_H)
check_include_file(stdlib.h HAVE_STDLIB_H)
check_include_file(string.h HAVE_STRING_H)
check_include_file(time.h HAVE_TIME_H)
check_function_exists(vprintf HAVE_VPRINTF)
check_include_file(fcntl.h HAVE_FCNTL_H)
check_function_exists(nanosleep HAVE_NANOSLEEP)
check_include_file(inttypes.h HAVE_INTTYPES_H)
check_include_file(stdint.h HAVE_STDINT_H)
if (NOT WIN32)
check_include_file(attr/xattr.h HAVE_ATTR_XATTR_H)
check_function_exists(catopen HAVE_CATOPEN)
check_include_file(dlfcn.h HAVE_DLFCN_H)
check_include_file(features.h HAVE_FEATURES_H)
check_include_file(filehdr.h HAVE_FILEHDR_H)
check_function_exists(fstat HAVE_FSTAT)
check_function_exists(gcvt HAVE_GCVT)
check_function_exists(geteuid HAVE_GETEUID)
check_function_exists(getpgrp HAVE_GETPGRP)
check_function_exists(getpwuid HAVE_GETPWUID)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
check_function_exists(IDtouser HAVE_IDTOUSER)
find_library(HAVE_LIBPTHREAD pthread)
find_library(HAVE_LIBRT rt)
check_include_file(mesg.h HAVE_MESG_H)
check_include_file(netinet/in.h HAVE_NETINET_IN_H)
check_include_file(nl_types.h HAVE_NL_TYPES_H)
check_include_file(pthread.h HAVE_PTHREAD_H)
set(CMAKE_REQUIRED_LIBRARIES pthread)
set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE=1")
check_function_exists(pthread_mutexattr_settype HAVE_PTHREAD_MUTEXATTR_SETTYPE)
check_function_exists(pthread_mutex_timedlock HAVE_PTHREAD_MUTEX_TIMEDLOCK)
# Some platforms use an enum for these values rather than defines
# so we cannot use the simpler check_symbol_exists test to check for these.
check_c_source_compiles("#include <pthread.h>
int main(int arg, char **argv) {
int tryme;
tryme = PTHREAD_MUTEX_ERRORCHECK;
return 0;}"
HAVE_PTHREAD_MUTEX_ERRORCHECK)
check_c_source_compiles("#include <pthread.h>
int main(int arg, char **argv) {
int tryme;
tryme = PTHREAD_MUTEX_RECURSIVE;
return 0;}"
HAVE_PTHREAD_MUTEX_RECURSIVE)
# this requires -ldl on the link
set(CMAKE_REQUIRED_LIBRARIES dl)
check_c_source_compiles("#include <dlfcn.h>
int main(int arg, char **argv) {
Dl_info DlInfo;
dladdr((void*)0, &DlInfo);
return 0;}"
HAVE_DLADDR)
check_symbol_exists(_PC_CASE_SENSITIVE unistd.h HAVE_PC_CASE_SENSITIVE)
check_symbol_exists(FNM_CASEFOLD fnmatch.h HAVE_FNM_CASEFOLD)
check_symbol_exists(KDMKTONE linux/kd.h HAVE_KDMKTONE)
check_symbol_exists(_NSGetExecutablePath mach-o/dyld.h HAVE_NSGETEXECUTABLEPATH)
check_symbol_exists(getexecname stdlib.h HAVE_GETEXECNAME)
check_struct_has_member("struct stat" st_mtim sys/stat.h HAVE_STAT_ST_MTIM)
check_struct_has_member("struct stat" st_mtimespec sys/stat.h HAVE_STAT_ST_MTIMESPEC)
check_include_file(pwd.h HAVE_PWD_H)
check_include_file(sched.h HAVE_SCHED_H)
check_function_exists(sighold HAVE_SIGHOLD)
check_function_exists(strdup HAVE_STRDUP)
check_include_file(strings.h HAVE_STRINGS_H)
check_include_file(stropts.h HAVE_STROPTS_H)
check_include_file(sys/filio.h HAVE_SYS_FILIO_H)
check_include_file(sys/ldr.h HAVE_SYS_LDR_H)
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
check_include_file(sys/select.h HAVE_SYS_SELECT_H)
check_include_file(sys/sem.h HAVE_SYS_SEM_H)
check_include_file(sys/signal.h HAVE_SYS_SIGNAL_H)
check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
check_include_file(sys/syscall.h HAVE_SYS_SYSCALL_H)
check_include_file(sys/time.h HAVE_SYS_TIME_H)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_file(sys/wait.h HAVE_SYS_WAIT_H)
check_c_source_compiles("#include <sys/types.h>
#include <sys/sem.h>
int main(int arg, char **argv) {
union semun semopts;
return 0;}"
HAVE_UNION_SEMUN)
check_include_file(unistd.h HAVE_UNISTD_H)
check_include_file(usersec.h HAVE_USERSEC_H)
if (CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
check_library_exists(socket getaddrinfo "" HAVE_LIBSOCKET)
if (HAVE_LIBSOCKET)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} socket)
endif (HAVE_LIBSOCKET)
check_library_exists(nsl gethostbyname "" HAVE_LIBNSL)
if (HAVE_LIBNSL)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} nsl)
endif (HAVE_LIBNSL)
check_library_exists(resolv hstrerror "" HAVE_LIBRESOLV)
if (HAVE_LIBRESOLV)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} resolv)
endif (HAVE_LIBRESOLV)
check_library_exists(rt nanosleep "" HAVE_LIBRT)
if (HAVE_LIBRT)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} rt)
endif (HAVE_LIBRT)
check_include_file(ncurses/ncurses.h NCURSES_H_)
if (NOT NCURSES_H_)
check_include_file(ncurses.h HAVE_NCURSES_H)
else ()
include_directories(/usr/include/ncurses)
endif (NOT NCURSES_H_)
else ()
check_include_file(ncurses.h HAVE_NCURSES_H)
endif ()
endif ()
set (PACKAGE ${PROJECT_NAME})
set (PACKAGE_BUGREPORT "http://sourceforge.net/projects/oorexx/")
set (PACKAGE_NAME ${PROJECT_NAME})
set (PACKAGE_STRING ${PROJECT_NAME})
set (PACKAGE_TARNAME "ooRexx.tar")
set (PACKAGE_URL "http://www.oorexx.org/")
set (PACKAGE_VERSION ${ORX_VER_STR})
set (VERSION ${ORX_VER_STR})
set (STDC_HEADERS 1)
# Configure files config.h
configure_file(config.h.in.cmake ${PROJECT_BINARY_DIR}/config.h)
#/*----------------------------------------------------------------------------*/
#/* Subdirectory short names */
#/*----------------------------------------------------------------------------*/
set (build_common_dir common)
set (build_common_platform_dir ${build_common_dir}/${ORX_PLATFORM_DIR})
set (build_lib_dir lib)
set (build_platform_dir ${ORX_PLATFORM_DIR})
set (build_rexxapi_dir rexxapi)
set (build_rexxapi_client_dir ${build_rexxapi_dir}/client)
set (build_rexxapi_client_platform_dir ${build_rexxapi_client_dir}/${ORX_PLATFORM_DIR})
set (build_rexxapi_common_dir ${build_rexxapi_dir}/common)
set (build_rexxapi_common_platform_dir ${build_rexxapi_common_dir}/${ORX_PLATFORM_DIR})
set (build_rexxapi_server_dir ${build_rexxapi_dir}/server)
set (build_rexxapi_server_platform_dir ${build_rexxapi_server_dir}/${ORX_PLATFORM_DIR})
set (build_interpreter_dir interpreter)
set (build_interpreter_platform_dir ${build_interpreter_dir}/${ORX_PLATFORM_DIR})
set (build_interpreter_api_dir ${build_interpreter_dir}/api)
set (build_behaviour_dir ${build_interpreter_dir}/behaviour)
set (build_classes_dir ${build_interpreter_dir}/classes)
set (build_classes_support_dir ${build_interpreter_dir}/classes/support)
set (build_concurrency_dir ${build_interpreter_dir}/concurrency)
set (build_execution_dir ${build_interpreter_dir}/execution)
set (build_expression_dir ${build_interpreter_dir}/expression)
set (build_instructions_dir ${build_interpreter_dir}/instructions)
set (build_memory_dir ${build_interpreter_dir}/memory)
set (build_messages_dir ${build_interpreter_dir}/messages)
set (build_package_dir ${build_interpreter_dir}/package)
set (build_parser_dir ${build_interpreter_dir}/parser)
set (build_interpreter_common_dir ${build_interpreter_dir}/platform/common)
set (build_rexx_classes_dir ${build_interpreter_dir}/RexxClasses)
set (build_runtime_dir ${build_interpreter_dir}/runtime)
set (build_streamlibrary_dir ${build_interpreter_dir}/streamLibrary)
set (build_extensions_dir extensions)
set (build_extensions_platform_dir ${build_extensions_dir}/${ORX_PLATFORM_DIR})
set (build_extensions_rxftp_dir ${build_extensions_dir}/rxftp)
set (build_extensions_csvstream_dir ${build_extensions_dir}/csvStream)
set (build_extensions_json_dir ${build_extensions_dir}/json)
set (build_extensions_rxmath_dir ${build_extensions_dir}/rxmath)
set (build_extensions_rxregexp_dir ${build_extensions_dir}/rxregexp)
set (build_extensions_rxsock_dir ${build_extensions_dir}/rxsock)
set (build_extensions_orxncurses_dir ${build_extensions_dir}/orxncurses)
set (build_extensions_hostemu_dir ${build_extensions_dir}/hostemu)
set (build_extensions_hostemu_platform_dir ${build_extensions_hostemu_dir}/${ORX_PLATFORM_DIR})
set (build_utilities_dir utilities)
set (build_utilities_rexx_dir ${build_utilities_dir}/rexx/${ORX_PLATFORM_DIR})
set (build_utilities_rexxc_dir ${build_utilities_dir}/rexxc/${ORX_PLATFORM_DIR})
set (build_utilities_rexximage_dir ${build_utilities_dir}/rexximage)
set (build_utilities_rxqueue_dir ${build_utilities_dir}/rxqueue/${ORX_PLATFORM_DIR})
set (build_utilities_rxsubcom_dir ${build_utilities_dir}/rxsubcom/${ORX_PLATFORM_DIR})
set (build_api_dir api)
set (build_api_platform_dir api/${ORX_PLATFORM_DIR})
set (build_samples_dir samples)
set (api_dir ${build_api_dir}/${ORX_PLATFORM_DIR})
set(SAMPLES_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/${build_samples_dir})
if (WIN32)
set (platform_samples_dir ${build_samples_dir}/windows)
else ()
set (platform_samples_dir ${build_samples_dir}/unix)
endif ()
# The following are windows only
set (build_extensions_ole_dir ${build_extensions_dir}/platform/windows/ole)
set (build_extensions_oodialog_dir ${build_extensions_dir}/platform/windows/oodialog)
set (build_extensions_rxwinsys_dir ${build_extensions_dir}/platform/windows/rxwinsys)
set (build_utilities_rexxpaws_dir ${build_utilities_dir}/platform/windows/rexxpaws)
set (build_utilities_rexxhide_dir ${build_utilities_dir}/platform/windows/rexxhide)
if (WIN32)
# This replaces the /MD compile flag with /MT.
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
endif ()
#/*----------------------------------------------------------------------------*/
#/* Build targets */
#/*----------------------------------------------------------------------------*/
# 2019-01-04: macro to create and install symbolic links on Unix
macro(create_install_symlink target)
if (UNIX) # checking for UNIX here simplifies invocation of this macro (no need to check operating system for the invoker)
set(baseName "${CMAKE_SHARED_LIBRARY_PREFIX}${target}")
set(targetName "${baseName}${CMAKE_SHARED_LIBRARY_SUFFIX}")
foreach(loop_var RANGE ${SYM_LINK_CREATE_FROM} ${SYM_LINK_CREATE_TO})
if (APPLE) # Darwin has version numbers before ".dylib"
set(linkName "${baseName}.${loop_var}${CMAKE_SHARED_LIBRARY_SUFFIX}")
else ()
set(linkName "${baseName}${CMAKE_SHARED_LIBRARY_SUFFIX}.${loop_var}")
endif ()
# message(STATUS "---> macro create_install_symlink() ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}: ln -sf targetName=[${targetName}] linkName=[${linkName}]")
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ln -sf ${targetName} ${linkName}
DEPENDS ${target}
# COMMENT "--> ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}: [ln -sf ${targetName} ${linkName} DEPENDS ${target}]"
)
install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${linkName}
COMPONENT Core
DESTINATION ${INSTALL_LIB_DIR}
)
endforeach(loop_var)
endif ()
endmacro(create_install_symlink)
#################### librexxapi.so ##########################
# Full set of files used in all platforms.
set (common_rexxapi_sources
${build_rexxapi_client_dir}/ClientMessage.cpp
${build_rexxapi_client_dir}/LocalAPIContext.cpp
${build_rexxapi_client_dir}/LocalAPIManager.cpp
${build_rexxapi_client_dir}/LocalMacroSpaceManager.cpp
${build_rexxapi_client_dir}/LocalQueueManager.cpp
${build_rexxapi_client_dir}/LocalRegistrationManager.cpp
${build_rexxapi_client_dir}/MacroSpaceApi.cpp
${build_rexxapi_client_dir}/QueuesAPI.cpp
${build_rexxapi_client_dir}/RegistrationAPI.cpp
${build_rexxapi_client_platform_dir}/SysLegacyAPI.cpp
${build_rexxapi_client_platform_dir}/SysLocalAPIManager.cpp
${build_rexxapi_common_dir}/RegistrationTable.cpp
${build_rexxapi_common_dir}/ServiceMessage.cpp
${build_rexxapi_common_dir}/CSStream.cpp
${build_rexxapi_common_platform_dir}/SysAPIManager.cpp
${build_common_dir}/Utilities.cpp
${build_common_platform_dir}/SysSemaphore.cpp
${build_common_platform_dir}/SysLibrary.cpp
${build_common_platform_dir}/SysFile.cpp
${build_common_platform_dir}/SysProcess.cpp
${build_common_platform_dir}/SysThread.cpp)
# additional source files required by specific platforms
if (WIN32)
set (platform_rexxapi_sources
${build_rexxapi_common_platform_dir}/SysCSNamedPipeStream.cpp
${build_rexxapi_client_platform_dir}/rexxapi.def
${build_platform_dir}/verinfo.rc)
set (platform_rexxapi_libs wsock32)
else ()
set (platform_rexxapi_sources
${build_rexxapi_common_platform_dir}/SysCSStream.cpp)
set (platform_rexxapi_libs ${ORX_SYSLIB_DL} ${ORX_SYSLIB_PTHREAD})
endif ()
# Library definition
add_library(rexxapi SHARED
${common_rexxapi_sources}
${platform_rexxapi_sources})
# Include file definition
target_include_directories(rexxapi PUBLIC
${build_rexxapi_client_dir}
${build_rexxapi_client_platform_dir}
${build_rexxapi_common_dir}
${build_rexxapi_common_platform_dir}
${build_common_dir}
${build_common_platform_dir}
${build_lib_dir})
# Extra link library definitions
target_link_libraries(rexxapi ${platform_rexxapi_libs} ${CMAKE_REQUIRED_LIBRARIES})
install(TARGETS rexxapi RUNTIME DESTINATION ${INSTALL_LIB_DIR} COMPONENT Core
LIBRARY DESTINATION ${INSTALL_LIB_DIR} COMPONENT Core
ARCHIVE DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT DevLib)
set_target_properties(rexxapi PROPERTIES VERSION ${ORX_VERSION})
create_install_symlink(rexxapi)
#################### librexx.so ##########################
# Sources for librexx.so
set (interpreter_api_sources ${build_interpreter_api_dir}/CallContextStubs.cpp
${build_interpreter_api_dir}/InterpreterAPI.cpp
${build_interpreter_api_dir}/InterpreterInstanceStubs.cpp
${build_interpreter_api_dir}/MethodContextStubs.cpp
${build_interpreter_api_dir}/ThreadContextStubs.cpp)
set (classes_support_sources ${build_classes_support_dir}/HashCollection.cpp
${build_classes_support_dir}/HashContents.cpp
${build_classes_support_dir}/ListContents.cpp
${build_classes_support_dir}/ProgramMetaData.cpp
${build_classes_support_dir}/CompoundTableElement.cpp
${build_classes_support_dir}/CompoundVariableTable.cpp
${build_classes_support_dir}/CompoundVariableTail.cpp
${build_classes_support_dir}/RexxDateTime.cpp
${build_classes_support_dir}/StringUtil.cpp)
set (classes_sources ${build_classes_dir}/ArrayClass.cpp
${build_classes_dir}/BagClass.cpp
${build_classes_dir}/BufferClass.cpp
${build_classes_dir}/ClassClass.cpp
${build_classes_dir}/ContextClass.cpp
${build_classes_dir}/DirectoryClass.cpp
${build_classes_dir}/EventSemaphore.cpp
${build_classes_dir}/IntegerClass.cpp
${build_classes_dir}/ListClass.cpp
${build_classes_dir}/MessageClass.cpp
${build_classes_dir}/MethodClass.cpp
${build_classes_dir}/MutableBufferClass.cpp
${build_classes_dir}/MutexSemaphore.cpp
${build_classes_dir}/NumberStringClass.cpp
${build_classes_dir}/NumberStringMath.cpp
${build_classes_dir}/NumberStringMath2.cpp
${build_classes_dir}/ObjectClass.cpp
${build_classes_dir}/PackageClass.cpp
${build_classes_dir}/PointerClass.cpp
${build_classes_dir}/QueueClass.cpp
${build_classes_dir}/RelationClass.cpp
${build_classes_dir}/RexxInfoClass.cpp
${build_classes_dir}/RoutineClass.cpp
${build_classes_dir}/RexxQueueMethods.cpp
${build_classes_dir}/SetClass.cpp
${build_classes_dir}/StemClass.cpp
${build_classes_dir}/StringClass.cpp
${build_classes_dir}/StringClassBit.cpp
${build_classes_dir}/StringClassConversion.cpp
${build_classes_dir}/StringClassMisc.cpp
${build_classes_dir}/StringClassSub.cpp
${build_classes_dir}/StringClassUtil.cpp
${build_classes_dir}/StringClassWord.cpp
${build_classes_dir}/StringTableClass.cpp
${build_classes_dir}/SupplierClass.cpp
${build_classes_dir}/TableClass.cpp
${build_classes_dir}/IdentityTableClass.cpp
${build_classes_dir}/WeakReferenceClass.cpp
${build_classes_dir}/StackFrameClass.cpp
${build_classes_dir}/VariableReference.cpp)
set (package_sources ${build_package_dir}/LibraryPackage.cpp
${build_package_dir}/PackageManager.cpp)
set (memory_sources ${build_memory_dir}/DeadObject.cpp
${build_memory_dir}/FileNameBuffer.cpp
${build_memory_dir}/GlobalNames.cpp
${build_memory_dir}/MapBucket.cpp
${build_memory_dir}/MapTable.cpp
${build_memory_dir}/MemorySegment.cpp
${build_memory_dir}/MemoryStack.cpp
${build_memory_dir}/MemoryStats.cpp
${build_memory_dir}/NumberArray.cpp
${build_memory_dir}/PointerBucket.cpp
${build_memory_dir}/PointerTable.cpp
${build_memory_dir}/ProtectedObject.cpp
${build_memory_dir}/Envelope.cpp
${build_memory_dir}/InternalStack.cpp
${build_memory_dir}/SmartBuffer.cpp
${build_memory_dir}/UninitDispatcher.cpp
${build_memory_dir}/Setup.cpp
${build_memory_dir}/RexxMemory.cpp)
set (execution_sources ${build_execution_dir}/CPPCode.cpp
${build_execution_dir}/ActivationStack.cpp
${build_execution_dir}/RexxActivation.cpp
${build_execution_dir}/BaseCode.cpp
${build_execution_dir}/RexxCode.cpp
${build_execution_dir}/BaseExecutable.cpp
${build_execution_dir}/RexxLocalVariables.cpp
${build_execution_dir}/NativeActivation.cpp
${build_execution_dir}/NativeCode.cpp
${build_execution_dir}/RexxVariable.cpp
${build_execution_dir}/TrapHandler.cpp
${build_execution_dir}/VariableDictionary.cpp
${build_execution_dir}/SecurityManager.cpp
${build_execution_dir}/TraceSetting.cpp)
set (behaviour_sources ${build_behaviour_dir}/PrimitiveBehaviours.cpp
${build_behaviour_dir}/RexxBehaviour.cpp
${build_behaviour_dir}/MethodDictionary.cpp
${build_behaviour_dir}/VirtualFunctionTable.cpp)
set (concurrency_sources ${build_concurrency_dir}/ActivityDispatcher.cpp
${build_concurrency_dir}/ActivityManager.cpp
${build_concurrency_dir}/ActivationFrame.cpp
${build_concurrency_dir}/CallbackDispatcher.cpp
${build_concurrency_dir}/TrappingDispatcher.cpp
${build_concurrency_dir}/ConditionTrappingDispatcher.cpp
${build_concurrency_dir}/ExitHandler.cpp
${build_concurrency_dir}/CommandHandler.cpp
${build_concurrency_dir}/MessageDispatcher.cpp
${build_concurrency_dir}/Activity.cpp
${build_concurrency_dir}/RexxStartDispatcher.cpp
${build_concurrency_dir}/TranslateDispatcher.cpp)
set (expression_sources ${build_expression_dir}/BuiltinFunctions.cpp
${build_expression_dir}/CommonExternalFunctions.cpp
${build_expression_dir}/ExpressionClassResolver.cpp
${build_expression_dir}/ExpressionCompoundVariable.cpp
${build_expression_dir}/ExpressionDotVariable.cpp
${build_expression_dir}/SpecialDotVariable.cpp
${build_expression_dir}/ExpressionFunction.cpp
${build_expression_dir}/ExpressionMessage.cpp
${build_expression_dir}/ExpressionOperator.cpp
${build_expression_dir}/ExpressionQualifiedFunction.cpp
${build_expression_dir}/ExpressionStack.cpp
${build_expression_dir}/ExpressionStem.cpp
${build_expression_dir}/ExpressionVariable.cpp
${build_expression_dir}/IndirectVariableReference.cpp
${build_expression_dir}/ExpressionList.cpp
${build_expression_dir}/ExpressionLogical.cpp
${build_expression_dir}/VariableReferenceOp.cpp)
set (instructions_sources ${build_instructions_dir}/AddressInstruction.cpp
${build_instructions_dir}/AddressWithInstruction.cpp
${build_instructions_dir}/AssignmentInstruction.cpp
${build_instructions_dir}/AddressInstruction.cpp
${build_instructions_dir}/BaseDoInstruction.cpp
${build_instructions_dir}/CallInstruction.cpp
${build_instructions_dir}/ClassDirective.cpp
${build_instructions_dir}/CommandInstruction.cpp
${build_instructions_dir}/CommandIOContext.cpp
${build_instructions_dir}/CommandIOConfiguration.cpp
${build_instructions_dir}/ConstantDirective.cpp
${build_instructions_dir}/InputRedirector.cpp
${build_instructions_dir}/OutputRedirector.cpp
${build_instructions_dir}/DoBlock.cpp
${build_instructions_dir}/DoBlockComponents.cpp
${build_instructions_dir}/DoCountInstruction.cpp
${build_instructions_dir}/SimpleDoInstruction.cpp
${build_instructions_dir}/ControlledDoInstruction.cpp
${build_instructions_dir}/DoForeverInstruction.cpp
${build_instructions_dir}/DoOverInstruction.cpp
${build_instructions_dir}/DoWithInstruction.cpp
${build_instructions_dir}/DoWhileInstruction.cpp
${build_instructions_dir}/DropInstruction.cpp
${build_instructions_dir}/ElseInstruction.cpp
${build_instructions_dir}/EndIf.cpp
${build_instructions_dir}/EndInstruction.cpp
${build_instructions_dir}/ExitInstruction.cpp
${build_instructions_dir}/ExposeInstruction.cpp
${build_instructions_dir}/ForwardInstruction.cpp
${build_instructions_dir}/GuardInstruction.cpp
${build_instructions_dir}/IfInstruction.cpp
${build_instructions_dir}/InterpretInstruction.cpp
${build_instructions_dir}/LabelInstruction.cpp
${build_instructions_dir}/LeaveInstruction.cpp
${build_instructions_dir}/LibraryDirective.cpp
${build_instructions_dir}/MessageInstruction.cpp
${build_instructions_dir}/NopInstruction.cpp
${build_instructions_dir}/NumericInstruction.cpp
${build_instructions_dir}/OptionsInstruction.cpp
${build_instructions_dir}/OtherwiseInstruction.cpp
${build_instructions_dir}/ParseInstruction.cpp
${build_instructions_dir}/ParseTarget.cpp
${build_instructions_dir}/ParseTrigger.cpp
${build_instructions_dir}/ProcedureInstruction.cpp
${build_instructions_dir}/QueueInstruction.cpp
${build_instructions_dir}/RaiseInstruction.cpp
${build_instructions_dir}/ReplyInstruction.cpp
${build_instructions_dir}/RequiresDirective.cpp
${build_instructions_dir}/ReturnInstruction.cpp
${build_instructions_dir}/RexxInstruction.cpp
${build_instructions_dir}/SayInstruction.cpp
${build_instructions_dir}/SelectInstruction.cpp
${build_instructions_dir}/SignalInstruction.cpp
${build_instructions_dir}/ThenInstruction.cpp
${build_instructions_dir}/TraceInstruction.cpp
${build_instructions_dir}/UseInstruction.cpp
${build_instructions_dir}/UseArgVariableRef.cpp
${build_instructions_dir}/UseLocalInstruction.cpp
${build_instructions_dir}/WhenCaseInstruction.cpp)
set (parser_sources ${build_parser_dir}/Clause.cpp
${build_parser_dir}/KeywordConstants.cpp
${build_parser_dir}/DirectiveParser.cpp
${build_parser_dir}/InstructionParser.cpp
${build_parser_dir}/LanguageParser.cpp
${build_parser_dir}/ProgramSource.cpp
${build_parser_dir}/Scanner.cpp
${build_parser_dir}/Token.cpp)
set (platform_sources ${build_interpreter_platform_dir}/ExternalFunctions.cpp
${build_interpreter_platform_dir}/MemorySupport.cpp
${build_interpreter_platform_dir}/MiscSystem.cpp
${build_interpreter_platform_dir}/SysActivity.cpp
${build_interpreter_platform_dir}/SysFileSystem.cpp
${build_interpreter_platform_dir}/SysInterpreterInstance.cpp
${build_interpreter_platform_dir}/SysRexxUtil.cpp
${build_interpreter_platform_dir}/SystemCommands.cpp
${build_interpreter_platform_dir}/SystemInitialization.cpp
${build_interpreter_platform_dir}/SystemInterpreter.cpp
${build_interpreter_platform_dir}/TimeSupport.cpp
${build_interpreter_platform_dir}/UseridFunction.cpp
${build_interpreter_platform_dir}/ValueFunction.cpp)
set (common_sources ${build_common_dir}/Utilities.cpp
${build_common_platform_dir}/SysFile.cpp
${build_common_platform_dir}/SysLibrary.cpp
${build_common_platform_dir}/SysProcess.cpp
${build_common_platform_dir}/SysSemaphore.cpp
${build_common_platform_dir}/SysThread.cpp)
set (runtime_sources ${build_runtime_dir}/InternalPackage.cpp
${build_runtime_dir}/Interpreter.cpp
${build_runtime_dir}/InterpreterInstance.cpp
${build_runtime_dir}/Numerics.cpp
${build_runtime_dir}/RexxUtilCommon.cpp
${build_runtime_dir}/Version.cpp)
set (streamlibrary_sources ${build_streamlibrary_dir}/StreamCommandParser.cpp
${build_streamlibrary_dir}/StreamNative.cpp
${build_streamlibrary_dir}/FileNative.cpp)
# Full set of files used in all platforms.
set (common_interpreter_sources ${classes_sources}
${classes_support_sources}
${interpreter_api_sources}
${behaviour_sources}
${execution_sources}
${memory_sources}
${package_sources}
${concurrency_sources}
${expression_sources}
${instructions_sources}
${parser_sources}
${platform_sources}
${common_sources}
${runtime_sources}
${streamlibrary_sources})
# additional source files required by specific platforms
if (WIN32)
set (platform_interpreter_sources ${build_interpreter_platform_dir}/rexx.def
${build_platform_dir}/verinfo.rc)
set (platform_interpreter_libs comctl32 shlwapi version)
else ()
set (platform_interpreter_sources ${build_interpreter_platform_dir}/RexxMain.cpp)
set (platform_rexx_libs ${ORX_SYSLIB_DL} ${ORX_SYSLIB_PTHREAD})
endif ()
# Library definition
add_library(rexx SHARED
${common_interpreter_sources}
${platform_interpreter_sources})
set (core_platform_classes ${build_interpreter_platform_dir}/PlatformObjects.orx)
# Include file definition
target_include_directories(rexx PUBLIC
${build_lib_dir}
${build_api_dir}
${build_api_platform_dir}
${build_common_dir}
${build_common_platform_dir}
${build_interpreter_dir}
${build_behaviour_dir}
${build_execution_dir}
${build_memory_dir}
${build_package_dir}
${build_concurrency_dir}
${build_expression_dir}
${build_instructions_dir}
${build_classes_dir}
${build_classes_support_dir}
${build_runtime_dir}
${build_parser_dir}
${build_messages_dir}
${build_streamlibrary_dir}
${build_interpreter_common_dir}
${build_interpreter_platform_dir})
# Extra link library definitions
target_link_libraries(rexx rexxapi ${platform_interpreter_libs} ${CMAKE_REQUIRED_LIBRARIES})
install(TARGETS rexx RUNTIME DESTINATION ${INSTALL_LIB_DIR} COMPONENT Core
LIBRARY DESTINATION ${INSTALL_LIB_DIR} COMPONENT Core
ARCHIVE DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT DevLib)
set_target_properties(rexx PROPERTIES VERSION ${ORX_VERSION})
create_install_symlink(rexx)
#################### orexx (executable) ##########################
if (WIN32)
set (platform_rexx_exe_sources
${build_platform_dir}/rexx.rc)
else ()
set (platform_rexx_exe_libs ${ORX_SYSLIB_DL} ${ORX_SYSLIB_PTHREAD})
endif ()
# Sources for rexx. Note, the target must not be rexx, since we already
# have a rexx library target
add_executable(rexx_exe ${build_utilities_rexx_dir}/rexx.cpp
${platform_rexx_exe_sources})
# This allows the executable to have the same name as the library.
SET_TARGET_PROPERTIES(rexx_exe
PROPERTIES OUTPUT_NAME rexx)
if (WIN32)
# We need to override the PDB output file name for rexx.exe so it doesn't overwrite
# the file for rexx.dll, which essentially makes the interpreter undebuggable on Windows
# we want to append, which is a little bit of a pain.
get_property(link_flags TARGET rexx_exe PROPERTY LINK_FLAGS_DEBUG)
set(link_flags "${link_flags} /PDB:bin\\orexx.pdb")
set_target_properties(rexx_exe PROPERTIES LINK_FLAGS_DEBUG ${link_flags})
get_property(link_flags TARGET rexx_exe PROPERTY LINK_FLAGS_RELWITHDEBINFO)
set(link_flags "${link_flags} /PDB:bin\\orexx.pdb")
set_target_properties(rexx_exe PROPERTIES LINK_FLAGS_RELWITHDEBINFO ${link_flags})
endif ()
# Include file definition
target_include_directories(rexx_exe PUBLIC
${build_lib_dir}
${build_api_dir}
${build_api_platform_dir}
${build_messages_dir})
# Extra link library definitions
target_link_libraries(rexx_exe rexx rexxapi ${platform_rexx_exe_libs} ${CMAKE_REQUIRED_LIBRARIES})
# Merge in extra manifest information on Windows
if (WIN32)
add_custom_command(TARGET rexx_exe POST_BUILD
COMMAND "mt.exe" -nologo -manifest \"${EXE_MANIFEST_FILE}\" "-inputresource:bin\\rexx.exe;#1" "-outputresource:bin\\rexx.exe;#1"
COMMENT "Adding custom manifest to rexx.exe...")
endif ()
install(TARGETS rexx_exe RUNTIME COMPONENT Core DESTINATION ${INSTALL_EXECUTABLE_DIR})
#################### rexximage (bin file) ##########################
# These are the core classes built into the .img file.