Skip to content

Commit

Permalink
Merge pull request #527 from damiannolan/damian/build-directives
Browse files Browse the repository at this point in the history
imp: allow cgo while disabling libwasmvm linking
  • Loading branch information
webmaster128 committed Mar 29, 2024
2 parents fcbfbff + bcde382 commit a259723
Show file tree
Hide file tree
Showing 11 changed files with 1,069 additions and 1,040 deletions.
20 changes: 20 additions & 0 deletions .circleci/config.yml
Expand Up @@ -201,6 +201,25 @@ jobs:
- run:
name: Test package "cosmwasm" without cgo
command: CGO_ENABLED=0 go test .

# Build types and cosmwasm with libwasmvm linking disabled
nolink_libwasmvm:
docker:
- image: cimg/go:1.21.4
steps:
- checkout
- run:
name: Build package "types" with libwasmvm linking disabled
command: go build -tags "nolink_libwasmvm" ./types
- run:
name: Build package "cosmwasm" with libwasmvm linking disabled
command: go build -tags "nolink_libwasmvm" .
- run:
name: Test package "types" with libwasmvm linking disabled
command: go test -tags "nolink_libwasmvm" ./types
- run:
name: Test package "cosmwasm" with libwasmvm linking disabled
command: go test -tags "nolink_libwasmvm" .

tidy-go:
docker:
Expand Down Expand Up @@ -433,6 +452,7 @@ workflows:
- libwasmvm_audit
- format-go
- wasmvm_no_cgo
- nolink_libwasmvm
- tidy-go
- format-scripts
- lint-scripts
Expand Down
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -90,6 +90,13 @@ go build .
CGO_ENABLED=0 go build .
```

In the case that it may be desirable to compile with cgo, but with libwasmvm linking disabled an additional build tag is available.

```sh
# Build with CGO, but with libwasmvm linking disabled
go build -tags "nolink_libwasmvm"
```

## Supported Platforms

See [COMPILER_VERSIONS.md](docs/COMPILER_VERSIONS.md) for information on Go and
Expand Down
2 changes: 1 addition & 1 deletion ibc_test.go
@@ -1,4 +1,4 @@
//go:build cgo
//go:build cgo && !nolink_libwasmvm

package cosmwasm

Expand Down

0 comments on commit a259723

Please sign in to comment.