Skip to content

Commit

Permalink
fixes a lot
Browse files Browse the repository at this point in the history
  • Loading branch information
paulocoutinhox committed Aug 17, 2024
1 parent e0f1f1c commit b180ecf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
5 changes: 3 additions & 2 deletions modules/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ def get_build_args(config, target_os, target_cpu, libc=None, enable_v8=False):
args.append("treat_warnings_as_errors=false")
args.append("is_component_build=false")

# static lib
# args.append("pdf_is_complete_lib=true")

if enable_v8:
args.append("v8_use_external_startup_data=false")
args.append("v8_enable_i18n_support=false")
Expand All @@ -130,7 +133,6 @@ def get_build_args(config, target_os, target_cpu, libc=None, enable_v8=False):
elif target_os == "ios":
args.append("ios_enable_code_signing=false")
args.append("use_blink=true")
args.append("pdf_is_complete_lib=true")

if enable_v8 and target_cpu == "arm64":
args.append('arm_control_flow_integrity="none"')
Expand All @@ -140,7 +142,6 @@ def get_build_args(config, target_os, target_cpu, libc=None, enable_v8=False):
elif target_os.startswith("mac"):
args.append('mac_deployment_target="10.13.0"')
args.append("clang_use_chrome_plugins=false")
args.append("pdf_is_complete_lib=true")
elif target_os.startswith("wasm"):
args.append("pdf_is_complete_lib=true")
args.append("is_clang=false")
Expand Down
4 changes: 2 additions & 2 deletions modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

# macos
configurations_macos = ["release"]
shared_lib_macos = False
shared_lib_macos = True
targets_macos = [
{"target_os": "macos", "target_cpu": "x64", "pdfium_os": "mac"},
{"target_os": "macos", "target_cpu": "arm64", "pdfium_os": "mac"},
]

# ios
configurations_ios = ["release"]
shared_lib_ios = False
shared_lib_ios = True
targets_ios = [
{
"target_os": "ios",
Expand Down
12 changes: 7 additions & 5 deletions modules/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ def run_task_install():
config,
),
"obj",
"libpdfium.a",
"libpdfium.dylib",
)

target_lib_path = os.path.join(
"build",
target["target_os"],
config,
"lib",
"libpdfium_{0}-{1}.a".format(
"libpdfium_{0}-{1}.dylib".format(
target["target_cpu"], target["target_environment"]
),
)
Expand All @@ -222,12 +222,14 @@ def run_task_install():
# universal
universal_libs = []
for env in ["simulator", "device"]:
folder = os.path.join("build", "ios", config, "lib", "*-{0}.a".format(env))
folder = os.path.join(
"build", "ios", config, "lib", "*-{0}.dylib".format(env)
)
files = glob.glob(folder)
files_str = " ".join(files)
f.create_dir(os.path.join("build", "ios", config, "lib", env))
lib_file_out = os.path.join(
"build", "ios", config, "lib", env, "libpdfium.a"
"build", "ios", config, "lib", env, "libpdfium.dylib"
)

l.colored("Merging {0} libraries (lipo)...".format(env), l.YELLOW)
Expand Down Expand Up @@ -281,7 +283,7 @@ def run_task_test():
for config in c.configurations_ios:
for env in ["simulator", "device"]:
lib_dir = os.path.join("build", "ios", config, "lib", env)
command = ["file", os.path.join(lib_dir, "libpdfium.a")]
command = ["file", os.path.join(lib_dir, "libpdfium.dylib")]
r.run(command)

framework_dir = os.path.join("build", "ios", config, "pdfium.xcframework")
Expand Down
9 changes: 4 additions & 5 deletions modules/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,15 @@ def run_task_install():
"pdfium",
"out",
"{0}-{1}-{2}".format(target["target_os"], target["target_cpu"], config),
"obj",
"libpdfium.a",
"libpdfium.dylib",
)

target_lib_path = os.path.join(
"build",
target["target_os"],
config,
"lib",
"libpdfium_{0}.a".format(target["target_cpu"]),
"libpdfium_{0}.dylib".format(target["target_cpu"]),
)

f.copy_file(source_lib_path, target_lib_path)
Expand All @@ -150,10 +149,10 @@ def run_task_install():
f.replace_in_file(header, '#include "public/', '#include "../')

# universal
folder = os.path.join("build", "macos", config, "lib", "*.a")
folder = os.path.join("build", "macos", config, "lib", "*.dylib")
files = glob.glob(folder)
files_str = " ".join(files)
lib_file_out = os.path.join("build", "macos", config, "lib", "libpdfium.a")
lib_file_out = os.path.join("build", "macos", config, "lib", "libpdfium.dylib")

l.colored("Merging libraries (lipo)...", l.YELLOW)
command = ["lipo", "-create", files_str, "-o", lib_file_out]
Expand Down

0 comments on commit b180ecf

Please sign in to comment.