Commit d95fcfd0 authored by Drew's avatar Drew Committed by GitHub

Merge pull request #115 from AnarchyTools/c-rollup

Add support for C language to atllbuild
parents db6b092c e2fa4f07
Pipeline #2332 passed with stage
in 4 minutes and 56 seconds
......@@ -5,7 +5,7 @@ linux:
stage: build
script:
- apt-get update
- apt-get install -y xz-utils package-deb
- apt-get install -y xz-utils package-deb libcurl4-openssl-dev
- git submodule update --init --recursive
- bootstrap/build.sh linux
- bin/atbuild check
......
FROM drewcrawford/swift:latest
RUN apt-get update && apt-get install curl -y && curl -s https://packagecloud.io/install/repositories/anarchytools/AT/script.deb.sh | bash && apt-get install --no-install-recommends -y package-deb xz-utils
FROM drewcrawford/buildbase:latest
RUN apt-get update && apt-get install package-deb libcurl4-openssl-dev
ADD . /atbuild
WORKDIR atbuild
RUN bootstrap/build.sh linux
......
Subproject commit 362108f47d0535a37881f99a34946f4c8e4caa1d
Subproject commit 79f5d1dc15017965216aaf5b905c2ca142dd7125
This diff is collapsed.
This tests C project support. Some notes:
* Link with libcurl, which means libcurl-dev must be installed on your system. This also tests the module-map-link option.
* We also test C/iOS support, however libcurl is not available on that platform. So we just disable everything curl-related
(package
:name "c"
:tasks {
:lib {
:tool "atllbuild"
:name "lib"
:sources ["lib/**.swift" "lib/**.c" "lib/**.h"]
:output-type "static-library"
:module-map "synthesized"
:c-compile-options ["-DGOT_OPTIONS"]
:overlays {
:atbuild.platform.osx {
:module-map-link ["curl"]
}
:atbuild.platform.linux {
:module-map-link ["curl"]
}
}
}
:tool {
:tool "atllbuild"
:name "tool"
:sources ["tool/**.swift"]
:output-type "executable"
:link-with-product ["lib.a"]
:dependencies ["lib"]
}
:default {
:tool "nop"
:dependencies ["tool"]
}
}
)
\ No newline at end of file
#include "baz.h"
void bar() {
printf("hello from C");
baz();
//compile error if we don't get GOT_OPTIONS
#ifndef GOT_OPTIONS
#error didn't get options
#endif
}
\ No newline at end of file
void bar();
\ No newline at end of file
#include "baz.h"
void baz() {
#ifndef NO_CURL_AVAILABLE
curl_global_init(CURL_GLOBAL_SSL);
#endif
}
\ No newline at end of file
#if __arm64__
#define NO_CURL_AVAILABLE
#endif
#ifndef NO_CURL_AVAILABLE
#include <curl/curl.h>
#endif
void baz();
\ No newline at end of file
public func foo() {
#if !os(iOS)
curl_global_init(Int(CURL_GLOBAL_SSL))
#endif
bar()
}
\ No newline at end of file
import lib
foo()
\ No newline at end of file
......@@ -13,6 +13,15 @@ echo "****************SELF-HOSTING TEST**************"
$ATBUILD atbuild
echo "****************C TEST**************"
cd $DIR/tests/fixtures/c
$ATBUILD
$ATBUILD --configuration release
if [ "$UNAME" == "Darwin" ]; then
$ATBUILD --platform ios-arm64
fi
echo "****************CONFIGURATION TEST**************"
cd $DIR/tests/fixtures/configurations
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment