Skip to content

Commit

Permalink
balancebox, add qml-box2d as git submodule and build target
Browse files Browse the repository at this point in the history
Most distributions don't provide a packaged qml-box2d 2.0.
Therefore and to simplify things we build the qml-box2d automatically
as external target and install it under lib/qml/.

Therefore also GCompris now searches also in the relative path
../lib/qml for its qml plugins on desktop.

For android we add the module correspondingly.

The git submodule for now points directly to the upstream repo on
github.
  • Loading branch information
hkaelber committed Oct 20, 2015
1 parent 3a63f3b commit fbe2ac1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "external/qml-box2d"]
path = external/qml-box2d
url = https://github.com/qml-box2d/qml-box2d
22 changes: 22 additions & 0 deletions CMakeLists.txt
Expand Up @@ -260,3 +260,25 @@ if(SAILFISHOS)
add_subdirectory(platforms/sailfishOS)
endif()

#
# external: qml-box2d
#

include(ExternalProject)

set (_box2d_install_dir ${CMAKE_CURRENT_BINARY_DIR}/lib/qml/Box2D.2.0)
set (_box2d_source_dir ${CMAKE_CURRENT_SOURCE_DIR}/external/qml-box2d)

ExternalProject_Add(qml_box2d
DOWNLOAD_COMMAND ""
SOURCE_DIR ${_box2d_source_dir}
CONFIGURE_COMMAND qmake ${_box2d_source_dir}/box2d.pro
BUILD_COMMAND make
INSTALL_DIR ${_box2d_install_dir}
INSTALL_COMMAND cp libBox2D.so ${_box2d_source_dir}/qmldir ${_box2d_install_dir}
)

add_library(qml-box2d SHARED IMPORTED)
set_target_properties(qml-box2d PROPERTIES IMPORTED_LOCATION ${_box2d_install_dir}/libBox2D.so)

install(DIRECTORY ${_box2d_install_dir} DESTINATION lib/qml)
3 changes: 2 additions & 1 deletion android/configAndroid.json.cmake
Expand Up @@ -10,5 +10,6 @@
"target-architecture": "@ARM_TARGET@",
"application-binary": "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@libGCompris.so",
"android-package-source-directory": "@PACKAGE_SOURCE_ANDROID@/",
"android-package": "net.gcompris"
"android-package": "net.gcompris",
"android-extra-plugins": "@CMAKE_BINARY_DIR@/lib/qml"
}
1 change: 1 addition & 0 deletions external/qml-box2d
Submodule qml-box2d added at 130885
3 changes: 3 additions & 0 deletions src/core/main.cpp
Expand Up @@ -228,6 +228,9 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine(QUrl("qrc:/gcompris/src/core/main.qml"));
QObject::connect(&engine, SIGNAL(quit()), DownloadManager::getInstance(),
SLOT(shutdown()));
// add import path for shipped qml modules:
engine.addImportPath(QStringLiteral("%1/../lib/qml")
.arg(QCoreApplication::applicationDirPath()));

if(parser.isSet(exportActivitiesAsSQL)) {
ActivityInfoTree *menuTree(qobject_cast<ActivityInfoTree*>(ActivityInfoTree::menuTreeProvider(&engine, NULL)));
Expand Down

0 comments on commit fbe2ac1

Please sign in to comment.