Skip to content
This repository was archived by the owner on Jan 27, 2025. It is now read-only.

Commit 24dffb0

Browse files
committed
fix(wrapper): manually add definition ANDROID
1 parent af0fc0c commit 24dffb0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/wrapper/wrapper_base.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ auto WrapperBase::prepare_args(Arguments args)
3333
#ifdef USE_CXX
3434
options = Arguments::remove_stdc(options);
3535
#endif // USE_CXX
36+
#ifdef NDK
37+
options.push_back("-D");
38+
options.push_back("ANDROID");
39+
#endif // NDK
3640
options = Arguments::suppress_warnings(options);
41+
options.push_back("-fPIC");
3742
return std::make_tuple(phases, inputs, options);
3843
}
3944

@@ -105,6 +110,12 @@ fs::path WrapperBase::generate_ll(Arguments options, const fs::path& input,
105110
if (no_opaque_pointers) options = Arguments::no_opaque_pointers(options);
106111
options.push_back("--assemble");
107112
options.push_back("-emit-llvm");
113+
#ifdef USE_CXX
114+
if (input.extension() == ".c") {
115+
options.push_back("--language");
116+
options.push_back("c");
117+
}
118+
#endif // USE_CXX
108119
options.push_back("--output");
109120
options.push_back(*output);
110121
auto args = this->join_args(options, {input});

src/wrapper/wrapper_base.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
#define TARGET_CXX "clang++"
2121
#endif // TARGET_CXX
2222

23-
// #define USE_CXX
23+
// #define USE_CXX 1
24+
25+
// #define NDK 1
2426

2527
class WrapperBase : public Executor {
2628
public:

0 commit comments

Comments
 (0)