forked from desktop-app/cmake_helpers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3182d2d
commit 632ed31
Showing
7 changed files
with
90 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
''' | ||
This file is part of Telegram Desktop, | ||
the official desktop application for the Telegram messaging service. | ||
For license and copyright information please follow this link: | ||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL | ||
''' | ||
import sys, os, shutil, subprocess | ||
|
||
def run(project, arguments): | ||
scriptPath = os.path.dirname(os.path.realpath(__file__)) | ||
basePath = scriptPath + '/../out' | ||
|
||
cmake = ['cmake'] | ||
for arg in arguments: | ||
if arg == 'debug': | ||
cmake.append('-DCMAKE_BUILD_TYPE=Debug') | ||
elif arg != 'fresh': | ||
cmake.append(arg) | ||
|
||
if sys.platform == 'win32': | ||
cmake.append('-AWin32') | ||
elif sys.platform != 'darwin': | ||
if not '-DCMAKE_BUILD_TYPE=Debug' in cmake: | ||
cmake.append('-DCMAKE_BUILD_TYPE=Release') | ||
|
||
specialTarget = '' | ||
specialTargetFile = scriptPath + '/../' + project + '/build/target' | ||
if os.path.isfile(specialTargetFile): | ||
with open(specialTargetFile, 'r') as f: | ||
for line in f: | ||
target = line.strip() | ||
if len(target) > 0: | ||
cmake.append('-DDESKTOP_APP_SPECIAL_TARGET=' + target) | ||
|
||
cmake.extend(['-Werror=dev', '-Werror=deprecated', '--warn-uninitialized', '..']) | ||
command = ' '.join(cmake) | ||
|
||
if not os.path.exists(basePath): | ||
os.mkdir(basePath) | ||
elif 'fresh' in arguments: | ||
paths = os.listdir(basePath) | ||
for path in paths: | ||
if path.lower().startswith('cmake'): | ||
full = basePath + '/' + path | ||
if os.path.isdir(full): | ||
shutil.rmtree(full, ignore_errors=False) | ||
else: | ||
os.remove(full) | ||
print('Cleared previous.') | ||
os.chdir(basePath) | ||
subprocess.call(command, shell=True) | ||
|
||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters