mirror of https://github.com/axmolengine/axmol.git
Unify usage of chipmunk library
* cmake/Modules/FindChipmunk.cmake now can find prebuilt chipmunk libs * follow USE_CHIPMUNK variable (although at the moment cocos can't build without chipmunk) * come cleanups and formatting
This commit is contained in:
parent
aaff42d6a9
commit
eb0159b2b7
|
@ -168,11 +168,9 @@ include_directories(
|
|||
|
||||
# GLFW3 used on Mac, Windows and Linux desktop platforms
|
||||
if(LINUX OR MACOSX OR WINDOWS)
|
||||
|
||||
find_package(GLFW3 REQUIRED)
|
||||
message(STATUS "GLFW3 include dirs: ${GLFW3_INCLUDE_DIRS}")
|
||||
include_directories(${GLFW3_INCLUDE_DIRS})
|
||||
|
||||
endif(LINUX OR MACOSX OR WINDOWS)
|
||||
|
||||
# Freetype required on all platforms
|
||||
|
@ -184,14 +182,19 @@ include_directories(${FREETYPE_INCLUDE_DIRS})
|
|||
if(USE_WEBP)
|
||||
find_package(WebP REQUIRED)
|
||||
message(STATUS "WebP include dirs: ${WEBP_INCLUDE_DIRS}")
|
||||
endif()
|
||||
endif(USE_WEBP)
|
||||
|
||||
if(USE_CHIPMUNK)
|
||||
find_package(Chipmunk REQUIRED)
|
||||
message(STATUS "Chipmunk include dirs: ${CHIPMUNK_INCLUDE_DIRS}")
|
||||
add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=1)
|
||||
endif(USE_CHIPMUNK)
|
||||
|
||||
if(NOT MINGW)
|
||||
|
||||
include_directories(
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/tinyxml2
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/chipmunk/include/chipmunk
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/box2d/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/include/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/png/include/${PLATFORM_FOLDER}
|
||||
|
@ -208,7 +211,6 @@ if(NOT MINGW)
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER_ARCH}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/png/prebuilt/${PLATFORM_FOLDER_ARCH}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/websockets/prebuilt/${PLATFORM_FOLDER_ARCH}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/chipmunk/prebuilt/${PLATFORM_FOLDER_ARCH}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/box2d/prebuilt/${PLATFORM_FOLDER_ARCH}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/prebuilt/${PLATFORM_FOLDER_ARCH}
|
||||
|
||||
|
|
|
@ -27,6 +27,29 @@
|
|||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
if(USE_PREBUILT_LIBS)
|
||||
find_path(CHIPMUNK_INCLUDE_DIR chipmunk.h
|
||||
PATH_SUFFIXES
|
||||
include/chipmunk
|
||||
include
|
||||
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/external/chipmunk
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
find_library(CHIPMUNK_LIBRARY
|
||||
NAMES chipmunk libchipmunk
|
||||
PATH_SUFFIXES
|
||||
prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
|
||||
prebuilt/${PLATFORM_FOLDER}
|
||||
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/external/chipmunk
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
# cleanup if not found (prevent from mix prebuilt include paths and system installed libraries)
|
||||
if(NOT CHIPMUNK_INCLUDE_DIR OR NOT CHIPMUNK_LIBRARY)
|
||||
unset(CHIPMUNK_INCLUDE_DIR CACHE)
|
||||
unset(CHIPMUNK_LIBRARY CACHE)
|
||||
endif()
|
||||
endif(USE_PREBUILT_LIBS)
|
||||
|
||||
FIND_PATH(CHIPMUNK_INCLUDE_DIR chipmunk.h
|
||||
HINTS
|
||||
ENV CHIPMUNK_DIR
|
||||
|
|
|
@ -88,13 +88,10 @@ if(MINGW)
|
|||
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
find_package(Chipmunk REQUIRED)
|
||||
|
||||
message( STATUS "ZLIB dirs: ${ZLIB_INCLUDE_DIRS}")
|
||||
message( STATUS "Chipmunk dirs: ${CHIPMUNK_INCLUDE_DIRS}")
|
||||
message( STATUS "Protobuf dirs: ${PROTOBUF_INCLUDE_DIRS}")
|
||||
|
||||
include_directories(${ZLIB_INCLUDE_DIRS} ${CHIPMUNK_INCLUDE_DIRS} ${PROTOBUF_INCLUDE_DIRS})
|
||||
include_directories(${ZLIB_INCLUDE_DIRS} ${PROTOBUF_INCLUDE_DIRS})
|
||||
|
||||
else()
|
||||
|
||||
|
@ -163,7 +160,7 @@ if(LINUX OR MACOSX OR WINDOWS)
|
|||
list(APPEND PLATFORM_SPECIFIC_LIBS ${GLFW3_LIBRARIES})
|
||||
endif()
|
||||
|
||||
target_link_libraries(cocos2d chipmunk box2d protobuf tinyxml2 unzip xxhash ${FREETYPE_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS})
|
||||
target_link_libraries(cocos2d box2d protobuf tinyxml2 unzip xxhash ${FREETYPE_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS})
|
||||
|
||||
if(USE_WEBP)
|
||||
add_definitions(-DCC_USE_WEBP=1)
|
||||
|
@ -173,6 +170,11 @@ else()
|
|||
add_definitions(-DCC_USE_WEBP=0)
|
||||
endif()
|
||||
|
||||
if(USE_CHIPMUNK)
|
||||
include_directories(${CHIPMUNK_INCLUDE_DIRS})
|
||||
target_link_libraries(cocos2d ${CHIPMUNK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
set_target_properties(cocos2d
|
||||
PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
|
|
|
@ -2,19 +2,6 @@ if(WINDOWS AND NOT BUILD_STATIC)
|
|||
ADD_DEFINITIONS (-D_USREXDLL)
|
||||
endif()
|
||||
|
||||
if(WINDOWS)
|
||||
|
||||
# set(PLATFORM_EXTENSIONS_SRC
|
||||
# ../extensions/proj.win32/Win32InputBox.cpp
|
||||
# )
|
||||
|
||||
elseif(MACOSX)
|
||||
|
||||
else()
|
||||
# set(PLATFORM_EXTENSIONS_SRC
|
||||
# ../../extensions/GUI/CCEditBox/CCEditBoxImplNone.cpp)
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
../../extensions
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue