forked from bacnet-stack/bacnet-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
817 lines (740 loc) · 25.3 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
cmake_minimum_required(VERSION 3.7 FATAL_ERROR)
project(
bacnet-stack
VERSION 0.8.6
LANGUAGES C)
#
# options
#
option(
BACNET_STACK_BUILD_APPS
"build apps"
ON)
option(
BAC_ROUTING
"enable bac routing"
ON)
option(
BACNET_PROPERTY_LISTS
"enable property lists"
ON)
option(
BACNET_BUILD_PIFACE_APP
"compile the piface app"
OFF)
option(
BACDL_ETHERNET
"compile with ethernet support"
OFF)
option(
BACDL_MSTP
"compile with mstp support"
OFF)
option(
BACDL_ARCNET
"compile with arcnet support"
OFF)
option(
BACDL_BIP
"compile with ip support"
ON)
option(
BACDL_BIP6
"compile with ipv6 support"
OFF)
option(
BACDL_NONE
"compile without datalink"
OFF)
set(BACNET_PROTOCOL_REVISION 19)
#
# library
#
find_package(Threads)
add_library(${PROJECT_NAME}
src/bacnet/abort.c
src/bacnet/abort.h
src/bacnet/access_rule.c
src/bacnet/access_rule.h
src/bacnet/alarm_ack.c
src/bacnet/alarm_ack.h
src/bacnet/apdu.h
src/bacnet/arf.c
src/bacnet/arf.h
src/bacnet/assigned_access_rights.c
src/bacnet/assigned_access_rights.h
src/bacnet/authentication_factor.c
src/bacnet/authentication_factor_format.c
src/bacnet/authentication_factor_format.h
src/bacnet/authentication_factor.h
src/bacnet/awf.c
src/bacnet/awf.h
src/bacnet/bacaddr.c
src/bacnet/bacaddr.h
src/bacnet/bacapp.c
src/bacnet/bacapp.h
src/bacnet/bacdcode.c
src/bacnet/bacdcode.h
src/bacnet/bacdef.h
src/bacnet/bacdevobjpropref.c
src/bacnet/bacdevobjpropref.h
src/bacnet/bacenum.h
src/bacnet/bacerror.c
src/bacnet/bacerror.h
src/bacnet/bacint.c
src/bacnet/bacint.h
src/bacnet/bacprop.c
src/bacnet/bacprop.h
src/bacnet/bacpropstates.c
src/bacnet/bacpropstates.h
src/bacnet/bacreal.c
src/bacnet/bacreal.h
src/bacnet/bacstr.c
src/bacnet/bacstr.h
src/bacnet/bactext.c
src/bacnet/bactext.h
src/bacnet/bactimevalue.c
src/bacnet/bactimevalue.h
$<$<BOOL:${BACDL_BIP}>:src/bacnet/basic/bbmd/h_bbmd.c>
$<$<BOOL:${BACDL_BIP}>:src/bacnet/basic/bbmd/h_bbmd.h>
$<$<BOOL:${BACDL_BIP6}>:src/bacnet/basic/bbmd6/h_bbmd6.c>
$<$<BOOL:${BACDL_BIP6}>:src/bacnet/basic/bbmd6/h_bbmd6.h>
$<$<BOOL:${BACDL_BIP6}>:src/bacnet/basic/bbmd6/vmac.c>
$<$<BOOL:${BACDL_BIP6}>:src/bacnet/basic/bbmd6/vmac.h>
src/bacnet/basic/binding/address.c
src/bacnet/basic/binding/address.h
src/bacnet/basic/npdu/h_npdu.c
src/bacnet/basic/npdu/h_npdu.h
src/bacnet/basic/npdu/h_routed_npdu.c
src/bacnet/basic/npdu/h_routed_npdu.h
src/bacnet/basic/npdu/s_router.c
src/bacnet/basic/npdu/s_router.h
src/bacnet/basic/object/access_credential.c
src/bacnet/basic/object/access_credential.h
src/bacnet/basic/object/access_door.c
src/bacnet/basic/object/access_door.h
src/bacnet/basic/object/access_point.c
src/bacnet/basic/object/access_point.h
src/bacnet/basic/object/access_rights.c
src/bacnet/basic/object/access_rights.h
src/bacnet/basic/object/access_user.c
src/bacnet/basic/object/access_user.h
src/bacnet/basic/object/access_zone.c
src/bacnet/basic/object/access_zone.h
src/bacnet/basic/object/acc.c
src/bacnet/basic/object/ai.c
src/bacnet/basic/object/ai.h
src/bacnet/basic/object/ao.c
src/bacnet/basic/object/ao.h
src/bacnet/basic/object/av.c
src/bacnet/basic/object/av.h
src/bacnet/basic/object/bacfile.c
src/bacnet/basic/object/bacfile.h
src/bacnet/basic/object/bi.c
src/bacnet/basic/object/bi.h
src/bacnet/basic/object/bo.c
src/bacnet/basic/object/bo.h
src/bacnet/basic/object/bv.c
src/bacnet/basic/object/bv.h
src/bacnet/basic/object/channel.c
src/bacnet/basic/object/channel.h
# src/bacnet/basic/object/client/device-client.c
src/bacnet/basic/object/command.c
src/bacnet/basic/object/command.h
src/bacnet/basic/object/credential_data_input.c
src/bacnet/basic/object/credential_data_input.h
src/bacnet/basic/object/csv.c
src/bacnet/basic/object/csv.h
src/bacnet/basic/object/device.c
src/bacnet/basic/object/device.h
$<$<BOOL:${BAC_ROUTING}>:src/bacnet/basic/object/gateway/gw_device.c>
src/bacnet/basic/object/iv.c
src/bacnet/basic/object/iv.h
src/bacnet/basic/object/lc.c
src/bacnet/basic/object/lc.h
src/bacnet/basic/object/lo.c
src/bacnet/basic/object/lo.h
src/bacnet/basic/object/lsp.c
src/bacnet/basic/object/lsp.h
src/bacnet/basic/object/Makefile
src/bacnet/basic/object/ms-input.c
src/bacnet/basic/object/ms-input.h
src/bacnet/basic/object/mso.c
src/bacnet/basic/object/mso.h
src/bacnet/basic/object/msv.c
src/bacnet/basic/object/msv.h
src/bacnet/basic/object/nc.c
src/bacnet/basic/object/nc.h
src/bacnet/basic/object/netport.c
src/bacnet/basic/object/netport.h
src/bacnet/basic/object/objects.c
src/bacnet/basic/object/objects.h
src/bacnet/basic/object/osv.c
src/bacnet/basic/object/osv.h
src/bacnet/basic/object/piv.c
src/bacnet/basic/object/piv.h
src/bacnet/basic/object/schedule.c
src/bacnet/basic/object/schedule.h
src/bacnet/basic/object/trendlog.c
src/bacnet/basic/object/trendlog.h
src/bacnet/basic/service/h_alarm_ack.c
src/bacnet/basic/service/h_alarm_ack.h
src/bacnet/basic/service/h_apdu.c
src/bacnet/basic/service/h_apdu.h
src/bacnet/basic/service/h_arf_a.c
src/bacnet/basic/service/h_arf_a.h
src/bacnet/basic/service/h_arf.c
src/bacnet/basic/service/h_arf.h
src/bacnet/basic/service/h_awf.c
src/bacnet/basic/service/h_awf.h
src/bacnet/basic/service/h_ccov.c
src/bacnet/basic/service/h_ccov.h
src/bacnet/basic/service/h_cov.c
src/bacnet/basic/service/h_cov.h
src/bacnet/basic/service/h_dcc.c
src/bacnet/basic/service/h_dcc.h
src/bacnet/basic/service/h_gas_a.c
src/bacnet/basic/service/h_gas_a.h
src/bacnet/basic/service/h_get_alarm_sum.c
src/bacnet/basic/service/h_get_alarm_sum.h
src/bacnet/basic/service/h_getevent_a.c
src/bacnet/basic/service/h_getevent_a.h
src/bacnet/basic/service/h_getevent.c
src/bacnet/basic/service/h_getevent.h
src/bacnet/basic/service/h_iam.c
src/bacnet/basic/service/h_iam.h
src/bacnet/basic/service/h_ihave.c
src/bacnet/basic/service/h_ihave.h
src/bacnet/basic/service/h_lso.c
src/bacnet/basic/service/h_lso.h
src/bacnet/basic/service/h_noserv.c
src/bacnet/basic/service/h_noserv.h
src/bacnet/basic/service/h_rd.c
src/bacnet/basic/service/h_rd.h
src/bacnet/basic/service/h_rp_a.c
src/bacnet/basic/service/h_rp_a.h
src/bacnet/basic/service/h_rp.c
src/bacnet/basic/service/h_rp.h
src/bacnet/basic/service/h_rpm_a.c
src/bacnet/basic/service/h_rpm_a.h
src/bacnet/basic/service/h_rpm.c
src/bacnet/basic/service/h_rpm.h
src/bacnet/basic/service/h_rr_a.c
src/bacnet/basic/service/h_rr_a.h
src/bacnet/basic/service/h_rr.c
src/bacnet/basic/service/h_rr.h
src/bacnet/basic/service/h_ts.c
src/bacnet/basic/service/h_ts.h
src/bacnet/basic/service/h_ucov.c
src/bacnet/basic/service/h_ucov.h
src/bacnet/basic/service/h_upt.c
src/bacnet/basic/service/h_upt.h
src/bacnet/basic/service/h_whohas.c
src/bacnet/basic/service/h_whohas.h
src/bacnet/basic/service/h_whois.c
src/bacnet/basic/service/h_whois.h
src/bacnet/basic/service/h_wp.c
src/bacnet/basic/service/h_wp.h
src/bacnet/basic/service/h_wpm.c
src/bacnet/basic/service/h_wpm.h
src/bacnet/basic/service/s_abort.c
src/bacnet/basic/service/s_abort.h
src/bacnet/basic/service/s_ack_alarm.c
src/bacnet/basic/service/s_ack_alarm.h
src/bacnet/basic/service/s_arfs.c
src/bacnet/basic/service/s_arfs.h
src/bacnet/basic/service/s_awfs.c
src/bacnet/basic/service/s_awfs.h
src/bacnet/basic/service/s_cevent.c
src/bacnet/basic/service/s_cevent.h
src/bacnet/basic/service/s_cov.c
src/bacnet/basic/service/s_cov.h
src/bacnet/basic/service/s_dcc.c
src/bacnet/basic/service/s_dcc.h
src/bacnet/basic/service/s_error.c
src/bacnet/basic/service/s_error.h
src/bacnet/basic/service/s_get_alarm_sum.c
src/bacnet/basic/service/s_get_alarm_sum.h
src/bacnet/basic/service/s_get_event.c
src/bacnet/basic/service/s_getevent.c
src/bacnet/basic/service/s_get_event.h
src/bacnet/basic/service/s_getevent.h
src/bacnet/basic/service/s_iam.c
src/bacnet/basic/service/s_iam.h
src/bacnet/basic/service/s_ihave.c
src/bacnet/basic/service/s_ihave.h
src/bacnet/basic/service/s_lso.c
src/bacnet/basic/service/s_lso.h
src/bacnet/basic/service/s_rd.c
src/bacnet/basic/service/s_rd.h
src/bacnet/basic/service/s_readrange.c
src/bacnet/basic/service/s_readrange.h
src/bacnet/basic/service/s_rp.c
src/bacnet/basic/service/s_rp.h
src/bacnet/basic/service/s_rpm.c
src/bacnet/basic/service/s_rpm.h
src/bacnet/basic/service/s_ts.c
src/bacnet/basic/service/s_ts.h
src/bacnet/basic/service/s_uevent.c
src/bacnet/basic/service/s_uevent.h
src/bacnet/basic/service/s_upt.c
src/bacnet/basic/service/s_upt.h
src/bacnet/basic/service/s_whohas.c
src/bacnet/basic/service/s_whohas.h
src/bacnet/basic/service/s_whois.c
src/bacnet/basic/service/s_whois.h
src/bacnet/basic/service/s_wp.c
src/bacnet/basic/service/s_wp.h
src/bacnet/basic/service/s_wpm.c
src/bacnet/basic/service/s_wpm.h
src/bacnet/basic/services.h
src/bacnet/basic/sys/bigend.c
src/bacnet/basic/sys/bigend.h
src/bacnet/basic/sys/debug.c
src/bacnet/basic/sys/debug.h
src/bacnet/basic/sys/fifo.c
src/bacnet/basic/sys/fifo.h
src/bacnet/basic/sys/filename.c
src/bacnet/basic/sys/filename.h
src/bacnet/basic/sys/key.c
src/bacnet/basic/sys/key.h
src/bacnet/basic/sys/keylist.c
src/bacnet/basic/sys/keylist.h
src/bacnet/basic/sys/mstimer.c
src/bacnet/basic/sys/mstimer.h
src/bacnet/basic/sys/ringbuf.c
src/bacnet/basic/sys/ringbuf.h
src/bacnet/basic/sys/sbuf.c
src/bacnet/basic/sys/sbuf.h
src/bacnet/basic/tsm/tsm.c
src/bacnet/basic/tsm/tsm.h
src/bacnet/bits.h
src/bacnet/bytes.h
src/bacnet/config.h
src/bacnet/cov.c
src/bacnet/cov.h
src/bacnet/credential_authentication_factor.c
src/bacnet/credential_authentication_factor.h
src/bacnet/datalink/arcnet.h
src/bacnet/datalink/bacsec.c
src/bacnet/datalink/bacsec.h
src/bacnet/datalink/bip6.h
$<$<BOOL:${BACDL_BIP}>:src/bacnet/datalink/bip.h>
$<$<BOOL:${BACDL_BIP6}>:src/bacnet/datalink/bvlc6.c>
$<$<BOOL:${BACDL_BIP6}>:src/bacnet/datalink/bvlc6.h>
$<$<BOOL:${BACDL_BIP}>:src/bacnet/datalink/bvlc.h>
$<$<BOOL:${BACDL_BIP}>:src/bacnet/datalink/bvlc.c>
$<$<BOOL:${BACDL_MSTP}>:src/bacnet/datalink/crc.h>
$<$<BOOL:${BACDL_MSTP}>:src/bacnet/datalink/crc.c>
src/bacnet/datalink/datalink.c
src/bacnet/datalink/datalink.h
src/bacnet/datalink/dlenv.c
src/bacnet/datalink/dlenv.h
src/bacnet/datalink/dlmstp.h
src/bacnet/datalink/ethernet.h
$<$<BOOL:${BACDL_MSTP}>:src/bacnet/datalink/mstp.c>
src/bacnet/datalink/mstpdef.h
src/bacnet/datalink/mstp.h
src/bacnet/datalink/mstptext.c
src/bacnet/datalink/mstptext.h
src/bacnet/datetime.c
src/bacnet/datetime.h
src/bacnet/dcc.c
src/bacnet/dcc.h
src/bacnet/event.c
src/bacnet/event.h
src/bacnet/get_alarm_sum.c
src/bacnet/get_alarm_sum.h
src/bacnet/getevent.c
src/bacnet/getevent.h
src/bacnet/iam.c
src/bacnet/iam.h
src/bacnet/ihave.c
src/bacnet/ihave.h
src/bacnet/indtext.c
src/bacnet/indtext.h
src/bacnet/lighting.c
src/bacnet/lighting.h
src/bacnet/lso.c
src/bacnet/lso.h
src/bacnet/memcopy.c
src/bacnet/memcopy.h
src/bacnet/npdu.c
src/bacnet/npdu.h
src/bacnet/property.c
src/bacnet/property.h
src/bacnet/proplist.c
src/bacnet/proplist.h
src/bacnet/ptransfer.c
src/bacnet/ptransfer.h
src/bacnet/rd.c
src/bacnet/rd.h
src/bacnet/readrange.c
src/bacnet/readrange.h
src/bacnet/reject.c
src/bacnet/reject.h
src/bacnet/rp.c
src/bacnet/rp.h
src/bacnet/rpm.c
src/bacnet/rpm.h
src/bacnet/timestamp.c
src/bacnet/timestamp.h
src/bacnet/timesync.c
src/bacnet/timesync.h
src/bacnet/version.h
src/bacnet/whohas.c
src/bacnet/whohas.h
src/bacnet/whois.c
src/bacnet/whois.h
src/bacnet/wp.c
src/bacnet/wp.h
src/bacnet/wpm.c
src/bacnet/wpm.h)
target_sources(
${PROJECT_NAME}
PRIVATE
${BACNETSTACK_SRCS})
target_include_directories(
${PROJECT_NAME}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src/>
$<INSTALL_INTERFACE:include/bacnet/>)
if(BUILD_SHARED_LIBS)
set_target_properties(
${PROJECT_NAME}
PROPERTIES
C_VISIBILITY_PRESET hidden)
endif()
target_compile_definitions(
${PROJECT_NAME}
PUBLIC
BACNET_PROTOCOL_REVISION=${BACNET_PROTOCOL_REVISION}
$<$<BOOL:${BACDL_BIP}>:BACDL_BIP>
$<$<BOOL:${BACDL_BIP6}>:BACDL_BIP6>
$<$<BOOL:${BACDL_ARCNET}>:BACDL_ARCNET>
$<$<BOOL:${BACDL_MSTP}>:BACDL_MSTP>
$<$<BOOL:${BACDL_ETHERNET}>:BACDL_ETHERNET>
$<$<BOOL:${BACDL_NONE}>:BACDL_NONE>
$<$<BOOL:${BACNET_PROPERTY_LISTS}>:BACNET_PROPERTY_LISTS>
$<$<BOOL:${BAC_ROUTING}>:BAC_ROUTING>
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:BACNET_STACK_STATIC_DEFINE>
PRIVATE
PRINT_ENABLED=1)
target_link_libraries(${PROJECT_NAME} PUBLIC Threads::Threads)
add_library(
${PROJECT_NAME}::${PROJECT_NAME}
ALIAS
${PROJECT_NAME})
#
# add tests
#
list(APPEND testdirs
test/bacnet/abort
test/bacnet/alarm_ack
test/bacnet/arf
test/bacnet/awf
test/bacnet/bacapp
test/bacnet/bacdcode
test/bacnet/bacdevobjpropref
test/bacnet/bacerror
test/bacnet/bacint
test/bacnet/bacpropstates
test/bacnet/bacreal
test/bacnet/bacstr
test/bacnet/cov
#test/bacnet/datetime #Tests skipped, redesign to use only API
test/bacnet/dcc
test/bacnet/event
test/bacnet/getevent
test/bacnet/iam
test/bacnet/ihave
test/bacnet/indtext
test/bacnet/lighting
test/bacnet/lso
test/bacnet/memcopy
test/bacnet/npdu
test/bacnet/property
test/bacnet/ptransfer
test/bacnet/rd
test/bacnet/reject
test/bacnet/rp
test/bacnet/rpm
test/bacnet/timestamp
test/bacnet/timesync
test/bacnet/whohas
test/bacnet/whois
test/bacnet/wp
)
# bacnet/basic/*
list(APPEND testdirs
# basic/object/binding
test/bacnet/basic/binding/address
# basic/object
#test/bacnet/basic/object/acc #Tests skipped, redesign to use only API
test/bacnet/basic/object/access_credential # Build failed
test/bacnet/basic/object/access_door # Build failed
test/bacnet/basic/object/access_point # Build failed
test/bacnet/basic/object/access_rights # Build failed
test/bacnet/basic/object/access_user # Build failed
test/bacnet/basic/object/access_zone # Build failed
test/bacnet/basic/object/ai # Build failed
test/bacnet/basic/object/ao # Build failed
test/bacnet/basic/object/av # Build failed
test/bacnet/basic/object/bi # Build failed
test/bacnet/basic/object/bo # Build failed
test/bacnet/basic/object/bv # Build failed
#test/bacnet/basic/object/command #Tests skipped, redesign to use only API
test/bacnet/basic/object/credential_data_input # Build failed
test/bacnet/basic/object/device # Build failed
#test/bacnet/basic/object/lc #Tests skipped, redesign to use only API
test/bacnet/basic/object/lo # Build failed
test/bacnet/basic/object/lsp # Build failed
test/bacnet/basic/object/ms-input # Build failed
test/bacnet/basic/object/mso # Build failed
test/bacnet/basic/object/msv # Build failed
test/bacnet/basic/object/netport # Build failed
#test/bacnet/basic/object/objects #Tests skipped, redesign to use only API
test/bacnet/basic/object/osv # Build failed
test/bacnet/basic/object/piv # Build failed
test/bacnet/basic/object/schedule # Build failed
# basic/sys
test/bacnet/basic/sys/fifo
test/bacnet/basic/sys/filename
test/bacnet/basic/sys/key
test/bacnet/basic/sys/keylist
test/bacnet/basic/sys/ringbuf
test/bacnet/basic/sys/sbuf
)
# bacnet/datalink/*
list(APPEND testdirs
test/bacnet/datalink/crc
#test/bacnet/datalink/bvlc #All tests skipped, needing development
)
enable_testing()
foreach(testdir IN ITEMS ${testdirs})
get_filename_component(basename ${testdir} NAME)
add_subdirectory(${testdir})
add_test(build_${basename}
"${CMAKE_COMMAND}"
--build "${CMAKE_BINARY_DIR}"
--config "$<CONFIG>"
--target test_${basename}
)
add_test(test_${basename} ${testdir}/test_${basename})
set_tests_properties(test_${basename} PROPERTIES FIXTURES_REQUIRED test_fixture)
set_tests_properties(build_${basename} PROPERTIES FIXTURES_SETUP test_fixture)
endforeach()
#
# add ports
#
set(BACNET_PORT_DIRECTORY_PATH "")
if(ZEPHYR_BASE)
message(FATAL_ERROR "ZEPHYR_BASE env variable defined. Use zephyr/CMakeLists.txt for Zephyr build")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message(STATUS "BACNET: building for linux")
set(BACNET_PORT_DIRECTORY_PATH ${CMAKE_CURRENT_LIST_DIR}/ports/linux)
target_sources(${PROJECT_NAME} PRIVATE
ports/linux/bacport.h
ports/linux/datetime-init.c
$<$<BOOL:${BACDL_BIP}>:ports/linux/bip-init.c>
$<$<BOOL:${BACDL_BIP6}>:ports/linux/bip6.c>
$<$<BOOL:${BACDL_ARCNET}>:ports/linux/arcnet.c>
$<$<BOOL:${BACDL_MSTP}>:ports/linux/rs485.c>
$<$<BOOL:${BACDL_MSTP}>:ports/linux/rs485.h>
$<$<BOOL:${BACDL_MSTP}>:ports/linux/dlmstp.c>
$<$<BOOL:${BACDL_MSTP}>:ports/linux/dlmstp_linux.c>
$<$<BOOL:${BACDL_MSTP}>:ports/linux/dlmstp_linux.h>
# ports/linux/rx_fsm.c
$<$<BOOL:${BACDL_ETHERNET}>:ports/linux/ethernet.c>
ports/linux/mstimer-init.c)
elseif(WIN32)
message(STATUS "BACNET: building for win32")
set(BACNET_PORT_DIRECTORY_PATH ${CMAKE_CURRENT_LIST_DIR}/ports/win32)
target_link_libraries(${PROJECT_NAME} PUBLIC wsock32)
target_link_libraries(${PROJECT_NAME} PRIVATE
winmm
$<$<BOOL:${BACDL_BIP}>:ws2_32>
$<$<BOOL:${BACDL_BIP}>:iphlpapi>)
target_sources(${PROJECT_NAME} PRIVATE
ports/win32/bacport.h
$<$<BOOL:${BACDL_BIP6}>:ports/win32/bip6.c>
$<$<BOOL:${BACDL_BIP}>:ports/win32/bip-init.c>
# ports/win32/rx_fsm.c
ports/win32/datetime-init.c
$<$<BOOL:${BACDL_MSTP}>:ports/win32/dlmstp.c>
# ports/win32/dlmstp-mm.c
$<$<BOOL:${BACDL_ETHERNET}>:ports/win32/ethernet.c>
ports/win32/mstimer-init.c
$<$<BOOL:${BACDL_MSTP}>:ports/win32/rs485.c>
$<$<BOOL:${BACDL_MSTP}>:ports/win32/rs485.h>)
elseif(APPLE)
message(STATUS "BACNET: building for APPLE")
set(BACNET_PORT_DIRECTORY_PATH ${CMAKE_CURRENT_LIST_DIR}/ports/bsd)
target_sources(${PROJECT_NAME} PRIVATE
ports/bsd/bacport.h
ports/bsd/bip-init.c
ports/bsd/datetime-init.c
ports/bsd/mstimer-init.c
ports/bsd/stdbool.h)
endif()
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${BACNET_PORT_DIRECTORY_PATH}>)
#
# examples
#
if(BACNET_STACK_BUILD_APPS)
message(STATUS "BACNET: compiling also apps")
add_executable(abort apps/abort/main.c)
target_link_libraries(abort PRIVATE ${PROJECT_NAME})
add_executable(dcc apps/dcc/main.c)
target_link_libraries(dcc PRIVATE ${PROJECT_NAME})
add_executable(epics apps/epics/main.c)
target_link_libraries(epics PRIVATE ${PROJECT_NAME})
add_executable(error apps/error/main.c)
target_link_libraries(error PRIVATE ${PROJECT_NAME})
# add_executable(gateway apps/gateway/main.c apps/gateway/gateway.h)
# target_link_libraries(gateway PRIVATE ${PROJECT_NAME})
add_executable(getevent apps/getevent/main.c)
target_link_libraries(getevent PRIVATE ${PROJECT_NAME})
add_executable(iam apps/iam/main.c)
target_link_libraries(iam PRIVATE ${PROJECT_NAME})
add_executable(iamrouter apps/iamrouter/main.c)
target_link_libraries(iamrouter PRIVATE ${PROJECT_NAME})
add_executable(initrouter apps/initrouter/main.c)
target_link_libraries(initrouter PRIVATE ${PROJECT_NAME})
if(BACDL_MSTP)
add_executable(mstpcap apps/mstpcap/main.c)
target_link_libraries(mstpcap PRIVATE ${PROJECT_NAME})
add_executable(mstpcrc apps/mstpcrc/main.c)
target_link_libraries(mstpcrc PRIVATE ${PROJECT_NAME})
endif()
if(BACNET_BUILD_PIFACE_APP)
add_executable(piface apps/piface/main.c apps/piface/device.c)
target_link_libraries(piface PRIVATE ${PROJECT_NAME})
endif(BACNET_BUILD_PIFACE_APP)
# add_executable(
# ptransfer
# apps/ptransfer/main.c
# apps/ptransfer/h_pt_a.h
# apps/ptransfer/h_pt_a.c
# apps/ptransfer/h_pt.h
# apps/ptransfer/h_pt.c
# apps/ptransfer/s_ptransfer.h
# apps/ptransfer/s_ptransfer.c)
# target_link_libraries(ptransfer PRIVATE ${PROJECT_NAME})
if(NOT BACDL_ETHERNET)
add_executable(readbdt apps/readbdt/main.c)
target_link_libraries(readbdt PRIVATE ${PROJECT_NAME})
add_executable(readfdt apps/readfdt/main.c)
target_link_libraries(readfdt PRIVATE ${PROJECT_NAME})
endif()
add_executable(readfile apps/readfile/main.c)
target_link_libraries(readfile PRIVATE ${PROJECT_NAME})
add_executable(readprop apps/readprop/main.c)
target_link_libraries(readprop PRIVATE ${PROJECT_NAME})
add_executable(readpropm apps/readpropm/main.c)
target_link_libraries(readpropm PRIVATE ${PROJECT_NAME})
add_executable(readrange apps/readrange/main.c)
target_link_libraries(readrange PRIVATE ${PROJECT_NAME})
add_executable(reinit apps/reinit/main.c)
target_link_libraries(reinit PRIVATE ${PROJECT_NAME})
if(BACDL_MSTP)
add_executable(
router
apps/router/ipmodule.c
apps/router/ipmodule.h
apps/router/main.c
apps/router/msgqueue.c
apps/router/msgqueue.h
apps/router/mstpmodule.c
apps/router/mstpmodule.h
apps/router/network_layer.c
apps/router/network_layer.h
apps/router/portthread.c
apps/router/portthread.h)
target_link_libraries(
router
PRIVATE ${PROJECT_NAME}
# needs libconfig
-lconfig)
endif()
if(BACDL_BIP6)
add_executable(router-ipv6 apps/router-ipv6/main.c)
target_link_libraries(router-ipv6 PRIVATE ${PROJECT_NAME})
endif()
add_executable(scov apps/scov/main.c)
target_link_libraries(scov PRIVATE ${PROJECT_NAME})
add_executable(server apps/server/main.c)
target_link_libraries(server PRIVATE ${PROJECT_NAME})
add_executable(timesync apps/timesync/main.c)
target_link_libraries(timesync PRIVATE ${PROJECT_NAME})
add_executable(ucov apps/ucov/main.c)
target_link_libraries(ucov PRIVATE ${PROJECT_NAME})
add_executable(uevent apps/uevent/main.c)
target_link_libraries(uevent PRIVATE ${PROJECT_NAME})
add_executable(uptransfer apps/uptransfer/main.c)
target_link_libraries(uptransfer PRIVATE ${PROJECT_NAME})
add_executable(whohas apps/whohas/main.c)
target_link_libraries(whohas PRIVATE ${PROJECT_NAME})
add_executable(whois apps/whois/main.c)
target_link_libraries(whois PRIVATE ${PROJECT_NAME})
add_executable(whoisrouter apps/whoisrouter/main.c)
target_link_libraries(whoisrouter PRIVATE ${PROJECT_NAME})
add_executable(writefile apps/writefile/main.c)
target_link_libraries(writefile PRIVATE ${PROJECT_NAME})
add_executable(writeprop apps/writeprop/main.c)
target_link_libraries(writeprop PRIVATE ${PROJECT_NAME})
add_executable(writepropm apps/writepropm/main.c)
target_link_libraries(writepropm PRIVATE ${PROJECT_NAME})
endif()
#
# install
#
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(BACNET_STACK_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
install(
EXPORT ${PROJECT_NAME}Targets
DESTINATION ${BACNET_STACK_CONFIG_INSTALL_DIR}
NAMESPACE ${PROJECT_NAME}::
COMPONENT dev)
configure_package_config_file(
cmake/Config.cmake.in
${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION
${BACNET_STACK_CONFIG_INSTALL_DIR})
write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake COMPATIBILITY SameMajorVersion)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${BACNET_STACK_CONFIG_INSTALL_DIR}
COMPONENT dev)
install(
DIRECTORY src/bacnet
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT dev
FILES_MATCHING
PATTERN "*.h")
install(
DIRECTORY ${BACNET_PORT_DIRECTORY_PATH}/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT dev
FILES_MATCHING
PATTERN "*.h")
message(STATUS "BACNET: using cmake:....................\"${CMAKE_VERSION}\"")
message(STATUS "BACNET: CMAKE_C_COMPILER_ID:............\"${CMAKE_C_COMPILER_ID}\"")
message(STATUS "BACNET: CMAKE_C_COMPILER_VERSION:.......\"${CMAKE_C_COMPILER_VERSION}\"")
message(STATUS "BACNET: CMAKE_CXX_COMPILER_ID:..........\"${CMAKE_CXX_COMPILER_ID}\"")
message(STATUS "BACNET: CMAKE_CXX_COMPILER_VERSION:.....\"${CMAKE_CXX_COMPILER_VERSION}\"")
message(STATUS "BACNET: CMAKE_INSTALL_PREFIX:...........\"${CMAKE_INSTALL_PREFIX}\"")
message(STATUS "BACNET: BACNET_PROTOCOL_REVISION:.......\"${BACNET_PROTOCOL_REVISION}\"")
message(STATUS "BACNET: BACDL_BIP6:.....................\"${BACDL_BIP6}\"")
message(STATUS "BACNET: BACDL_BIP:......................\"${BACDL_BIP}\"")
message(STATUS "BACNET: BACDL_ARCNET:...................\"${BACDL_ARCNET}\"")
message(STATUS "BACNET: BACDL_MSTP:.....................\"${BACDL_MSTP}\"")
message(STATUS "BACNET: BACDL_ETHERNET:.................\"${BACDL_ETHERNET}\"")
message(STATUS "BACNET: BACDL_NONE:.....................\"${BACDL_NONE}\"")