Skip to content
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

Added Multiple Core build support option #344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion build.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
a:hover {
text-decoration: underline;
}
select, button {
select, button, input {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8071063642:AAEhvpJXOE3hLohCbkG-_fz7N5JLgiWeLBc

border: 1px solid var(--color-select-border);
background-color: var(--background);
color: var(--color);
Expand Down Expand Up @@ -263,6 +263,14 @@
<label><input type="checkbox" id="buildRootCheckbox" onchange="onOptionsChanged()"/>Build from root user (unrecommended).</label>
</div>

<div id="buildMultiCoreDiv" class="hide">
<label><input type="checkbox" id="buildMultiCoreCheckbox" onchange="onOptionsChanged()"/>Build using mulitple cores<span class="hide" id="buildMultiCoreColon">:</span></label>

<div id="buildMultiCoreInputDiv" class="hide">
<input type="number" id="buildMultiCoreInput" onchange="onOptionsChanged()" placeholder="Cores number" min="1" style="text-align: center;"/>
</div>
</div>

<p></p>
</div>

Expand Down Expand Up @@ -351,6 +359,7 @@
linux_distro = document.getElementById('linuxSelect').value;
}
document.getElementById('buildCommandsDiv').style.display = 'block';
document.getElementById('buildMultiCoreDiv').style.display = 'block';

var use_clang = os_freebsd || os_openbsd;
if (os_linux && linux_distro !== 'Alpine' && !linux_distro.includes('CentOS')) {
Expand Down Expand Up @@ -660,6 +669,11 @@
commands.push('cd ../build');
}
let build_command = cmake + ' --build . --target install';

if (document.getElementById('buildMultiCoreCheckbox').checked && document.getElementById('buildMultiCoreInput').value.toString().length > 0 && !(isNaN(document.getElementById('buildMultiCoreInput').value))) {
build_command += ` -j ${ document.getElementById('buildMultiCoreInput').value }`;
}

if (use_msvc) {
if (!is_debug_build) {
commands.push(build_command + ' --config Release');
Expand All @@ -678,6 +692,8 @@
if (install_dir !== '/usr/local') {
install_dir = 'telegram-bot-api';
}
document.getElementById('buildMultiCoreInputDiv').style.display = document.getElementById('buildMultiCoreCheckbox').checked ? 'block' : 'none';
document.getElementById('buildMultiCoreColon').style.display = document.getElementById('buildMultiCoreCheckbox').checked ? 'inline' : 'none';
commands.push((use_powershell ? 'dir ' : 'ls -l ') + install_dir + '/bin/telegram-bot-api*');
document.getElementById('buildCommands').innerHTML = '<ul><li>' + commands.join('</li><li>') + '</li></ul>';
document.getElementById('copyBuildCommandsButton').style.display = commands.includes('exit') ? 'none' : 'block';
Expand Down