Frodo45127 / rpfm

Rusted PackFile Manager (RPFM) is a... reimplementation in Rust and Qt5 of PackFile Manager (PFM), one of the best modding tools for Total War Games.
MIT License
366 stars 58 forks source link

For those who wanna compile on mac #198

Open Phantato opened 2 years ago

Phantato commented 2 years ago

Here is how I get things work, but may mess up sth.

  1. Assuming you already got cmake, gmake, clang, cargo or any other compile-related tools.
  2. brew install qt@5
  3. brew link qt@5
  4. Follow kde's brew instructions and brew install kde-mac/kde/kf5-ktexteditor
  5. Now comes to the mess up things: 4.1. Use the following script to let qt@5 recognize those installed kde frameworks, literally, copy those *.pri files:
    
    import subprocess as sp
    import os

li = sp.check_output("brew list | grep kf5-", shell=True, text=True).split('\n') print(li)

qt_dir = '/usr/local/Cellar/qt@5/5.15.2_2/mkspecs/modules/'

for item in li: item = item.removeprefix('kf5-') kde_dir = '/usr/local/Cellar/kf5-' + item + '/5.90.0' #version might be different if os.path.isdir(kde_dir): pri_dir = kde_dir + '/mkspecs/modules' for f in os.listdir(pri_dir): s_path = pri_dir + "/" + f t_path = qt_dir + f with open(s_path) as f: text = f.read(); text = text.replace("$$PWD", pri_dir) with open(t_path, 'w') as f: f.write(text)

4.2. run

cp /usr/local/Cellar/ki18n/5.91.0/mkspecs/modules/qt_KI18n.pri /usr/local/Cellar/qt@5/5.15.2_2/mkspecs/modules

since `i18n` doesn't have the "kf5-" prefix. Again, version might be different.
4.4. open `/usr/local/Cellar/qt@5/5.15.2_2/mkspecs/modules/qt_KSyntaxHighlighting.pri` and
4.5. change line 8 from

QT.KSyntaxHighlighting.includes = /usr/local/Cellar/kf5-syntax-highlighting/5.90.0/mkspecs/modules/../../include/KF5/KSyntaxHighlighting

to

QT.KSyntaxHighlighting.includes = /usr/local/Cellar/kf5-syntax-highlighting/5.90.0/mkspecs/modules/../../include/KF5

i.e. remove last `KSyntaxHighlighting`
4.6. go to `/YOUR/PATH/TO/rpfm-3.0.5/rpfm_ui/qt_subclasses`, modify the `qt_subclasses.pro`, add

QT += KSyntaxHighlighting

so it looks like 

QT += widgets QT += KTextEditor QT += KWidgetsAddons QT += KSyntaxHighlighting # <- add here TARGET = qt_subclasses


5. Then finally `cargo build` should do its work.

Personally, I'm not feeling good about the python and text-editing things so any improvement are welcome.