Merge pull request #7237 from martell/v3

Cmake update and remove old scripts from build folder
This commit is contained in:
minggo 2014-08-07 10:36:10 +08:00
commit 7b11c6a74e
18 changed files with 180 additions and 380 deletions

View File

@ -1,6 +1,6 @@
#/**************************************************************************** #/****************************************************************************
# Copyright (c) 2013 cocos2d-x.org # Copyright (c) 2013 cocos2d-x.org
# Copyright (c) 2012-2013 martell malone # Copyright (c) 2014 martell malone
# #
# http://www.cocos2d-x.org # http://www.cocos2d-x.org
# #
@ -28,38 +28,23 @@ project (Cocos2dx)
# The version number # The version number
set(Cocos2dxSamples_VERSION_MAJOR 3) set(Cocos2dxSamples_VERSION_MAJOR 3)
set(Cocos2dxSamples_VERSION_MINOR 0) set(Cocos2dxSamples_VERSION_MINOR 1)
include(build/BuildHelpers.CMakeLists.txt) include(build/BuildHelpers.CMakeLists.txt)
if(WIN32 OR APPLE) message(${BUILDING_STRING})
option(USE_CHIPMUNK "Use chipmunk for physics library" ON) option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF) option(USE_BOX2D "Use box2d for physics library" OFF)
option(DEBUG_MODE "Debug or release?" ON) option(DEBUG_MODE "Debug or release?" ON)
option(BUILD_LIBS_LUA "Build lua libraries" OFF)
option(BUILD_EXTENSIONS "Build extension library" ON) option(BUILD_EXTENSIONS "Build extension library" ON)
option(BUILD_EDITOR_SPINE "Build editor support for spine" ON) option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON) option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON) option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
option(BUILD_EXTERN_LIBS "Build Box2d, Chipmunk, Tinyxml2 from source" ON)
option(BUILD_CppTests "Only build TestCpp sample" ON) option(BUILD_CppTests "Build TestCpp samples" ON)
option(BUILD_LuaTests "Only build TestLua sample" OFF)
else()#temp
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(DEBUG_MODE "Debug or release?" ON)
option(BUILD_LIBS_LUA "Build lua libraries" ON) option(BUILD_LIBS_LUA "Build lua libraries" ON)
option(BUILD_EXTENSIONS "Build extension library" ON) option(BUILD_LuaTests "Build TestLua samples" ON)
option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
option(BUILD_CppTests "Only build TestCpp sample" ON)
option(BUILD_LuaTests "Only build TestLua sample" ON)
endif()#temp
if(DEBUG_MODE) if(DEBUG_MODE)
set(CMAKE_BUILD_TYPE DEBUG) set(CMAKE_BUILD_TYPE DEBUG)
@ -70,31 +55,25 @@ endif(DEBUG_MODE)
set(CMAKE_C_FLAGS_DEBUG "-DCOCOS2D_DEBUG=1") set(CMAKE_C_FLAGS_DEBUG "-DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
if(WIN32) if(MSVC)
ADD_DEFINITIONS (-D_USRDLL -DCOCOS2DXWIN32_EXPORTS -D_WINDOWS -DWIN32) ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
-wd4251 -wd4244 -wd4334 -wd4005 -wd4820 -wd4710
if(MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS
-D_SCL_SECURE_NO_WARNINGS
-wd4251 -wd4244 -wd4334
-wd4005 -wd4820 -wd4710
-wd4514 -wd4056 -wd4996 -wd4099) -wd4514 -wd4056 -wd4996 -wd4099)
else(MSVC)#MINGW else()
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions -std=c99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -std=c++11")
endif(MSVC)
endif(MSVC) if(WINDOWS)
elseif(APPLE) ADD_DEFINITIONS (-D_USRDLL -DCOCOS2DXWIN32_EXPORTS -D_WINDOWS -DWIN32)
set(PLATFORM_FOLDER win32)
elseif(MACOSX)
else()#Linux set(PLATFORM_FOLDER mac)
ADD_DEFINITIONS(-DLINUX) else(LINUX)
endif() ADD_DEFINITIONS(-DLINUX)
set(PLATFORM_FOLDER linux)
if(NOT MSVC)# all gcc
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-std=c99")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11")
endif() endif()
if(MINGW) if(MINGW)
@ -102,8 +81,12 @@ if(MINGW)
add_definitions(-D__SSIZE_T) add_definitions(-D__SSIZE_T)
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lws2_32") set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lws2_32")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lws2_32") set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lws2_32")
endif()
if(CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions ")
endif()
endif()
if(USE_CHIPMUNK) if(USE_CHIPMUNK)
message("Using chipmunk ...") message("Using chipmunk ...")
@ -122,14 +105,6 @@ else()
set(ARCH_DIR "32-bit") set(ARCH_DIR "32-bit")
endif() endif()
if(WIN32) # Win32
set(PLATFORM_FOLDER win32)
elseif(APPLE)# osx or ios
set(PLATFORM_FOLDER mac)
else() # Assume Linux
set(PLATFORM_FOLDER linux)
endif()
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cocos ${CMAKE_CURRENT_SOURCE_DIR}/cocos
@ -156,18 +131,18 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/external/xxtea ${CMAKE_CURRENT_SOURCE_DIR}/external/xxtea
) )
if(WIN32 AND NOT MINGW) if(MSVC)
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/gles/include/OGLES ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/gles/include/OGLES
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/icon/include ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/icon/include
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/zlib/include ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/zlib/include
external/curl/include/${PLATFORM_FOLDER} external/curl/include/${PLATFORM_FOLDER}
) )
elseif(APPLE) elseif(MACOSX)
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/include/${PLATFORM_FOLDER} ${CMAKE_CURRENT_SOURCE_DIR}/external/curl/include/${PLATFORM_FOLDER}
) )
else() elseif(LINUX)
include_directories( include_directories(
/usr/include /usr/include
/usr/include/GLFW /usr/include/GLFW
@ -177,9 +152,8 @@ else()
endif() endif()
if(WIN32) if(MSVC)
if(NOT MINGW)
link_directories( link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/prebuilt/${PLATFORM_FOLDER} ${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/prebuilt/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER} ${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER}
@ -189,11 +163,8 @@ if(WIN32)
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/icon/prebuilt ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/icon/prebuilt
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/zlib/prebuilt ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/zlib/prebuilt
) )
endif()
elseif(APPLE) elseif(LINUX)
else()
link_directories( link_directories(
/usr/local/lib /usr/local/lib
@ -208,17 +179,21 @@ else()
endif() endif()
if(BUILD_EXTERN_LIBS)
# chipmunk library # chipmunk library
add_subdirectory(external/chipmunk/src) add_subdirectory(external/chipmunk/src)
# box2d library # box2d library
add_subdirectory(external/Box2D) add_subdirectory(external/Box2D)
endif()
# unzip library # unzip library
add_subdirectory(external/unzip) add_subdirectory(external/unzip)
if(BUILD_EXTERN_LIBS)
# tinyxml2 library # tinyxml2 library
add_subdirectory(external/tinyxml2) add_subdirectory(external/tinyxml2)
endif()
# xxhash library # xxhash library
add_subdirectory(external/xxhash) add_subdirectory(external/xxhash)
@ -267,10 +242,8 @@ add_subdirectory(external/xxtea)
endif(BUILD_LIBS_LUA) endif(BUILD_LIBS_LUA)
# build tests # build tests
add_subdirectory(tests/cpp-empty-test)
if(BUILD_CppTests) if(BUILD_CppTests)
add_subdirectory(tests/cpp-empty-test)
add_subdirectory(tests/cpp-tests) add_subdirectory(tests/cpp-tests)
endif(BUILD_CppTests) endif(BUILD_CppTests)

View File

@ -11,3 +11,59 @@ macro(pre_build TARGET_NAME)
add_custom_target( ${TARGET_NAME}_CORE_PRE_BUILD ) add_custom_target( ${TARGET_NAME}_CORE_PRE_BUILD )
add_dependencies( ${TARGET_NAME}_PRE_BUILD ${TARGET_NAME}_CORE_PRE_BUILD ) add_dependencies( ${TARGET_NAME}_PRE_BUILD ${TARGET_NAME}_CORE_PRE_BUILD )
endmacro() endmacro()
#cmake has some strange defaults, this should help us a lot
#Please use them everywhere
#WINDOWS = Windows Desktop
#WINRT = Windows RT
#WP8 = Windows Phone 8
#ANDROID = ANDROID
#IOS = IOS
#MACOSX = MAC OSX
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if(WINRT)
set(SYSTEM_STRING "Windows RT")
elseif(WP8)
set(SYSTEM_STRING "Windows Phone 8")
else()
set(WINDOWS TRUE)
set(SYSTEM_STRING "Windows Desktop")
endif()
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if(ANDROID)
set(SYSTEM_STRING "Android")
else()
set(LINUX TRUE)
set(SYSTEM_STRING "Linux")
endif()
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(IOS)
set(SYSTEM_STRING "IOS")
else()
set(MACOSX TRUE)
set(SYSTEM_STRING "Mac OSX")
endif()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(COMPILER_STRING ${CMAKE_CXX_COMPILER_ID})
set(CLANG TRUE)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if(MINGW)
set(COMPILER_STRING "Mingw GCC")
else()
set(COMPILER_STRING "GCC")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set(COMPILER_STRING "${CMAKE_CXX_COMPILER_ID} C++")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(COMPILER_STRING "Visual Studio C++")
endif()
if(CMAKE_CROSSCOMPILING)
set(BUILDING_STRING "It appears you are cross compiling for ${SYSTEM_STRING} with ${COMPILER_STRING}")
else()
set(BUILDING_STRING "It appears you are builing natively for ${SYSTEM_STRING} with ${COMPILER_STRING}")
endif()

View File

@ -1,62 +0,0 @@
#!/bin/bash
# msys2 Pacman Manager for cocos2d-x
#/****************************************************************************
# Copyright (c) 2013-2014 Martell Malone
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ****************************************************************************/
set -e
THISDIR="$(dirname $0)"
test "$THISDIR" = "." && THISDIR=${PWD}
OSTYPE=${OSTYPE//[0-9.]/}
HOST_ARCH=$(uname -m)
if [ "${HOST_ARCH}" = "i686" ]; then
BITS=32
elif [ "${HOST_ARCH}" = "x86_64" ]; then
BITS=64
fi
if [ "${OSTYPE}" = "msys" ]; then
CC=clang
CXX=clang++
PP=mingw-w64-${HOST_ARCH}
MINGW_PACKAGES=(glfw glew libwebp libjpeg-turbo libpng freetype libiconv zlib curl
make clang binutils headers cmake)
MINGW_PACKAGES=(${MINGW_PACKAGES[@]/#/${PP}-})
pacman -S --force --noconfirm --needed ${MINGW_PACKAGES[@]}
mkdir -p mingw${BITS}-clang && cd mingw${BITS}-clang
export PATH=/mingw${BITS}/bin:${PATH}
cmake -G"MinGW Makefiles" -DCMAKE_MAKE_PROGRAM="mingw32-make" \
-DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" ../..
mingw32-make
fi

View File

@ -1,62 +0,0 @@
#!/bin/bash
# msys2 Pacman Manager for cocos2d-x
#/****************************************************************************
# Copyright (c) 2012-2013 Martell Malone
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ****************************************************************************/
set -e
THISDIR="$(dirname $0)"
test "$THISDIR" = "." && THISDIR=${PWD}
OSTYPE=${OSTYPE//[0-9.]/}
HOST_ARCH=$(uname -m)
if [ "${HOST_ARCH}" = "i686" ]; then
BITS=32
elif [ "${HOST_ARCH}" = "x86_64" ]; then
BITS=64
fi
if [ "${OSTYPE}" = "msys" ]; then
CC=${HOST_ARCH}-w64-mingw32-gcc
CXX=${HOST_ARCH}-w64-mingw32-g++
PP=mingw-w64-${HOST_ARCH}
MINGW_PACKAGES=(glfw glew libwebp libjpeg-turbo libpng freetype libiconv zlib curl
make gcc binutils headers cmake)
MINGW_PACKAGES=(${MINGW_PACKAGES[@]/#/${PP}-})
pacman -S --force --noconfirm --needed ${MINGW_PACKAGES[@]}
mkdir -p mingw${BITS} && cd mingw${BITS}
export PATH=/mingw${BITS}/bin:${PATH}
cmake -G"MinGW Makefiles" -DCMAKE_MAKE_PROGRAM="mingw32-make" \
-DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" ../..
mingw32-make
fi

View File

@ -1,9 +1,3 @@
if(WIN32)
ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
endif()
include_directories( include_directories(
../external/ConvertUTF ../external/ConvertUTF
) )
@ -76,4 +70,3 @@ set(COCOS_2D_SRC
2d/CCTransitionProgress.cpp 2d/CCTransitionProgress.cpp
2d/CCTweenFunction.cpp 2d/CCTweenFunction.cpp
) )

View File

@ -13,4 +13,3 @@ set(COCOS_3D_SRC
3d/CCMeshSkin.cpp 3d/CCMeshSkin.cpp
3d/CCBundleReader.cpp 3d/CCBundleReader.cpp
) )

View File

@ -1,11 +1,8 @@
if(WIN32) if(WINDOWS)
ADD_DEFINITIONS(-DUNICODE -D_UNICODE) ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
endif() endif()
set(COCOS_SRC cocos2d.cpp)
set(COCOS_SRC
cocos2d.cpp
)
include(2d/CMakeLists.txt) include(2d/CMakeLists.txt)
include(3d/CMakeLists.txt) include(3d/CMakeLists.txt)
@ -34,60 +31,12 @@ add_library(cocos2d STATIC
${COCOS_DEPRECATED_SRC} ${COCOS_DEPRECATED_SRC}
) )
if(WIN32)
if(MINGW) if(MINGW)
set(COCOS_LINK z jpeg png webp tiff glfw3 glew32 opengl32 iconv freetype bz2)
set(COCOS_LINK elseif(WINDOWS)
z set(COCOS_LINK libjpeg libpng libwebp libtiff freetype250 glfw3 glew32 opengl32 libiconv libzlib)
jpeg elseif(LINUX)
png set(COCOS_LINK jpeg webp tiff freetype fontconfig png pthread glfw GLEW GL X11 rt z)
webp
tiff
glfw3
glew32
opengl32
iconv
freetype
bz2
)
else()
set(COCOS_LINK
libjpeg
libpng
libwebp
libtiff
freetype250
glfw3
glew32
opengl32
libiconv
libzlib
)
endif()
elseif(APPLE)
else()
set(COCOS_LINK
jpeg
webp
tiff
freetype
fontconfig
png
pthread
glfw
GLEW
GL
X11
rt
z
)
endif() endif()
target_link_libraries(cocos2d target_link_libraries(cocos2d
@ -105,4 +54,3 @@ set_target_properties(cocos2d
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
) )

View File

@ -1,19 +1,18 @@
# architecture # architecture
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) #if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(ARCH_DIR "64-bit") #set(ARCH_DIR "64-bit")
else() #else()
set(ARCH_DIR "32-bit") #set(ARCH_DIR "32-bit")
endif() #endif()
if(WIN32) if(WINDOWS)
set(AUDIO_SRC set(AUDIO_SRC
win32/SimpleAudioEngine.cpp win32/SimpleAudioEngine.cpp
win32/MciPlayer.cpp win32/MciPlayer.cpp
win32/MciPlayer.h win32/MciPlayer.h
) )
elseif(APPLE)
else() elseif(LINUX)
set(AUDIO_SRC set(AUDIO_SRC
linux/SimpleAudioEngineFMOD.cpp linux/SimpleAudioEngineFMOD.cpp
linux/FmodAudioPlayer.cpp linux/FmodAudioPlayer.cpp
@ -21,9 +20,7 @@ else()
linux/AudioPlayer.h linux/AudioPlayer.h
) )
include_directories( include_directories( ../../external/linux-specific/fmod/include/${ARCH_DIR} )
../../external/linux-specific/fmod/include/${ARCH_DIR}
)
endif() endif()
@ -33,28 +30,23 @@ add_library(audio STATIC
include/SimpleAudioEngine.h include/SimpleAudioEngine.h
) )
if((NOT APPLE) AND (NOT WIN32)) if(LINUX)
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(FMOD_LIB "fmodex64") set(FMOD_LIB "fmodex64")
else() else()
set(FMOD_LIB "fmodex") set(FMOD_LIB "fmodex")
endif()
target_link_libraries(audio ${FMOD_LIB})
elseif(WINDOWS)
target_link_libraries(audio Winmm)
endif() endif()
target_link_libraries(audio
${FMOD_LIB}
)
set_target_properties(audio set_target_properties(audio
PROPERTIES PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
) )
elseif(WIN32)
target_link_libraries(audio
Winmm
)
endif()

View File

@ -23,17 +23,12 @@ set(CCB_SRC
CCNode+CCBRelativePositioning.cpp CCNode+CCBRelativePositioning.cpp
) )
include_directories( include_directories( .. )
..
)
add_library(cocosbuilder STATIC add_library(cocosbuilder STATIC ${CCB_SRC})
${CCB_SRC}
)
set_target_properties(cocosbuilder set_target_properties(cocosbuilder
PROPERTIES PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
) )

View File

@ -55,16 +55,11 @@ set(CS_SRC
ActionTimeline/CCTimeLine.cpp ActionTimeline/CCTimeLine.cpp
) )
include_directories( include_directories( .. )
..
)
add_library(cocostudio STATIC add_library(cocostudio STATIC ${CS_SRC} )
${CS_SRC}
)
target_link_libraries(cocostudio target_link_libraries(cocostudio)
)
set_target_properties(cocostudio set_target_properties(cocostudio
PROPERTIES PROPERTIES

View File

@ -32,13 +32,9 @@ set(SPINE_SRC
SkeletonBounds.cpp SkeletonBounds.cpp
) )
include_directories( include_directories( .. )
..
)
add_library(spine STATIC add_library(spine STATIC ${SPINE_SRC})
${SPINE_SRC}
)
set_target_properties(spine set_target_properties(spine
PROPERTIES PROPERTIES

View File

@ -1,37 +1,13 @@
if(WIN32) if(WINDOWS)
set(PLATFORM_SRC set(PLATFORM_LINK websockets)
network/WebSocket.cpp elseif(LINUX)
) set(PLATFORM_LINK websockets ssl crypto)
set(PLATFORM_LINK
websockets
)
elseif(NOT APPLE)
set(PLATFORM_SRC
network/WebSocket.cpp
)
set(PLATFORM_LINK
websockets
ssl
crypto
)
endif() endif()
set(COCOS_NETWORK_SRC set(COCOS_NETWORK_SRC network/HttpClient.cpp network/SocketIO.cpp network/WebSocket.cpp)
network/HttpClient.cpp
network/SocketIO.cpp
${PLATFORM_SRC}
)
IF (WIN32 AND NOT MINGW) if(MSVC)
set(COCOS_NETWORK_LINK set(COCOS_NETWORK_LINK libcurl_imp ${PLATFORM_LINK})
libcurl_imp else()
${PLATFORM_LINK} set(COCOS_NETWORK_LINK curl ${PLATFORM_LINK} )
) endif()
ELSE()
set(COCOS_NETWORK_LINK
curl
${PLATFORM_LINK}
)
ENDIF()

View File

@ -405,7 +405,8 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
} }
// draw text // draw text
SIZE size = {textDefinition._dimensions.width, textDefinition._dimensions.height}; // does changing to SIZE here affects the font size by rounding from float?
SIZE size = {(LONG) textDefinition._dimensions.width,(LONG) textDefinition._dimensions.height};
CC_BREAK_IF(! dc.drawText(text, size, align)); CC_BREAK_IF(! dc.drawText(text, size, align));
int dataLen = size.cx * size.cy * 4; int dataLen = size.cx * size.cy * 4;

View File

@ -124,12 +124,14 @@ inline int vsnprintf_s(char *buffer, size_t sizeOfBuffer, size_t count,
const char *format, va_list argptr) { const char *format, va_list argptr) {
return vsnprintf(buffer, sizeOfBuffer, format, argptr); return vsnprintf(buffer, sizeOfBuffer, format, argptr);
} }
#ifndef __clang__
inline errno_t strcpy_s(char *strDestination, size_t numberOfElements, inline errno_t strcpy_s(char *strDestination, size_t numberOfElements,
const char *strSource) { const char *strSource) {
strcpy(strDestination, strSource); strcpy(strDestination, strSource);
return 0; return 0;
} }
#endif
#endif // __MINGW32__ #endif // __MINGW32__
// Conflicted with cocos2d::MessageBox, so we need to undef it. // Conflicted with cocos2d::MessageBox, so we need to undef it.

View File

@ -16,4 +16,3 @@ set(COCOS_RENDERER_SRC
renderer/CCTextureAtlas.cpp renderer/CCTextureAtlas.cpp
renderer/CCTextureCache.cpp renderer/CCTextureCache.cpp
) )

View File

@ -1,9 +1,2 @@
set(COCOS_STORAGE_SRC storage/local-storage/LocalStorage.cpp)
set(COCOS_STORAGE_SRC set(COCOS_STORAGE_LINK sqlite3 )
storage/local-storage/LocalStorage.cpp
)
set(COCOS_STORAGE_LINK
sqlite3
)

View File

@ -24,4 +24,3 @@ set(COCOS_UI_SRC
ui/UIDeprecated.cpp ui/UIDeprecated.cpp
ui/UIScale9Sprite.cpp ui/UIScale9Sprite.cpp
) )

View File

@ -1,34 +1,38 @@
set(APP_NAME cpp-empty-test) set(APP_NAME cpp-empty-test)
if(QT) if(ANDROID)
set(PLATFORM_SRC
proj.qt/main.cpp
)
elseif(ANDROID)
set(PLATFORM_SRC set(PLATFORM_SRC
proj.android/jni/hellocpp/main.cpp proj.android/jni/hellocpp/main.cpp
) )
elseif(WIN32)
elseif(WINDOWS)
set(PLATFORM_SRC set(PLATFORM_SRC
proj.win32/main.cpp proj.win32/main.cpp
) )
elseif(APPLE)
if(IOS) elseif(IOS)
set(PLATFORM_SRC set(PLATFORM_SRC
proj.ios/main.m proj.ios/main.m
proj.ios/AppController.mm proj.ios/AppController.mm
proj.ios/RootViewController.mm proj.ios/RootViewController.mm
) )
else()
elseif(MACOSX)
set(PLATFORM_SRC set(PLATFORM_SRC
proj.mac/main.m proj.mac/main.m
) )
endif()
else() elseif(LINUX)
set(PLATFORM_SRC set(PLATFORM_SRC
proj.linux/main.cpp proj.linux/main.cpp
) )
endif()
endif()
set(SAMPLE_SRC set(SAMPLE_SRC
${PLATFORM_SRC} ${PLATFORM_SRC}
@ -41,7 +45,8 @@ add_executable(${APP_NAME}
${SAMPLE_SRC} ${SAMPLE_SRC}
) )
if(WIN32 AND MSVC) if(MSVC)
#get our resources #get our resources
add_custom_command(TARGET ${APP_NAME} PRE_BUILD add_custom_command(TARGET ${APP_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
@ -60,7 +65,9 @@ if(WIN32 AND MSVC)
#Visual Studio Defaults to wrong type #Visual Studio Defaults to wrong type
set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS") set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
else() else()
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}") set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
set_target_properties(${APP_NAME} PROPERTIES set_target_properties(${APP_NAME} PROPERTIES