CMake settings for Mac Os X

Also works with CLion
This commit is contained in:
Anton Sokolchenko 2014-10-15 00:45:00 +03:00
commit 518b5c2949
8 changed files with 23 additions and 9 deletions

View File

@ -87,7 +87,7 @@ if(WINDOWS)
ADD_DEFINITIONS (-DCOCOS2DXWIN32_EXPORTS -D_WINDOWS -DWIN32)
set(PLATFORM_FOLDER win32)
elseif(MACOSX)
elseif(MACOSX OR APPLE)
ADD_DEFINITIONS (-DCC_TARGET_OS_MAC)
ADD_DEFINITIONS (-DUSE_FILE32API)
set(PLATFORM_FOLDER mac)

View File

@ -32,7 +32,6 @@ THE SOFTWARE.
#include "deprecated/CCString.h"
#include <vector>
#include <stdarg.h>
using namespace std;

View File

@ -1,5 +1,5 @@
include_directories(
../external/ConvertUTF
../external/ConvertUTF, .
)
set(COCOS_2D_SRC

View File

@ -25,6 +25,8 @@
# this CMakeLists is to generate libcocos2d.a
cmake_minimum_required(VERSION 2.7)
if(WINDOWS)
ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
endif()
@ -74,6 +76,19 @@ set(COCOS_SRC cocos2d.cpp
${COCOS_EXTENSIONS_SRC}
)
if(MACOSX OR APPLE)
include(FindFreetype REQUIRED)
IF(NOT FREETYPE_FOUND)
FIND_LIBRARY(FREETYPE_LIBRARIES NAMES libfreetype freetype.dll PATHS "../external/freetype2/prebuilt/mac" "../external/freetype2/prebuilt/ios" DOC "Freetype includes")
find_path(FREETYPE_INCLUDE_DIRS ft2build.h "../external/freetype2/include/mac" "../external/freetype2/include/mac/freetype" "../external/freetype2/include/ios" "../external/freetype2/include/ios/freetype" DOC "Freetype includes")
ENDIF(NOT FREETYPE_FOUND)
find_package(Freetype)
include_directories(${FREETYPE_INCLUDE_DIRS})
endif()
if(MINGW)
find_package(Freetype REQUIRED)
find_package(WebP REQUIRED)
@ -126,8 +141,8 @@ elseif(WINDOWS)
elseif(LINUX)
set(PLATFORM_SPECIFIC_LIBS jpeg webp tiff freetype curl websockets
fontconfig png pthread glfw GLEW GL X11 rt z protobuf ${FMOD_LIB})
elseif(MACOSX)
elseif(MACOSX OR APPLE)
set (CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++")
INCLUDE_DIRECTORIES ( /System/Library/Frameworks )
FIND_LIBRARY(COCOA_LIBRARY Cocoa)

View File

@ -1,5 +1,5 @@
if(MACOSX)
if(MACOSX OR APPLE)
set(COCOS_BASE_SPECIFIC_SRC
base/CCUserDefault-apple.mm)
endif()

View File

@ -57,7 +57,7 @@ THE SOFTWARE.
#define CC_TARGET_PLATFORM CC_PLATFORM_UNKNOWN
// mac
#if defined(CC_TARGET_OS_MAC)
#if defined(CC_TARGET_OS_MAC) || defined(__APPLE__)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_MAC
#endif

View File

@ -10,7 +10,7 @@ set(COCOS_PLATFORM_SPECIFIC_SRC
platform/desktop/CCGLViewImpl-desktop.cpp
)
elseif(MACOSX)
elseif(MACOSX OR APPLE)
set(COCOS_PLATFORM_SPECIFIC_SRC
platform/mac/CCApplication-mac.mm

View File

@ -17,7 +17,7 @@ elseif(IOS)
proj.ios/RootViewController.mm
)
elseif(MACOSX)
elseif(MACOSX OR APPLE)
set(PLATFORM_SRC
proj.mac/main.cpp
)