Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
48db64cb
Commit
48db64cb
authored
3 years ago
by
Andreas Traczyk
Browse files
Options
Downloads
Patches
Plain Diff
misc: simplify windows build scripts
Change-Id: I8c115b95ee46af8809e00f48e64b3e9796e78a27
parent
707a7b60
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+5
-8
5 additions, 8 deletions
CMakeLists.txt
make-lrc.py
+46
-175
46 additions, 175 deletions
make-lrc.py
with
51 additions
and
183 deletions
CMakeLists.txt
+
5
−
8
View file @
48db64cb
...
...
@@ -27,8 +27,12 @@ if(CMAKE_GENERATOR_SHORT MATCHES "Visual Studio ")
message
(
STATUS
"Generating VS project"
)
set
(
CMAKE_CXX_COMPILER_ID
"MSVC"
)
set
(
ENABLE_TEST false
)
set
(
ENABLE_SHARED false
)
set
(
ENABLE_STATIC true
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"
${
CMAKE_CXX_FLAGS_RELEASE
}
/Zi /W0 /MP"
)
add_definitions
(
-DUNICODE -D_UNICODE
)
remove_definitions
(
-D_MBCS
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/Zi /W0 /MP"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
/Zi /W0 /MP"
)
endif
()
if
(
NOT
(
CMAKE_CXX_COMPILER_ID MATCHES
"MSVC"
))
...
...
@@ -751,10 +755,3 @@ CONFIGURE_FILE(
ADD_CUSTOM_TARGET
(
uninstall
COMMAND
${
CMAKE_COMMAND
}
-P
${
CMAKE_CURRENT_BINARY_DIR
}
/cmake_uninstall.cmake
)
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"MSVC"
)
add_definitions
(
-DUNICODE -D_UNICODE
)
remove_definitions
(
-D_MBCS
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
"
)
endif
()
This diff is collapsed.
Click to expand it.
make-lrc.py
+
46
−
175
View file @
48db64cb
#!/usr/bin/env python3
import
tempfile
import
re
import
sys
...
...
@@ -11,10 +13,7 @@ import fileinput
import
re
from
enum
import
Enum
# vs help
win_sdk_default
=
'
10.0.16299.0
'
win_toolset_default
=
'
142
'
qt_version_default
=
'
6.2.0
'
qt_version_default
=
'
6.2.1
'
vs_where_path
=
os
.
path
.
join
(
os
.
environ
[
'
ProgramFiles(x86)
'
],
'
Microsoft Visual Studio
'
,
'
Installer
'
,
'
vswhere.exe
'
...
...
@@ -22,12 +21,21 @@ vs_where_path = os.path.join(
host_is_64bit
=
(
False
,
True
)[
platform
.
machine
().
endswith
(
'
64
'
)]
this_dir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
build_dir
=
this_dir
+
'
\\
build
'
build_dir
=
os
.
path
.
join
(
this_dir
,
'
build
'
)
qt_path
=
os
.
path
.
join
(
'
c:
'
,
os
.
sep
,
'
Qt
'
)
qt_kit_path
=
'
msvc2019_64
'
qt_root_path
=
os
.
getenv
(
'
QT_ROOT_DIRECTORY
'
,
qt_path
)
def
execute_cmd
(
cmd
,
with_shell
=
False
,
env_vars
=
None
,
cmd_dir
=
os
.
getcwd
()):
p
=
subprocess
.
Popen
(
cmd
,
shell
=
with_shell
,
stdout
=
sys
.
stdout
,
env
=
env_vars
,
cwd
=
cmd_dir
)
_
,
_
=
p
.
communicate
()
return
p
.
returncode
class
QtVerison
(
Enum
):
Major
=
0
Minor
=
1
Micro
=
2
def
getLatestVSVersion
():
args
=
[
...
...
@@ -59,13 +67,6 @@ def findVSLatestDir():
return
def
findMSBuild
():
filename
=
'
MSBuild.exe
'
for
root
,
_
,
files
in
os
.
walk
(
findVSLatestDir
()
+
r
'
\\MSBuild
'
):
if
filename
in
files
:
return
os
.
path
.
join
(
root
,
filename
)
def
getVSEnv
(
arch
=
'
x64
'
,
platform
=
''
,
version
=
''
):
env_cmd
=
'
set path=%path:
"
=% &&
'
+
\
getVSEnvCmd
(
arch
,
platform
,
version
)
+
'
&& set
'
...
...
@@ -77,18 +78,6 @@ def getVSEnv(arch='x64', platform='', version=''):
return
dict
(
s
.
split
(
'
=
'
,
1
)
for
s
in
out
)
def
getCMakeGenerator
(
vs_version
):
if
vs_version
==
'
15
'
:
return
'
Visual Studio 15 2017 Win64
'
else
:
return
'
Visual Studio
'
+
vs_version
+
'
2019
'
def
getQtVersionNumber
(
qt_version
,
version_type
):
version_list
=
qt_version
.
split
(
'
.
'
)
return
version_list
[
version_type
.
value
]
def
getVSEnvCmd
(
arch
=
'
x64
'
,
platform
=
''
,
version
=
''
):
vcEnvInit
=
[
findVSLatestDir
()
+
r
'
\VC\Auxiliary\Build\"vcvarsall.bat
'
]
if
platform
!=
''
:
...
...
@@ -101,159 +90,55 @@ def getVSEnvCmd(arch='x64', platform='', version=''):
return
vcEnvInit
def
build_project
(
msbuild
,
msbuild_args
,
proj
,
env_vars
):
args
=
[]
args
.
extend
(
msbuild_args
)
args
.
append
(
proj
)
cmd
=
[
msbuild
]
cmd
.
extend
(
args
)
p
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
stdout
=
sys
.
stdout
,
env
=
env_vars
)
_
,
_
=
p
.
communicate
()
if
p
.
returncode
:
print
(
"
Build failed when building
"
,
proj
)
sys
.
exit
(
1
)
def
build
(
qtver
):
print
(
"
Building with Qt
"
+
qtver
)
def
purge_dir
(
build_dir
):
if
os
.
path
.
exists
(
build_dir
):
try
:
shutil
.
rmtree
(
build_dir
)
except
Exception
as
e
:
print
(
'
Error while removing directory:
'
+
str
(
e
))
sys
.
exit
(
1
)
config_str
=
'
Release
'
vs_env_vars
=
{}
vs_env_vars
.
update
(
getVSEnv
())
def
generate
(
force
,
qtver
,
sdk
,
toolset
,
arch
):
# check build dir
if
os
.
path
.
exists
(
build_dir
):
if
not
force
:
print
(
"
Skipping generate, build directory already exists!
"
)
return
purge_dir
(
build_dir
)
print
(
'
Generating lrc with Qt-
'
+
qtver
+
'
'
+
arch
+
'
'
+
sdk
+
'
'
+
toolset
)
qt_dir
=
os
.
path
.
join
(
qt_root_path
,
qtver
,
qt_kit_path
)
daemon_dir
=
os
.
path
.
dirname
(
this_dir
)
+
'
\\
daemon
'
daemon_bin
=
daemon_dir
+
'
\\
build
\\
x64
\\
ReleaseLib_win32
\\
bin
\\
jami.lib
'
if
not
os
.
path
.
exists
(
daemon_bin
):
print
(
"
Daemon library not found!
"
)
sys
.
exit
(
1
)
# we just assume Qt is installed in the default folder
qt_dir
=
'
C:
\\
Qt
\\
'
+
qtver
cmake_gen
=
getCMakeGenerator
(
getLatestVSVersion
())
qt_major_version
=
getQtVersionNumber
(
qtver
,
QtVerison
.
Major
)
msvc_folder
=
'
\\
msvc2019_64
'
qt_cmake_dir
=
qt_dir
+
msvc_folder
+
'
\\
lib
\\
cmake
\\
'
qt_general_macro
=
'
Qt
'
+
qt_major_version
cmake_options
=
[
'
-DCMAKE_PREFIX_PATH=
'
+
qt_cmake_dir
,
'
-DQT_DIR=
'
+
qt_dir
+
msvc_folder
,
'
-D
'
+
qt_general_macro
+
'
_DIR=
'
+
qt_cmake_dir
+
qt_general_macro
,
'
-D
'
+
qt_general_macro
+
'
Core_DIR=
'
+
qt_cmake_dir
+
qt_general_macro
+
'
Core
'
,
'
-D
'
+
qt_general_macro
+
'
Sql_DIR=
'
+
qt_cmake_dir
+
qt_general_macro
+
'
Sql
'
,
'
-D
'
+
qt_general_macro
+
'
LinguistTools_DIR=
'
+
qt_cmake_dir
+
qt_general_macro
+
'
LinguistTools
'
,
'
-D
'
+
qt_general_macro
+
'
Concurrent_DIR=
'
+
qt_cmake_dir
+
qt_general_macro
+
'
Concurrent
'
,
'
-D
'
+
qt_general_macro
+
'
Gui_DIR=
'
+
qt_cmake_dir
+
qt_general_macro
+
'
Gui
'
,
'
-DCMAKE_PREFIX_PATH=
'
+
qt_dir
,
'
-DCMAKE_BUILD_TYPE=
'
+
config_str
,
'
-Dring_BIN=
'
+
daemon_bin
,
'
-DRING_INCLUDE_DIR=
'
+
daemon_dir
+
'
\\
src
\\
jami
'
,
'
-DCMAKE_SYSTEM_VERSION=
'
+
sdk
'
-DRING_INCLUDE_DIR=
'
+
daemon_dir
+
'
\\
src
\\
jami
'
]
if
not
os
.
path
.
exists
(
build_dir
):
os
.
makedirs
(
build_dir
)
os
.
chdir
(
build_dir
)
cmd
=
[
'
cmake
'
,
'
..
'
,
'
-G
'
,
cmake_gen
]
cmd
=
[
'
cmake
'
,
'
..
'
]
print
(
'
Configuring…
'
)
cmd
.
extend
(
cmake_options
)
p
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
)
_
,
_
=
p
.
communicate
()
if
p
.
returncode
:
print
(
"
Couldn
'
t generate!
"
)
if
(
execute_cmd
(
cmd
,
False
,
vs_env_vars
,
build_dir
)):
print
(
"
Cmake generate error
"
)
sys
.
exit
(
1
)
qtwrapper_proj_path
=
build_dir
+
'
\\
src
\\
qtwrapper
\\
qtwrapper.vcxproj
'
lrc_proj_path
=
build_dir
+
'
\\
ringclient_static.vcxproj
'
# force toolset
replace_vs_prop
(
qtwrapper_proj_path
,
'
PlatformToolset
'
,
toolset
)
replace_vs_prop
(
lrc_proj_path
,
'
PlatformToolset
'
,
toolset
)
# force unicode
replace_vs_prop
(
qtwrapper_proj_path
,
'
CharacterSet
'
,
'
Unicode
'
)
replace_vs_prop
(
lrc_proj_path
,
'
CharacterSet
'
,
'
Unicode
'
)
os
.
chdir
(
this_dir
)
def
replace_vs_prop
(
filename
,
prop
,
val
):
p
=
re
.
compile
(
r
'
(?s)<
'
+
prop
+
r
'
\s?.*?>(.*?)<\/
'
+
prop
+
r
'
>
'
)
val
=
r
'
<
'
+
prop
+
r
'
>
'
+
val
+
r
'
</
'
+
prop
+
r
'
>
'
with
fileinput
.
FileInput
(
filename
,
inplace
=
True
)
as
file
:
for
line
in
file
:
print
(
re
.
sub
(
p
,
val
,
line
),
end
=
''
)
def
build
(
arch
,
toolset
):
print
(
'
Building lrc Release|
'
+
arch
)
vs_env_vars
=
{}
vs_env_vars
.
update
(
getVSEnv
())
qtwrapper_proj_path
=
build_dir
+
'
\\
src
\\
qtwrapper
\\
qtwrapper.vcxproj
'
lrc_proj_path
=
build_dir
+
'
\\
ringclient_static.vcxproj
'
msbuild
=
findMSBuild
()
if
not
os
.
path
.
isfile
(
msbuild
):
raise
IOError
(
'
msbuild.exe not found. path=
'
+
msbuild
)
msbuild_args
=
[
'
/nologo
'
,
'
/verbosity:minimal
'
,
'
/maxcpucount:
'
+
str
(
multiprocessing
.
cpu_count
()),
'
/p:Platform=
'
+
arch
,
'
/p:Configuration=
'
+
'
Release
'
,
'
/p:useenv=true
'
,
'
/p:PlatformToolset=
'
+
toolset
]
build_project
(
msbuild
,
msbuild_args
,
qtwrapper_proj_path
,
vs_env_vars
)
build_project
(
msbuild
,
msbuild_args
,
lrc_proj_path
,
vs_env_vars
)
print
(
'
Building…
'
)
cmd
=
[
'
cmake
'
,
'
--build
'
,
'
.
'
,
'
--config
'
,
config_str
,
'
--
'
,
'
-m
'
]
if
(
execute_cmd
(
cmd
,
False
,
vs_env_vars
,
build_dir
)):
print
(
"
Cmake build error
"
)
sys
.
exit
(
1
)
def
parse_args
():
ap
=
argparse
.
ArgumentParser
(
description
=
"
Windows Jami-lrc build tool
"
)
ap
.
add_argument
(
'
-b
'
,
'
--build
'
,
action
=
'
store_true
'
,
help
=
'
Build lrc
'
)
ap
.
add_argument
(
'
-f
'
,
'
--force
'
,
action
=
'
store_true
'
,
help
=
'
Force action
'
)
ap
.
add_argument
(
'
-p
'
,
'
--purge
'
,
action
=
'
store_true
'
,
help
=
'
Purges the build directory
'
)
ap
.
add_argument
(
'
-q
'
,
'
--qtver
'
,
default
=
qt_version_default
,
help
=
'
Sets the Qt version to build with
'
)
ap
.
add_argument
(
'
-g
'
,
'
--gen
'
,
action
=
'
store_true
'
,
help
=
'
Generates vs project files for lrc using CMake
'
)
ap
.
add_argument
(
'
-a
'
,
'
--arch
'
,
default
=
'
x64
'
,
help
=
'
Sets the build architecture
'
)
ap
.
add_argument
(
'
-s
'
,
'
--sdk
'
,
default
=
win_sdk_default
,
type
=
str
,
help
=
'
Use specified windows sdk version
'
)
ap
.
add_argument
(
'
-t
'
,
'
--toolset
'
,
default
=
win_toolset_default
,
type
=
str
,
help
=
'
Use specified platform toolset version
'
)
parsed_args
=
ap
.
parse_args
()
if
parsed_args
.
toolset
:
if
parsed_args
.
toolset
[
0
]
!=
'
v
'
:
parsed_args
.
toolset
=
'
v
'
+
parsed_args
.
toolset
return
parsed_args
...
...
@@ -267,21 +152,7 @@ def main():
sys
.
exit
(
1
)
parsed_args
=
parse_args
()
if
int
(
getQtVersionNumber
(
parsed_args
.
qtver
,
QtVerison
.
Major
))
<
6
:
print
(
'
We currently only support Qt6
'
)
sys
.
exit
(
1
)
if
parsed_args
.
purge
:
print
(
'
Purging build dir
'
)
purge_dir
(
build_dir
)
if
parsed_args
.
gen
:
generate
(
parsed_args
.
force
,
parsed_args
.
qtver
,
parsed_args
.
sdk
,
parsed_args
.
toolset
,
parsed_args
.
arch
)
if
parsed_args
.
build
:
build
(
parsed_args
.
arch
,
parsed_args
.
toolset
)
build
(
parsed_args
.
qtver
)
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment