-
Notifications
You must be signed in to change notification settings - Fork 366
Add scripts to build asm/wasm and portable linux + add github action to draft release on tag #60
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
Changes from all commits
7bb1bc8
bd87003
4ab275a
1686eca
2010df7
9d52131
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: release | ||
10000
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
package-cimbar: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get the code | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Get openCV | ||
run: | | ||
wget https://github.com/opencv/opencv/archive/refs/tags/4.5.5.zip | ||
unzip 4.5.5.zip | ||
mv opencv-4.5.5 opencv4 | ||
|
||
- name: Run the build process with Docker | ||
uses: addnab/docker-run-action@v3 | ||
with: | ||
image: emscripten/emsdk:latest | ||
options: -v ${{ github.workspace }}:/usr/src/app | ||
shell: bash | ||
run: | | ||
bash /usr/src/app/package-wasm.sh | ||
|
||
- name: Show results | ||
run: ls -l web/ | ||
|
||
- name: Create release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
draft: true | ||
files: | | ||
web/cimbar.asmjs.zip | ||
web/cimbar.wasm.tar.gz | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
## targeting old glibc | ||
# docker run --mount type=bind,source="$(pwd)",target="/usr/src/app" -it ubuntu:16.04 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't fully automated yet, but the That said, I did test on centos7 a bit, and it works. So that's cool. |
||
|
||
cd /usr/src/app | ||
|
||
# https://gist.github.com/jlblancoc/99521194aba975286c80f93e47966dc5 | ||
apt update | ||
apt install -y software-properties-common | ||
add-apt-repository -y ppa:ubuntu-toolchain-r/test | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For g++7 |
||
|
||
apt update | ||
apt install -y pkgconf g++-7 python-pip | ||
apt install -y libgles2-mesa-dev libglfw3-dev | ||
|
||
# cmake (via pip) | ||
python -m pip install cmake | ||
|
||
# use gcc7 | ||
update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-7 100 | ||
update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-7 100 | ||
|
||
cd opencv4/ | ||
mkdir build-portable/ && cd build-portable/ | ||
/usr/local/bin/cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_SHARED_LIBS=OFF -DOPENCV_GENERATE_PKGCONFIG=YES -DOPENCV_FORCE_3RDPARTY_BUILD=YES | ||
make -j5 install | ||
|
||
cd /usr/src/app | ||
mkdir build-portable/ && cd build-portable/ | ||
/usr/local/bin/cmake .. -DBUILD_PORTABLE_LINUX=1 | ||
make -j5 install |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
#docker run --mount type=bind,source="$(pwd)",target="/usr/src/app" -it emscripten/emsdk:latest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm slightly nervous about using |
||
|
||
cd /usr/src/app | ||
|
||
apt update | ||
apt install python -y | ||
|
||
cd opencv4/ | ||
mkdir opencv-build-wasm && cd opencv-build-wasm | ||
python ../platforms/js/build_js.py build_wasm --build_wasm --emscripten_dir=/emsdk/upstream/emscripten | ||
|
||
cd /usr/src/app | ||
mkdir build-wasm && cd build-wasm | ||
emcmake cmake .. -DUSE_WASM=1 -DOPENCV_DIR=/usr/src/app/opencv4 | ||
make -j5 install | ||
(cd ../web/ && tar -czvf cimbar.wasm.tar.gz cimbar_js.* index.html main.js) | ||
|
||
cd /usr/src/app | ||
mkdir build-asmjs && cd build-asmjs | ||
emcmake cmake .. -DUSE_WASM=2 -DOPENCV_DIR=/usr/src/app/opencv4 | ||
make -j5 install | ||
(cd ../web/ && zip cimbar.asmjs.zip cimbar_js.js index.html main.js) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,10 @@ namespace image_hash | |
uint64_t mval = (*hax) & 0x101010101ULL; | ||
const uint8_t* cv = reinterpret_cast<const uint8_t*>(&mval); | ||
uint8_t val = cv[0] << 4 | cv[1] << 3 | cv[2] << 2 | cv[3] << 1 | cv[4]; | ||
// TODO: | ||
/*if (bigEndian) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Everything I'm targeting right now is littleendian, but this little optimization/hack will need some extra care for other platforms... |
||
val = cv[7] << 4 | cv[6] << 3 | cv[5] << 2 | cv[4] << 1 | cv[3];*/ // ? | ||
|
||
res |= intx::uint128(val) << bitpos; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also adding ubuntu-latest, which (at the moment) seems to be gcc9.