Added files and scripts to enable Launchpad.net package building
This commit is contained in:
committed by
Bertrand Songis
parent
d9c95f97d7
commit
0e906162e1
@@ -1,8 +1,16 @@
|
||||
set(SIMULATOR_INSTALL_PREFIX "" CACHE STRING "Alternative simulator library search path")
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(C9X_NAME_SUFFIX ${VERSION_MAJOR}${VERSION_MINOR})
|
||||
set(COMPANION_NAME "companion${C9X_NAME_SUFFIX}")
|
||||
set(SIMULATOR_NAME "simulator${C9X_NAME_SUFFIX}")
|
||||
set(SIMULATOR_LIB_PATH ${CMAKE_INSTALL_PREFIX}/lib/companion${C9X_NAME_SUFFIX})
|
||||
if (NOT ${SIMULATOR_INSTALL_PREFIX} STREQUAL "")
|
||||
set(SIMULATOR_LIB_PATH ${SIMULATOR_INSTALL_PREFIX}/lib/companion${C9X_NAME_SUFFIX})
|
||||
else()
|
||||
set(SIMULATOR_LIB_PATH ${CMAKE_INSTALL_PREFIX}/lib/companion${C9X_NAME_SUFFIX})
|
||||
endif()
|
||||
message(STATUS "Simulators library search path: " ${SIMULATOR_LIB_PATH})
|
||||
set(SIMULATOR_LIB_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/companion${C9X_NAME_SUFFIX})
|
||||
else(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(COMPANION_NAME "companion")
|
||||
set(SIMULATOR_NAME "simulator")
|
||||
@@ -318,7 +326,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
message(STATUS "install " ${CMAKE_BINARY_DIR} " to " ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
install(TARGETS ${COMPANION_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
install(TARGETS ${SIMULATOR_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
install(FILES ${simulator_plugins} DESTINATION "${SIMULATOR_LIB_PATH}")
|
||||
install(FILES ${simulator_plugins} DESTINATION "${SIMULATOR_LIB_INSTALL_PATH}")
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/companion.desktop DESTINATION share/applications RENAME companion${C9X_NAME_SUFFIX}.desktop)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/simulator.desktop DESTINATION share/applications RENAME simulator${C9X_NAME_SUFFIX}.desktop)
|
||||
if(${CMAKE_INSTALL_PREFIX} MATCHES "/usr/local")
|
||||
|
||||
@@ -32,30 +32,25 @@
|
||||
|
||||
QMap<QString, SimulatorFactory *> registered_simulators;
|
||||
|
||||
void registerSimulatorFactory(SimulatorFactory *factory)
|
||||
{
|
||||
qDebug() << "registering" << factory->name() << "simulator";
|
||||
registered_simulators[factory->name()] = factory;
|
||||
}
|
||||
|
||||
void registerSimulator(const QString &filename)
|
||||
void registerSimulator(const QString & filename)
|
||||
{
|
||||
QLibrary lib(filename);
|
||||
typedef SimulatorFactory * (*RegisterSimulator)();
|
||||
RegisterSimulator registerSimulator = (RegisterSimulator)lib.resolve("registerSimu");
|
||||
if (registerSimulator) {
|
||||
SimulatorFactory * factory = registerSimulator();
|
||||
registerSimulatorFactory(factory);
|
||||
qDebug() << "trying to register simulator in " << filename;
|
||||
RegisterSimulator registerFunc = (RegisterSimulator)lib.resolve("registerSimu");
|
||||
if (registerFunc) {
|
||||
SimulatorFactory * factory = registerFunc();
|
||||
registered_simulators[factory->name()] = factory;
|
||||
qDebug() << "Registered" << factory->name() << "simulator";
|
||||
}
|
||||
else {
|
||||
qWarning() << "Library error" << filename << lib.errorString();
|
||||
}
|
||||
}
|
||||
|
||||
void registerSimulators()
|
||||
int registerSimulators(const QDir & dir)
|
||||
{
|
||||
bool simulatorsFound = false;
|
||||
QDir dir(".");
|
||||
int noSimulatorsFound = 0;
|
||||
QStringList filters;
|
||||
#if defined(__APPLE__)
|
||||
filters << "*-simulator.dylib";
|
||||
@@ -65,28 +60,34 @@ void registerSimulators()
|
||||
filters << "*-simulator.so";
|
||||
#endif
|
||||
|
||||
qDebug() << "Searching for simulators in" << dir.path();
|
||||
foreach(QString filename, dir.entryList(filters, QDir::Files)) {
|
||||
registerSimulator(filename.prepend("./"));
|
||||
simulatorsFound = true;
|
||||
QString libraryFilename = dir.path() + "/" + filename;
|
||||
registerSimulator(libraryFilename);
|
||||
noSimulatorsFound++;
|
||||
}
|
||||
return noSimulatorsFound;
|
||||
}
|
||||
|
||||
void registerSimulators()
|
||||
{
|
||||
QDir dir(".");
|
||||
if (registerSimulators(dir)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!simulatorsFound) {
|
||||
#if defined(__APPLE__)
|
||||
dir = QLibraryInfo::location(QLibraryInfo::PrefixPath) + "/Resources";
|
||||
#elif (!defined __GNUC__)
|
||||
char name[MAX_PATH];
|
||||
GetModuleFileName(NULL, name, MAX_PATH);
|
||||
QString path(name);
|
||||
path.truncate(path.lastIndexOf('\\'));
|
||||
dir.setPath(path);
|
||||
dir = QLibraryInfo::location(QLibraryInfo::PrefixPath) + "/Resources";
|
||||
#elif (!defined __GNUC__)
|
||||
char name[MAX_PATH];
|
||||
GetModuleFileName(NULL, name, MAX_PATH);
|
||||
QString path(name);
|
||||
path.truncate(path.lastIndexOf('\\'));
|
||||
dir.setPath(path);
|
||||
#else
|
||||
dir = SIMULATOR_LIB_SEARCH_PATH;
|
||||
dir = SIMULATOR_LIB_SEARCH_PATH;
|
||||
#endif
|
||||
foreach(QString filename, dir.entryList(filters, QDir::Files)) {
|
||||
registerSimulator(filename.prepend(dir.path() + "/"));
|
||||
simulatorsFound = true;
|
||||
}
|
||||
}
|
||||
registerSimulators(dir);
|
||||
}
|
||||
|
||||
SimulatorFactory * getSimulatorFactory(const QString & name)
|
||||
|
||||
Reference in New Issue
Block a user