cocos2d-X 纯.lib的使用
CMakeList.txt
:
{
cmake_minimum_required(VERSION 3.5)
######
## WINDOWS 32 bit library linux 64 bit library
######
project(CCS)
######################
message("please define target platform")
#add_definitions(-D WINDOWS)
#add_definitions(-D LINUX)
# 1 WINDOWS
# 0 LINUX
message("test project ,please define target platform, 1 WINDOWS ,0 LINUX")
set(PLATFOROM 1)
#set(PLATFOROM 0)
message("PROJECT_SOURCE_DIR is ${PROJECT_SOURCE_DIR}")
if(PLATFOROM)
add_definitions(-D UNICODE)
add_definitions(-D WINDOWS)
add_definitions(-D CC_STATIC)
else()
#add_definitions(-D LINUX)
endif()
include_directories(${PROJECT_SOURCE_DIR}/CCS)
include_directories(${PROJECT_SOURCE_DIR}/CCS/cocos2d)
include_directories(${PROJECT_SOURCE_DIR}/CCS/cocos2d/cocos)
include_directories(${PROJECT_SOURCE_DIR}/CCS/cocos2d/cocos/audio)
include_directories(${PROJECT_SOURCE_DIR}/CCS/cocos2d/cocos/audio/include)
include_directories(${PROJECT_SOURCE_DIR}/CCS/cocos2d/external)
include_directories(${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/glfw3/include/win32)
include_directories(${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/win32-specific/gles/include/OGLES)
include_directories(${PROJECT_SOURCE_DIR}/../NDKLIB/src)
include_directories(${PROJECT_SOURCE_DIR}/../NDKLIB/src/socket)
include_directories(${PROJECT_SOURCE_DIR}/../NDKLIB/src/socket/Private)
include_directories(${PROJECT_SOURCE_DIR}/../NDKLIB/src/defined)
include_directories(${PROJECT_SOURCE_DIR}/../NDKLIB/src/Database)
include_directories(${PROJECT_SOURCE_DIR}/../NDKLIB/src/Tools)
if(PLATFOROM)
set(PLATFROMDEP
opengl32.lib
odbc32.lib
ws2_32.lib
Version.lib
Winmm.lib
${PROJECT_SOURCE_DIR}/../NDKLIB/build/Debug/libNDKLIBRARY.lib
${PROJECT_SOURCE_DIR}/CCS/x86/lib/Debug/cocos2d.lib
${PROJECT_SOURCE_DIR}/CCS/x86/lib/Debug/flatbuffers.lib
${PROJECT_SOURCE_DIR}/CCS/x86/lib/Debug/recast.lib
${PROJECT_SOURCE_DIR}/CCS/x86/lib/Debug/tinyxml2.lib
${PROJECT_SOURCE_DIR}/CCS/x86/lib/Debug/unzip.lib
${PROJECT_SOURCE_DIR}/CCS/x86/lib/Debug/xxhash.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/Box2D/prebuilt/win32/debug/libbox2d.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/bullet/prebuilt/win32/debug/libbullet.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/chipmunk/prebuilt/win32/debug-lib/libchipmunk.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/curl/prebuilt/win32/libcurl.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/freetype2/prebuilt/win32/freetype.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/glfw3/prebuilt/win32/glfw3.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/jpeg/prebuilt/win32/libjpeg.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/openssl/prebuilt/win32/libcrypto.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/openssl/prebuilt/win32/libssl.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/png/prebuilt/win32/libpng.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/sqlite3/libraries/win32/sqlite3.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/tiff/prebuilt/win32/libtiff.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/webp/prebuilt/win32/libwebp.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/websockets/prebuilt/win32/websockets.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/win32-specific/gles/prebuilt/glew32.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/win32-specific/icon/prebuilt/libiconv.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/win32-specific/MP3Decoder/prebuilt/libmpg123.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/win32-specific/OggDecoder/prebuilt/libogg.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/win32-specific/OggDecoder/prebuilt/libvorbis.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/win32-specific/OggDecoder/prebuilt/libvorbisfile.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/win32-specific/OpenalSoft/prebuilt/OpenAL32.lib
${PROJECT_SOURCE_DIR}/CCS/cocos2d/external/win32-specific/zlib/prebuilt/libzlib.lib
)
else()
#set(PLATFROMDEP )
endif()
set(CCS_HEADER
${PROJECT_SOURCE_DIR}/../NDKLIB/src/Database/SQLServerEngine.h
${PROJECT_SOURCE_DIR}/../NDKLIB/src/Database/SQL/SQLServer.h
src/AppDelegate.h
src/MainScene.h
)
set(CCS_SOURCE
${PROJECT_SOURCE_DIR}/../NDKLIB/src/Database/SQLServerEngine.cpp
${PROJECT_SOURCE_DIR}/../NDKLIB/src/Database/SQL/SQLServer.cpp
src/AppDelegate.cpp
src/MainScene.cpp
src/main.cpp
)
list(APPEND CCS_SOURCE ${CCS_HEADER})
add_executable(CCS ${CCS_SOURCE} )
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:LIBC.LIB")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:LIBC.LIB")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:LIBC.LIB")
endif (CMAKE_SYSTEM_NAME MATCHES "Windows")
target_link_libraries(CCS PUBLIC ${PLATFROMDEP})
}