-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathcompile_lib_screencapture.py
59 lines (48 loc) · 2.43 KB
/
compile_lib_screencapture.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
'''
This Source Code Form is subject to the terms of the Mozilla
Public License, v. 2.0. If a copy of the MPL was not distributed
with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
'''
import compile_generic
import os
import utils
class Compile(compile_generic.Compile):
def __init__(self):
compile_generic.Compile.__init__(self,"lib_screencapture")
def get_os_config(self,osn):
conf=None
if osn=="windows":
conf={}
conf["outname"]="dwagscreencapture.dll"
conf["cpp_include_paths"]=[self.get_path_tmp() + os.sep + "lib_z", self.get_path_tmp() + os.sep + "lib_turbojpeg"]
conf["cpp_library_paths"]=conf["cpp_include_paths"]
conf["libraries"]=["zlib1", "turbojpeg", "gdi32", "userenv"]
conf["linker_flags"]="-shared"
conf["cpp_compiler_flags"]="-DOS_MAIN"
elif osn=="linux":
conf={}
conf["outname"]="dwagscreencapture.so"
conf["cpp_include_paths"]=[self.get_path_tmp() + os.sep + "lib_z", self.get_path_tmp() + os.sep + "lib_turbojpeg"]
conf["cpp_library_paths"]=conf["cpp_include_paths"]
conf["libraries"]=["z", "turbojpeg", "dl"]
conf["cpp_compiler_flags"]="-DOS_MAIN"
elif osn=="mac":
conf={}
conf["outname"]="dwagscreencapture.dylib"
conf["cpp_include_paths"]=[self.get_path_tmp() + os.sep + "lib_z", self.get_path_tmp() + os.sep + "lib_turbojpeg"]
conf["cpp_library_paths"]=conf["cpp_include_paths"]
conf["libraries"]=["z", "turbojpeg"]
#conf["frameworks"]=["IOKit","Carbon"]
conf["frameworks"]=["SystemConfiguration","IOKit","Carbon","AppKit"] #TO REMOVE 16/08/2021 (SystemConfiguration)
conf["cpp_compiler_flags"]="-DOS_MAIN"
return conf
def before_copy_to_native(self,osn):
if utils.is_mac():
confos=self._conf[osn]
utils.system_exec(["install_name_tool -change \"/usr/local/lib/libz.1.dylib\" \"@loader_path/libz.dylib\" " + confos["outname"]], self._conf["pathdst"])
utils.system_exec(["install_name_tool -change \"/opt/libjpeg-turbo/lib/libturbojpeg.0.2.0.dylib\" \"@loader_path/libturbojpeg.dylib\" " + confos["outname"]], self._conf["pathdst"])
if __name__ == "__main__":
m = Compile()
#m.set_32bit()
m.run()