Skip to content

How to build with CMake on macOS? #1555

Closed

Description

@tiendq

I just tried to build this project on macOS for the first time, I found there are different ways to build for different OSes e.g I saw both cmake, qmake, and make.

I tried make a build folder and use CMake (on macOS) but it didn't work (it didn't find Qt5.make), while it's instructed way for Ubuntu Linux. How can I use CMake on macOS? or better for building on all supported OSes?

Thanks,

Activity

  1. justinclift commented on Oct 3, 2018

    @justinclift
    Member

    As a thought, have you seen the macOS/OSX section of BUILDING.md?

    In theory, the instructions there should work cut-n-paste style.

    It's been a fair while since I've personally tried them out though, so there's a chance they may need a bit of tweaking/updating to get current (not sure).

  2. justinclift commented on Oct 3, 2018

    @justinclift
    Member

    If you really want CMake on OSX it should work, but there might be some environment variables that need setting first.

  3. tiendq commented on Oct 3, 2018

    @tiendq
    ContributorAuthor

    @justinclift I did, if not how I know it uses qmake.

  4. tiendq commented on Oct 4, 2018

    @tiendq
    ContributorAuthor

    I got same build issue at raised in #1439, QScintilla is rebuilt even it existed (via brew install qscintilla2). Build errors are naming issues between qsciscintillabase.h and Scintilla.h, identifiers used in an enum also defined with #define, for example:

    /GitHub/sqlitebrowser/libs/qscintilla/Qt4Qt5/Qsci/qsciscintillabase.h:70:9: error: expected identifier
            SCI_START = 2000,
            ^
    /GitHub/sqlitebrowser/libs/qscintilla/Qt4Qt5/../include/Scintilla.h:48:19: note: expanded from macro 'SCI_START'
    #define SCI_START 2000
    

    My system is macOS 10.12.6 and clang-900.0.39.2

  5. justinclift commented on Oct 4, 2018

    @justinclift
    Member

    Ouch. This isn't something I can help with personally, so hopefully one of our other Community members has the time/interest to investigate. 😄

  6. MKleusberg commented on Dec 2, 2018

    @MKleusberg
    Member

    @tiendq This problem should be finally solved now. Compiling should work fine with cmake when using the latest DB4S version from our master branch. I'm going to close this issue then. If you should still have any problems with this, even with the latest version, you can always reopen this issue 😄

  7. MKleusberg commented on Dec 2, 2018

    @MKleusberg
    Member

    Oh, just saw that you were already informed in issue #1439 😉

  8. tiendq commented on Dec 3, 2018

    @tiendq
    ContributorAuthor

    @MKleusberg I could build with CMake now, but there are still 2 issues:

    1. Qt path need to be supplied in CMake command, it should be added in the building instruction.
    mkdir build
    cd build
    cmake -DCMAKE_PREFIX_PATH=/usr/local/opt/qt/lib/cmake ..
    make
    1. CMake build only created output file build/sqlitebrowser (though it works well) but no build/src/DB Browser for SQLite.app like using qmake

    I also want to know if I could use qscintilla2 installed by brew instead of building its source in libs.

  9. justinclift commented on Dec 3, 2018

    @justinclift
    Member

    @tiendq With that "Qt path need to be supplied in CMake command ...", is the example cmake -DCMAKE ... line definitely correct?

    Asking because it has cmake inside what looks like a Qt installation. Should it be qmake (the Qt alternative to CMake) instead? 😄

  10. tiendq commented on Dec 3, 2018

    @tiendq
    ContributorAuthor

    @justinclift Yes, I copied it from terminal :). Qt was installed by brew and the path actually has many folders inside, they contains .cmake files for each Qt components.

  11. justinclift commented on Dec 3, 2018

    @justinclift
    Member

    No worries. 😄

    We have a (very old, slow) mac mini used as our nightly build server. In theory I should be able to investigate this in depth using that, then update our docs as appropriate.

    It won't be this week though, as my schedule has become rather full very quickly. And it's just the start of the week! 😖

  12. MKleusberg commented on Dec 4, 2018

    @MKleusberg
    Member

    @tiendq I'll leave this to @justinclift since I don't have access to a Mac to try this out myself. As for the qscintilla question: it actually should prefer the system installation of qscintilla over the version we include in our repository - so in theory it should just work. If it doesn't that means we may need to adjust the HINTS lines in the cmake/FindQScintilla.cmake file to include the path brew uses.

  13. tiendq commented on Dec 4, 2018

    @tiendq
    ContributorAuthor

    @MKleusberg Providing path information (as I did) is actually the way it needs to work with Qt on macOS (see this). I would make a PR for this small change in docs. Regarding qscintilla, if it's what you prefer I'd find to make it work with system installation too.

  14. MKleusberg commented on Dec 5, 2018

    @MKleusberg
    Member

    Thanks, @tiendq! A PR for that would be awesome 😄 With the qscintilla library, any way to make it work with the system installation is welcomed, be it automatically or via a command line parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions