-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuildLinuxMac.sh
executable file
·118 lines (102 loc) · 4.41 KB
/
buildLinuxMac.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env bash
echo "Checking toolset"
sleep 1
## check for wget
WGET=`which wget`
DoesWGETExist=`${WGET} --version || echo "false"`
if [[ ${DoesWGETExist} != false ]]; then
echo "WGET is present"
else
echo
echo " Missing dependency: wget (http://gnu.org/software/wget)"
echo
exit 1
fi
GIT=`which git`
DoesGITExist=`${GIT} --version || echo "false"`
if [[ ${DoesGITExist} != false ]]; then
echo "GIT is present"
else
echo
echo " Missing dependency: git (http://gnu.org/software/git)"
echo
exit 1
fi
CMAKE=`which cmake`
DoesCMAKEExist=`${CMAKE} --version || echo "false"`
if [[ ${DoesCMAKEExist} != false ]]; then
echo "CMAKE is present"
else
echo
echo " Missing dependency: CMAKE (http://gnu.org/software/cmake)"
echo
exit 1
fi
TAR=`which tar`
DoesTARExist=`${TAR} --version || echo "false"`
if [[ ${DoesTARExist} != false ]]; then
echo "TAR is present"
else
echo
echo " Missing dependency: TAR (http://gnu.org/software/tar)"
echo
exit 1
fi
MAKE=`which make`
DoesMAKEExist=`${MAKE} --version || echo "false"`
if [[ ${DoesMAKEExist} != false ]]; then
echo "MAKE is present"
else
echo
echo " Missing dependency: MAKE (http://gnu.org/software/make)"
echo
exit 1
fi
echo "Downloading emscripten"
sleep 1
mkdir -p downloads
cd downloads
${GIT} clone https://github.com/emscripten-core/emsdk.git
${WGET} -c -nc https://github.com/malaterre/GDCM/archive/v2.8.8.tar.gz -O gdcm.tar.gz
echo "Decompressing GDCM"
sleep 1
${TAR} -xvzf gdcm.tar.gz
mkdir -p gdcm
mv -f GDCM-2.8.8/* gdcm
rm -rf GDCM-2.8.8
#cd downloads
#md emsdk
#unzip.exe cmake.zip
#ren cmake-3.10.1-win64-x64 cmake
#unzip.exe gdcm.zip
#ren GDCM-2.8.3 gdcm
#unzip.exe emsdk.zip -d emsdk
echo "Setting up emscripten"
sleep 1
cd emsdk
./emsdk update
./emsdk install 1.38.33
./emsdk activate 1.38.33
echo "sourcing emsdk"
source ./emsdk_env.sh
#./emsdk install mingw-7.1.0-64bit
#emsdk.bat activate mingw-7.1.0-64bit
#emsdk.bat install gnu-2.5.4
#emsdk.bat activate gnu-2.5.4
echo "Configuring gdcm"
cd ..
cd gdcm
mkdir build
cd build
emcmake cmake -DCMAKE_TOOLCHAIN_FILE=${EMSDK}/fastcomp/emscripten/cmake/Modules/Platform/Emscripten.cmake -DGDCM_BUILD_DOCBOOK_MANPAGES=0 -DGDCM_BUILD_APPLICATIONS=1 -DGDCM_BUILD_EXAMPLES=1 -DEMSCRIPTEN=1 -DEMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES=1 ..
emcmake cmake -DCMAKE_TOOLCHAIN_FILE=${EMSDK}/fastcomp/emscripten/cmake/Modules/Platform/Emscripten.cmake -DGDCM_BUILD_DOCBOOK_MANPAGES=0 -DGDCM_BUILD_APPLICATIONS=1 -DGDCM_BUILD_EXAMPLES=1 -DEMSCRIPTEN=1 -DEMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES=1 ..
${MAKE} -j 20
cd ..
cd ..
cd ..
for i in downloads/gdcm/Applications/Cxx/*.cxx; do
NEWNAME=${i##*/} ;
NEWNAME=${NEWNAME%%.*}.js ;
echo "${i}" ;
em++ "${i}" -o "${NEWNAME}" -s WASM=0 -s MODULARIZE=0 -s EXIT_RUNTIME=0 --memory-init-file 0 -Oz -s FORCE_FILESYSTEM=1 -s NODEJS_CATCH_EXIT=0 -s DISABLE_EXCEPTION_CATCHING=0 --closure 0 --post-js ./pos.js --pre-js ./pre.js -Idownloads/gdcm/build/Utilities/gdcmzlib -Idownloads/gdcm/Utilities -Idownloads/gdcm/Utilities/gdcmzlib -Idownloads/gdcm/Source/InformationObjectDefinition -Idownloads/gdcm/build/bin -Idownloads/gdcm/build/Source/Common -Idownloads/gdcm/build/Source/Common -Idownloads/gdcm/build/Source/DataStructureAndEncodingDefinition -Idownloads/gdcm/build/Source/MediaStorageAndFileFormat -Idownloads/gdcm/build/Source/InformationObjectDefinition -Idownloads/gdcm/build/Source/MessageExchangeDefinition -Idownloads/gdcm/build/Source/DataDictionary -Idownloads/gdcm/build/Utilities -Idownloads/gdcm/build/Utilities/socketxx -Idownloads/gdcm/build/Utilities/socketxx/socket++ -Idownloads/gdcm/build/Utilities/socketxx/socket++ -Idownloads/gdcm/build/Utilities/gdcmopenjpeg -Idownloads/gdcm/Source/DataStructureAndEncodingDefinition -Idownloads/gdcm/Source/Common -Idownloads/gdcm/Source/MediaStorageAndFileFormat -Idownloads/gdcm/Source/DataDictionary downloads/gdcm/build/bin/libgdcmCommon.bc downloads/gdcm/build/bin/libgdcmIOD.bc downloads/gdcm/build/bin/libgdcmcharls.bc downloads/gdcm/build/bin/libgdcmjpeg16.bc downloads/gdcm/build/bin/libgdcmuuid.bc downloads/gdcm/build/bin/libgdcmDICT.bc downloads/gdcm/build/bin/libgdcmMEXD.bc downloads/gdcm/build/bin/libgdcmexpat.bc downloads/gdcm/build/bin/libgdcmjpeg8.bc downloads/gdcm/build/bin/libgdcmzlib.bc downloads/gdcm/build/bin/libgdcmDSED.bc downloads/gdcm/build/bin/libgdcmMSFF.bc downloads/gdcm/build/bin/libgdcmjpeg12.bc downloads/gdcm/build/bin/libgdcmopenjp2.bc downloads/gdcm/build/bin/libsocketxx.bc ;
done ;