Commit 59e1a5e1 authored by Bruno Coudoin's avatar Bruno Coudoin

build, add a WITH_DEMO_ONLY option

This option includes only the demo activities in the build.
parent 4d7f31da
......@@ -4,3 +4,5 @@ GCompris.pro.user
*.qrc
build/*
*.DS_Store
src/activities/activities_out.txt
po
......@@ -65,6 +65,7 @@ find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED
#endforeach()
option(WITH_ACTIVATION_CODE "Include the activation system" OFF)
option(WITH_DEMO_ONLY "Include only demo activities" OFF)
# Set output directory
if(CMAKE_HOST_APPLE)
......
......@@ -6,18 +6,26 @@ file(READ activities.txt ACTIVITIES)
# Split the output on a list containing each line
string(REGEX REPLACE ";" "\\\\;" ACTIVITIES "${ACTIVITIES}")
string(REGEX REPLACE "\n" ";" ACTIVITIES "${ACTIVITIES}")
file(REMOVE "activities_out.txt")
foreach(ACTIVITY ${ACTIVITIES})
# For each line found, we remove comments
string(FIND "${ACTIVITY}" "#" match)
if(${match})
file(STRINGS "${ACTIVITY}/ActivityInfo.qml" demoline REGEX "demo:[ ]+")
string(REGEX REPLACE ".*demo:.*(true|false).*" "\\1" demo "${demoline}" )
set(DEFAULT_MODE ON)
if((${WITH_DEMO_ONLY}) AND (${demo} STREQUAL "false"))
set(DEFAULT_MODE OFF)
endif()
# Set activities as options (enabled by default)
option("USE_${ACTIVITY}" "Enable ${ACTIVITY} activity" ON)
option("USE_${ACTIVITY}" "Enable ${ACTIVITY} activity" ${DEFAULT_MODE})
if(USE_${ACTIVITY})
# Add the directory for compilation
add_subdirectory(${ACTIVITY})
file(APPEND "activities_out.txt" "${ACTIVITY}\n")
endif(USE_${ACTIVITY})
endif(${match})
endforeach(ACTIVITY ${ACTIVITIES})
GCOMPRIS_ADD_RCC(activities activities.txt)
GCOMPRIS_ADD_RCC(activities activities_out.txt)
......@@ -220,7 +220,7 @@ QObject *ActivityInfoTree::menuTreeProvider(QQmlEngine *engine, QJSEngine *scrip
menuTree->setRootMenu(qobject_cast<ActivityInfo*>(objectRoot));
QFile file(":/gcompris/src/activities/activities.txt");
QFile file(":/gcompris/src/activities/activities_out.txt");
if(!file.open(QFile::ReadOnly)) {
qDebug() << "Failed to load the activity list";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment