mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 05:13:59 +02:00
FreeBSD and Mac OS X support by GeoVah, thanks a bunch!
This commit is contained in:
@@ -29,6 +29,20 @@ ENDIF(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
|
|||||||
|
|
||||||
##install part
|
##install part
|
||||||
|
|
||||||
|
#extracting the current version...
|
||||||
|
EXECUTE_PROCESS(
|
||||||
|
COMMAND /usr/bin/sed
|
||||||
|
-n -e "s/.*glestVersionString= \"v\\\(.*\\\)\";.*/\\1/p"
|
||||||
|
game_util.cpp
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/source/glest_game/facilities"
|
||||||
|
OUTPUT_VARIABLE MEGAGLEST_VERSION )
|
||||||
|
|
||||||
|
#for some reason the MEGAGLEST_VERSION can containts return like thus remove it
|
||||||
|
STRING(REGEX REPLACE "\n" "" MEGAGLEST_VERSION "${MEGAGLEST_VERSION}")
|
||||||
|
|
||||||
|
set(CPACK_PACKAGE_FILE_NAME MegaGlest-${MEGAGLEST_VERSION})
|
||||||
|
|
||||||
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/Info.plist" "${CMAKE_CURRENT_BINARY_DIR}/Info.plist")
|
||||||
|
|
||||||
|
|
||||||
include (InstallRequiredSystemLibraries)
|
include (InstallRequiredSystemLibraries)
|
||||||
@@ -37,132 +51,27 @@ set (CPACK_RESOURCE_FILE_LICENSE
|
|||||||
"${CMAKE_CURRENT_SOURCE_DIR}/docs/code_license.txt")
|
"${CMAKE_CURRENT_SOURCE_DIR}/docs/code_license.txt")
|
||||||
set (CPACK_GENERATOR Bundle)
|
set (CPACK_GENERATOR Bundle)
|
||||||
set (CPACK_BUNDLE_NAME "MegaGlest")
|
set (CPACK_BUNDLE_NAME "MegaGlest")
|
||||||
set (CPACK_BUNDLE_STARTUP_COMMAND "${PROJECT_SOURCE_DIR}/data/glest_game/Debug/glest.bin")
|
set (CPACK_BUNDLE_STARTUP_COMMAND "${PROJECT_SOURCE_DIR}/data/glest_game/Release/glest.bin")
|
||||||
set (CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/MegaGlest.icns")
|
set (CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/MegaGlest.icns")
|
||||||
set (CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/MegaGlest.icns")
|
set (CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/MegaGlest.icns")
|
||||||
set (CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/Info.plist")
|
set (CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist")
|
||||||
|
#set (CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/Info.plist.template")
|
||||||
INSTALL(FILES
|
INSTALL(FILES
|
||||||
${LUA_LIBRARIES}
|
${LUA_LIBRARIES}
|
||||||
DESTINATION ../Frameworks
|
DESTINATION ../Frameworks
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#the SDL_LIBRARY is seen as a framework thus we need to remove the suffix...
|
||||||
|
STRING(REGEX REPLACE ";.*" "" SDL_LIBRARY_DIR "${SDL_LIBRARY}")
|
||||||
|
|
||||||
INSTALL(DIRECTORY
|
INSTALL(DIRECTORY
|
||||||
${OGG_LIBRARY}
|
${OGG_LIBRARY}
|
||||||
${XERCESC_LIBRARY}
|
${XERCESC_LIBRARY}
|
||||||
${VORBIS_LIBRARY}
|
${VORBIS_LIBRARY}
|
||||||
${SDL_LIBRARY}
|
${SDL_LIBRARY_DIR}
|
||||||
|
${PNG_LIBRARY}
|
||||||
DESTINATION ../Frameworks
|
DESTINATION ../Frameworks
|
||||||
)
|
)
|
||||||
|
|
||||||
include (CPack)
|
include (CPack)
|
||||||
# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
|
|
||||||
# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
|
|
||||||
# These are just defaults/recommendations, but how we want to build
|
|
||||||
# out of the box. But the user needs to be able to change these options.
|
|
||||||
# So we must only set the values the first time CMake is run, or we
|
|
||||||
# will overwrite any changes the user sets.
|
|
||||||
# FORCE is used because the options are not reflected in the UI otherwise.
|
|
||||||
# Seems like a good place to add version specific compiler flags too.
|
|
||||||
IF(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
|
|
||||||
IF(EXISTS /Developer/SDKs/MacOSX10.6.sdk)
|
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Build architectures for OSX" FORCE)
|
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.6 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
|
||||||
|
|
||||||
ELSEIF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
|
|
||||||
# 64-bit compiles are not supported with Carbon. We should enable
|
|
||||||
# 64-bit compilation by default once osgviewer has been
|
|
||||||
# rewritten with Cocoa.
|
|
||||||
#SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
|
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Build architectures for OSX" FORCE)
|
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
|
||||||
ELSE()
|
|
||||||
# No Universal Binary support
|
|
||||||
# Should break down further to set the -mmacosx-version-min,
|
|
||||||
# but the SDK detection is too unreliable here.
|
|
||||||
ENDIF()
|
|
||||||
ENDIF(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##install part
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
include (InstallRequiredSystemLibraries)
|
|
||||||
|
|
||||||
set (CPACK_RESOURCE_FILE_LICENSE
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/docs/code_license.txt")
|
|
||||||
set (CPACK_GENERATOR Bundle)
|
|
||||||
set (CPACK_BUNDLE_NAME "MegaGlest")
|
|
||||||
set (CPACK_BUNDLE_STARTUP_COMMAND "${PROJECT_SOURCE_DIR}/data/glest_game/Debug/glest.bin")
|
|
||||||
set (CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/MegaGlest.icns")
|
|
||||||
set (CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/MegaGlest.icns")
|
|
||||||
set (CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/Info.plist")
|
|
||||||
INSTALL(FILES
|
|
||||||
${LUA_LIBRARIES}
|
|
||||||
DESTINATION ../Frameworks
|
|
||||||
)
|
|
||||||
INSTALL(DIRECTORY
|
|
||||||
${OGG_LIBRARY}
|
|
||||||
${XERCESC_LIBRARY}
|
|
||||||
${VORBIS_LIBRARY}
|
|
||||||
${SDL_LIBRARY}
|
|
||||||
DESTINATION ../Frameworks
|
|
||||||
)
|
|
||||||
|
|
||||||
include (CPack)
|
|
||||||
# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
|
|
||||||
# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
|
|
||||||
# These are just defaults/recommendations, but how we want to build
|
|
||||||
# out of the box. But the user needs to be able to change these options.
|
|
||||||
# So we must only set the values the first time CMake is run, or we
|
|
||||||
# will overwrite any changes the user sets.
|
|
||||||
# FORCE is used because the options are not reflected in the UI otherwise.
|
|
||||||
# Seems like a good place to add version specific compiler flags too.
|
|
||||||
IF(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
|
|
||||||
IF(EXISTS /Developer/SDKs/MacOSX10.6.sdk)
|
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Build architectures for OSX" FORCE)
|
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.6 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
|
||||||
|
|
||||||
ELSEIF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
|
|
||||||
# 64-bit compiles are not supported with Carbon. We should enable
|
|
||||||
# 64-bit compilation by default once osgviewer has been
|
|
||||||
# rewritten with Cocoa.
|
|
||||||
#SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
|
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Build architectures for OSX" FORCE)
|
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
|
||||||
ELSE()
|
|
||||||
# No Universal Binary support
|
|
||||||
# Should break down further to set the -mmacosx-version-min,
|
|
||||||
# but the SDK detection is too unreliable here.
|
|
||||||
ENDIF()
|
|
||||||
ENDIF(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##install part
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
include (InstallRequiredSystemLibraries)
|
|
||||||
|
|
||||||
set (CPACK_RESOURCE_FILE_LICENSE
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/docs/code_license.txt")
|
|
||||||
set (CPACK_GENERATOR Bundle)
|
|
||||||
set (CPACK_BUNDLE_NAME "MegaGlest")
|
|
||||||
set (CPACK_BUNDLE_STARTUP_COMMAND "${PROJECT_SOURCE_DIR}/data/glest_game/Debug/glest.bin")
|
|
||||||
set (CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/MegaGlest.icns")
|
|
||||||
set (CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/MegaGlest.icns")
|
|
||||||
set (CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/Info.plist")
|
|
||||||
INSTALL(FILES
|
|
||||||
${LUA_LIBRARIES}
|
|
||||||
DESTINATION ../Frameworks
|
|
||||||
)
|
|
||||||
INSTALL(DIRECTORY
|
|
||||||
${OGG_LIBRARY}
|
|
||||||
${XERCESC_LIBRARY}
|
|
||||||
${VORBIS_LIBRARY}
|
|
||||||
${SDL_LIBRARY}
|
|
||||||
DESTINATION ../Frameworks
|
|
||||||
)
|
|
||||||
|
|
||||||
include (CPack)
|
|
||||||
|
@@ -7,11 +7,11 @@
|
|||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>MegaGlest</string>
|
<string>MegaGlest</string>
|
||||||
<key>CFBundleGetInfoString</key>
|
<key>CFBundleGetInfoString</key>
|
||||||
<string>3.2.2r1, © 2001-2009 The Glest Team All Rights Reserved.</string>
|
<string>${MEGAGLEST_VERSION}, © 2001-2010 The Glest Team All Rights Reserved.</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>MegaGlest</string>
|
<string>MegaGlest</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>jp.ne.ivory.ciderhouse.MegaGlest</string>
|
<string>geovah.MegaGlest</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
@@ -19,75 +19,11 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>3.2.2</string>
|
<string>${MEGAGLEST_VERSION}</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>3.2</string>
|
<string>${MEGAGLEST_VERSION}</string>
|
||||||
<key>NSMainNibFile</key>
|
|
||||||
<string>MainMenu</string>
|
|
||||||
<key>NSPrincipalClass</key>
|
|
||||||
<string>NSApplication</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>English</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>MegaGlest</string>
|
|
||||||
<key>CFBundleGetInfoString</key>
|
|
||||||
<string>3.2.2r1, © 2001-2009 The Glest Team All Rights Reserved.</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string>MegaGlest</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>jp.ne.ivory.ciderhouse.MegaGlest</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>MegaGlest</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>3.2.2</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>3.2</string>
|
|
||||||
<key>NSMainNibFile</key>
|
|
||||||
<string>MainMenu</string>
|
|
||||||
<key>NSPrincipalClass</key>
|
|
||||||
<string>NSApplication</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>English</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>MegaGlest</string>
|
|
||||||
<key>CFBundleGetInfoString</key>
|
|
||||||
<string>3.2.2r1, © 2001-2009 The Glest Team All Rights Reserved.</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string>MegaGlest</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>jp.ne.ivory.ciderhouse.MegaGlest</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>MegaGlest</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>3.2.2</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>3.2</string>
|
|
||||||
<key>NSMainNibFile</key>
|
<key>NSMainNibFile</key>
|
||||||
<string>MainMenu</string>
|
<string>MainMenu</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
|
@@ -39,6 +39,8 @@ string getPlatformNameString() {
|
|||||||
platform = "Windows";
|
platform = "Windows";
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
platform = "FreeBSD";
|
platform = "FreeBSD";
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
platform = "MacOSX";
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
platform = "GNU";
|
platform = "GNU";
|
||||||
#else
|
#else
|
||||||
|
@@ -235,41 +235,46 @@ void findAll(const string &path, vector<string> &results, bool cutExtension, boo
|
|||||||
glob_t globbuf;
|
glob_t globbuf;
|
||||||
|
|
||||||
int res = glob(mypath.c_str(), 0, 0, &globbuf);
|
int res = glob(mypath.c_str(), 0, 0, &globbuf);
|
||||||
if(res < 0) {
|
if(res < 0)
|
||||||
std::stringstream msg;
|
{
|
||||||
msg << "Couldn't scan directory '" << mypath << "': " << strerror(errno);
|
if(errorOnNotFound) {
|
||||||
throw runtime_error(msg.str());
|
std::stringstream msg;
|
||||||
}
|
msg << "Couldn't scan directory '" << mypath << "': " << strerror(errno);
|
||||||
|
throw runtime_error(msg.str());
|
||||||
for(int i = 0; i < globbuf.gl_pathc; ++i) {
|
|
||||||
const char* p = globbuf.gl_pathv[i];
|
|
||||||
const char* begin = p;
|
|
||||||
for( ; *p != 0; ++p) {
|
|
||||||
// strip the path component
|
|
||||||
if(*p == '/')
|
|
||||||
begin = p+1;
|
|
||||||
}
|
|
||||||
if(!(strcmp(".", begin)==0 || strcmp("..", begin)==0 || strcmp(".svn", begin)==0)) {
|
|
||||||
results.push_back(begin);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SKIPPED SPECIAL FILENAME [%s]\n",__FILE__,__FUNCTION__,__LINE__,begin);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(int i = 0; i < globbuf.gl_pathc; ++i) {
|
||||||
|
const char* p = globbuf.gl_pathv[i];
|
||||||
|
const char* begin = p;
|
||||||
|
for( ; *p != 0; ++p) {
|
||||||
|
// strip the path component
|
||||||
|
if(*p == '/')
|
||||||
|
begin = p+1;
|
||||||
|
}
|
||||||
|
if(!(strcmp(".", begin)==0 || strcmp("..", begin)==0 || strcmp(".svn", begin)==0)) {
|
||||||
|
results.push_back(begin);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SKIPPED SPECIAL FILENAME [%s]\n",__FILE__,__FUNCTION__,__LINE__,begin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
globfree(&globbuf);
|
globfree(&globbuf);
|
||||||
|
|
||||||
if(results.size() == 0 && errorOnNotFound == true) {
|
if(results.size() == 0 && errorOnNotFound == true) {
|
||||||
throw runtime_error("No files found in: " + mypath);
|
throw runtime_error("No files found in: " + mypath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cutExtension) {
|
if(cutExtension) {
|
||||||
for (size_t i=0; i<results.size(); ++i){
|
for (size_t i=0; i<results.size(); ++i){
|
||||||
results.at(i)=cutLastExt(results.at(i));
|
results.at(i)=cutLastExt(results.at(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isdir(const char *path)
|
bool isdir(const char *path)
|
||||||
{
|
{
|
||||||
string friendly_path = path;
|
string friendly_path = path;
|
||||||
|
Reference in New Issue
Block a user