Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate prebuilt libraries #40

Open
daviswalker opened this issue Jan 14, 2015 · 5 comments
Open

Integrate prebuilt libraries #40

daviswalker opened this issue Jan 14, 2015 · 5 comments

Comments

@daviswalker
Copy link

It would be great to have a pattern for integrating prebuilt static libraries. Sometimes there are libraries where the configuration and build scripts are complex and not easily convertible to gyp. Pointing to them is a problem especially for Android, for which there will be multiple copies of the binary for the different target architectures.

@skabbes
Copy link
Contributor

skabbes commented Jan 16, 2015

Yes, totally agree. The gyp documentation shows how to do something similar, but I could add an example. Do you have a library in mind perhaps?

@tanaka-de-silva
Copy link

Microsoft’s cross-platform C++ REST SDK (Casablanca) is probably a good candidate for a monolithic library that could be of use for a number of apps that would benefit from the use of prebuilt binaries.

@daviswalker
Copy link
Author

I'm currently playing with openh264 (https://github.com/cisco/openh264), which has just enough in its Makefile that I don't really want to take on converting it to gyp.

Btw my current solution to this is to point a gyp file at one of the Android architecture library files. e.g.:

'conditions': [
['OS=="ios"', {
"libraries": [
'../prebuilt/ios/libopenh264.a'
]
},'OS=="mac"', {
"libraries": [
'../prebuilt/osx/libopenh264.a'
]
}, 'OS=="android"', {
# This generates a reference to the lib without referencing the
# architecture. Gyp doesn't support specifying multi-architecture
# files, so are added with a hand-written Android.mk.
"libraries": [
'../prebuilt/android/x86/libopenh264.a'
]
}],
]

This generates a line like: LOCAL_STATIC_LIBRARIES := libopenh264 in target.mk. Then in a hand-written Android.mk I include GypAndroid.mk and specify the real path to the architecture-specific library like:

include $(CLEAR_VARS)
LOCAL_PATH := $(PREBUILTS)/$(TARGET_ARCH_ABI)
LOCAL_MODULE := openh264
LOCAL_SRC_FILES := libopenh264.a
include $(PREBUILT_STATIC_LIBRARY)

It works. Something tells me this pattern could be cleaner, though...

P.S. I'm using fat binaries on darwin to avoid this problem.

@skabbes
Copy link
Contributor

skabbes commented Jan 20, 2015

^ I've actually seen this pattern for Android several times now - the wrapper "root makefile". The libraries don't even have to be pre-built, they can even be dependencies that have their own (android) Makefiles.

I think Casablanca would be a more general example than h264 - thanks for the idea @tanaka-de-silva

@AraHaan
Copy link

AraHaan commented Sep 19, 2016

I am happy that Android and Apple Support C/C++ because I plan to make a Application that helps to prevent the phones that are made by Samsung from overheating. (they have tiny cheep processors)

My Plan: Use C++.

Drawbacks: With me having years of experiance of Visual Basic under windows Only I got no idea what API Headers I need to maske this work. I have some knowlege on C and C++ but that is from places of open source games/code made in C/C++. A perfect Example is Doom or even Duke Nukem 3D.

At least I know namespaces, classes, defines, structs, functions, exports, includes, defines, while loops, for loops, if, else, else if blocks, and breaks for loops.

Although I think there is a lot more things the most funniest thing I found in C and C++ when I first seen them before was things like.
#define WIN32_LEAN_AND_MEAN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants