-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add two test recipes for cross compilation
One depending on the other.
- Loading branch information
1 parent
1046ff2
commit ef41d51
Showing
7 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
tests/test-recipes/metadata/_cross_helloworld/.conda_build_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
c_compiler: "gcc-osx-64" | ||
target_platform: "imx351uc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package: | ||
name: _cross_helloworld | ||
version: 1.0 | ||
|
||
source: | ||
path: ./src | ||
|
||
requirements: | ||
build: | ||
- {{ compiler('c') }} | ||
- xz | ||
host: | ||
- _cross_libgreeting | ||
|
||
build: | ||
script: | ||
- gcc helloworld.c -L${PREFIX}/lib -lgreeting -DGREETING_SUFFIX=$(xz --version | head -n 1) -o ${PREFIX}/bin/helloworld | ||
|
||
tests: | ||
- strings ${PREFIX}/bin/helloworld | grep "XZ Utils" |
14 changes: 14 additions & 0 deletions
14
tests/test-recipes/metadata/_cross_helloworld/src/helloworld.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <libgreeting.h> | ||
#include <stdio.h> | ||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
char * say_it = greeting(GREETING_SUFFIX); | ||
if (say_it != NULL) | ||
{ | ||
puts(say_it); | ||
putc('\n'); | ||
return 0; | ||
} | ||
return 1; | ||
} |
2 changes: 2 additions & 0 deletions
2
tests/test-recipes/metadata/_cross_libgreeting/.conda_build_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
c-compiler: "gcc-osx-64" | ||
target_platform: "imx351uc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package: | ||
name: _cross_libgreeting | ||
version: 1.0 | ||
|
||
requirements: | ||
build: | ||
- {{ compiler('c') }} | ||
|
||
build: | ||
script: | ||
- env | ||
- gcc -o ${LDFLAGS} ${CFLAGS} libgreeting.o libgreeting.c | ||
- ar cru ${PREFIX}/lib/libgreeting.a libgreeting.o | ||
- cp libgreeting.h ${PREFIX}/include |
14 changes: 14 additions & 0 deletions
14
tests/test-recipes/metadata/_cross_libgreeting/src/libgreeting.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <string.h> | ||
|
||
#define SALUTATION "Hello World! " | ||
|
||
char * greeting(char const * suffix) | ||
{ | ||
char * res = malloc(strlen(SALUTATION) + strlen(suffix) + 1); | ||
if (res == NULL) | ||
return NULL; | ||
res[0] = '\0'; | ||
strcat(res, SALUTATION); | ||
strcat(res, suffix); | ||
return res; | ||
} |
6 changes: 6 additions & 0 deletions
6
tests/test-recipes/metadata/_cross_libgreeting/src/libgreeting.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef LIBGREETING_H_INCLUDED | ||
#define LIBGREETING_H_INCLUDED | ||
|
||
char * greeting(char const * suffix); | ||
|
||
#endif /* LIBGREETING_H_INCLUDED */ |