Last active
July 9, 2019 16:51
-
-
Save paleozogt/a72d7e4ab96aa04a1e614344726caa3e to your computer and use it in GitHub Desktop.
dockcross testing
This file contains hidden or 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
#!/bin/bash | |
set -x | |
function dockcross_build { | |
docker run --rm dockcross/linux-$1 > dockcross-linux-$1 | |
chmod +x dockcross-linux-$1 | |
./dockcross-linux-$1 bash -c '$CXX -std=c++11 helloworld.cpp' | |
mv a.out $1 | |
} | |
dockcross_build armv6 | |
dockcross_build armv7 | |
dockcross_build armv7a | |
dockcross_build arm64 |
This file contains hidden or 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
#include <iostream> | |
#include <string> | |
int main() { | |
std::string plat= "unknown"; | |
#if defined(_WIN32) | |
plat= "win"; | |
#elif defined(__APPLE__) | |
plat= "mac"; | |
#elif defined(__unix__) | |
plat= "unix"; | |
#endif | |
std::string arch= "unknown"; | |
#if defined(__i386__) || defined(_M_IX86) | |
arch="x86"; | |
#elif defined(__x86_64__) || defined(_M_X64) | |
arch="x86_64"; | |
#elif defined(__arm__) || defined(_M_ARM) | |
arch="arm"; | |
#elif defined(__aarch64__) || defined(_M_ARM64) | |
arch="arm64"; | |
#endif | |
std::string compiler= "unknown"; | |
int compilerVer= 0; | |
#if defined(__GNUC__) | |
compiler= "gnu"; | |
compilerVer= __GNUC__; | |
#elif defined(__clang__) | |
compiler= "clang"; | |
compilerVer= __clang_major__; | |
#elif defined(_MSC_VER) | |
compiler= "msvc"; | |
compilerVer= _MSC_VER; | |
#endif | |
std::cout << "hello world from " | |
<< plat << " " << arch << " " | |
<< compiler << " v" << compilerVer << std::endl; | |
return 0; | |
} |
This file contains hidden or 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
set -x | |
docker run --rm -w$PWD -v$HOME:$HOME multiarch/ubuntu-core:armhf-trusty ./armv6 | |
docker run --rm -w$PWD -v$HOME:$HOME multiarch/ubuntu-core:armhf-trusty ./armv7 | |
docker run --rm -w$PWD -v$HOME:$HOME multiarch/ubuntu-core:armhf-trusty ./armv7a | |
docker run --rm -w$PWD -v$HOME:$HOME multiarch/ubuntu-core:arm64-trusty ./arm64 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running the above files: