Add the makefiles to the repository
This commit is contained in:
parent
63f887dc07
commit
bdf9acb54f
21
CMakeLists.txt
Normal file → Executable file
21
CMakeLists.txt
Normal file → Executable file
|
@ -1,12 +1,17 @@
|
||||||
# Minimum cmake version required
|
# Minimum cmake version required
|
||||||
cmake_minimum_required(VERSION 2.6)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||||
|
|
||||||
# Project configuration
|
# Project configuration
|
||||||
project(ReactPhysics3D)
|
PROJECT(REACTPHYSICS3D)
|
||||||
set(LIBRARY_OUTPUT_PATH lib/)
|
|
||||||
|
# Where to build the library
|
||||||
|
SET(LIBRARY_OUTPUT_PATH lib/)
|
||||||
|
|
||||||
|
# Options
|
||||||
|
OPTION(COMPILE_EXAMPLES "Select this if you want to build the examples" OFF)
|
||||||
|
|
||||||
# Headers
|
# Headers
|
||||||
include_directories(src)
|
INCLUDE_DIRECTORIES(src)
|
||||||
|
|
||||||
# Library configuration
|
# Library configuration
|
||||||
file (
|
file (
|
||||||
|
@ -15,8 +20,14 @@ file (
|
||||||
src/*
|
src/*
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library (
|
# Require the reactphysics3d code to be compiled in a static library
|
||||||
|
ADD_LIBRARY (
|
||||||
reactphysics3d
|
reactphysics3d
|
||||||
STATIC
|
STATIC
|
||||||
${source_files}
|
${source_files}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# If we need to compile the examples
|
||||||
|
IF (COMPILE_EXAMPLES)
|
||||||
|
add_subdirectory(examples/fallingcubes)
|
||||||
|
ENDIF (COMPILE_EXAMPLES)
|
||||||
|
|
50
examples/fallingbox/CMakeLists.txt
Executable file
50
examples/fallingbox/CMakeLists.txt
Executable file
|
@ -0,0 +1,50 @@
|
||||||
|
# Minimum cmake version required
|
||||||
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
|
# Project configuration
|
||||||
|
PROJECT(FallingCubes)
|
||||||
|
|
||||||
|
# Headers
|
||||||
|
INCLUDE_DIRECTORIES(${REACTPHYSICS3D_SOURCE_DIR}/src)
|
||||||
|
|
||||||
|
# Find Glut or Freeglut
|
||||||
|
if(WIN32 OR APPLE)
|
||||||
|
# Find the necessary libraries
|
||||||
|
FIND_PACKAGE(GLUT)
|
||||||
|
else()
|
||||||
|
# Find the Freeglut library
|
||||||
|
FIND_PATH(FREEGLUT_INCLUDE_DIR NAMES GL/freeglut.h
|
||||||
|
/usr/include/GL
|
||||||
|
)
|
||||||
|
FIND_LIBRARY(FREEGLUT_LIBRARY NAMES freeglut glut)
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FREEGLUT DEFAULT_MSG FREEGLUT_LIBRARY FREEGLUT_INCLUDE_DIR)
|
||||||
|
IF(FREEGLUT_FOUND)
|
||||||
|
MESSAGE("Freeglut found")
|
||||||
|
SET(FREEGLUT_LIBRARIES ${FREEGLUT_LIBRARY})
|
||||||
|
SET(FREEGLUT_INCLUDE_DIRS ${FREEGLUT_INCLUDE_DIR})
|
||||||
|
else()
|
||||||
|
MESSAGE("Freeglut not found (required to build the examples)")
|
||||||
|
SET(FREEGLUT_LIBRARIES)
|
||||||
|
SET(FREEGLUT_INCLUDE_DIRS)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find OpenGL
|
||||||
|
FIND_PACKAGE(OpenGL)
|
||||||
|
if(OPENGL_FOUND)
|
||||||
|
MESSAGE("OpenGL found")
|
||||||
|
else()
|
||||||
|
MESSAGE("OpenGL not found")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# Create the example executable using the
|
||||||
|
# compiled reactphysics3d static library
|
||||||
|
ADD_EXECUTABLE(fallingcubes main.cpp Box.cpp Box.h)
|
||||||
|
|
||||||
|
if(WIN32 OR APPLE)
|
||||||
|
TARGET_LINK_LIBRARIES(fallingcubes reactphysics3d ${GLUT_LIBRARY} ${OPENGL_LIBRARY})
|
||||||
|
elseif(FREEGLUT_FOUND)
|
||||||
|
TARGET_LINK_LIBRARIES(fallingcubes reactphysics3d ${FREEGLUT_LIBRARY} ${OPENGL_LIBRARY})
|
||||||
|
endif()
|
Loading…
Reference in New Issue
Block a user