- step #1 towards a working make install via cmake

This commit is contained in:
Mark Vejvoda 2011-05-03 18:25:35 +00:00
parent 62ae318e60
commit e4f0e8bfbf
6 changed files with 96 additions and 15 deletions

View File

@ -190,3 +190,47 @@ TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
ENDIF()
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${EXTERNAL_LIBS})
# Installation of the program
INSTALL(TARGETS
${TARGET_NAME}
DESTINATION bin/megaglest)
# Installation of the program config and image files
INSTALL(FILES
"${PROJECT_SOURCE_DIR}/mk/linux/glest.ini"
"${PROJECT_SOURCE_DIR}/mk/linux/glestkeys.ini"
"${PROJECT_SOURCE_DIR}/mk/linux/megaglest.bmp"
"${PROJECT_SOURCE_DIR}/data/glest_game/megaglest.ico"
DESTINATION bin/megaglest)
# Installation of the tools
#INSTALL(TARGETS
# "${PROJECT_SOURCE_DIR}/mk/linux/megaglest_configurator"
# "${PROJECT_SOURCE_DIR}/mk/linux/megaglest_editor"
# "${PROJECT_SOURCE_DIR}/mk/linux/megaglest_g3dviewer"
# DESTINATION bin/megaglest)
# Installation of the program config and image files
#INSTALL(FILES
# "${PROJECT_SOURCE_DIR}/mk/linux/g3dviewer.ico"
# "${PROJECT_SOURCE_DIR}/mk/linux/editor.ico"
# "${PROJECT_SOURCE_DIR}/mk/linux/configuration.xml"
# DESTINATION bin/megaglest)
# Installation of data files from outside normal data folder
INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/source/masterserver/flags"
DESTINATION share/megaglest/data/core/misc_textures
OPTIONAL REGEX "/.svn" EXCLUDE)
# Installation of the data
install(
DIRECTORY "${PROJECT_SOURCE_DIR}/data/glest_game/data"
"${PROJECT_SOURCE_DIR}/data/glest_game/docs"
"${PROJECT_SOURCE_DIR}/data/glest_game/maps"
"${PROJECT_SOURCE_DIR}/data/glest_game/scenarios"
"${PROJECT_SOURCE_DIR}/data/glest_game/techs"
"${PROJECT_SOURCE_DIR}/data/glest_game/tilesets"
"${PROJECT_SOURCE_DIR}/data/glest_game/tutorials"
DESTINATION share/megaglest
OPTIONAL REGEX "/.svn" EXCLUDE)

View File

@ -2724,7 +2724,7 @@ int glestMainWrapper(int argc, char** argv) {
#ifdef WIN32_STACK_TRACE
__try {
#endif
application_binary= executable_path(argv[0]);
application_binary= executable_path(argv[0],true);
//printf("\n\nargv0 [%s] application_binary [%s]\n\n",argv[0],application_binary.c_str());
#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__FreeBSD__) && !defined(BSD)

View File

@ -195,9 +195,6 @@ std::vector<std::string> FactionType::validateFactionType() {
}
}
//const SoundContainer & getCommandSounds() const { return commandSounds; }
for(int j = 0; j < unitType.getCommandTypeCount(); ++j) {
const CommandType *cmdType = unitType.getCommandType(j);
if(cmdType != NULL) {

View File

@ -701,7 +701,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) {
builtUnit->create();
if(builtUnitType->hasSkillClass(scBeBuilt) == false) {
throw runtime_error("Unit [" + builtUnitType->getName() + "] has no be_built skill.");
throw runtime_error("Unit [" + builtUnitType->getName() + "] has no be_built skill, producer was [" + intToStr(unit->getId()) + " - " + unit->getType()->getName() + "].");
}
builtUnit->setCurrSkill(scBeBuilt);

View File

@ -209,7 +209,7 @@ inline string trim (const string & s, const string & t = SPACES) {
string getFullFileArchiveExtractCommand(string fileArchiveExtractCommand,
string fileArchiveExtractCommandParameters, string outputpath, string archivename);
bool executeShellCommand(string cmd,int expectedResult=IGNORE_CMD_RESULT_VALUE);
string executable_path(string exeName);
string executable_path(string exeName,bool includeExeNameInPath=false);
class ValueCheckerVault {

View File

@ -1678,24 +1678,44 @@ off_t getFileSize(string filename) {
return 0;
}
string executable_path(string exeName) {
string executable_path(string exeName, bool includeExeNameInPath) {
string value = "";
#ifdef _WIN32
char path[MAX_PATH]="";
if( GetModuleFileName(NULL,path,MAX_PATH) == 0 ) {
value = extractDirectoryPathFromFile(exeName);
if(includeExeNameInPath == true) {
value = exeName;
}
else {
value = extractDirectoryPathFromFile(exeName);
}
}
else {
value = extractDirectoryPathFromFile(path);
if(includeExeNameInPath == true) {
value = path;
}
else {
value = extractDirectoryPathFromFile(path);
}
}
#elif __APPLE__
char path[MAXPATHLEN+1]="";
uint32_t path_len = MAXPATHLEN;
if ( _NSGetExecutablePath(path, &path_len) ) {
value = extractDirectoryPathFromFile(exeName);
if(includeExeNameInPath == true) {
value = exeName;
}
else {
value = extractDirectoryPathFromFile(exeName);
}
}
else {
value = extractDirectoryPathFromFile(path);
if(includeExeNameInPath == true) {
value = path;
}
else {
value = extractDirectoryPathFromFile(path);
}
}
#else
char exe_link_path[200]="";
@ -1703,23 +1723,43 @@ string executable_path(string exeName) {
if(length < 0 || length >= 200 ) {
char *argv0_path = realpath(exeName.c_str(),NULL);
if(argv0_path != NULL) {
value = extractDirectoryPathFromFile(argv0_path);
if(includeExeNameInPath == true) {
value = argv0_path;
}
else {
value = extractDirectoryPathFromFile(argv0_path);
}
free(argv0_path);
argv0_path = NULL;
}
else {
const char *shell_path = getenv("_");
if(shell_path != NULL) {
value = extractDirectoryPathFromFile(shell_path);
if(includeExeNameInPath == true) {
value = shell_path;
}
else {
value = extractDirectoryPathFromFile(shell_path);
}
}
else {
value = extractDirectoryPathFromFile(exeName);
if(includeExeNameInPath == true) {
value = exeName;
}
else {
value = extractDirectoryPathFromFile(exeName);
}
}
}
}
else {
exe_link_path[length] = '\0';
value = extractDirectoryPathFromFile(exe_link_path);
if(includeExeNameInPath == true) {
value = exe_link_path;
}
else {
value = extractDirectoryPathFromFile(exe_link_path);
}
}
#endif
return value;