Skip to content

Commit

Permalink
CMake fixes for Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
ivansafrin committed Nov 11, 2011
1 parent 1bf0c87 commit fe565d2
Show file tree
Hide file tree
Showing 31 changed files with 3,156 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
*.xcuserdata
*.orig

/Player/Build
/Standalone/Build
/Dependencies/Build
/Dependencies/Downloads
/Core/Build/Mac\ OS\ X/build
/IDE/Build/Mac\ OS\ X/build
/Modules/Build/Mac\ OS\ X/build
/Tools/Build/Mac\ OS\ X/build
/Player/Build/Mac\ OS\ X/build
/Bindings/Build/Mac\ OS\ X/build
/Core/Dependencies
/Modules/Dependencies
Expand Down
Binary file added Assets/SamplePolyapp/main.polyapp
Binary file not shown.
2 changes: 1 addition & 1 deletion Bindings/Contents/LUA/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
INCLUDE(PolycodeIncludes)

FIND_PACKAGE(Lua51 REQUIRED)
FIND_PACKAGE(Lua REQUIRED)

INCLUDE_DIRECTORIES(
${LUA_INCLUDE_DIR}
Expand Down
92 changes: 92 additions & 0 deletions CMake/FindLua.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@

SET(LUA_SEARCH_PATHS
${POLYCODE_RELEASE_DIR}/Framework/Core/Dependencies/lib
${POLYCODE_RELEASE_DIR}/Framework/Core/Dependencies/include
${POLYCODE_RELEASE_DIR}/Framework/Core/Dependencies/include/lua5.1
${POLYCODE_RELEASE_DIR}/Framework/Modules/Dependencies/lib
${POLYCODE_RELEASE_DIR}/Framework/Tools/Dependencies/lib
)

SET(MSVC_YEAR_NAME)
IF (MSVC_VERSION GREATER 1599) # >= 1600
SET(MSVC_YEAR_NAME VS2010)
ELSEIF(MSVC_VERSION GREATER 1499) # >= 1500
SET(MSVC_YEAR_NAME VS2008)
ELSEIF(MSVC_VERSION GREATER 1399) # >= 1400
SET(MSVC_YEAR_NAME VS2005)
ELSEIF(MSVC_VERSION GREATER 1299) # >= 1300
SET(MSVC_YEAR_NAME VS2003)
ELSEIF(MSVC_VERSION GREATER 1199) # >= 1200
SET(MSVC_YEAR_NAME VS6)
ENDIF()

FIND_PATH(LUA_INCLUDE_DIR
NAMES lua.h
HINTS
$ENV{LUADIR}
$ENV{LUA_PATH}
PATH_SUFFIXES include include/lua5.1 lua5.1
PATHS ${LUA_SEARCH_PATHS}
)

FIND_LIBRARY(LUA_LIBRARY
NAMES lua5.1 liblua5.1
HINTS
NO_DEFAULT_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_PATH
CMAKE_FIND_FRAMEWORK NEVER
$ENV{LUADIR}
$ENV{LUA_PATH}
PATH_SUFFIXES lib lib64 win32/Dynamic_Release "Win32/${MSVC_YEAR_NAME}/x64/Release" "Win32/${MSVC_YEAR_NAME}/Win32/Release"
PATHS ${LUA_SEARCH_PATHS}
)

# First search for d-suffixed libs
FIND_LIBRARY(LUA_LIBRARY_DEBUG
NAMES lua5.1d liblua5.1d
HINTS
NO_DEFAULT_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_PATH
CMAKE_FIND_FRAMEWORK NEVER
$ENV{LUADIR}
$ENV{LUA_PATH}
PATH_SUFFIXES lib lib64 win32/Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug"
PATHS ${LUA_SEARCH_PATHS}
)

IF(NOT LUA_LIBRARY_DEBUG)
# Then search for non suffixed libs if necessary, but only in debug dirs
FIND_LIBRARY(LUA_LIBRARY_DEBUG
NAMES lua liblua libliblua
HINTS
NO_DEFAULT_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_PATH
CMAKE_FIND_FRAMEWORK NEVER
$ENV{LUADIR}
$ENV{LUA_PATH}
PATH_SUFFIXES win32/Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug"
PATHS ${LUA_SEARCH_PATHS}
)
ENDIF()


IF(LUA_LIBRARY)
IF(LUA_LIBRARY_DEBUG)
SET(LUA_LIBRARIES optimized "${LUA_LIBRARY}" debug "${LUA_LIBRARY_DEBUG}")
ELSE()
SET(LUA_LIBRARIES "${LUA_LIBRARY}") # Could add "general" keyword, but it is optional
ENDIF()
ENDIF()

# handle the QUIETLY and REQUIRED arguments and set XXX_FOUND to TRUE if all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LUA DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR)
2 changes: 2 additions & 0 deletions CMake/PolycodeIncludes.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ FIND_PACKAGE(Freetype REQUIRED)
FIND_PACKAGE(Ogg REQUIRED)
FIND_PACKAGE(Vorbis REQUIRED)
FIND_PACKAGE(VorbisFile REQUIRED)
FIND_PACKAGE(Lua REQUIRED)

# Use SDL on non-Apple unixes
IF(UNIX AND NOT APPLE)
Expand All @@ -37,4 +38,5 @@ INCLUDE_DIRECTORIES(
${VORBISFILE_INCLUDE_DIR}
${PNG_INCLUDE_DIR}
${OPENGLEXT_INCLUDE_DIR}
${LUA_INCLUDE_DIR}
)
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ ENDIF(NOT CMAKE_BUILD_TYPE)
# Options for what components to build
#OPTION(POLYCODE_BUILD_SHARED "Build Polycode shared libraries" OFF)
#OPTION(POLYCODE_BUILD_STATIC "Build Polycode static libraries" ON)
#OPTION(POLYCODE_BUILD_BINDINGS "Build Polycode Lua bindings" ON)
OPTION(POLYCODE_BUILD_BINDINGS "Build Polycode Lua bindings" ON)
OPTION(POLYCODE_BUILD_MODULES "Build Polycode modules" ON)
OPTION(POLYCODE_BUILD_PLAYER "Build Polycode standalone player" OFF)
OPTION(POLYCODE_BUILD_PLAYER "Build Polycode standalone player" ON)
OPTION(POLYCODE_BUILD_TOOLS "Build Polycode tools" ON)
OPTION(POLYCODE_BUILD_DOCS "Build Polycode documentation" ON)

Expand Down
25 changes: 24 additions & 1 deletion Modules/Bindings/2DPhysics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,43 @@ INCLUDE_DIRECTORIES(
${BOX2D_INCLUDE_DIR}
${Polycode_SOURCE_DIR}/Modules/Contents/2DPhysics/Include
Include
../../Contents/2DPhysics/Include
)

SET(polycode2DPhysics_SRCS
Source/Physics2DLUA.cpp
../../Contents/2DPhysics/Source/PolyPhysicsScreen.cpp
../../Contents/2DPhysics/Source/PolyPhysicsScreenEntity.cpp
)

SET(polycode2DPhysics_HDRS
Include/Physics2DLUA.h
Include/Physics2DLUAWrappers.h
../../Contents/2DPhysics/Include/Polycode2DPhysics.h
../../Contents/2DPhysics/Include/PolyPhysicsScreenEntity.h
../../Contents/2DPhysics/Include/PolyPhysicsScreen.h
)

ADD_LIBRARY(Physics2D ${polycode2DPhysics_SRCS} ${polycode2DPhysics_HDRS})
ADD_LIBRARY(Physics2D SHARED ${polycode2DPhysics_SRCS} ${polycode2DPhysics_HDRS})
SET(CMAKE_DEBUG_POSTFIX "_d")

SET_TARGET_PROPERTIES(Physics2D PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(Physics2D
Polycore
${LUA_LIBRARY}
${BOX2D_RELEASE_LIBRARY}
"-framework Cocoa"
"-framework IOKit"
${OPENGL_LIBRARIES}
${OPENAL_LIBRARY}
${PNG_LIBRARIES}
${FREETYPE_LIBRARIES}
${PHYSFS_LIBRARY}
${OGG_LIBRARIES}
${VORBIS_LIBRARIES}
${VORBISFILE_LIBRARIES}
${EXTRA_LIBS})

IF(POLYCODE_INSTALL_FRAMEWORK)

# install headers
Expand Down
31 changes: 30 additions & 1 deletion Modules/Bindings/3DPhysics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,56 @@
INCLUDE(PolycodeIncludes)

FIND_PACKAGE(Lua51 REQUIRED)
FIND_PACKAGE(Bullet REQUIRED)

INCLUDE_DIRECTORIES(
${LUA_INCLUDE_DIR}
${BULLET_INCLUDE_DIR}
${Polycode_SOURCE_DIR}/Modules/Contents/3DPhysics/Include
Include
../../Contents/3DPhysics/Include
)

SET(polycode3DPhysics_SRCS
Source/Physics3DLUA.cpp
../../Contents/3DPhysics/Source/PolyPhysicsSceneEntity.cpp
../../Contents/3DPhysics/Source/PolyPhysicsScene.cpp
../../Contents/3DPhysics/Source/PolyCollisionSceneEntity.cpp
../../Contents/3DPhysics/Source/PolyCollisionScene.cpp
)

SET(polycode3DPhysics_HDRS
Include/Physics3DLUA.h
Include/Physics3DLUAWrappers.h
../../Contents/3DPhysics/Include/PolyPhysicsSceneEntity.h
../../Contents/3DPhysics/Include/Polycode3DPhysics.h
../../Contents/3DPhysics/Include/PolyCollisionScene.h
../../Contents/3DPhysics/Include/PolyPhysicsScene.h
../../Contents/3DPhysics/Include/PolyCollisionSceneEntity.h
)

ADD_LIBRARY(Physics3D ${polycode3DPhysics_SRCS} ${polycode3DPhysics_HDRS})
ADD_LIBRARY(Physics3D SHARED ${polycode3DPhysics_SRCS} ${polycode3DPhysics_HDRS})

SET(CMAKE_DEBUG_POSTFIX "_d")

SET_TARGET_PROPERTIES(Physics3D PROPERTIES PREFIX "")

TARGET_LINK_LIBRARIES(Physics3D
Polycore
${LUA_LIBRARY}
${BULLET_LIBRARIES}
"-framework Cocoa"
"-framework IOKit"
${OPENGL_LIBRARIES}
${OPENAL_LIBRARY}
${PNG_LIBRARIES}
${FREETYPE_LIBRARIES}
${PHYSFS_LIBRARY}
${OGG_LIBRARIES}
${VORBIS_LIBRARIES}
${VORBISFILE_LIBRARIES}
${EXTRA_LIBS})

IF(POLYCODE_INSTALL_FRAMEWORK)

# install headers
Expand Down
Loading

0 comments on commit fe565d2

Please sign in to comment.