more minor improvements for OS X build
Add Homebrew and MacPorts paths for findings headers and libraries.
Add -x objective-c++ to the C++ compile command so that conditionally
compiled ObjectiveC code for OS X can be supported.
Throw a fatal error if the user tries to enable ENABLE_ASM_CORE,
ENABLE_ASM_SCALERS or ENABLE_MMX on AMD64, as this is not supported yet.
If ENABLE_ASM_SCALERS is enabled, try to find a Homebrew or MacPorts
nasm before using the outdated XCode nasm.
For the future, if the user has only the old XCode nasm which does not
support 64 bit objects and the build is 64 bit, throw a fatal error.
For 32 bit builds with the old XCode nasm, use -f macho instead of -f
macho32, which is used if the version of nasm is > 2.0 .
Pass -DMACHO instead of -DELF and, on AMD64 (for the future) -D__AMD64__
for nasm on OS X.
Pass -D__AMD64__ to C++ compilation as well on AMD64, this will help
when we support AMD64 inline assembly.
Add support for automatically linking Homebrew keg-only gettext from
/usr/local/opt/gettext for ENABLE_NLS.
Fix copying Info.plist and vbam.icns to the .app bundle.
Add a key to the Info.plist to support sharp text on retina displays, as
per:
https://wiki.wxwidgets.org/WxMac-specific_topics#Retina_display_support
Set wxWidgets_USE_DEBUG to ON if CMAKE_BUILD_TYPE is "Debug". I'm not
sure this does anything or if I'm doing this correctly though.
Also set wxWidgets_USE_UNICODE to ON. Again, I'm not sure this does
anything or is in the right place.
Fix a bug in the config dir finding code in
wxvbamApp::GetConfigurationPath() updated in 8b8f2f7
to only use the
more top level dirs if there is a vbam.ini in them, not if they are
writable as well, and use the reverse order (starting with user local
dirs) to check for writable dirs and their writable parents. This fixes
a problem with the vbam.ini being written to the Plugins directory of
the .app bundle if it's writable instead of ~/Library/Application
Support/vbam as was intended.
This commit is contained in:
parent
c3574c543c
commit
3d679c1469
|
@ -58,6 +58,8 @@ IF( NOT VERSION )
|
|||
endif(EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
||||
ENDIF( NOT VERSION )
|
||||
|
||||
|
||||
|
||||
# Fill in SDLMAIN_LIBRARY on OS X manually to avoid using SDLMain.m
|
||||
# OS X users will have to compile and install SDL from source.
|
||||
if( APPLE AND ENABLE_SDL )
|
||||
|
@ -65,9 +67,40 @@ if( APPLE AND ENABLE_SDL )
|
|||
SET(SDLMAIN_LIBRARY "-lSDLmain")
|
||||
endif( APPLE AND ENABLE_SDL )
|
||||
|
||||
# Add support for MacPorts and Homebrew on OS X
|
||||
# and ObjectiveC code
|
||||
IF(APPLE)
|
||||
SET(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH};/usr/local/include;/opt/local/include")
|
||||
SET(CMAKE_LIBRARY_PATH "${CMAKE_LIBRARY_PATH};/usr/local/lib;/opt/local/lib")
|
||||
SET(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};/usr/local/bin;/opt/local/bin")
|
||||
|
||||
link_directories("/usr/local/lib")
|
||||
include_directories("/usr/local/include")
|
||||
|
||||
link_directories("/opt/local/lib")
|
||||
include_directories("/opt/local/include")
|
||||
|
||||
# and compile as Objective-C++ for ObjectiveC #ifdefs
|
||||
SET(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> -x objective-c++ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
ENDIF()
|
||||
|
||||
# We do not support amd64 asm yet
|
||||
IF((ENABLE_ASM_CORE OR ENABLE_ASM_SCALERS OR ENABLE_MMX)
|
||||
AND CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|[aA][mM][dD]64|[xX]64"
|
||||
AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
MESSAGE(FATAL_ERROR "The options ASM_CORE, ASM_SCALERS and MMX are not supported on AMD64 yet.")
|
||||
ENDIF()
|
||||
|
||||
# Check for nasm
|
||||
if( ENABLE_ASM_SCALERS )
|
||||
ENABLE_LANGUAGE( ASM_NASM )
|
||||
IF(EXISTS "/usr/local/bin/nasm")
|
||||
SET(CMAKE_ASM_NASM_COMPILER "/usr/local/bin/nasm")
|
||||
ELSEIF(EXISTS "/opt/local/bin/nasm")
|
||||
SET(CMAKE_ASM_NASM_COMPILER "/opt/local/bin/nasm")
|
||||
ELSE()
|
||||
SET(CMAKE_ASM_NASM_COMPILER "/usr/bin/nasm")
|
||||
ENDIF()
|
||||
ENABLE_LANGUAGE(ASM_NASM)
|
||||
endif( ENABLE_ASM_SCALERS )
|
||||
|
||||
# Look for some dependencies using CMake scripts
|
||||
|
@ -166,6 +199,14 @@ if( ENABLE_NLS )
|
|||
ADD_DEFINITIONS ( -DENABLE_NLS )
|
||||
ADD_DEFINITIONS ( -DLOCALEDIR=\\\"${LOCALEDIR}\\\" )
|
||||
# for now, only GBALink.cpp uses gettext() directly
|
||||
IF(APPLE)
|
||||
# use Homebrew gettext if available
|
||||
IF(EXISTS "/usr/local/opt/gettext")
|
||||
SET(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH};/usr/local/opt/gettext/include")
|
||||
SET(CMAKE_LIBRARY_PATH "${CMAKE_LIBRARY_PATH};/usr/local/opt/gettext/lib")
|
||||
SET(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};/usr/local/opt/gettext/bin")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(ENABLE_LINK)
|
||||
FIND_PATH(LIBINTL_INC libintl.h )
|
||||
FIND_LIBRARY(LIBINTL_LIB intl )
|
||||
|
@ -176,18 +217,25 @@ if( ENABLE_NLS )
|
|||
INCLUDE(CheckFunctionExists)
|
||||
CHECK_FUNCTION_EXISTS(gettext GETTEXT_FN)
|
||||
IF(NOT LIBINTL_INC OR NOT GETTEXT_FN)
|
||||
message( SEND_ERROR "NLS requires libintl" )
|
||||
MESSAGE(FATAL_ERROR "NLS requires libintl/gettext")
|
||||
ENDIF(NOT LIBINTL_INC OR NOT GETTEXT_FN)
|
||||
INCLUDE_DIRECTORIES(${LIBINTL_INC})
|
||||
ENDIF(ENABLE_LINK)
|
||||
endif( ENABLE_NLS )
|
||||
|
||||
# Compiler flags
|
||||
IF ( WIN32 )
|
||||
SET( CMAKE_ASM_NASM_FLAGS "-I$(CMAKE_SOURCE_DIR)/src/filters/hq/asm/ -O1 -w-orphan-labels")
|
||||
ELSE ( WIN32 )
|
||||
SET( CMAKE_ASM_NASM_FLAGS "-I$(CMAKE_SOURCE_DIR)/src/filters/hq/asm/ -O1 -DELF -w-orphan-labels")
|
||||
ENDIF ( WIN32 )
|
||||
IF(WIN32)
|
||||
SET( CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -I$(CMAKE_SOURCE_DIR)/src/filters/hq/asm/ -O1 -w-orphan-labels")
|
||||
ELSEIF(APPLE)
|
||||
SET( CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -I$(CMAKE_SOURCE_DIR)/src/filters/hq/asm/ -O1 -DMACHO -w-orphan-labels")
|
||||
ELSEIF("${CMAKE_SYSTEM}" MATCHES "Linux")
|
||||
SET( CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -I$(CMAKE_SOURCE_DIR)/src/filters/hq/asm/ -O1 -DELF -w-orphan-labels")
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|[aA][mM][dD]64|[xX]64" AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
ADD_DEFINITIONS( -D__AMD64__ )
|
||||
SET(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -D__AMD64__")
|
||||
ENDIF()
|
||||
|
||||
SET( CMAKE_C_FLAGS_RELEASE "-O3")
|
||||
SET( CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||||
|
|
|
@ -24,11 +24,19 @@ if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT)
|
|||
SET(CMAKE_ASM_NASM_OBJECT_FORMAT win32)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_ASM_NASM_COMPILER} -v COMMAND awk "{print \$3}" OUTPUT_VARIABLE NASM_VERSION)
|
||||
IF(NASM_VERSION VERSION_LESS 2.0)
|
||||
IF(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
MESSAGE(FATAL_ERROR "Your nasm is too old to support AMD64, please install nasm from Homebrew or MacPorts.")
|
||||
ENDIF()
|
||||
SET(CMAKE_ASM_NAMS_OBJECT_FORMAT macho)
|
||||
ELSE()
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho64)
|
||||
else()
|
||||
SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho32)
|
||||
endif()
|
||||
ENDIF()
|
||||
else()
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
|
||||
|
|
|
@ -30,6 +30,10 @@ else(ENABLE_OPENAL)
|
|||
endif(ENABLE_OPENAL)
|
||||
|
||||
|
||||
IF(CMAKE_BUILD_TYPE EQUAL "Debug")
|
||||
SET(wxWidgets_USE_DEBUG ON)
|
||||
ENDIF()
|
||||
SET(wxWidgets_USE_UNICODE ON)
|
||||
# adv is for wxAboutBox
|
||||
# xml, html is for xrc
|
||||
SET( wxWidgets_USE_LIBS xrc xml html adv gl net core base )
|
||||
|
@ -175,13 +179,14 @@ ENDIF(NOT WIN32 AND NOT APPLE)
|
|||
|
||||
if(APPLE)
|
||||
# this should set ROM file types correctly
|
||||
SET_PROPERTY(TARGET wxvbam APPEND PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/wxplist.in)
|
||||
# file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/icons/vbam.icns DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
SET_PROPERTY(TARGET visualboyadvance-m APPEND PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/wxplist.in)
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/icons/vbam.icns DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
SET(MACOSX_BUNDLE_ICON_FILE vbam.icns)
|
||||
SET_SOURCE_FILES_PROPERTIES(${VBAM_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
endif(APPLE)
|
||||
IF( WIN32 )
|
||||
|
||||
IF(WIN32 OR APPLE)
|
||||
SET(WX_EXE_NAME visualboyadvance-m${CMAKE_EXECUTABLE_SUFFIX})
|
||||
ELSE( WIN32 )
|
||||
ELSE()
|
||||
SET(WX_EXE_NAME vbam${CMAKE_EXECUTABLE_SUFFIX})
|
||||
ENDIF( WIN32 )
|
||||
ENDIF()
|
||||
|
|
|
@ -32,6 +32,12 @@
|
|||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||
|
||||
<!-- this is for retina support in rendered text -->
|
||||
<!-- see: https://wiki.wxwidgets.org/WxMac-specific_topics#Retina_display_support -->
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
|
||||
<key>UTExportedTypeDeclarations</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
|
|
@ -65,6 +65,8 @@ static void tack_full_path(wxString &s, const wxString &app = wxEmptyString)
|
|||
|
||||
wxString wxvbamApp::GetConfigurationPath()
|
||||
{
|
||||
// first check if config files exists in reverse order
|
||||
// (from system paths to more local paths.)
|
||||
if (data_path.empty())
|
||||
{
|
||||
get_config_path(config_path);
|
||||
|
@ -78,21 +80,25 @@ wxString wxvbamApp::GetConfigurationPath()
|
|||
data_path = config_path[i];
|
||||
break;
|
||||
}
|
||||
// Check if path is writeable
|
||||
else if (wxIsWritable(config_path[i]))
|
||||
{
|
||||
data_path = config_path[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if no config dir was found, search for writable parent to
|
||||
// create it in in reverse order
|
||||
// if no config file was not found, search for writable config
|
||||
// dir or parent to create it in in OnInit in normal order
|
||||
// (from user paths to system paths.)
|
||||
if (data_path.empty())
|
||||
{
|
||||
for (int i = 0; i < config_path.size() ; i++)
|
||||
{
|
||||
// Check if path is writeable
|
||||
if (wxIsWritable(config_path[i]))
|
||||
{
|
||||
data_path = config_path[i];
|
||||
break;
|
||||
}
|
||||
|
||||
// check if parent of path is writable, so we can
|
||||
// create the path in OnInit
|
||||
wxFileName parent_dir = wxFileName::DirName(config_path[i] + wxT("//.."));
|
||||
parent_dir.MakeAbsolute();
|
||||
|
||||
|
|
Loading…
Reference in New Issue