Skip to content

Commit

Permalink
Make COCOS2D_DEBUG span throughout libcocos2d in Linux (cocos2d#17033)
Browse files Browse the repository at this point in the history
CCASSERT and other macros that are affected by COCOS2D_DEBUG will now be
properly defined for debugging builds in Linux.
  • Loading branch information
Rubonnek authored and minggo committed Dec 20, 2016
1 parent 77d0e82 commit 035aab2
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions templates/cpp-template-default/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ set(COCOS2D_ROOT ${CMAKE_SOURCE_DIR}/cocos2d)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${COCOS2D_ROOT}/cmake/Modules/")
include(CocosBuildHelpers)

# libcocos2d
set(BUILD_CPP_EMPTY_TEST OFF CACHE BOOL "turn off build cpp-empty-test")
set(BUILD_CPP_TESTS OFF CACHE BOOL "turn off build cpp-tests")
set(BUILD_LUA_LIBS OFF CACHE BOOL "turn off build lua related targets")
set(BUILD_JS_LIBS OFF CACHE BOOL "turn off build js related targets")
add_subdirectory(${COCOS2D_ROOT})

# Some macro definitions
if(WINDOWS)
Expand Down Expand Up @@ -69,15 +63,18 @@ endif()
# Compiler options
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:msvcrt /NODEFAULTLIB:libcmt")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:msvcrt /NODEFAULTLIB:libcmt")
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:libcmt")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:libcmt")
endif()
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
-wd4251 -wd4244 -wd4334 -wd4005 -wd4820 -wd4710
-wd4514 -wd4056 -wd4996 -wd4099)
else()
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
if(CMAKE_BUILD_TYPE MATCHES Debug)
ADD_DEFINITIONS(-DCOCOS2D_DEBUG=1)
endif()
set(CMAKE_C_FLAGS_DEBUG "-g -Wall")
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 -Wno-deprecated-declarations -Wno-reorder")
Expand All @@ -86,7 +83,6 @@ else()
endif()
endif(MSVC)


set(PLATFORM_SPECIFIC_SRC)
set(PLATFORM_SPECIFIC_HEADERS)

Expand Down Expand Up @@ -139,6 +135,16 @@ set(GAME_HEADERS
${PLATFORM_SPECIFIC_HEADERS}
)


# Configure libcocos2d
set(BUILD_CPP_EMPTY_TEST OFF CACHE BOOL "turn off build cpp-empty-test")
set(BUILD_CPP_TESTS OFF CACHE BOOL "turn off build cpp-tests")
set(BUILD_LUA_LIBS OFF CACHE BOOL "turn off build lua related targets")
set(BUILD_JS_LIBS OFF CACHE BOOL "turn off build js related targets")
add_subdirectory(${COCOS2D_ROOT})


# MyGame
if( ANDROID )
add_library(${APP_NAME} SHARED ${GAME_SRC} ${GAME_HEADERS})
IF(CMAKE_BUILD_TYPE MATCHES RELEASE)
Expand Down

0 comments on commit 035aab2

Please sign in to comment.