pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post fbd661 by Anonymous on Tue 5th Sep 2023 11:50
original post e98be by Anonymous on Tue 1st Aug 2023 14:46
Download diff
Show old version | new version | both versions

    
11
#!/bin/bash
22
33
#
44
# buildrdecygwin.bash - build ROVEMA RDE using Cygwin
55
#
66
77
#
88
# Written by Roland Mainz <roland.mainz@rovema.de>
99
#
1010
1111
#
1212
# Usage:
1313
#
1414
# 1. Build RDE
1515
# mkdir try10_rde_new_rds/
1616
# cd try10_rde_new_rds
1717
# git clone https://RovemaDevelopment@dev.azure.com/RovemaDevelopment/RDE-Development/_git/Dependencies
1818
# git clone --recurse-submodules https://RovemaDevelopment@dev.azure.com/RovemaDevelopment/RDE-Development/_git/RDE-Development
1919
# cd RDE-Development/
2020
# mkdir build_windows4
2121
# cd build_windows4/
2222
# time nice bash ../scripts/buildrdecygwin.bash buildall 2>&1 | tee -a buildlog.log
2323
#
2424
# 2a. Start RDE (manually):
2525
# $ bash -c 'PATH+=":${qtpath}/5.15.2/mingw81_64/bin" ; ./rde'
2626
#
2727
# 2b. Start RDE (via script):
2828
# $ bash buildrdecygwin.bash run
2929
#
3030
3131
3232
function calc_max_parallel_jobs
3333
{
3434
	set -o nounset
3535
3636
	typeset -li mem_total=-1
3737
	typeset -li swap_total=-1
3838
	typeset -r -li memory_per_job=$2
3939
	typeset -r -li num_cpus=$(getconf '_NPROCESSORS_ONLN')
4040
	typeset -li numjobs_in_memory
4141
	typeset -n numjobs=$1
4242
4343
	read mem_total <<<"$(awk \
4444
		$'/MemTotal/ { print $2 }' \
4545
		<'/proc/meminfo')"
4646
	read swap_total <<<"$(awk \
4747
		$'/SwapTotal/ { print $2 }' \
4848
		<'/proc/meminfo')"
4949
5050
	printf $"%s: mem_total=%d, swap_total=%d\n" \
5151
		"$0" \
5252
		"$mem_total" \
5353
		"$swap_total"
5454
5555
	# data in /proc/meminto are in KB, but we need bytes
5656
	(( mem_total*=1024, swap_total*=1024 ))
5757
5858
	# handle read errors
5959
	if (( (mem_total < 0) || (swap_total < 0) )) ; then
6060
		printf $"%s: error, could not read memory data\n" "$0"
6161
		return 1
6262
	fi
6363
6464
	# we need at least 1GB of swap space
6565
	if (( swap_total < (1024*1024*1924) )) ; then
6666
		printf $"#\n# %s: ERROR: Swap memory too low %d\n#\n" "$0" "$swap_total"
6767
		return 1
6868
	fi
6969
7070
	# Reserve 256MB for the Windows OS
7171
	(( mem_total -= 256*1024*1024 ))
7272
7373
	# calculate how much jobs would fit into the memory
7474
	(( numjobs_in_memory = (mem_total+memory_per_job+1) / memory_per_job ))
7575
7676
	# restrict the number of jobs to twice the amount of CPUs
7777
	(( numjobs = (numjobs_in_memory > (num_cpus*2))?(num_cpus*2):numjobs_in_memory ))
7878
7979
	# we want at least one job
8080
	(( numjobs = (numjobs > 1)?numjobs:1 ))
8181
8282
	# statistics
8383
	printf $"%s: memory_per_job=%d\n"	"$0" "$memory_per_job"
8484
	printf $"%s: numjobs_in_memory=%d\n"	"$0" "$numjobs_in_memory"
8585
	printf $"%s: numjobs=%d\n"		"$0" "$numjobs"
8686
8787
	return 0
8888
}
8989
9090
9191
#
9292
# Configuration paths
9393
#
9494
function configure_paths
9595
{
9696
	boost_Version='1_71_0'
9797
	qt_Version='5_15_2'
9898
9999
	#
100100
	# Prebuild RDE build tools (compiler etc)
101101
	# (from $ git clone https://RovemaDevelopment@dev.azure.com/RovemaDevelopment/RDE-Development/_git/Dependencies #)
102102
	#
103103
	#git_rde_dependicies_dir='/cygdrive/h/tmp/winnfstest/hummingbirdnfstest1/rde_windows_developmement/Dependencies/win/'
104104
	#git_rde_dependicies_dir='/home/roland_mainz/work/rde/build_dep/Dependencies/win/'
105105
	git_rde_dependicies_dir="$(realpath "$PWD/../../Dependencies")/win/"
106106
	if [[ ! -d "$git_rde_dependicies_dir" ]] ; then
107107
		printf $"%s: ERROR: %s dir not found\n" "$0" "$git_rde_dependicies_dir" 1>&2
108108
		return 1
109109
	fi
110110
111111
	boostpath="${git_rde_dependicies_dir}/boost/boost_${boost_Version}/"
112112
	qtpath="${git_rde_dependicies_dir}/qt/qt_${qt_Version}/"
113113
114114
	printf $"# building with boost version %s and qt version %s\n" "$boost_Version" "qt_Version"
115115
116116
	# Setting-up PATH
117117
	export PATH="$qtpath/Tools/mingw810_64/bin/:$qtpath/5.15.2/mingw81_64/bin/:$qtpath/Tools/CMake_64/bin/:$boostpath/bin/:$boostpath/lib/:$PATH"
118118
	printf $"# PATH=%s\n# Windows PATH=%s\n" "$PATH" "$(cygpath -p -w "$PATH")"
119119
	return 0
120120
}
121121
122122
function probe_paths
123123
{
124124
	printf $"# Probing PATH for tools ...\n"
125125
	which -a gcc
126126
	which -a g++
127127
	which -a cmake
128128
	which -a make
129129
130130
	return 0
131131
}
132132
133133
#
134134
# Build
135135
#
136136
137137
function build_clean
138138
{
139139
	printf $"# Cleanup old build stuff ...\n"
140140
	rm -Rf CMake* CPack* CTestTestfile.cmake app_translations.qrc cmake_install.cmake nowide tests RDS Makefile *.qm rde.rc rde_autogen tmp versioninfo.cpp
141141
	return 0
142142
}
143143
144144
function build_cmake_config
145145
{
146146
	printf $"# Running build configuration via cmake ...\n"
147147
	# note: Windows/minGW uses '-G "MinGW Makefiles"', while compiling with Cygwin requires '-G "Unix Makefiles"'
148148
	cmake -G "Unix Makefiles" -DBOOST_ROOT="$boostpath" -DBoost_LIB_PREFIX="lib" -DBoost_USE_STATIC_LIBS=TRUE -DBoost_ARCHITECTURE="-x64" -DBUILD_TESTS=ON ".."
149149
	return 0
150150
}
151151
152152
function build_cmake_clean
153153
{
154154
	printf $"# Target clean ...\n"
155155
	cmake --build . -j 1 --target clean
156156
	return 0
157157
}
158158
159159
function build_cmake_targets
160160
{
161161
	typeset -li num_parallel_jobs=$1
162162
163163
	printf $"# Building ...\n"
164164
165165
	cmake --build . -j $num_parallel_jobs
166166
	printf $"%s: Build done.\n" "$0"
167167
	return 0
168168
}
169169
170170
#
171171
# main
172172
#
173173
set -o errexit
174174
set -o nounset
175175
#set -o xtrace # debug
176176
177177
printf $"%s: Start ...\n" "$0"
178178
179179
# Check whether we are really on Cygwin...
180180
if [[ "$(uname -s)" != *CYGWIN* ]] ; then
181181
	printf $"%s: ERROR: Not a Cygwin environment.\n" "$0" 1>&2
182182
	exit 1
183183
fi
184184
185185
typeset boost_Version qt_Version git_rde_dependicies_dir boostpath qtpath
186186
typeset -li num_parallel_jobs
187187
188188
configure_paths
189189
190190
case "${1-}" in
191191
	'buildall')
192192
		calc_max_parallel_jobs num_parallel_jobs $((512*1024*1024)) || exit 1
193193
		probe_paths
194194
		build_clean
195195
		build_cmake_config
196196
		build_cmake_clean
197197
		build_cmake_targets "$num_parallel_jobs"
198198
		;;
199199
	'clean')
200200
		build_clean
201201
		;;
202202
	'run')
203203
		./rde
204204
		exit $?
205205
		;;
206206
	*)
207207
		printf $"%s: Unknown cmd %q\n" "$0" "${1-}" 1>&2
208208
		exit 1
209209
		;;
210210
esac
211211
212212
exit 0
213213
214214
# EOF.
215215

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at