mac bundle support for the config file and its path references

git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@1019 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
w1z7ard
2008-05-22 23:15:01 +00:00
parent 6332d446d0
commit 57ea251d39
8 changed files with 43 additions and 52 deletions

View File

@ -12,7 +12,6 @@ OPTION (USE_NATIVE_GLEW "Use projectM's native implemention of GLEW." OFF)
#OPTION (FTGL_STATIC "Build the projectM target library in the platform's native static (NOT shared) format." OFF)
OPTION (BUILD_PROJECTM_STATIC "Build the projectM target library in the platform's native static (NOT shared) format." OFF)
SET(SOIL_SOURCES image_DXT.c image_helper.c SOIL.c stb_image_aug.c)
if (USE_NATIVE_GLEW)
@ -58,10 +57,13 @@ SET_TARGET_PROPERTIES(projectM PROPERTIES VERSION 2.00 SOVERSION 2)
if (APPLE)
ADD_DEFINITIONS(-DMACOS -DSTBI_NO_DDS -DUSE_THREADS)
set(RESOURCE_PREFIX "Resources")
else (APPLE)
if (WIN32)
set (RESOURCE_PREFIX "Resources")
ADD_DEFINITIONS(-DWIN32 -DSTBI_NO_DDS -DUSE_THREADS)
else(WIN32)
set (RESOURCE_PREFIX "share/projectM")
ADD_DEFINITIONS(-DLINUX -DSTBI_NO_DDS -DUSE_THREADS)
endif(WIN32)
endif(APPLE)

View File

@ -16,7 +16,7 @@ Easter Egg Parameter = 1
Hard Cut Sensitivity = 10 # Lower to make hard cuts more frequent
Aspect Correction = true # Custom Shape Aspect Correction
Preset Path = @CMAKE_INSTALL_PREFIX@/share/projectM/presets #preset location
Title Font = @CMAKE_INSTALL_PREFIX@/share/projectM/fonts/Vera.ttf
Menu Font = @CMAKE_INSTALL_PREFIX@/share/projectM/fonts/VeraMono.ttf
Preset Path = @CMAKE_INSTALL_PREFIX@/@RESOURCE_PREFIX@/presets # preset location
Title Font = @CMAKE_INSTALL_PREFIX@/@RESOURCE_PREFIX@/fonts/Vera.ttf
Menu Font = @CMAKE_INSTALL_PREFIX@/@RESOURCE_PREFIX@/fonts/VeraMono.ttf

View File

@ -2,8 +2,8 @@ prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_PREFIX@/lib
includedir=@CMAKE_INSTALL_PREFIX@/include
pkgdatadir=@CMAKE_INSTALL_PREFIX@/share/projectM
sysconfdir=@CMAKE_INSTALL_PREFIX@/share/projectM
pkgdatadir=@CMAKE_INSTALL_PREFIX@/@RESOURCE_PREFIX@
sysconfdir=@CMAKE_INSTALL_PREFIX@/@RESOURCE_PREFIX@
Name: libprojectM
Version: 1.10

View File

@ -163,6 +163,7 @@ bool projectM::writeConfig(const std::string & configFile, const Settings & sett
void projectM::readConfig (const std::string & configFile )
{
std::cout << "configFile: " << configFile << std::endl;
ConfigFile config ( configFile );
_settings.meshX = config.read<int> ( "Mesh X", 32 );
_settings.meshY = config.read<int> ( "Mesh Y", 24 );

View File

@ -19,6 +19,12 @@ else(${CMAKE_PROJECT_NAME} MATCHES ${PROJECT_NAME})
ADD_DEFINITIONS(-DLINUX -DPROJECTM_PREFIX='"${CMAKE_INSTALL_PREFIX}"')
endif(${CMAKE_PROJECT_NAME} MATCHES ${PROJECT_NAME})
if (APPLE)
ADD_DEFINITIONS(-DRESOURCE_PREFIX='"Resources"')
else (APPLE)
ADD_DEFINITIONS(-DRESOURCE_PREFIX='"share/projectM"')
endif (APPLE)
FIND_PACKAGE(OpenGL)
FIND_PACKAGE(Qt4 REQUIRED)

View File

@ -1,6 +1,7 @@
#!/bin/sh
### make_bund.sh A simple script to create a mac bundle ####
### Author: Carmelo Piccione (carmelo.piccione+projectM@gmail.com) ###
### make_bundle-no-qt.sh A simple script to create a mac bundle without qt
### included in the bundle (depends on standard framework paths instead)
### Author: Carmelo Piccione (carmelo.piccione+projectM@gmail.com)
# Path to installed qt framework on your machine
PATH_TO_QT=/Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks/
@ -22,44 +23,20 @@ mkdir ${APP}/Contents
mkdir ${APP}/Contents/Frameworks
mkdir ${APP}/Contents/Plugins
mkdir ${APP}/Contents/MacOs
mkdir ${APP}/Contents/Resources
mkdir ${APP}/Contents/Resources/fonts
mkdir ${APP}/Contents/Resources/presets
cp projectM-jack ${APP}/Contents/MAcOs/
cp projectM-jack ${APP}/Contents/MacOs/
cp -f ${PROJECTM_QT_BUILD_PATH} ${APP}/Contents/Plugins/libprojectM-qt.dylib
## [2] Copy each qt framework into the bundle
#cp -Rf ${PATH_TO_QT}/QtCore.framework ${APP}/Contents/Frameworks
#cp -Rf ${PATH_TO_QT}/QtGui.framework ${APP}/Contents/Frameworks
#cp -Rf ${PATH_TO_QT}/QtXml.framework ${APP}/Contents/Frameworks
#cp -Rf ${PATH_TO_QT}/QtOpenGL.framework ${APP}/Contents/Frameworks
cp -Rf ../../fonts/*.ttf ${APP}/Contents/Resources/fonts
cp -Rf ../../presets_projectM/*.prjm ${APP}/Contents/Resources/presets
cp -Rf ../../presets_projectM/*.milk ${APP}/Contents/Resources/presets
cp -f ${BUILD_PATH}/projectM-engine/config.inp ${APP}/Contents/Resources
## [3] Change id of each qt framework to specialized one for this bundle
#install_name_tool -id @executable_path/../Frameworks/QtCore.framework/Versions/${QT_VERSION}/QtCore ${APP}/Contents/Frameworks/QtCore.framework/Versions/${QT_VERSION}/QtCore
#install_name_tool -id @executable_path/../Frameworks/QtGui.framework/Versions/${QT_VERSION}/QtGui ${APP}/Contents/Frameworks/QtGui.framework/Versions/${QT_VERSION}/QtGui
#install_name_tool -id @executable_path/../Frameworks/QtXml.framework/Versions/${QT_VERSION}/QtXml ${APP}/Contents/Frameworks/QtXml.framework/Versions/${QT_VERSION}/QtXml
#install_name_tool -id @executable_path/../Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL ${APP}/Contents/Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL
install_name_tool -id @executable_path/../Plugins/libprojectM-qt.dylib ${APP}/Contents/Plugins/libprojectM-qt.dylib
## [4] Change reference ids in projectM-jack to the local referred to id's
#install_name_tool -change QtCore.framework/Versions/${QT_VERSION}/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/${QT_VERSION}/QtCore ${APP}/Contents/MacOs/projectM-jack
#install_name_tool -change QtGui.framework/Versions/${QT_VERSION}/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/${QT_VERSION}/QtGui ${APP}/Contents/MacOs/projectM-jack
#install_name_tool -change QtXml.framework/Versions/${QT_VERSION}/QtXml @executable_path/../Frameworks/QtXml.framework/Versions/${QT_VERSION}/QtXml ${APP}/Contents/MacOs/projectM-jack
#install_name_tool -change QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL @executable_path/../Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL ${APP}/Contents/MacOs/projectM-jack
install_name_tool -change ${PROJECTM_QT_BUILD_PATH} @executable_path/../Plugins/libprojectM-qt.dylib ${APP}/Contents/MacOs/projectM-jack
# [4b] Change projectM-qt library reference to bundle version
## [5] Change references from one qt lib to another qt lib from system to local
#install_name_tool -change QtCore.framework/Versions/${QT_VERSION}/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/${QT_VERSION}/QtCore ${APP}/Contents/Frameworks/QtGui.framework/Versions/${QT_VERSION}/QtGui
#install_name_tool -change QtCore.framework/Versions/${QT_VERSION}/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/${QT_VERSION}/QtCore ${APP}/Contents/Frameworks/QtXml.framework/Versions/${QT_VERSION}/QtXml
#install_name_tool -change QtCore.framework/Versions/${QT_VERSION}/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/${QT_VERSION}/QtCore ${APP}/Contents/Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL
#install_name_tool -change QtGui.framework/Versions/${QT_VERSION}/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/${QT_VERSION}/QtGui ${APP}/Contents/Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL
#install_name_tool -change QtCore.framework/Versions/${QT_VERSION}/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/${QT_VERSION}/QtCore ${APP}/Contents/Plugins/libprojectM-qt.dylib
#install_name_tool -change QtGui.framework/Versions/${QT_VERSION}/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/${QT_VERSION}/QtGui ${APP}/Contents/Plugins/libprojectM-qt.dylib
#install_name_tool -change QtXml.framework/Versions/${QT_VERSION}/QtXml @executable_path/../Frameworks/QtXml.framework/Versions/${QT_VERSION}/QtXml ${APP}/Contents/Plugins/libprojectM-qt.dylib
#install_name_tool -change QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL @executable_path/../Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL ${APP}/Contents/Plugins/libprojectM-qt.dylib

View File

@ -24,7 +24,7 @@ mkdir ${APP}/Contents/Plugins
mkdir ${APP}/Contents/MacOs
cp projectM-jack ${APP}/Contents/MAcOs/
cp -f ${PROJECTM_QT_BUILD_PATH} ${APP}/Contents/Plugins/projectM-qt
cp -f ${PROJECTM_QT_BUILD_PATH} ${APP}/Contents/Plugins/libprojectM-qt.dylib
## [2] Copy each qt framework into the bundle
cp -Rf ${PATH_TO_QT}/QtCore.framework ${APP}/Contents/Frameworks
@ -41,7 +41,7 @@ install_name_tool -id @executable_path/../Frameworks/QtGui.framework/Versions/${
install_name_tool -id @executable_path/../Frameworks/QtXml.framework/Versions/${QT_VERSION}/QtXml ${APP}/Contents/Frameworks/QtXml.framework/Versions/${QT_VERSION}/QtXml
install_name_tool -id @executable_path/../Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL ${APP}/Contents/Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL
install_name_tool -id @executable_path/../Plugins/projectM-qt ${APP}/Contents/Plugins/projectM-qt
install_name_tool -id @executable_path/../Plugins/libprojectM-qt.dylib ${APP}/Contents/Plugins/libprojectM-qt.dylib
## [4] Change reference ids in projectM-jack to the local referred to id's
@ -53,7 +53,7 @@ install_name_tool -change QtXml.framework/Versions/${QT_VERSION}/QtXml @executab
install_name_tool -change QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL @executable_path/../Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL ${APP}/Contents/MacOs/projectM-jack
install_name_tool -change ${PROJECTM_QT_BUILD_PATH} @executable_path/../Plugins/projectM-qt ${APP}/Contents/MacOs/projectM-jack
install_name_tool -change ${PROJECTM_QT_BUILD_PATH} @executable_path/../Plugins/libprojectM-qt.dylib ${APP}/Contents/MacOs/projectM-jack
# [4b] Change projectM-qt library reference to bundle version
@ -64,7 +64,7 @@ install_name_tool -change QtCore.framework/Versions/${QT_VERSION}/QtCore @execut
install_name_tool -change QtCore.framework/Versions/${QT_VERSION}/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/${QT_VERSION}/QtCore ${APP}/Contents/Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL
install_name_tool -change QtGui.framework/Versions/${QT_VERSION}/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/${QT_VERSION}/QtGui ${APP}/Contents/Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL
install_name_tool -change QtCore.framework/Versions/${QT_VERSION}/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/${QT_VERSION}/QtCore ${APP}/Contents/Plugins/projectM-qt
install_name_tool -change QtGui.framework/Versions/${QT_VERSION}/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/${QT_VERSION}/QtGui ${APP}/Contents/Plugins/projectM-qt
install_name_tool -change QtXml.framework/Versions/${QT_VERSION}/QtXml @executable_path/../Frameworks/QtXml.framework/Versions/${QT_VERSION}/QtXml ${APP}/Contents/Plugins/projectM-qt
install_name_tool -change QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL @executable_path/../Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL ${APP}/Contents/Plugins/projectM-qt
install_name_tool -change QtCore.framework/Versions/${QT_VERSION}/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/${QT_VERSION}/QtCore ${APP}/Contents/Plugins/libprojectM-qt.dylib
install_name_tool -change QtGui.framework/Versions/${QT_VERSION}/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/${QT_VERSION}/QtGui ${APP}/Contents/Plugins/libprojectM-qt.dylib
install_name_tool -change QtXml.framework/Versions/${QT_VERSION}/QtXml @executable_path/../Frameworks/QtXml.framework/Versions/${QT_VERSION}/QtXml ${APP}/Contents/Plugins/libprojectM-qt.dylib
install_name_tool -change QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL @executable_path/../Frameworks/QtOpenGL.framework/Versions/${QT_VERSION}/QtOpenGL ${APP}/Contents/Plugins/libprojectM-qt.dylib

View File

@ -33,7 +33,7 @@
#include <sys/stat.h> // for mkdir
#include <jack/jack.h>
#define CONFIG_FILE "/share/projectM/config.inp"
#define QPROJECTM_JACK_CONFIG_FILE "/config.inp"
std::string read_config();
@ -67,7 +67,7 @@ std::string read_config()
{
int n;
char num[512];
FILE *in;
FILE *out;
@ -76,9 +76,14 @@ std::string read_config()
char projectM_home[1024];
char projectM_config[1024];
int len;
strcpy(projectM_config, PROJECTM_PREFIX);
strcpy(projectM_config+strlen(PROJECTM_PREFIX), CONFIG_FILE);
projectM_config[strlen(PROJECTM_PREFIX)+strlen(CONFIG_FILE)]='\0';
strcpy(projectM_config + (len = strlen(PROJECTM_PREFIX)), "/");
strcpy(projectM_config+(len += strlen("/")), RESOURCE_PREFIX);
strcpy(projectM_config+(len += strlen(RESOURCE_PREFIX)), QPROJECTM_JACK_CONFIG_FILE);
projectM_config[len += strlen(QPROJECTM_JACK_CONFIG_FILE)]='\0';
printf("dir:%s \n",projectM_config);
home=getenv("HOME");
strcpy(projectM_home, home);