-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
938 lines (851 loc) · 37.6 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
cmake_minimum_required(VERSION 3.16.3)
cmake_policy(VERSION 3.16.3...3.25.1)
project(psibase)
include(ExternalProject)
if(CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
message(FATAL_ERROR "Building in-source is not supported; create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt and ${CMAKE_SOURCE_DIR}/CMakeFiles")
endif()
if(NOT DEFINED WASI_SDK_PREFIX AND DEFINED ENV{WASI_SDK_PREFIX})
set(WASI_SDK_PREFIX $ENV{WASI_SDK_PREFIX})
endif()
if(NOT DEFINED ICU_LIBRARY_DIR )
set(ICU_LIBRARY_DIR $ENV{ICU_LIBRARY_DIR})
endif()
option (FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE)
if (${FORCE_COLORED_OUTPUT})
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options (-fdiagnostics-color=always)
else ()
add_compile_options(-fcolor-diagnostics)
endif ()
endif ()
file(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake)
option(BUILD_STATIC "Build static binaries" OFF)
option(ENABLE_SSL "Build psinode with TLS support" ON)
add_subdirectory(native)
add_subdirectory(rust)
file(APPEND ${CMAKE_BINARY_DIR}/CTestTestfile.cmake "subdirs(\"native\" \"rust\")\n")
option(BUILD_DEBUG_WASM "Build debug wasms" OFF)
include(GNUInstallDirs)
if(DEFINED WASI_SDK_PREFIX)
install(DIRECTORY ${WASI_SDK_PREFIX}/ USE_SOURCE_PERMISSIONS DESTINATION . COMPONENT WASI EXCLUDE_FROM_ALL)
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(WASI_SDK_URL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-x86_64-linux.tar.gz)
set(WASI_SDK_SHA256 c6c38aab56e5de88adf6c1ebc9c3ae8da72f88ec2b656fb024eda8d4167a0bc5)
elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "^(arm|aarch).*" )
set(WASI_SDK_URL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-arm64-linux.tar.gz)
set(WASI_SDK_SHA256 ae6c1417ea161e54bc54c0a168976af57a0c6e53078857886057a71a0d928646)
endif()
if(DEFINED WASI_SDK_URL)
ExternalProject_Add(wasi-sdk
URL ${WASI_SDK_URL}
URL_HASH SHA256=${WASI_SDK_SHA256}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(wasi-sdk SOURCE_DIR)
set(WASI_SDK_PREFIX ${SOURCE_DIR})
set(wasm-deps wasi-sdk)
install(DIRECTORY ${WASI_SDK_PREFIX}/ USE_SOURCE_PERMISSIONS DESTINATION . COMPONENT WASI)
endif()
endif()
if(DEFINED WASI_SDK_PREFIX)
ProcessorCount(NUM_PROCS)
# This is used by the VerifySig service. The kinds of keys supported need to be configured
# here. We use a minimized build to keep the size of the service down. Static linking is
# not enough because the algorithms are looked up dynamically.
#
# --cpu=generic is used instead of --cpu=wasm, because Botan thinks that wasm means emscripten.
# --cc=gcc is used instead of clang, because Botan's clang configration includes -pthread.
# The stack protector requires an entropy source so we can't support it.
# -msimd128 is disabled because binaryen 105 doesn't fully support it
ExternalProject_Add(wasm-botan
URL https://github.com/gofractally/psibase/releases/download/deps/Botan-3.1.1.tar.xz
URL_HASH SHA256=30c84fe919936a98fef5331f246c62aa2c0e4d2085b2d4511207f6a20afa3a6b
DEPENDS ${wasm-deps}
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/wasm/botan
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/wasm/deps
CONFIGURE_COMMAND <SOURCE_DIR>/configure.py --cc-bin=${WASI_SDK_PREFIX}/bin/clang++ --cc=gcc --cpu=generic --os=none --ar-command=${WASI_SDK_PREFIX}/bin/llvm-ar --build-targets=static --with-sysroot-dir=${WASI_SDK_PREFIX}/share/wasi-sysroot --minimized-build --enable-modules=ecdsa,raw_hash,auto_rng,sha2_64,getentropy --with-os-feature=getentropy "--cxxflags=--target=wasm32-wasi -O3 -msign-ext -mnontrapping-fptoint -mbulk-memory" --without-stack-protector --prefix=<INSTALL_DIR>
BUILD_COMMAND make -j${NUM_PROCS}
INSTALL_COMMAND make install
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/wasm/deps/lib/libbotan-3.a
DESTINATION ${CMAKE_INSTALL_DATADIR}/wasi-sysroot/lib
COMPONENT libpsibase
)
install(DIRECTORY ${CMAKE_BINARY_DIR}/wasm/deps/include/botan-3
DESTINATION ${CMAKE_INSTALL_DATADIR}/wasi-sysroot/include
COMPONENT libpsibase
)
ExternalProject_Add(wasm
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/wasm
DEPENDS ${wasm-deps} wasm-botan
BINARY_DIR wasm
INSTALL_COMMAND ""
BUILD_ALWAYS 1
TEST_EXCLUDE_FROM_MAIN 1
STEP_TARGETS configure
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=
-DBUILD_RELEASE_WASM=ON
-DBUILD_DEBUG_WASM=${BUILD_DEBUG_WASM}
-DCMAKE_TARGET_MESSAGES=${CMAKE_TARGET_MESSAGES}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_SOURCE_DIR}/wasm/toolchain.cmake
-DWASI_SDK_PREFIX=${WASI_SDK_PREFIX}
-DWASM_CLANG_PREFIX=${WASM_CLANG_PREFIX}
-DWASM_CLANG_SUFFIX=${WASM_CLANG_SUFFIX}
-DCMAKE_SYSROOT=${WASI_SDK_PREFIX}/share/wasi-sysroot
-DFORCE_COLORED_OUTPUT=${FORCE_COLORED_OUTPUT}
-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
-DCMAKE_FIND_ROOT_PATH=${CMAKE_CURRENT_BINARY_DIR}/wasm/deps
-DCMAKE_PREFIX_PATH=/
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_DATADIR}/wasi-sysroot/include
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_DATADIR}/wasi-sysroot/lib
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Accounts.wasm
${CMAKE_CURRENT_BINARY_DIR}/AuthDelegate.wasm
${CMAKE_CURRENT_BINARY_DIR}/AuthSig.wasm
${CMAKE_CURRENT_BINARY_DIR}/AuthAny.wasm
${CMAKE_CURRENT_BINARY_DIR}/AuthInvite.wasm
${CMAKE_CURRENT_BINARY_DIR}/CommonApi.wasm
${CMAKE_CURRENT_BINARY_DIR}/CoreFractal.wasm
${CMAKE_CURRENT_BINARY_DIR}/CpuLimit.wasm
${CMAKE_CURRENT_BINARY_DIR}/Events.wasm
${CMAKE_CURRENT_BINARY_DIR}/Explorer.wasm
${CMAKE_CURRENT_BINARY_DIR}/Fractal.wasm
${CMAKE_CURRENT_BINARY_DIR}/Invite.wasm
${CMAKE_CURRENT_BINARY_DIR}/Nft.wasm
${CMAKE_CURRENT_BINARY_DIR}/Nop.wasm
${CMAKE_CURRENT_BINARY_DIR}/Packages.wasm
${CMAKE_CURRENT_BINARY_DIR}/Producers.wasm
${CMAKE_CURRENT_BINARY_DIR}/HttpServer.wasm
${CMAKE_CURRENT_BINARY_DIR}/Sites.wasm
${CMAKE_CURRENT_BINARY_DIR}/RAccounts.wasm
${CMAKE_CURRENT_BINARY_DIR}/RAuthSig.wasm
${CMAKE_CURRENT_BINARY_DIR}/REvents.wasm
${CMAKE_CURRENT_BINARY_DIR}/RPackages.wasm
${CMAKE_CURRENT_BINARY_DIR}/RProducers.wasm
${CMAKE_CURRENT_BINARY_DIR}/RHttpServer.wasm
${CMAKE_CURRENT_BINARY_DIR}/RSetCode.wasm
${CMAKE_CURRENT_BINARY_DIR}/RTokens.wasm
${CMAKE_CURRENT_BINARY_DIR}/RTransact.wasm
${CMAKE_CURRENT_BINARY_DIR}/SetCode.wasm
${CMAKE_CURRENT_BINARY_DIR}/Symbol.wasm
${CMAKE_CURRENT_BINARY_DIR}/Tokens.wasm
${CMAKE_CURRENT_BINARY_DIR}/Transact.wasm
${CMAKE_CURRENT_BINARY_DIR}/VerifySig.wasm
${CMAKE_CURRENT_BINARY_DIR}/PSubjectiveService.wasm
${CMAKE_CURRENT_BINARY_DIR}/CounterService.wasm
${CMAKE_CURRENT_BINARY_DIR}/AsyncQueryService.wasm
${CMAKE_CURRENT_BINARY_DIR}/SubjectiveCounterService.wasm
${CMAKE_CURRENT_BINARY_DIR}/KeepSocketService.wasm
)
file(APPEND ${CMAKE_BINARY_DIR}/CTestTestfile.cmake "subdirs(\"wasm\")\n")
ExternalProject_Add_StepTargets(wasm test)
install(CODE "include(${CMAKE_CURRENT_BINARY_DIR}/wasm/cmake_install.cmake)" COMPONENT libpsibase)
else()
message(WARNING "WASI_SDK_PREFIX isn't defined; skipping wasm")
endif()
# Documentation
ExternalProject_Add(
gen-cpp-doc
DEPENDS wasm
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rust
CONFIGURE_COMMAND ""
BUILD_COMMAND cargo build -r --bin gen-cpp-doc --manifest-path ${CMAKE_CURRENT_SOURCE_DIR}/rust/Cargo.toml --target-dir ${CMAKE_CURRENT_BINARY_DIR}/rust
INSTALL_COMMAND ""
)
ExternalProject_Add(
md2man
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rust
CONFIGURE_COMMAND ""
BUILD_COMMAND cargo build -r --bin md2man --manifest-path ${CMAKE_CURRENT_SOURCE_DIR}/rust/Cargo.toml --target-dir ${CMAKE_CURRENT_BINARY_DIR}/rust
BUILD_ALWAYS 1
INSTALL_COMMAND ""
)
function(ADD_BOOK_FILES path extension)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}${path} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}${path})
file(GLOB DOC_FILES ${CMAKE_CURRENT_BINARY_DIR}${path}*.${extension})
set(doc-src ${doc-src} ${DOC_FILES} PARENT_SCOPE)
endfunction()
configure_file(doc/psidk/book.toml.in doc/psidk/book.toml)
configure_file(doc/psidk/theme/index.hbs doc/psidk/theme/index.hbs)
ADD_BOOK_FILES("/doc/psidk/theme/js/" "js")
ADD_BOOK_FILES("/doc/psidk/theme/css/" "css")
ADD_BOOK_FILES("/doc/psidk/src/_img/" "svg")
file(GLOB_RECURSE doc-src ${CMAKE_CURRENT_SOURCE_DIR}/doc/psidk/src/*.md)
list(APPEND doc-src ${CMAKE_CURRENT_BINARY_DIR}/doc/psidk/book.toml)
file(GLOB_RECURSE doc-cpp ${CMAKE_CURRENT_SOURCE_DIR}/doc/src/development/services/cpp-service/*.cpp)
file(GLOB_RECURSE doc-cmake doc/src/development/services/cpp-service/*/CMakeLists.txt)
file(GLOB doc-headers libraries/psibase/common/include/psibase/*.hpp)
file(GLOB doc-service-headers services/*/*/include/services/*/*.hpp)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/book/html/index.html
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/book/html
DEPENDS gen-cpp-doc ${doc-src} ${doc-cpp} ${doc-cmake} ${doc-headers} ${doc-service-headers}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/book
COMMAND mdbook build -d ${CMAKE_CURRENT_BINARY_DIR}/book ${CMAKE_CURRENT_BINARY_DIR}/doc/psidk
COMMAND find ${CMAKE_CURRENT_BINARY_DIR}/book "(" -name ".*" -o -name "*~" ")" -delete
VERBATIM
)
add_custom_target(
doc
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/book/html/index.html
)
function(add_manpage name)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doc/psidk/${name}.1
DEPENDS md2man doc/psidk/src/run-infrastructure/cli/${name}.md
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/rust/release/md2man < ${CMAKE_CURRENT_SOURCE_DIR}/doc/psidk/src/run-infrastructure/cli/${name}.md > ${CMAKE_CURRENT_BINARY_DIR}/doc/psidk/${name}.1
)
add_custom_target(${name}.1 ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doc/psidk/${name}.1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/doc/psidk/${name}.1 TYPE MAN COMPONENT Client)
endfunction()
add_manpage(psinode)
add_manpage(psibase)
add_manpage(psibase-create-snapshot)
add_manpage(psibase-load-snapshot)
# Cargo psibase
ExternalProject_Add(
cargo-psibase
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rust
CONFIGURE_COMMAND ""
BUILD_COMMAND cargo build -r --bin cargo-psibase --manifest-path ${CMAKE_CURRENT_SOURCE_DIR}/rust/Cargo.toml --target-dir ${CMAKE_CURRENT_BINARY_DIR}/rust
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/rust/release/cargo-psibase
BUILD_ALWAYS 1
INSTALL_COMMAND ""
)
# UIs built with yarn
set(JS_DIRS
services/user/Homepage/ui:Homepage_js
services/user/Supervisor/ui:Supervisor_js
services/user/Explorer/ui:Explorer_js
services/user/Tokens/ui:Tokens_js
services/user/Branding/ui:Branding_js
services/user/Chainmail/ui:Chainmail_js
)
set(ADMIN_DIR services/user/XAdmin/ui:XAdmin_js)
set(COMMON_LIB_DIR services/user/CommonApi/common/packages/common-lib/:CommonApiCommonLib_js)
function(add_js_target TARGET_TUPLE OUTPUT_FILE)
string(REGEX REPLACE "^([^:]+):([^:]+)$" \\1 PATH ${TARGET_TUPLE})
string(REGEX REPLACE "^([^:]+):([^:]+)$" \\2 TARGET_NAME ${TARGET_TUPLE})
set(OUTPUT_FILEPATH ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/dist/${OUTPUT_FILE})
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/src/*)
list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/package.json ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/yarn.lock)
# Add a command that rebuilds `${OUTPUT_FILEPATH}` whenever any sources or dependencies are updated
add_custom_command(
OUTPUT ${OUTPUT_FILEPATH}
BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/dist
DEPENDS ${SOURCES} ${ARGN}
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/${PATH} && yarn --mutex network && yarn build
)
# Create a custom target to ensure `${OUTPUT_FILEPATH}` is built before `${TARGET_NAME}`
add_custom_target(${TARGET_NAME} DEPENDS ${OUTPUT_FILEPATH})
# Expose `${TARGET_NAME}` and its dependency to the parent scope for further use
set(${TARGET_NAME}_DEP ${TARGET_NAME} ${OUTPUT_FILEPATH} PARENT_SCOPE)
endfunction()
# Static (not built) resource dependencies
file(GLOB common-misc-resources LIST_DIRECTORIES false ${CMAKE_CURRENT_SOURCE_DIR}/services/user/CommonApi/common/resources/*)
file(GLOB common-fonts LIST_DIRECTORIES false ${CMAKE_CURRENT_SOURCE_DIR}/services/user/CommonApi/common/resources/fonts/*)
# Builds the Common files that the UIs (just below) depend on
add_js_target(${COMMON_LIB_DIR} common-lib.js)
# Build each UI
# Each of these UIs receives the build output of CommonApi, so CommonApi files are listed as dependencies
foreach(ROW ${JS_DIRS})
add_js_target(${ROW} index.html ${common-misc-resources} ${common-fonts} ${CommonApiCommonLib_js_DEP})
endforeach()
# Static (not built) resource dependencies
file(GLOB plugin-wit LIST_DIRECTORIES false ${CMAKE_CURRENT_SOURCE_DIR}/services/user/CommonApi/common/packages/wit/*)
# Build each component
include(libraries/psibase/sdk/rs-components.cmake)
add_rs_component(services/user/CommonApi/common/packages/component-parser:ComponentParser component_parser.wasm wasm32-unknown-unknown)
add_dependencies(CommonApiCommonLib_js ComponentParser)
add_rs_component_workspace(services/:Plugins
accounts
account-tokens
auth-any
auth-delegate
auth-invite
auth-sig
clientdata
invite
sites
test
tokens
transact
)
set(WASM_PSIBASE_BYPRODUCTS
${CMAKE_CURRENT_SOURCE_DIR}/services/user/XAdmin/ui/wasm-psibase/wasm-psibase_bg.js
${CMAKE_CURRENT_SOURCE_DIR}/services/user/XAdmin/ui/wasm-psibase/wasm-psibase_bg.wasm
${CMAKE_CURRENT_SOURCE_DIR}/services/user/XAdmin/ui/wasm-psibase/wasm-psibase_bg.wasm.d.ts
${CMAKE_CURRENT_SOURCE_DIR}/services/user/XAdmin/ui/wasm-psibase/wasm-psibase.d.ts
${CMAKE_CURRENT_SOURCE_DIR}/services/user/XAdmin/ui/wasm-psibase/wasm-psibase.js
)
add_js_target(${ADMIN_DIR} index.html ${WASM_PSIBASE_BYPRODUCTS} ${CommonApiCommonLib_js_DEP})
add_custom_command(
OUTPUT ${WASM_PSIBASE_BYPRODUCTS}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/rust/release/psibase
COMMAND wasm-pack build ${CMAKE_CURRENT_SOURCE_DIR}/rust/psibase --out-dir ${CMAKE_CURRENT_SOURCE_DIR}/services/user/XAdmin/ui/wasm-psibase --out-name wasm-psibase
)
add_custom_target(wasm-psibase ALL DEPENDS ${WASM_PSIBASE_BYPRODUCTS})
add_dependencies(wasm-psibase rust)
function(psinode_files target pfx)
add_custom_target(
${target}
ALL
DEPENDS XAdmin_js
COMMAND rm -rf ${pfx}/share/psibase/services/x-admin
COMMAND mkdir -p ${pfx}/share/psibase/services
COMMAND cp -a ${CMAKE_CURRENT_SOURCE_DIR}/services/user/XAdmin/ui/dist ${pfx}/share/psibase/services/x-admin
COMMAND mkdir -p ${pfx}/share/psibase/services/x-admin/common
COMMAND cp -a ${CMAKE_CURRENT_SOURCE_DIR}/services/user/CommonApi/common/resources/fonts ${pfx}/share/psibase/services/x-admin/common/fonts
COMMAND cp -a ${CMAKE_CURRENT_SOURCE_DIR}/services/user/CommonApi/common/packages/common-lib/dist/common-lib.js ${pfx}/share/psibase/services/x-admin/common/
COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/programs/psinode/config.in ${pfx}/share/psibase/config.in
COMMAND ${CMAKE_COMMAND} -E create_symlink ../../packages ${pfx}/share/psibase/services/x-admin/packages
)
endfunction()
psinode_files(psinode-share ${CMAKE_CURRENT_BINARY_DIR})
add_dependencies(XAdmin_js wasm-psibase CommonApiCommonLib_js)
include(GNUInstallDirs)
install(DIRECTORY services/user/XAdmin/ui/dist/ DESTINATION ${CMAKE_INSTALL_DATADIR}/psibase/services/x-admin COMPONENT ServerData)
install(DIRECTORY services/user/CommonApi/common/resources/fonts DESTINATION ${CMAKE_INSTALL_DATADIR}/psibase/services/x-admin/common COMPONENT ServerData)
install(FILES services/user/CommonApi/common/packages/common-lib/dist/common-lib.js DESTINATION ${CMAKE_INSTALL_DATADIR}/psibase/services/x-admin/common COMPONENT ServerData)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/psibase/services/x-admin/packages DESTINATION ${CMAKE_INSTALL_DATADIR}/psibase/services/x-admin COMPONENT ServerData)
# Build service packages
include(libraries/psibase/sdk/pack_service.cmake)
set(SERVICE_DIR ${CMAKE_CURRENT_BINARY_DIR}/share/psibase/packages)
set(PSIBASE_VERSION "0.13.0")
psibase_package(
OUTPUT ${SERVICE_DIR}/Transact.psi
NAME Transact
VERSION ${PSIBASE_VERSION}
DESCRIPTION "All transactions enter the chain through this service"
SERVICE transact
WASM ${CMAKE_CURRENT_BINARY_DIR}/Transact.wasm
FLAGS allowSudo allowWriteNative
SERVER r-transact
DATA ${Plugins_OUTPUT_FILE_transact} /plugin.wasm
SERVICE r-transact
WASM ${CMAKE_CURRENT_BINARY_DIR}/RTransact.wasm
FLAGS allowWriteSubjective
POSTINSTALL ${CMAKE_CURRENT_SOURCE_DIR}/services/system/Transact/src/postinstall.json
DEPENDS wasm
DEPENDS ${Plugins_DEP}
PACKAGE_DEPENDS "Accounts(^${PSIBASE_VERSION})" "CpuLimit(^${PSIBASE_VERSION})" "HttpServer(^${PSIBASE_VERSION})" "Sites(^${PSIBASE_VERSION})"
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Accounts.psi
NAME Accounts
VERSION ${PSIBASE_VERSION}
DESCRIPTION "This service facilitates the creation of new accounts"
SERVICE accounts
WASM ${CMAKE_CURRENT_BINARY_DIR}/Accounts.wasm
SERVER r-accounts
DATA ${Plugins_OUTPUT_FILE_accounts} /plugin.wasm
DATA ${Plugins_OUTPUT_FILE_account_tokens} /account-tokens.wasm
INIT
SERVICE r-accounts
WASM ${CMAKE_CURRENT_BINARY_DIR}/RAccounts.wasm
DEPENDS wasm
DEPENDS ${Plugins_DEP}
PACKAGE_DEPENDS "AuthAny(^${PSIBASE_VERSION})" "HttpServer(^${PSIBASE_VERSION})" "Sites(^${PSIBASE_VERSION})"
)
psibase_package(
OUTPUT ${SERVICE_DIR}/ClientData.psi
NAME ClientData
DESCRIPTION "Plugin for enabling simpler interactions with client-side data storage"
VERSION ${PSIBASE_VERSION}
PACKAGE_DEPENDS "Nft(^${PSIBASE_VERSION})" "HttpServer(^${PSIBASE_VERSION})" "Sites(^${PSIBASE_VERSION})" "Accounts(^${PSIBASE_VERSION})" "CommonApi(^${PSIBASE_VERSION})" "Supervisor(^${PSIBASE_VERSION})"
SERVICE clientdata
DATA ${Plugins_OUTPUT_FILE_clientdata} /plugin.wasm
DEPENDS ${Plugins_DEP}
)
cargo_psibase_package(
OUTPUT ${SERVICE_DIR}/Chainmail.psi
PATH services/user/Chainmail
DEPENDS ${Chainmail_js_DEP}
)
cargo_psibase_package(
OUTPUT ${SERVICE_DIR}/Branding.psi
PATH services/user/Branding
DEPENDS ${Branding_js_DEP}
)
cargo_psibase_package(
OUTPUT ${SERVICE_DIR}/Brotli.psi
PATH services/user/Brotli
)
psibase_package(
OUTPUT ${SERVICE_DIR}/AuthSig.psi
NAME AuthSig
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Auth service using Botan to verify signatures"
SERVICE auth-sig
WASM ${CMAKE_CURRENT_BINARY_DIR}/AuthSig.wasm
DATA ${Plugins_OUTPUT_FILE_auth_sig} /plugin.wasm
SERVER r-auth-sig
SERVICE r-auth-sig
WASM ${CMAKE_CURRENT_BINARY_DIR}/RAuthSig.wasm
SERVICE verify-sig
WASM ${CMAKE_CURRENT_BINARY_DIR}/VerifySig.wasm
FLAGS isAuthService
DEPENDS wasm
DEPENDS ${Plugins_DEP}
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})" "Sites(^${PSIBASE_VERSION})"
)
set(COMMON_API ${CMAKE_CURRENT_SOURCE_DIR}/services/user/CommonApi)
set(THIRD_SRC ${COMMON_API}/common/resources/thirdParty/src)
set(THIRD_FILES
${THIRD_SRC}/htm.module.js
${THIRD_SRC}/react-dom.development.js
${THIRD_SRC}/react-dom.production.min.js
${THIRD_SRC}/react-router-dom.min.js
${THIRD_SRC}/react.development.js
${THIRD_SRC}/react.production.min.js
${THIRD_SRC}/semantic-ui-react.min.js
${THIRD_SRC}/useLocalStorageState.js)
psibase_package(
OUTPUT ${SERVICE_DIR}/CommonApi.psi
NAME CommonApi
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Service that contains the common files and libraries used by apps on psibase"
SERVICE common-api
WASM ${CMAKE_CURRENT_BINARY_DIR}/CommonApi.wasm
SERVER common-api
DATA ${COMMON_API}/common/packages/common-lib/dist/common-lib.js common/common-lib.js
DATA GLOB ${COMMON_API}/common/resources/*.mjs common/
DATA ${COMMON_API}/common/resources/fonts common/fonts
DATA GLOB ${THIRD_FILES} common
DATA ${COMPONENT_BIN_DIR}/${ComponentParser_OUTPUT_FILE} /common/${ComponentParser_OUTPUT_FILE}
DEPENDS ${CommonApiCommonLib_js_DEP}
DEPENDS ${ComponentParser_DEP}
DEPENDS wasm
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})" "Sites(^${PSIBASE_VERSION})"
)
psibase_package(
OUTPUT ${SERVICE_DIR}/AuthDelegate.psi
NAME AuthDelegate
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Auth service that delegates authorization to another account"
SERVICE auth-delegate
WASM ${CMAKE_CURRENT_BINARY_DIR}/AuthDelegate.wasm
SERVER auth-delegate
DATA ${Plugins_OUTPUT_FILE_auth_delegate} /plugin.wasm
DEPENDS wasm
DEPENDS ${Plugins_DEP}
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})" "Sites(^${PSIBASE_VERSION})"
)
psibase_package(
OUTPUT ${SERVICE_DIR}/AuthAny.psi
NAME AuthAny
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Insecure auth service that allows any access"
SERVICE auth-any
WASM ${CMAKE_CURRENT_BINARY_DIR}/AuthAny.wasm
DATA ${Plugins_OUTPUT_FILE_auth_any} /plugin.wasm
DEPENDS wasm
DEPENDS ${Plugins_DEP}
PACKAGE_DEPENDS "Sites(^${PSIBASE_VERSION})"
)
psibase_package(
OUTPUT ${SERVICE_DIR}/CpuLimit.psi
NAME CpuLimit
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Service that manages CPU billing"
SERVICE cpu-limit
WASM ${CMAKE_CURRENT_BINARY_DIR}/CpuLimit.wasm
FLAGS isSubjective canSetTimeLimit
DEPENDS wasm
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Docs.psi
NAME Docs
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Psibase documentation"
SERVICE docs
DATA ${CMAKE_CURRENT_BINARY_DIR}/book/html /
PACKAGE_DEPENDS "Sites(^${PSIBASE_VERSION})" "Accounts(^${PSIBASE_VERSION})"
DEPENDS doc ${CMAKE_CURRENT_BINARY_DIR}/book/html/index.html
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Homepage.psi
NAME Homepage
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Network homepage"
SERVICE homepage
DATA GLOB ${CMAKE_CURRENT_SOURCE_DIR}/services/user/Homepage/ui/dist/* /
POSTINSTALL ${CMAKE_CURRENT_SOURCE_DIR}/services/user/Homepage/postinstall.json
PACKAGE_DEPENDS "Sites(^${PSIBASE_VERSION})" "Accounts(^${PSIBASE_VERSION})"
DEPENDS ${Homepage_js_DEP}
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Nop.psi
NAME Nop
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Service that does nothing"
SERVICE nop
WASM ${CMAKE_CURRENT_BINARY_DIR}/Nop.wasm
DEPENDS wasm
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Sites.psi
NAME Sites
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Provides web hosting to non-service accounts"
SERVICE sites
WASM ${CMAKE_CURRENT_BINARY_DIR}/Sites.wasm
SERVER sites
DATA ${Plugins_OUTPUT_FILE_sites} /plugin.wasm
DEPENDS wasm
DEPENDS ${Plugins_DEP}
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})"
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Producers.psi
NAME Producers
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Manages the active producers"
SERVICE producers
WASM ${CMAKE_CURRENT_BINARY_DIR}/Producers.wasm
FLAGS allowWriteNative
SERVER r-producers
SERVICE r-producers
WASM ${CMAKE_CURRENT_BINARY_DIR}/RProducers.wasm
ACCOUNTS prods-weak prods-strong
POSTINSTALL ${CMAKE_CURRENT_SOURCE_DIR}/services/system/Producers/src/postinstall.json
DEPENDS wasm
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})" "Accounts(^${PSIBASE_VERSION})"
)
psibase_package(
OUTPUT ${SERVICE_DIR}/HttpServer.psi
NAME HttpServer
VERSION ${PSIBASE_VERSION}
DESCRIPTION "The `http-server` service routes HTTP requests to the appropriate service"
SERVICE http-server
WASM ${CMAKE_CURRENT_BINARY_DIR}/HttpServer.wasm
SERVER rhttp-server
FLAGS allowSocket allowWriteSubjective
SERVICE rhttp-server
WASM ${CMAKE_CURRENT_BINARY_DIR}/RHttpServer.wasm
DEPENDS wasm
)
psibase_package(
OUTPUT ${SERVICE_DIR}/SetCode.psi
NAME SetCode
VERSION ${PSIBASE_VERSION}
DESCRIPTION "All compiled code is uploaded to the chain through this service"
SERVICE setcode
WASM ${CMAKE_CURRENT_BINARY_DIR}/SetCode.wasm
FLAGS allowWriteNative
SERVER r-setcode
SERVICE r-setcode
WASM ${CMAKE_CURRENT_BINARY_DIR}/RSetCode.wasm
DEPENDS wasm
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})"
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Events.psi
NAME Events
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Indexes events and provides querying"
SERVICE events
WASM ${CMAKE_CURRENT_BINARY_DIR}/Events.wasm
FLAGS isSubjective forceReplay
SERVER r-events
SERVICE r-events
WASM ${CMAKE_CURRENT_BINARY_DIR}/REvents.wasm
POSTINSTALL ${CMAKE_CURRENT_SOURCE_DIR}/services/user/Events/src/postinstall.json
DEPENDS wasm
PACKAGE_DEPENDS "Transact(^${PSIBASE_VERSION})" "HttpServer(^${PSIBASE_VERSION})"
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Explorer.psi
NAME Explorer
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Block explorer"
SERVICE explorer
WASM ${CMAKE_CURRENT_BINARY_DIR}/Explorer.wasm
SERVER explorer
DATA ${CMAKE_CURRENT_SOURCE_DIR}/services/user/Explorer/ui/dist /
DEPENDS Explorer_js ${CMAKE_CURRENT_SOURCE_DIR}/services/user/Explorer/ui/dist/index.html
DEPENDS wasm
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})" "Sites(^${PSIBASE_VERSION})"
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Invite.psi
NAME Invite
VERSION ${PSIBASE_VERSION}
DESCRIPTION "This service facilitates the creation and redemption of invites"
PACKAGE_DEPENDS "Accounts(^${PSIBASE_VERSION})" "HttpServer(^${PSIBASE_VERSION})" "Nft(^${PSIBASE_VERSION})" "Tokens(^${PSIBASE_VERSION})" "AuthSig(^${PSIBASE_VERSION})" "Sites(^${PSIBASE_VERSION})"
SERVICE invite
WASM ${CMAKE_CURRENT_BINARY_DIR}/Invite.wasm
SERVER invite
INIT
DATA ${Plugins_OUTPUT_FILE_invite} /plugin.wasm
SERVICE auth-invite
WASM ${CMAKE_CURRENT_BINARY_DIR}/AuthInvite.wasm
DATA ${Plugins_OUTPUT_FILE_auth_invite} /plugin.wasm
DEPENDS wasm
DEPENDS ${Plugins_DEP}
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Nft.psi
NAME Nft
VERSION ${PSIBASE_VERSION}
PACKAGE_DEPENDS "Accounts(^${PSIBASE_VERSION})" "HttpServer(^${PSIBASE_VERSION})" "Events(^${PSIBASE_VERSION})"
SERVICE nft
WASM ${CMAKE_CURRENT_BINARY_DIR}/Nft.wasm
INIT
DEPENDS wasm
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Supervisor.psi
NAME Supervisor
VERSION ${PSIBASE_VERSION}
PACKAGE_DEPENDS "Nft(^${PSIBASE_VERSION})" "HttpServer(^${PSIBASE_VERSION})" "Sites(^${PSIBASE_VERSION})" "Accounts(^${PSIBASE_VERSION})" "CommonApi(^${PSIBASE_VERSION})"
SERVICE supervisor
DATA GLOB ${CMAKE_CURRENT_SOURCE_DIR}/services/user/Supervisor/ui/dist/* /
DEPENDS ${Supervisor_js_DEP}
)
psibase_package(
OUTPUT ${SERVICE_DIR}/SupervisorTests.psi
NAME SupervisorTests
DESCRIPTION "Plugin functions for testing Supervisor functionality"
VERSION ${PSIBASE_VERSION}
PACKAGE_DEPENDS "Nft(^${PSIBASE_VERSION})" "HttpServer(^${PSIBASE_VERSION})" "Sites(^${PSIBASE_VERSION})" "Accounts(^${PSIBASE_VERSION})" "CommonApi(^${PSIBASE_VERSION})" "Supervisor(^${PSIBASE_VERSION})"
SERVICE sup-test
DATA ${Plugins_OUTPUT_FILE_test} /test.wasm
DEPENDS ${Plugins_DEP}
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Tokens.psi
NAME Tokens
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Token service"
PACKAGE_DEPENDS "Nft(^${PSIBASE_VERSION})" "HttpServer(^${PSIBASE_VERSION})" "Events(^${PSIBASE_VERSION})" "Sites(^${PSIBASE_VERSION})"
SERVICE tokens
WASM ${CMAKE_CURRENT_BINARY_DIR}/Tokens.wasm
DATA GLOB ${CMAKE_CURRENT_SOURCE_DIR}/services/user/Tokens/ui/dist/* /
DATA ${Plugins_OUTPUT_FILE_tokens} /plugin.wasm
SERVER r-tokens
INIT
SERVICE r-tokens
WASM ${CMAKE_CURRENT_BINARY_DIR}/RTokens.wasm
DEPENDS ${Tokens_js_DEP} ${CMAKE_CURRENT_SOURCE_DIR}/services/user/Tokens/ui/dist/index.html
DEPENDS ${Plugins_DEP}
DEPENDS wasm
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Symbol.psi
NAME Symbol
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Symbol service"
PACKAGE_DEPENDS "Tokens(^${PSIBASE_VERSION})" "Nft(^${PSIBASE_VERSION})"
SERVICE symbol
WASM ${CMAKE_CURRENT_BINARY_DIR}/Symbol.wasm
INIT
DEPENDS wasm
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Fractal.psi
NAME Fractal
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Fractal service"
SERVICE fractal
WASM ${CMAKE_CURRENT_BINARY_DIR}/Fractal.wasm
SERVICE core-fractal
WASM ${CMAKE_CURRENT_BINARY_DIR}/CoreFractal.wasm
DEPENDS wasm
)
psibase_package(
OUTPUT ${SERVICE_DIR}/TokenUsers.psi
NAME TokenUsers
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Initial token users"
ACCOUNTS alice bob
PACKAGE_DEPENDS "Tokens(^${PSIBASE_VERSION})" "Symbol(^${PSIBASE_VERSION})" "Accounts(^${PSIBASE_VERSION})"
POSTINSTALL ${CMAKE_CURRENT_SOURCE_DIR}/services/user/Tokens/src/TokenUsers.json
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Packages.psi
NAME Packages
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Package manager for psibase apps"
SERVICE packages
WASM ${CMAKE_CURRENT_BINARY_DIR}/Packages.wasm
SERVER r-packages
SERVICE r-packages
WASM ${CMAKE_CURRENT_BINARY_DIR}/RPackages.wasm
DEPENDS wasm
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})" "Nop(^${PSIBASE_VERSION})"
)
psibase_package(
OUTPUT ${SERVICE_DIR}/DevDefault.psi
NAME DevDefault
VERSION ${PSIBASE_VERSION}
DESCRIPTION "All development services"
PACKAGE_DEPENDS Accounts AuthAny AuthSig AuthDelegate Branding Brotli Chainmail ClientData CommonApi CpuLimit
Docs Events Explorer Fractal Invite Nft Packages Producers HttpServer
Sites SetCode Supervisor Symbol Tokens Transact Homepage
)
psibase_package(
OUTPUT ${SERVICE_DIR}/ProdDefault.psi
NAME ProdDefault
VERSION ${PSIBASE_VERSION}
DESCRIPTION "All production services"
PACKAGE_DEPENDS Accounts AuthAny AuthSig AuthDelegate Branding Brotli Chainmail ClientData CommonApi CpuLimit
Docs Events Explorer Fractal Invite Nft Packages Producers HttpServer
Sites SetCode Supervisor Symbol Tokens Transact Homepage
)
psibase_package(
OUTPUT ${SERVICE_DIR}/Minimal.psi
NAME Minimal
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Minimum services for a functional chain"
PACKAGE_DEPENDS Accounts AuthDelegate AuthAny CpuLimit CommonApi Packages Producers HttpServer
SetCode Transact
)
function(write_package_index target dir)
set(deps ${CMAKE_CURRENT_SOURCE_DIR}/make_package_index.sh)
foreach(service IN LISTS ARGN)
list(APPEND deps ${service} ${dir}/${service}.psi)
endforeach()
add_custom_command(
OUTPUT ${dir}/index.json
DEPENDS ${deps}
COMMAND /usr/bin/bash ${CMAKE_CURRENT_SOURCE_DIR}/make_package_index.sh ${CMAKE_COMMAND} ${dir} >${dir}/index.json
)
add_custom_target(${target} ALL DEPENDS ${dir}/index.json)
endfunction()
write_package_index(package-index ${SERVICE_DIR}
Accounts AuthAny AuthSig Branding Brotli Chainmail ClientData CommonApi CpuLimit DevDefault ProdDefault
Docs Events Explorer Fractal Invite Nft Nop Minimal Packages Producers HttpServer
Sites SetCode Supervisor Symbol TokenUsers Tokens Transact Homepage)
install(
FILES ${SERVICE_DIR}/index.json
${SERVICE_DIR}/Accounts.psi
${SERVICE_DIR}/AuthAny.psi
${SERVICE_DIR}/AuthDelegate.psi
${SERVICE_DIR}/AuthSig.psi
${SERVICE_DIR}/Branding.psi
${SERVICE_DIR}/Brotli.psi
${SERVICE_DIR}/Chainmail.psi
${SERVICE_DIR}/ClientData.psi
${SERVICE_DIR}/CommonApi.psi
${SERVICE_DIR}/DevDefault.psi
${SERVICE_DIR}/ProdDefault.psi
${SERVICE_DIR}/CpuLimit.psi
${SERVICE_DIR}/Docs.psi
${SERVICE_DIR}/Homepage.psi
${SERVICE_DIR}/Events.psi
${SERVICE_DIR}/Explorer.psi
${SERVICE_DIR}/Fractal.psi
${SERVICE_DIR}/Invite.psi
${SERVICE_DIR}/Minimal.psi
${SERVICE_DIR}/Nft.psi
${SERVICE_DIR}/Nop.psi
${SERVICE_DIR}/Packages.psi
${SERVICE_DIR}/Producers.psi
${SERVICE_DIR}/HttpServer.psi
${SERVICE_DIR}/Sites.psi
${SERVICE_DIR}/SetCode.psi
${SERVICE_DIR}/Supervisor.psi
${SERVICE_DIR}/SupervisorTests.psi
${SERVICE_DIR}/Symbol.psi
${SERVICE_DIR}/TokenUsers.psi
${SERVICE_DIR}/Tokens.psi
${SERVICE_DIR}/Transact.psi
DESTINATION ${CMAKE_INSTALL_DATADIR}/psibase/packages/
COMPONENT ServerData)
psibase_package(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test-packages/PSubjective.psi
NAME PSubjective
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Test service for parallel access to the subjective database"
SERVICE psubjective
WASM ${CMAKE_CURRENT_BINARY_DIR}/PSubjectiveService.wasm
FLAGS isSubjective allowWriteSubjective
SERVER psubjective
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})"
DEPENDS wasm
)
psibase_package(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test-packages/Counter.psi
NAME Counter
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Test service than increments a counter"
SERVICE counter
WASM ${CMAKE_CURRENT_BINARY_DIR}/CounterService.wasm
SERVER counter
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})"
DEPENDS wasm
)
psibase_package(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test-packages/AsyncQuery.psi
NAME AsyncQuery
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Test service for the various ways to respond to http requests"
SERVICE as-query
WASM ${CMAKE_CURRENT_BINARY_DIR}/AsyncQueryService.wasm
SERVER as-query
POSTINSTALL ${CMAKE_CURRENT_SOURCE_DIR}/services/psibase_tests/AsyncQueryService.json
FLAGS allowWriteSubjective
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})"
DEPENDS wasm
)
psibase_package(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test-packages/SubjectiveCounter.psi
NAME SubjectiveCounter
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Test service that increments a counter in the subjective db"
SERVICE s-counter
WASM ${CMAKE_CURRENT_BINARY_DIR}/SubjectiveCounterService.wasm
SERVER s-counter
FLAGS isSubjective allowWriteSubjective
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})"
DEPENDS wasm
)
psibase_package(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test-packages/KeepSocket.psi
NAME KeepSocket
VERSION ${PSIBASE_VERSION}
DESCRIPTION "Accepts HTTP requests, but never returns a response"
SERVICE s-keep-sock
WASM ${CMAKE_CURRENT_BINARY_DIR}/KeepSocketService.wasm
SERVER s-keep-sock
PACKAGE_DEPENDS "HttpServer(^${PSIBASE_VERSION})"
DEPENDS wasm
)
write_package_index(test-index ${CMAKE_CURRENT_BINARY_DIR}/test-packages PSubjective Counter AsyncQuery SubjectiveCounter KeepSocket)
ExternalProject_Add(
rust
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rust
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/rust/release/psibase
CONFIGURE_COMMAND ""
BUILD_COMMAND cargo build -r --bin psibase --manifest-path ${CMAKE_CURRENT_SOURCE_DIR}/rust/Cargo.toml --target-dir ${CMAKE_CURRENT_BINARY_DIR}/rust
BUILD_ALWAYS 1
INSTALL_COMMAND ""
)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/rust/release/psibase TYPE BIN COMPONENT Client)
option(BUILD_EXAMPLES "Build examples" ON)
if(BUILD_EXAMPLES)
add_subdirectory(doc/psidk/src/development/services/cpp-service doc-examples)
endif()
include(CPackComponent)
cpack_add_component_group(Server DESCRIPTION "The psinode server")
cpack_add_component(ServerBin GROUP Server HIDDEN)
cpack_add_component(ServerData GROUP Server HIDDEN)
cpack_add_component(Client DESCRIPTION "The psibase client")
cpack_add_component_group(SDK DESCRIPTION "SDK for developing psibase services")
cpack_add_component(Tester GROUP SDK)
cpack_add_component(WASI GROUP SDK)
cpack_add_component(libpsibase GROUP SDK)
set(CPACK_PACKAGE_NAME psidk)
set(CPACK_PACKAGE_VENDOR "Fractally, LLC")
set(CPACK_PACKAGE_DESCRIPTION)
set(CPACK_PACKAGE_HOMEPAGE_URL https://about.psibase.io)
set(CPACK_GENERATOR TGZ)
include(CPack)
set(CMAKE_EXPORT_COMPILE_COMMANDS on)