Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build on OS X #1

Closed
thibaudgg opened this issue Sep 25, 2015 · 30 comments · Fixed by #2
Closed

Build on OS X #1

thibaudgg opened this issue Sep 25, 2015 · 30 comments · Fixed by #2

Comments

@thibaudgg
Copy link
Contributor

Hey,

I tried to build your project on OS X (10.10.5) with QT Creator 3.5 and opencv 2.4.12 (installed with HomeBrew) but when I try to build I got this issue:

:-1: error: opencv development package not found

I added already /usr/local/bin in PATH on Project Build Environment and opencv is listed via pkg-config:

pkg-config --list-all | grep opencv
opencv              OpenCV - Open Source Computer Vision Library

What am I missing?

screen shot 2015-09-25 at 13 33 20

Thanks for your help!

@supertriodo
Copy link
Owner

I don't see anything wrong. It seem as it is not listed in pkgconfig but as you checked is already there.

@thibaudgg
Copy link
Contributor Author

Hey thanks for the answer!

So following this solution, I added to QT_CONFIG -= no-pkg-config to the .pro file and was able to build (yeah!) but after I got a lot of weird stuff:

screen shot 2015-09-25 at 15 15 55

Do you plan do provide an OS X build app at some point? 😄

@supertriodo
Copy link
Owner

There is some kind of problem with the #defines I have created in deckcard.h for the different colors used.

Do you know c++ to touch a little of code?
Try removing the #define for the colors and change the color name every time the compiler complains for the expression at the rigth of the #define.
There is no much I can do without a mac to try it out.
In Linux everything compiles without a warning.

About the mac os binary question, I would like to make one but apple has put a lot of effort to make sure nobody without a mac can do it...

@thibaudgg
Copy link
Contributor Author

Thanks that was really helpful.

So I change colors definition like that:

#define GREEN QColor(200,250,200)
#define LIMEGREEN QColor(50,205,50)
#define RED QColor(255,0,0)
#define YELLOW QColor(255,255,0)
#define WHITE QColor(255,255,255)
#define BLACK QColor(0,0,0)
#define BLUE QColor(0,191,255)
#define VIOLET QColor(186,85,211)
#define ORANGE QColor(255,165,0)
#define TRANSPARENT QColor(0,0,0,0)
#define CARD_SIZE QSize(218,35)

And was able to build & run once I modified the /Users/Thibaud/Qt/5.5/clang_64/mkspecs/macx-clang/qmake.conf with QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10 here, yeah!

So after launching the app from the build dir (and move the HSCards folder to the build dir) I was able to start a new Arena from the menu (after having pick the Paladin in Hearthstone) but now I got that endlessly in the app log pane:

File: ERROR:Saving card image to disk. Make sure HSCards dir is in the same place as the exe.

I've updated the permissions on the build folder & the HSCardsfolder just in case but it doesn't fix it.
Any other ideas?

Thanks again!

PS: Should I launch the Hearthstone app in full screen?

@supertriodo
Copy link
Owner

Ok, great!

Did You choose hero in ArenaTracker for the draft and ArenaTracker helped you through the draft with hearthArena rankings?

If the answer is I chose the hero but ArenaTracker didn't help me with the drafting, then HSCards wasn't found. Try what I say in the rest of the message.
If the answer is I chose the hero and ArenaTracker helped me with the draft, then HSCards was found and there is some kind of weird problem with writting new files in that dir for the images of the cards.

That's a common error. It means the app cannot find HSCard dir that should be in the same place the executable is. But you already know this from what I have read in your comment.

If you run the app from qt creator the executable is run from a build dir (different from where the sources are). You have to make sure wherever the binary is the HSCards dir have to be. Try to find the binary. Checking your first screenshot I can see your build dir where the binary will be is:
USER/Downloads/build-ArenaTracker-Desktop_Qt_5_5_0_clang_64bits_release/
Move HSCards there.

Another thing to take into account: If you create a shortcut to the binary in your desktop then you will have to have an HSCards dir in your desktop too. To make things more clear HSCards have to be in the context from which the app was launched.

PS: You can launch hs in fullscreen or windowed as you wish. But if you choose fullscreen you won't be able to see ArenaTracker unless you have it in another monitor.

@thibaudgg
Copy link
Contributor Author

Did You choose hero in ArenaTracker for the draft and ArenaTracker helped you through the draft with hearthArena rankings?

I tried, but each time I got the same issue with the HSCards dir.

If you run the app from qt creator the executable is run from a build dir (different from where the sources are). You have to make sure wherever the binary is the HSCards dir have to be. Try to find the binary. Checking your first screenshot I can see your build dir where the binary will be is:
USER/Downloads/build-ArenaTracker-Desktop_Qt_5_5_0_clang_64bits_release/
Move HSCards there.

It's exactly what I did. I moved HSCards to the build folder and launched the ArenaTracker.app from there. But I still got the issue. :'(

My folder structure:

screen shot 2015-09-26 at 15 19 25

Would it be possible to check the presence of the folder and create it if not already present?
Any other ideas? 😄

Thanks, I think we're almost there!

@supertriodo
Copy link
Owner

I could create the dir but you should still have to move those 2 png files inside.

Try adding those 4 last lines to the first function of mainwindow.cpp so it looks like the following:

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent, Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint),
    ui(new Ui::MainWindow)
{
    QFontDatabase::addApplicationFont(":Fonts/hsFont.ttf");
    ui->setupUi(this);

    webUploader = NULL;//NULL indica que estamos leyendo el old log (primera lectura)
    atLogFile = NULL;
    isMainWindow = true;
    otherWindow = NULL;

    createLogFile();
    readSettings();
    completeUI();
    initCardsJson();

    createCardDownloader();
    createSecretsHandler();
    createDeckHandler();
    createDraftHandler();
    createEnemyHandHandler();
    createArenaHandler();
    createGameWatcher();
    createLogLoader();

    QFileInfo dir("./HSCards");
    if(!dir.isDir())        pLog("Settings: HSCards found on " + dir.absolutePath() + " is not a directory.");
    else if(dir.exists())   pLog("Settings: HSCards dir found on " + dir.absolutePath());
    else                    pLog("Settings: HSCards dir not found on " + dir.absolutePath() + " Move the directory there.");
}

I guess the code is pretty much self explanatory :)
It will add a message in log tab with the result and will show the absolute path where the dir should be found.
If the path is correct and HSCards is already there I can write more tests for writing image files.

P.S: Can you post the text of log tab after running the app?
P.S2: You don't need to play arena to test the app. If you have the last code (I commit it on 24 sept), it also works in constructed, tavern brawl or solo play.

@thibaudgg
Copy link
Contributor Author

Interesting, so I get: Settings: HSCards found on / is not a directory. and the message is the same if I have the directory or not in the app folder. It's weird as there's no HSCard found on / (not writable on OS X). Is the ./HSCards link cross-platform?

@supertriodo
Copy link
Owner

Try:

    QFileInfo dir("HSCards");

    if(!dir.isDir())        pLog("Settings: " + dir.absoluteFilePath() + " is not a directory.");
    else if(dir.exists())   pLog("Settings: HSCards dir found on " + dir.absoluteFilePath());
    else                    pLog("Settings: HSCards dir not found on " + dir.absoluteFilePath() + " Move the directory there.");

It will probably work.

@thibaudgg
Copy link
Contributor Author

Mmm still not Settings: /HSCards is not a directory., the full log:

File: ERROR:Creating Arena Tracker log on disk. Make sure HSCards dir is in the same place as the exe.
Settings: Path Player.log: /Users/Thibaud/Library/Logs/Unity/Player.log
Settings: Path log.config: /Users/Thibaud/Library/Preferences/Blizzard/Hearthstone/log.config
Log: Log found.
Settings: /HSCards is not a directory.
Log: New game.
Log: New game.
Log: New game.
Web: Arena mastery sign up success.

Maybe the application path need to set somewhere else?

@thibaudgg
Copy link
Contributor Author

If I create this dir on /HSCards I get Settings: HSCards dir found on /HSCards but if I try to launch an arena File: ERROR:Saving card image to disk. Make sure HSCards dir is in the same place as the exe.... so dir(...) seems to access the root folder (/), not what we want right?

@supertriodo
Copy link
Owner

The context where the app is run should be the directory where the .app is. But somehow, the context is the root folder. Let me ask google and search a little.

@supertriodo
Copy link
Owner

Try adding at the bottom:

pLog("Settings: Current path: " + QDir::currentPath());
pLog("Settings: Application path: " + QCoreApplication::applicationDirPath());

There seems to be a bug with some MAC versions
https://forum.qt.io/topic/33440/qdir-currentpath-osx-10-9-mavericks-bug/4

@thibaudgg
Copy link
Contributor Author

I get:

Settings: Current path: /
Settings: Application path: /Users/Thibaud/Downloads/build-ArenaTracker-Desktop_Qt_5_5_0_clang_64bit-Release/ArenaTracker.app/Contents/MacOS

So as mentioned in the forum, the following should return the dir of the App:

@QDir dir = QCoreApplication::applicationDirPath();
dir.cdUp();
dir.cdUp();

@supertriodo
Copy link
Owner

Yes. Well we did it XD.

Before I make the proper changes, try:

QDir dir = QCoreApplication::applicationDirPath();
dir.cdUp();
dir.cdUp();
dir.cdUp();
pLog("Settings: Application path: " +  dir.absolutePath());

I think we need 3 cdUps to get to the dir where the binary is.

I'll make the changes in the code and I will commit them. I'll tell you when is ready. Probably tomorrow.

@thibaudgg
Copy link
Contributor Author

Yup 3 ups seems to work: Settings: Application path: /Users/Thibaud/Downloads/build-ArenaTracker-Desktop_Qt_5_5_0_clang_64bit-Release.

PS: I just rename dir to dir2 as dir was already define as QFileInfo.

@supertriodo
Copy link
Owner

Ok, great, I'll tell you when the changes are done.

@supertriodo
Copy link
Owner

Done.
Download the latest code and see if everything works. (You will have to change the #define again).

@thibaudgg thibaudgg mentioned this issue Sep 27, 2015
@thibaudgg
Copy link
Contributor Author

@supertriodo awesome it works, I was able to do an Arena draft without entering manually each card name, awesome! 😍

PR open with all changes required!

@supertriodo
Copy link
Owner

Great, thanks for making the process easier for next mac users :)

If you find something you would like to see different or think of any nice feature for the app. Share it in ArenaTracker reddit or here.

Also if at some point you feel brave enough to make a static compilation in mac I'd add it to the releases.

Welcome aboard!

@ovidiusoft
Copy link

Anyone who successfully built on Mac cares to share the build?

@thibaudgg
Copy link
Contributor Author

@supertriodo
Copy link
Owner

I don't think that will work without making a static compiled binary with qt and opencv included.

I mean you still will have to compile it after installing opencv and qt.

@thibaudgg
Copy link
Contributor Author

@supertriodo

I tried to rebuild from master and I got the following error:

screen shot 2015-12-09 at 20 10 09

@supertriodo
Copy link
Owner

Strange we already solved the color macros problem...

@thibaudgg
Copy link
Contributor Author

@supertriodo yup :-/

@supertriodo
Copy link
Owner

Are you sure you have the latest code? I don't see that line in arenahandler.cpp:306

@supertriodo
Copy link
Owner

It's the exact same line as in the first screenshot you send me:

https://cloud.githubusercontent.com/assets/1322/10101329/578ae208-6398-11e5-9380-225a0f9bc12a.png

It seems like you are compiling a very old version that doesn't have the MACROS of color in deckcard.h fixed

@thibaudgg
Copy link
Contributor Author

@supertriodo correct, sorry my fork wasn't updated from this repo. Your master still works fine for me!

@supertriodo
Copy link
Owner

Great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants