diff --git a/src/projectM-engine/CMakeLists.txt b/src/projectM-engine/CMakeLists.txt index e027c0891..f9f719a27 100644 --- a/src/projectM-engine/CMakeLists.txt +++ b/src/projectM-engine/CMakeLists.txt @@ -38,7 +38,7 @@ FILE(GLOB presets "presets/*.milk" "presets/*.prjm" "presets/*.tga") INSTALL(FILES ${presets} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/projectM/presets) FILE(GLOB fonts "fonts/*.ttf") INSTALL(FILES ${fonts} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/projectM/fonts) -INSTALL(FILES "${CMAKE_BINARY_DIR}/libprojectM.pc" DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig) +INSTALL(FILES "${CMAKE_BINARY_DIR}/libprojectM.pc" DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig) INSTALL(FILES config.inp DESTINATION ${CMAKE_INSTALL_PREFIX}/share/projectM) INSTALL(FILES projectM.hpp event.h dlldefs.h fatal.h PresetFrameIO.hpp PCM.hpp DESTINATION include/libprojectM) INSTALL(TARGETS projectM DESTINATION lib) diff --git a/src/projectM-test/CMakeLists.txt b/src/projectM-test/CMakeLists.txt index 4ad90d989..ccbaab743 100644 --- a/src/projectM-test/CMakeLists.txt +++ b/src/projectM-test/CMakeLists.txt @@ -21,4 +21,4 @@ TARGET_LINK_LIBRARIES(projectM-test projectM ${SDL_LIBRARY} ${GTK_LIBRARIES}) TARGET_LINK_LIBRARIES(projectM-test-memleak projectM ${SDL_LIBRARY} ${GTK_LIBRARIES}) TARGET_LINK_LIBRARIES(projectM-test-texture projectM ${SDL_LIBRARY} ${GTK_LIBRARIES}) -#INSTALL(TARGETS projectM-test DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/xmms/Visualization ) +#INSTALL(TARGETS projectM-test DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/xmms/Visualization ) diff --git a/src/projectM-xmms/CMakeLists.txt b/src/projectM-xmms/CMakeLists.txt index b36c8b868..61f92d692 100644 --- a/src/projectM-xmms/CMakeLists.txt +++ b/src/projectM-xmms/CMakeLists.txt @@ -16,4 +16,4 @@ LINK_DIRECTORIES(${PROJECTM_LDFLAGS}) TARGET_LINK_LIBRARIES(xmms_projectM projectM ${SDL_LIBRARY} ${GTK_LIBRARIES}) -INSTALL(TARGETS xmms_projectM DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/xmms/Visualization ) \ No newline at end of file +INSTALL(TARGETS xmms_projectM DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/xmms/Visualization ) \ No newline at end of file diff --git a/src/qprojectM-xmms/CMakeLists.txt b/src/qprojectM-xmms/CMakeLists.txt index e7430eb50..257e1c439 100644 --- a/src/qprojectM-xmms/CMakeLists.txt +++ b/src/qprojectM-xmms/CMakeLists.txt @@ -22,4 +22,4 @@ ADD_LIBRARY(qprojectM-xmms SHARED main.cpp ConfigFile.h ConfigFile.cpp) TARGET_LINK_LIBRARIES(qprojectM-xmms qprojectM projectM ${GTK_LIBRARIES} ${QT_QTGUI_LIBRARIES} ${QT_QTOPENGL_LIBRARIES} ${QT_LIBRARIES}) -INSTALL(TARGETS qprojectM-xmms DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/xmms/Visualization ) \ No newline at end of file +INSTALL(TARGETS qprojectM-xmms DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/xmms/Visualization ) \ No newline at end of file diff --git a/src/qprojectM-xmms/main.cpp b/src/qprojectM-xmms/main.cpp index 32a480283..dba49a77e 100755 --- a/src/qprojectM-xmms/main.cpp +++ b/src/qprojectM-xmms/main.cpp @@ -28,8 +28,10 @@ www.gamedev.net/reference/programming/features/beatdetection/ #include #include +#include #include #include +#include #include #include #include @@ -56,7 +58,8 @@ extern "C" void projectM_playback_stop(void); extern "C" void projectM_render_pcm(gint16 pcm_data[2][512]); extern "C" void projectM_render_freq(gint16 pcm_data[2][256]); extern "C" VisPlugin *get_vplugin_info(); -void *worker(void *); +//void *worker(void *); +int worker(); std::string read_config(); void saveSnapshotToFile(); //extern preset_t * active_preset; @@ -153,22 +156,48 @@ QProjectM_MainWindow *mainWindow; int retval; pthread_t thread; +pid_t pID; + extern "C" void projectM_xmms_init(void) { - retval = pthread_create( &thread, NULL, worker, NULL); + // retval = pthread_create( &thread, NULL, worker, NULL); + + pID = clone(); + if (pID == 0) // child + { + // Code only executed by child process + + worker(); + exit(1); + } + else if (pID < 0) // failed to fork + { + std::cerr << "Failed to fork" << std::endl; + exit(1); + // Throw exception + } + else // parent + { + // Code only executed by parent process + + + } + + } bool initialized = false; -void *worker(void *) +int worker() +//void *worker(void *) { int argc; char **argv; argc = 0; // Start a new qapplication - //QApplication app(argc,argv); - app = new QApplication(argc,argv); + QApplication app(argc,argv); + //app = new QApplication(argc,argv); std::string config_file; config_file = read_config(); @@ -177,7 +206,7 @@ void *worker(void *) globalPM = mainWindow->getQProjectM(); initialized = true; - app->exec(); + return app.exec(); } @@ -186,12 +215,12 @@ extern "C" void projectM_cleanup(void) { initialized = false; mainWindow->close(); ; - pthread_join(thread, NULL); + //pthread_join(thread, NULL); - delete(mainWindow); - mainWindow = NULL; - delete(app); - app = NULL; + // delete(mainWindow); + // mainWindow = NULL; + // delete(app); + // app = NULL; // printf("projectM plugin: Cleanup completed\n"); }