Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/make.sh

Last change on this file was 16669, checked in by hmaislin, 5 years ago

#2929: Added missing dependencies

File size: 2.1 KB
Line 
1#!/usr/bin/env bash
2set -e          # Exit if any return code not equals 0
3
4ScriptRoot=$(dirname "$(readlink -f "$0")")
5OriginalProgram=0
6CreateDLL=0
7SimpleTest=0
8Archive=0
9
10case "$1" in
11"original")
12    OriginalProgram=1
13    ;;
14"clean")
15    ;;
16"cprog")
17    Archive=1
18    ;;
19"dll")
20    CreateDLL=1
21    Archive=1
22    ;;
23* | "all")
24    CreateDLL=1
25    SimpleTest=1
26    Archive=1
27    ;;
28esac
29
30export GOPATH="${ScriptRoot}:${ScriptRoot}/levmar"
31
32export GOGC="off"
33export GODEBUG="cgocheck=0"
34export CGO_ENABLED=1
35
36export GOARCH=amd64
37export GOHOSTARCH=amd64
38export GOHOSTOS=windows
39export GOOS=windows
40
41cd "$ScriptRoot"
42
43cd ./src/go-pge
44
45if [ $Archive -eq 1 ]; then
46    CGO_ENABLED=1 \
47    go build -o libpge.a -ldflags="-s -w " -gcflags=all="-N -l" -buildmode=c-archive \
48        pge.go
49
50    echo "Created c-archive from go"
51
52    gcc -x c testmulti.c -o testmulti.exe -std=c99 \
53        -L. -L../../levmar/src/go-levmar/levmar-2.6 -L../../levmar/src/go-levmar/levmar-2.6/libs64 \
54        -ggdb -fpic -m64 -pthread \
55        -lpge -lm -llevmar -llapack -lblas -lf2c -ltmglib -lWinMM -lntdll -lWS2_32 \
56        -Wno-implicit-function-declaration
57
58    echo "Built C-Test programm"
59fi
60
61if [ $CreateDLL -eq 1 ]; then
62    gcc -shared -pthread -o go-pge.dll pge.c libpge.a -lWinMM -lntdll -lWS2_32 \
63        -L../../levmar/src/go-levmar/levmar-2.6 -L../../levmar/src/go-levmar/levmar-2.6/libs64 \
64        -lm -llevmar -llapack -lblas -lf2c -ltmglib
65   
66    echo "Created PGE-DLL"
67    cp go-pge.dll ../../
68fi
69
70if [ -f libpge.a ]; then
71    rm -f libpge.a
72fi
73if [ -f libpge.h ]; then
74    rm -f libpge.h
75fi
76
77if [ $SimpleTest -eq 1 ]; then
78  echo "Starting simple test"
79  powershell -File ../../TestResults.ps1
80fi
81
82if [ $OriginalProgram -eq 1 ]; then
83    cd "$ScriptRoot"
84    cd "go-code/src/go-pge"
85    export GOPATH="${ScriptRoot}/go-code:${ScriptRoot}:${ScriptRoot}/levmar"
86    CGO_ENABLED=1 \
87    go build -o go-pge.exe -ldflags="-s -w " -gcflags=all="-N -l"
88    mv go-pge.exe "$ScriptRoot/src/go-pge"
89    echo "Rebuilt original application"
90fi
91
Note: See TracBrowser for help on using the repository browser.