зеркало из https://github.com/microsoft/cocos2d-x.git
quickly added win32 cmake
This commit is contained in:
Родитель
d3076a1415
Коммит
79401a7596
150
CMakeLists.txt
150
CMakeLists.txt
|
@ -10,20 +10,19 @@ include(build/BuildHelpers.CMakeLists.txt)
|
|||
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_GUI "Build GUI library" ON)
|
||||
option(BUILD_NETWORK "Build network library" ON)
|
||||
option(BUILD_EXTENSIONS "Build extension library" 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_LIBS_LUA "Build lua libraries" OFF)
|
||||
option(BUILD_GUI "Build GUI library" OFF)
|
||||
option(BUILD_NETWORK "Build network library" OFF)
|
||||
option(BUILD_EXTENSIONS "Build extension library" OFF)
|
||||
option(BUILD_EDITOR_SPINE "Build editor support for spine" OFF)
|
||||
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" OFF)
|
||||
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" OFF)
|
||||
|
||||
|
||||
option(BUILD_HelloCpp "Only build HelloCpp sample" ON)
|
||||
option(BUILD_TestCpp "Only build TestCpp sample" ON)
|
||||
option(BUILD_HelloLua "Only build HelloLua sample" ON)
|
||||
option(BUILD_TestLua "Only build TestLua sample" ON)
|
||||
|
||||
option(BUILD_TestCpp "Only build TestCpp sample" OFF)
|
||||
option(BUILD_HelloLua "Only build HelloLua sample" OFF)
|
||||
option(BUILD_TestLua "Only build TestLua sample" OFF)
|
||||
|
||||
if(DEBUG_MODE)
|
||||
set(CMAKE_BUILD_TYPE DEBUG)
|
||||
|
@ -31,18 +30,35 @@ else(DEBUG_MODE)
|
|||
set(CMAKE_BUILD_TYPE RELEASE)
|
||||
endif(DEBUG_MODE)
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "-DCOCOS2D_DEBUG=1")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
|
||||
|
||||
if(NOT MSVC)
|
||||
|
||||
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")
|
||||
|
||||
add_definitions(-DLINUX)
|
||||
else()
|
||||
|
||||
ADD_DEFINITIONS (-D_USRDLL -DCOCOS2DXWIN32_EXPORTS -DGL_GLEXT_PROTOTYPES)
|
||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS
|
||||
-D_SCL_SECURE_NO_WARNINGS
|
||||
-wd4251 -wd4244 -wd4334 -wd4005 -wd4820 -wd4710
|
||||
-wd4514)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
if(USE_CHIPMUNK)
|
||||
message("Using chipmunk ...")
|
||||
add_definitions(-DLINUX -DCC_ENABLE_CHIPMUNK_INTEGRATION=1)
|
||||
add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=1)
|
||||
elseif(USE_BOX2D)
|
||||
message("Using box2d ...")
|
||||
add_definitions(-DLINUX -DCC_ENABLE_BOX2D_INTEGRATION=1)
|
||||
add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=1)
|
||||
else(USE_CHIPMUNK)
|
||||
message(FATAL_ERROR "Must choose a physics library.")
|
||||
endif(USE_CHIPMUNK)
|
||||
|
@ -54,40 +70,86 @@ else()
|
|||
set(ARCH_DIR "32-bit")
|
||||
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(
|
||||
.
|
||||
cocos
|
||||
cocos/audio/include
|
||||
cocos/2d
|
||||
cocos/2d/platform
|
||||
cocos/2d/platform/linux
|
||||
cocos/base
|
||||
cocos/physics
|
||||
cocos/editor-support
|
||||
cocos/math/kazmath/include
|
||||
extensions
|
||||
external
|
||||
external/jpeg/include/linux
|
||||
external/tiff/include/linux
|
||||
external/webp/include/linux
|
||||
external/glfw3/include/linux
|
||||
external/curl/include/linux/${ARCH_DIR}
|
||||
external/tinyxml2
|
||||
external/unzip
|
||||
external/chipmunk/include/chipmunk
|
||||
external/freetype2/include/linux
|
||||
external/linux-specific/fmod/include/${ARCH_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cocos
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cocos/audio/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cocos/2d
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cocos/2d/platform
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cocos/base
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cocos/physics
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cocos/editor-support
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cocos/math/kazmath/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/extensions
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/tinyxml2
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/unzip
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/chipmunk/include/chipmunk
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cocos/2d/platform/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/include/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/png/include/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/include/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/webp/include/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/glfw3/include/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/include/${PLATFORM_FOLDER}
|
||||
)
|
||||
|
||||
link_directories(
|
||||
/usr/local/lib
|
||||
${CMAKE_SOURCE_DIR}/external/jpeg/prebuilt/linux/${ARCH_DIR}
|
||||
${CMAKE_SOURCE_DIR}/external/tiff/prebuilt/linux/${ARCH_DIR}
|
||||
${CMAKE_SOURCE_DIR}/external/webp/prebuilt/linux/${ARCH_DIR}
|
||||
${CMAKE_SOURCE_DIR}/external/freetype2/prebuilt/linux/${ARCH_DIR}
|
||||
${CMAKE_SOURCE_DIR}/external/curl/prebuilt/linux/${ARCH_DIR}
|
||||
${CMAKE_SOURCE_DIR}/external/linux-specific/fmod/prebuilt/${ARCH_DIR}
|
||||
)
|
||||
if(WIN32)
|
||||
include_directories(
|
||||
${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/zlib/include
|
||||
external/curl/include/${PLATFORM_FOLDER}
|
||||
)
|
||||
elseif(APPLE)
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/include/${PLATFORM_FOLDER}
|
||||
)
|
||||
else()
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/fmod/include/${ARCH_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/include/${PLATFORM_FOLDER}/${ARCH_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
if(WIN32)
|
||||
link_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/prebuilt/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/png/prebuilt/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/webp/prebuilt/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/glfw3/prebuilt/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/prebuilt/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/prebuilt/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/gles/prebuilt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/icon/prebuilt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/zlib/prebuilt
|
||||
)
|
||||
elseif(APPLE)
|
||||
|
||||
else()
|
||||
|
||||
link_directories(
|
||||
/usr/local/lib
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/webp/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/png/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/fmod/prebuilt/${ARCH_DIR}
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
# kazmath
|
||||
|
|
|
@ -1,3 +1,34 @@
|
|||
if(WIN32)
|
||||
|
||||
ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
|
||||
|
||||
set(PLATFORM_SRC
|
||||
platform/win32/CCStdC.cpp
|
||||
platform/win32/CCFileUtilsWin32.cpp
|
||||
platform/win32/CCCommon.cpp
|
||||
platform/win32/CCApplication.cpp
|
||||
platform/win32/CCEGLView.cpp
|
||||
platform/win32/CCImage.cpp
|
||||
platform/win32/CCDevice.cpp
|
||||
)
|
||||
|
||||
elseif(APPLE)
|
||||
|
||||
else()
|
||||
|
||||
set(PLATFORM_SRC
|
||||
platform/linux/CCStdC.cpp
|
||||
platform/linux/CCFileUtilsLinux.cpp
|
||||
platform/linux/CCCommon.cpp
|
||||
platform/linux/CCApplication.cpp
|
||||
platform/linux/CCEGLView.cpp
|
||||
platform/linux/CCImage.cpp
|
||||
platform/linux/CCDevice.cpp
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
set(COCOS2D_SRC
|
||||
CCAction.cpp
|
||||
CCActionCamera.cpp
|
||||
|
@ -107,40 +138,57 @@ set(COCOS2D_SRC
|
|||
platform/CCThread.cpp
|
||||
platform/CCEGLViewProtocol.cpp
|
||||
platform/CCFileUtils.cpp
|
||||
platform/linux/CCStdC.cpp
|
||||
platform/linux/CCFileUtilsLinux.cpp
|
||||
platform/linux/CCCommon.cpp
|
||||
platform/linux/CCApplication.cpp
|
||||
platform/linux/CCEGLView.cpp
|
||||
platform/linux/CCImage.cpp
|
||||
platform/linux/CCDevice.cpp
|
||||
)
|
||||
|
||||
include(../physics/CMakeLists.txt)
|
||||
|
||||
add_library(cocos2d STATIC
|
||||
${COCOS2D_SRC}
|
||||
${PLATFORM_SRC}
|
||||
${COCOS_PHYSICS_SRC}
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(COCOS_LINK
|
||||
libjpeg
|
||||
libpng
|
||||
libwebp
|
||||
libtiff
|
||||
freetype250
|
||||
glfw3
|
||||
glew32
|
||||
opengl32
|
||||
libiconv
|
||||
libzlib
|
||||
)
|
||||
elseif(APPLE)
|
||||
|
||||
else()
|
||||
set(COCOS_LINK
|
||||
jpeg
|
||||
png
|
||||
webp
|
||||
tiff
|
||||
freetype
|
||||
pthread
|
||||
fontconfig
|
||||
glfw
|
||||
gles
|
||||
GLEW
|
||||
GL
|
||||
X11
|
||||
rt
|
||||
z
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(cocos2d
|
||||
cocosbase
|
||||
chipmunk_static
|
||||
tinyxml2
|
||||
kazmath
|
||||
unzip
|
||||
jpeg
|
||||
webp
|
||||
tiff
|
||||
freetype
|
||||
fontconfig
|
||||
png
|
||||
pthread
|
||||
glfw
|
||||
GLEW
|
||||
GL
|
||||
X11
|
||||
rt
|
||||
z
|
||||
${COCOS_LINK}
|
||||
)
|
||||
|
||||
set_target_properties(cocos2d
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
set(AUDIO_SRC
|
||||
linux/SimpleAudioEngineFMOD.cpp
|
||||
linux/FmodAudioPlayer.cpp
|
||||
)
|
||||
|
||||
# architecture
|
||||
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
set(ARCH_DIR "64-bit")
|
||||
|
@ -10,14 +5,31 @@ else()
|
|||
set(ARCH_DIR "32-bit")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
../../external/linux-specific/fmod/include/${ARCH_DIR}
|
||||
)
|
||||
if(WIN32)
|
||||
set(AUDIO_SRC
|
||||
win32/SimpleAudioEngine.cpp
|
||||
win32/MciPlayer.cpp
|
||||
)
|
||||
else(APPLE)
|
||||
|
||||
else()
|
||||
set(AUDIO_SRC
|
||||
linux/SimpleAudioEngineFMOD.cpp
|
||||
linux/FmodAudioPlayer.cpp
|
||||
)
|
||||
|
||||
include_directories(
|
||||
../../external/linux-specific/fmod/include/${ARCH_DIR}
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
add_library(audio STATIC
|
||||
${AUDIO_SRC}
|
||||
)
|
||||
|
||||
if((NOT APPLE) AND (NOT WIN32))
|
||||
|
||||
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
set(FMOD_LIB "fmodex64")
|
||||
else()
|
||||
|
@ -33,4 +45,4 @@ set_target_properties(audio
|
|||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib"
|
||||
)
|
||||
|
||||
endif()
|
||||
|
|
|
@ -1,16 +1,31 @@
|
|||
set(APP_NAME hellocpp)
|
||||
|
||||
if(WIN32)
|
||||
set(SAMPLE_SRC
|
||||
proj.win32/main.cpp
|
||||
Classes/AppDelegate.cpp
|
||||
Classes/HelloWorldScene.cpp
|
||||
)
|
||||
|
||||
else()
|
||||
set(SAMPLE_SRC
|
||||
proj.linux/main.cpp
|
||||
Classes/AppDelegate.cpp
|
||||
Classes/HelloWorldScene.cpp
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
# add the executable
|
||||
add_executable(${APP_NAME}
|
||||
${SAMPLE_SRC}
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
|
||||
set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
|
||||
endif(WIN32)
|
||||
|
||||
target_link_libraries(${APP_NAME} audio cocos2d)
|
||||
|
||||
set(APP_BIN_DIR "${CMAKE_SOURCE_DIR}/bin/${APP_NAME}")
|
||||
|
|
Загрузка…
Ссылка в новой задаче