mirror of https://github.com/axmolengine/axmol.git
60 lines
2.3 KiB
CMake
60 lines
2.3 KiB
CMake
![]() |
file(GLOB chipmunk_source_files "*.c")
|
||
|
file(GLOB chipmunk_public_header "${chipmunk_SOURCE_DIR}/include/chipmunk/*.h")
|
||
|
|
||
|
include_directories(${chipmunk_SOURCE_DIR}/include)
|
||
|
|
||
|
# Chipmunk2D 7.0.3
|
||
|
set(CHIPMUNK_VERSION_MAJOR 7)
|
||
|
set(CHIPMUNK_VERSION_MINOR 0)
|
||
|
set(CHIPMUNK_VERSION_PATCH 3)
|
||
|
set(CHIPMUNK_VERSION "${CHIPMUNK_VERSION_MAJOR}.${CHIPMUNK_VERSION_MINOR}.${CHIPMUNK_VERSION_PATCH}")
|
||
|
message("Configuring Chipmunk2D version ${CHIPMUNK_VERSION}")
|
||
|
|
||
|
|
||
|
if(CP_BUILD_SHARED)
|
||
|
add_library(chipmunk SHARED
|
||
|
${chipmunk_source_files}
|
||
|
)
|
||
|
# Tell MSVC to compile the code as C++.
|
||
|
if(MSVC)
|
||
|
set_source_files_properties(${chipmunk_source_files} PROPERTIES LANGUAGE CXX)
|
||
|
set_target_properties(chipmunk PROPERTIES LINKER_LANGUAGE CXX)
|
||
|
endif(MSVC)
|
||
|
# set the lib's version number
|
||
|
# But avoid on Android because symlinks to version numbered .so's don't work with Android's Java-side loadLibrary.
|
||
|
if(NOT ANDROID)
|
||
|
set_target_properties(chipmunk PROPERTIES
|
||
|
SOVERSION ${CHIPMUNK_VERSION_MAJOR}
|
||
|
VERSION ${CHIPMUNK_VERSION})
|
||
|
endif(NOT ANDROID)
|
||
|
if(ANDROID OR UNIX)
|
||
|
# need to explicitly link to the math library because the CMake/Android toolchains may not do it automatically
|
||
|
target_link_libraries(chipmunk m)
|
||
|
endif(ANDROID OR UNIX)
|
||
|
install(TARGETS chipmunk RUNTIME DESTINATION ${BIN_INSTALL_DIR}
|
||
|
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
||
|
ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
|
||
|
endif(CP_BUILD_SHARED)
|
||
|
|
||
|
if(CP_BUILD_STATIC)
|
||
|
add_library(chipmunk STATIC
|
||
|
${chipmunk_source_files}
|
||
|
)
|
||
|
# Tell MSVC to compile the code as C++.
|
||
|
if(MSVC)
|
||
|
set_source_files_properties(${chipmunk_source_files} PROPERTIES LANGUAGE CXX)
|
||
|
set_target_properties(chipmunk PROPERTIES LINKER_LANGUAGE CXX)
|
||
|
endif(MSVC)
|
||
|
# Sets chipmunk to output "libchipmunk.a" not "libchipmunk.a"
|
||
|
set_target_properties(chipmunk PROPERTIES OUTPUT_NAME chipmunk)
|
||
|
if(CP_INSTALL_STATIC)
|
||
|
install(TARGETS chipmunk ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
|
||
|
endif(CP_INSTALL_STATIC)
|
||
|
endif(CP_BUILD_STATIC)
|
||
|
|
||
|
if(CP_BUILD_SHARED OR CP_INSTALL_STATIC)
|
||
|
# FIXME: change to PUBLIC_HEADER to allow building frameworks
|
||
|
install(FILES ${chipmunk_public_header} DESTINATION include/chipmunk)
|
||
|
install(FILES ${chipmunk_constraint_header} DESTINATION include/chipmunk/constraints)
|
||
|
endif(CP_BUILD_SHARED OR CP_INSTALL_STATIC)
|