Skip to content

Commit

Permalink
Linux fixed, background is gray but otherwise works
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyyrylainen committed Mar 12, 2016
1 parent 1e479ff commit 902a53a
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 36 deletions.
13 changes: 10 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Asset directory
assets/*
# We want certain xmls though
!assets/definitions/
!assets/definitions/*.xml

# asset symlinks
/cegui_examples
/definitions
/fonts
/gui
/materials
/models
/sounds
/videos

# Website directory

Expand Down
34 changes: 31 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ include(utils)
# Search path for dynamic libraries at runtime. Only relevant for Linux.
set(CMAKE_INSTALL_RPATH ".")

# Makes sure that the RPATH is always the install path. Required for linux
# redistributable
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# Assure a proper build type
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE
Expand Down Expand Up @@ -82,8 +87,8 @@ set(OGRE_PLUGINS
# Plugin_BSPSceneManager
# Plugin_OctreeSceneManager
# Plugin_OctreeZone
Plugin_ParticleFX
Plugin_CgProgramManager
#Plugin_ParticleFX
#Plugin_CgProgramManager
# Plugin_PCZSceneManager
RenderSystem_GL
)
Expand Down Expand Up @@ -268,7 +273,8 @@ if(WIN32)
)
else()
target_link_libraries(ThriveLib
${AVRESAMPLE_LIBRARIES}
${AVRESAMPLE_LIBRARIES}
${SWRESAMPLE_LIBRARIES}
)
endif()

Expand Down Expand Up @@ -666,3 +672,25 @@ add_custom_target(zip
DEPENDS Thrive
)

###############################################################################
# Linux package
###############################################################################

if(UNIX)

file(READ "thriveversion.ver" THRIVE_VERSION)
set(LINUX_LIBRARIES "${cAudio_LIBRARIES}" "${BULLET_LIBRARIES}" "${AVRESAMPLE_LIBRARIES}"
"${SWRESAMPLE_LIBRARIES}" "${OgreFFMPEG_LIBRARIES}" "${FFMPEG_LIBRARIES}" "${Boost_LIBRARIES}"
"${OGRE_LIBRARIES}" "${OIS_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}" "${BULLET_LIBRARIES}"
"${CEGUI_LIBRARY}" "${TINYXML_LIBRARIES}" "${OpenAL_LIBRARIES}")

configure_file("${CMAKE_SOURCE_DIR}/cpack/CreatePackage.sh.in"
"${CMAKE_CURRENT_BINARY_DIR}/CreatePackage.sh" @ONLY
)

add_custom_target(linuxrelease
COMMAND "./CreatePackage.sh"
DEPENDS Thrive doc
)

endif()
51 changes: 33 additions & 18 deletions SetupThrive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ OriginalFolder=$(pwd)
if [ -f ./thriveversion.ver -o "$InsideFolder" = "thrive" ]; then

# Running from thrive folder
StartingDirectory=$(dirname "$(pwd)")
cd ..
StartingDirectory=$(pwd)

else

StartingDirectory=$(pwd)
StartingDirectory=$(pwd)
fi


Expand Down Expand Up @@ -81,20 +82,24 @@ fi

PackageManager="dnf install -y "
PackagesToInstall="bullet-devel boost gcc-c++ libXaw-devel freetype-devel freeimage-devel \
zziplib-devel boost-devel ois-devel tinyxml-devel glm-devel ffmpeg-devel ffmpeg-libs openal-soft-devel"
zziplib-devel boost-devel ois-devel tinyxml-devel glm-devel ffmpeg-devel ffmpeg-libs \
openal-soft-devel libatomic"
CommonPackages="cmake make git mercurial svn"

if [ "$OS" = "Fedora" ]; then

echo "Creating CEGUI project folder for $OS"
echo "Creating Thrive project folder for $OS"

elif [ "$OS" = "Ubuntu" ]; then

echo "Creating Thrive project folder for $OS"

PackageManager="apt-get install -y "

PackagesToInstall="bullet-dev boost-dev build-essential automake libtool libfreetype6-dev \
libfreeimage-dev libzzip-dev libxrandr-dev libxaw7-dev freeglut3-dev libgl1-mesa-dev \
libglu1-mesa-dev libois-dev libboost-thread-dev tinyxml-dev glm-dev ffmpeg-dev libavutil-dev libopenal-dev"
libfreeimage-dev libzzip-dev libxrandr-dev libxaw7-dev freeglut3-dev libgl1-mesa-dev \
libglu1-mesa-dev libois-dev libboost-thread-dev tinyxml-dev glm-dev ffmpeg-dev libavutil-dev libopenal-dev \
libatomic1"
else

echo "Unkown linux OS \"$OS\""
Expand Down Expand Up @@ -175,10 +180,12 @@ else
fi

hg update default
# Working commit
hg checkout a2e49193409c

mkdir build
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCEGUI_BUILD_APPLICATION_TEMPLATES=OFF -DCEGUI_BUILD_PYTHON_MODULES=OFF -DCEGUI_SAMPLES_ENABLED=OFF
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCEGUI_BUILD_APPLICATION_TEMPLATES=OFF -DCEGUI_BUILD_PYTHON_MODULES=OFF -DCEGUI_SAMPLES_ENABLED=OFF -DCEGUI_STRING_CLASS=1

cd "$StartingDirectory"

Expand All @@ -196,8 +203,8 @@ else

#Official repo
#git clone https://github.com/scrawl/ogre-ffmpeg-videoplayer.git ogre-ffmpeg-videoplayer
# Currently working hhyyrylainen's fork
git clone https://github.com/hhyyrylainen/ogre-ffmpeg-videoplayer.git ogre-ffmpeg-videoplayer
# Currently working Revolutionary games fork
git clone https://github.com/Revolutionary-Games/ogre-ffmpeg-videoplayer.git ogre-ffmpeg-videoplayer
cd ogre-ffmpeg-videoplayer
fi

Expand All @@ -215,9 +222,8 @@ echo "cAudio"
if [ -d cAudio ]; then

cd cAudio
#Workaround for broken latest version
#git checkout master
#git pull origin master
git checkout master
git pull origin master


else
Expand All @@ -227,7 +233,7 @@ else
fi

#Workaround for broken build with latest version
git checkout 22ff1a97a9a820c72726463708590adfae77008c
#git checkout 22ff1a97a9a820c72726463708590adfae77008c

mkdir -p build
cd build
Expand Down Expand Up @@ -324,28 +330,37 @@ fi

echo "Making all the links"
ln -sf assets/cegui_examples cegui_examples
ln -sf assets/definitions definitions
#ln -sf assets/definitions definitions
ln -sf assets/fonts fonts
ln -sf assets/gui gui
ln -sf assets/materials materials
ln -sf assets/models models
ln -sf assets/sounds sounds
ln -sf assets/videos videos

mkdir -p build

echo "Copying Ogre resources file"
cp ogre_cfg/resources.cfg build/resources.cfg

echo "Copying complelety pointless Ogre files"

cp /usr/local/share/OGRE/plugins.cfg build/plugins.cfg

cp ogre_cfg/plugins.cfg build/plugins.cfg

echo "Copying Ogre libs to bin"
cp $StartingDirectory/ogreBuild/build/ogre/lib/RenderSystem_GL.* build/
cp $StartingDirectory/ogreBuild/build/ogre/lib/Plugin_ParticleFX.* build/
#cp $StartingDirectory/ogreBuild/build/ogre/lib/Plugin_CgProgramManager.* build/
#cp $StartingDirectory/ogreBuild/build/ogre/lib/libOgreMain.* build/

echo "Compiling Thrive"
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
eval "make $MakeArgs"

echo "Making symlinks to libraries in bin/contrib"
ln -s contrib/lua/liblua.so liblua.so

echo "."
echo "."
echo "."
Expand Down
130 changes: 130 additions & 0 deletions cpack/CreatePackage.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#!/bin/sh
# Creates a zipped redistributable Thrive package for linux
version=@THRIVE_VERSION@
versionedname=Thrive-$version
stripfiles=1

target=$versionedname

librariestoinstall="@LINUX_LIBRARIES@"

mkdir -p $target
mkdir -p $target/bin


# Copy all required files
cp Thrive $target/bin
cp contrib/lua/liblua.so $target/bin


if [ $stripfiles = 1 ] ; then
strip $target/bin/Thrive
strip $target/bin/liblua.so
fi

# Copies a single library

CopyDependency () {

echo "Copying dependency $1"

cp "$1" $target/bin

linkto=$(readlink "$1")

if [ ! -z "$linkto" ]; then

echo "Following symlink $1 => $linkto"
linkdir=$(dirname "$1")

CopyDependency "$linkdir/$linkto"

fi

# Strip the copied file
if [ $stripfiles = 1 ] ; then

filename=$(basename "$1")
echo "Stripping dependency $filename"
strip "$target/bin/$filename"
fi
}

# Loop through all required libraries
echo "$librariestoinstall" | awk 'BEGIN { RS=";" } { print $0 }' | while read -r line ; do

filename=$(basename "$line")
extension="${filename##*.}"

if [ -f "$line" ] && [ "$extension" != "a" ]; then

CopyDependency "$line"
echo ""
fi
done

# Ogre plugins
cp ./RenderSystem_GL.* $target/bin
cp ./Plugin_ParticleFX.* $target/bin
#cp ./Plugin_CgProgramManager.* $target/bin

if [ $stripfiles = 1 ] ; then
strip $target/bin/RenderSystem_GL.*
strip $target/bin/Plugin_ParticleFX.*
#strip $target/bin/Plugin_CgProgramManager.*
fi

# Assets
# TODO: see if these could be symlinks
cp -r ../assets/fonts $target/
#cp -r ../assets/definitions $target/
cp -r ../assets/gui $target/
cp -r ../assets/materials $target/
cp -r ../assets/models $target/
cp -r ../assets/sounds $target/
cp -r ../assets/videos $target/
cp -r ../scripts $target/

echo "Copying and creating rest of the resources"

# Ogre files that are required until Thrive gets its own config files
cp resources.cfg $target/bin
cp plugins.cfg $target/bin

# Launch links
echo "#!/bin/sh
cd bin
./Thrive" > $target/launch.sh
chmod +x $target/launch.sh

# Info files
cp ../LICENSE.txt $target/
cp ../README.md $target/
cp ../gpl.txt $target/

# documentation
cp -r doc $target/

# Version file
cp ../thriveversion.ver $target/
touch "$target/package.version.$versionedname"

# Source code setup script
mkdir -p $target/source_build
cp ../SetupThrive.sh $target/source_build
echo "To get a copy of the source code and automatically build it run ./SetupThrive.sh.
Note: the script requires root, so you should read through it before running it" > $target/source_build/README.MD

# Delete log files, if ran from the staging folder before
echo "Deleting log and settings files if they exist"
rm $target/bin/cAudioEngineLog.html
rm $target/bin/CEGUI.log
rm $target/bin/default
rm $target/bin/ogre.cfg

echo "Zipping it up"

# Zip it up
7za a "Thrive.$version.7z" $versionedname

echo "Package Thrive.$version.7z done"
6 changes: 3 additions & 3 deletions src/engine/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ struct Engine::Implementation : public Ogre::WindowEventListener {
namespace fs = boost::filesystem;
fs::path manifestPath = directory / "manifest.txt";
if (not fs::exists(manifestPath)) {
throw std::runtime_error("Missing manifest file: " + manifestPath.string());
return;
}
std::ifstream manifest(manifestPath.string());
Expand Down Expand Up @@ -348,8 +349,7 @@ struct Engine::Implementation : public Ogre::WindowEventListener {
// Using the handling on keydown mode to detect when inputs are consumed
m_aggregator->initialise(false);

CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultTooltipType(
reinterpret_cast<const CEGUI::utf8*>("Thrive/Tooltip") );
CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultTooltipType("Thrive/Tooltip");

// For demos
// This file is renamed in newer CEGUI versions
Expand All @@ -361,7 +361,7 @@ struct Engine::Implementation : public Ogre::WindowEventListener {
// CEGUI::ImageManager::getSingleton().loadImageset("GameMenu.imageset");
// CEGUI::ImageManager::getSingleton().loadImageset("HUDDemo.imageset");

CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultTooltipType( reinterpret_cast<const CEGUI::utf8*>("Thrive/Tooltip") );
CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultTooltipType("Thrive/Tooltip");
CEGUI::AnimationManager::getSingleton().loadAnimationsFromXML("thrive.anims");

//For demos:
Expand Down
6 changes: 3 additions & 3 deletions src/gui/CEGUIWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ CEGUIWindow::destroy() const {

std::string
CEGUIWindow::getText() const {
return std::string(m_window->getText().c_str());
return m_window->getText().c_str();
}


Expand Down Expand Up @@ -381,7 +381,7 @@ CEGUIWindow::listWidgetGetFirstSelectedItemText(){
if(!selected)
return "";

return std::string(selected->getText().c_str());
return selected->getText().c_str();
}

int
Expand Down Expand Up @@ -580,7 +580,7 @@ CEGUIWindow::setSizeRel(

std::string
CEGUIWindow::getName() {
return std::string(m_window->getName().c_str());
return m_window->getName().c_str();
}

void
Expand Down
Loading

0 comments on commit 902a53a

Please sign in to comment.