Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
102 lines (79 loc) · 3.57 KB
/
Copy pathCMakeLists.txt
File metadata and controls
102 lines (79 loc) · 3.57 KB
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
# Copyright 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
CMAKE_MINIMUM_REQUIRED(VERSION 3.16 FATAL_ERROR)
PROJECT(pdo-contracts)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
INCLUDE(ProjectVariables)
LIST(APPEND CMAKE_MODULE_PATH "${PDO_SOURCE_ROOT}/contracts/wawaka")
INCLUDE(contract-build)
INCLUDE(wawaka_common)
# These switches are not necessary in general, but help to
# optimize memory use for expectations
LIST(APPEND WASM_LINK_OPTIONS "-Wl,--no-entry,--strip-all")
# Uncomment the following to set stack and memory sizes, these
# are strictly speaking not needed as the runtime will manage
# maximum sizes. However, they can be useful to trap unbounded
# memory usage at compile time rather than at runtime.
# MATH(EXPR CONTRACT_STACK "1*1024*1024")
# MATH(EXPR CONTRACT_TOTAL "2*1024*1024")
# LIST(APPEND WASM_LINK_OPTIONS "-Wl,--max-memory=${CONTRACT_TOTAL}")
# LIST(APPEND WASM_LINK_OPTIONS "-Wl,--initial-memory=${CONTRACT_TOTAL}")
# LIST(APPEND WASM_LINK_OPTIONS "-z stack-size=${CONTRACT_STACK}")
# The clang runtime library appears to provide builtins for
# some of the missing functions such as __multi3 and __ashlti3
LIST(APPEND WASM_LIBRARIES "libclang_rt.builtins.a")
# Include the contract common libraries
LIST(APPEND WASM_LIBRARIES ${WW_COMMON_LIB})
LIST(APPEND WASM_INCLUDES ${WW_COMMON_INCLUDES})
FILE(GLOB CONTRACT_FAMILIES RELATIVE ${CMAKE_SOURCE_DIR} "*-contract")
# A local cmake file (Local.cmake) allows for local overrides of
# variables. In particular, this is useful to set CONTRACT_FAMILIES
# to just the subset that you want to build/test.
#
# For example, if you place this line in Local.cmake then only the
# exchange and digital asset contract families will be built:
#
# SET(CONTRACT_FAMILIES exchange-contract digital-asset-contract)
#
INCLUDE(Local.cmake OPTIONAL)
ENABLE_TESTING()
# Contract families must contain common-contract and
# it should be the first built; this just makes sure
# it is include
LIST(REMOVE_ITEM CONTRACT_FAMILIES common-contract)
LIST(PREPEND CONTRACT_FAMILIES common-contract)
MESSAGE(STATUS "BUILD CONTRACT FAMILIES ${CONTRACT_FAMILIES}")
FOREACH(FAMILY IN ITEMS ${CONTRACT_FAMILIES})
ADD_SUBDIRECTORY(${FAMILY})
ENDFOREACH()
# -----------------------------------------------------------------
# install the jupyter notebooks, note that the trailing slash here
# is significant and should not be removed; it prevents the notebooks
# directory being prepended to the copied name
# -----------------------------------------------------------------
INCLUDE(Jupyter)
FILE(GLOB_RECURSE NOTEBOOK_SOURCES docs/notebooks/*.py docs/notebooks/*.md)
CONVERT_JUPYTEXT(ROOT_NOTEBOOKS ${NOTEBOOK_SOURCES})
ADD_CUSTOM_TARGET(root-notebooks ALL DEPENDS ${ROOT_NOTEBOOKS})
INSTALL(DIRECTORY docs/notebooks/
DESTINATION "${PDO_JUPYTER_ROOT}/"
FILES_MATCHING PATTERN "*.ipynb" PATTERN "*.png")
ADD_CUSTOM_TARGET(uninstall)
ADD_CUSTOM_COMMAND(
TARGET uninstall
POST_BUILD
COMMAND xargs -a ${CMAKE_BINARY_DIR}/install_manifest.txt rm -f
COMMAND echo "uninstall complete"
)