chewing / chewing-editor

Cross platform chewing user phrase editor
https://chewing.im/
GNU General Public License v2.0
30 stars 52 forks source link

No qtchooser on OS X with homebrew for cmake #203

Closed chengchingwen closed 7 years ago

chengchingwen commented 7 years ago

What is your environment?

As the title, I know there is a qtchooser on macport, but not on homebrew.

Is it possible to have cmake without using qtchooser? or a specific build script for osx?

jserv commented 7 years ago

Don't say "as the title"! You should always explain what you were intended to do.

chengchingwen commented 7 years ago

I'm trying to build chewing-editor on osx, so I install qt5 and libchewing through homebrew. But when I run cmake . -DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.8.0_1, I got an error saying Cannot find qtchooser. then I try to install qtchooser through homebrew.

However, I realized there is no qtchooser on homebrew, only on macport.

It is more convenient to use homebrew instead of macport, so I'm wondering is it possible to have chewing-editor buildable without qtchooser so that I don't need to install macport.

jserv commented 7 years ago

I would like to ask for @david50407's help to clarify what @chengchingwen expected to address the exact problem.

david50407 commented 7 years ago

@chengchingwen, you can build qtchooser by your own here (source).

BTW, @jserv, qtchooser is not a part of qt5, as I know, we only support qt5 now, right? qtchooser provides option to select between qt development environments easily (like selecting between qt4 and qt5).

After this commit will break all macOS builds without qtchooser. But qtchooser is not essential (and not effective) in Homebrew environment, because Homebrew provided its own development and run-time environment isolation.

Maybe we can try to use qtchooser first, and we rollback to find qt-tools directly if there is no qtchooser?

jserv commented 7 years ago

Cc. @czchen

Per @david50407's analysis, I would like to think of conditional dependency of qtchooser. What is the impact to decouple qtchooser dependency from chewing-editor?

czchen commented 7 years ago

@jserv @david50407

Okay for me.

chengchingwen commented 7 years ago

@david50407 that qtchooser is unusable because it can not find the path of qt install by homebrew, so I modify the CMakeLists.txt removing the find_program for qtchooser and changing qtchooser to call the command directly

    add_custom_target("${TRANSLATION}-ts"
        #COMMAND ${QTCHOOSER} -run-tool=lupdate -qt=${QT_VERSION} -${PROJECT_SOURCE_DIR}/src -ts ${TS_FILE}
        COMMAND lupdate -${PROJECT_SOURCE_DIR}/src -ts ${TS_FILE}
        DEPENDS prepare_lupdate
    )
    add_dependencies(lupdate "${TRANSLATION}-ts")

    add_custom_command(
        OUTPUT
            ${QM_FILE}
        #COMMAND ${QTCHOOSER} -run-tool=lrelease -qt=${QT_VERSION} ${TS_FILE} -qm ${QM_FILE}
        COMMAND lrelease  ${TS_FILE} -qm ${QM_FILE}
        DEPENDS
            prepare_lrelease
            ${TS_FILE}
    )
    list(APPEND QM_FILES ${QM_FILE})
endforeach()

After this, the rest works well on mac

david50407 commented 7 years ago

@chengchingwen yes, I'm going to make qtchooser as optional dependency.

chengchingwen commented 7 years ago

@david50407 since that, maybe we can try to make chewing-editor available through homebrew.