diff --git a/contracts/wawaka/contract-build.cmake b/contracts/wawaka/contract-build.cmake index 843bd48d..d64cd219 100644 --- a/contracts/wawaka/contract-build.cmake +++ b/contracts/wawaka/contract-build.cmake @@ -73,26 +73,41 @@ LIST(APPEND WASM_LIBRARIES "${WASI_SDK_DIR}/share/wasi-sysroot/lib/wasm32-wasi/l ## ----------------------------------------------------------------- # Define the function for building contracts # -# Intention is that the contract writer add to the WASM_BUILD_OPTIONS, +# Parameters: +# SRC -- contract source, implicit +# PLUGINS -- list of files to be installed in the plugins directory +# SCRIPTS -- list of files to be installed in the script directory +# HEADERS -- list of directories to be included in the build path +# LIBRARIES -- list of additional libraries to be included during link +# +# Intention is that the contract writer can configure options across +# all contracts by extending the WASM_BUILD_OPTIONS, # WASM_LINK_OPTIONS, WASM_INCLUDES and WASM_LIBRARIES to add custom -# files and link options +# files and link options. ## ----------------------------------------------------------------- FUNCTION(BUILD_CONTRACT contract) - STRING(REPLACE ";" " " WASM_BUILD_OPTIONS "${WASM_BUILD_OPTIONS}") - STRING(REPLACE ";" " " WASM_LINK_OPTIONS "${WASM_LINK_OPTIONS}") + STRING(REPLACE ";" " " LOCAL_BUILD_OPTIONS "${WASM_BUILD_OPTIONS}") + STRING(REPLACE ";" " " LOCAL_LINK_OPTIONS "${WASM_LINK_OPTIONS}") - SET(MultiValueArgs SRC PLUGINS SCRIPTS) + SET(MultiValueArgs SRC PLUGINS SCRIPTS HEADERS LIBRARIES) CMAKE_PARSE_ARGUMENTS(BC "" "" "${MultiValueArgs}" ${ARGN}) SET(BC_SRC ${BC_SRC} ${BC_UNPARSED_ARGUMENTS}) ADD_EXECUTABLE( ${contract} ${BC_SRC}) - SET(CMAKE_CXX_FLAGS ${WASM_BUILD_OPTIONS} CACHE INTERNAL "") + SET(CMAKE_CXX_FLAGS ${LOCAL_BUILD_OPTIONS} CACHE INTERNAL "") SET(CMAKE_CXX_COMPILER_TARGET "wasm32-wasi") TARGET_INCLUDE_DIRECTORIES(${contract} PUBLIC ${WASM_INCLUDES}) + IF (DEFINED BC_HEADERS) + TARGET_INCLUDE_DIRECTORIES(${contract} PUBLIC ${BC_HEADERS}) + ENDIF() + TARGET_LINK_LIBRARIES(${contract} LINK_PUBLIC ${WASM_LIBRARIES}) + IF (DEFINED BC_LIBRARIES) + TARGET_LINK_LIBRARIES(${contract} LINK_PUBLIC ${BC_LIBRARIES}) + ENDIF() SET(b64contract ${CMAKE_CURRENT_BINARY_DIR}/_${contract}.b64) ADD_CUSTOM_COMMAND( @@ -104,7 +119,7 @@ FUNCTION(BUILD_CONTRACT contract) SET_DIRECTORY_PROPERTIES(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${b64contract}) # this can be replaced in later versions of CMAKE with target_link_options - SET_PROPERTY(TARGET ${contract} APPEND_STRING PROPERTY LINK_FLAGS "${WASM_LINK_OPTIONS}") + SET_PROPERTY(TARGET ${contract} APPEND_STRING PROPERTY LINK_FLAGS "${LOCAL_LINK_OPTIONS}") INSTALL(FILES ${b64contract} DESTINATION ${CONTRACT_INSTALL_DIRECTORY}) INSTALL(FILES ${BC_PLUGINS} DESTINATION ${CONTRACT_INSTALL_DIRECTORY}/plugins) INSTALL(FILES ${BC_SCRIPTS} DESTINATION ${CONTRACT_INSTALL_DIRECTORY}/scripts) diff --git a/docker/Makefile b/docker/Makefile index 174f31eb..bef23a51 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -49,7 +49,15 @@ PDO_USER_UID ?= $(shell id -u) PDO_GROUP_UID ?= $(shell id -g) DOCKER_COMMAND ?= docker -DOCKER_COMPOSE_COMMAND ?= docker-compose + +ifndef DOCKER_COMPOSE_COMMAND + DOCKER_COMPOSE_COMMAND := $(shell command -v docker-compose 2> /dev/null) + ifndef DOCKER_COMPOSE_COMMAND + $(warning "docker-compose command is not available") + DOCKER_COMPOSE_COMMAND := $(DOCKER_COMMAND) compose + endif +endif + # to work with upstream docker and docker compose plugin, redefine above # as `DOCKER_COMPOSE_COMMAND=docker compose` in your `make.loc`