Commit 9e8f2b81 authored by Eric Bruneton's avatar Eric Bruneton
Browse files

patch #11282 from Tapio Vierros

git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/ork/trunk@9 28599a00-4e59-401b-b2d8-d34d4661a6c9
parent 81f99889
project(Ork CXX C)
cmake_minimum_required(VERSION 2.6)
cmake_policy(VERSION 2.6)
# Avoid source tree pollution
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-source builds are not permitted. Make a separate folder for building:\nmkdir build; cd build; cmake ..\nBefore that, remove the files already created:\nrm -rf CMakeCache.txt CMakeFiles")
endif(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
# Add a sensible build type default and warning because empty means no optimization and no debug info.
if(NOT CMAKE_BUILD_TYPE)
message("WARNING: CMAKE_BUILD_TYPE is not defined!\n Defaulting to CMAKE_BUILD_TYPE=RelWithDebInfo. Use ccmake to set a proper value.")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif(NOT CMAKE_BUILD_TYPE)
# Common deps
find_package(PkgConfig)
PKG_CHECK_MODULES(Glew glew REQUIRED)
include_directories(${Glew_INCLUDE_DIRS})
link_directories(${Glew_LIBRARY_DIRS})
find_package(GLUT)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
add_definitions("-DORK_API=" "-DTIXML_USE_STL" "-fPIC")
option(BUILD_SHARED "Build shared library instead of static" OFF)
option(BUILD_EXAMPLES "Build examples" ON )
option(BUILD_TESTS "Build tests" ON )
# Sub dirs
add_subdirectory(libraries)
add_subdirectory(ork)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif(BUILD_EXAMPLES)
if(BUILD_TESTS)
add_subdirectory(test)
endif(BUILD_TESTS)
......@@ -12,7 +12,7 @@ Ork also requires the following external libraries:
- pthreads-2.8.0 (only the task graph and scene graph frameworks)
- glut or freeglut (only for the GlutWindow class)
INSTALLATION
INSTALLATION WITH PROJECT FILES
------------------------------------------------------------------------------
Ork comes with two project files, one for Code::Blocks (either on Windows or
......@@ -34,6 +34,29 @@ The USE_SHARED_PTR preprocessor flag can be set to use std::tr1::shared_ptr
an Ork specific implementation (potentially more efficient since based on
intrusive counters).
INSTALLATION WITH CMAKE
------------------------------------------------------------------------------
CMake (http://www.cmake.org) is a cross-platform build system able to generate
Makefiles and project files for various IDEs.
The following instructions assume Linux/MSYS-like environment.
$ mkdir build
$ cd build
$ cmake ..
$ make
It will output a library to $SOURCE_DIR/lib and executables to $SOURCE_DIR/bin
You can control the build with certain variables that can be edited with a
CMake GUI, such as ccmake, or by directly giving arguments to cmake in the
form: -DVARIABLE_NAME=VALUE
The variables (and their defaults) are:
BUILD_SHARED OFF
BUILD_EXAMPLES ON
BUILD_TESTS ON
CMAKE_BUILD_TYPE RelWithDebInfo
UNIT TESTS
------------------------------------------------------------------------------
......
cmake_minimum_required(VERSION 2.6)
set(EXENAME ork-examples)
# Sources
include_directories("${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/libraries" "${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB SOURCE_FILES *.cpp)
add_definitions("-DORK_API=")
add_executable(${EXENAME} ${SOURCE_FILES})
target_link_libraries(${EXENAME} ork)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
add_subdirectory(stbi)
add_subdirectory(tinyxml)
set(LIBNAME "stb_image")
# Sources
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB SOURCE_FILES *.cpp)
# Create a static library
add_library(${LIBNAME} STATIC ${SOURCE_FILES})
link_directories(${CMAKE_CURRENT_BINARY_DIR})
set(LIBNAME "tinyxml")
# Sources
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB SOURCE_FILES *.cpp)
add_definitions("-DORK_API=" "-DTIXML_USE_STL")
# Create a static library
add_library(${LIBNAME} STATIC ${SOURCE_FILES})
link_directories(${CMAKE_CURRENT_BINARY_DIR})
set(LIBNAME "ork")
# Sources
include_directories("${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/libraries" "${PROJECT_SOURCE_DIR}/libraries/*")
file(GLOB SOURCE_FILES *.cpp */*.cpp)
# Libraries
set(LIBS GLEW glut pthread stb_image tinyxml)
if(UNIX)
set(LIBS ${LIBS} rt)
endif(UNIX)
# Static or shared?
set(LIBTYPE STATIC)
if(BUILD_SHARED)
set(LIBTYPE SHARED)
endif(BUILD_SHARED)
# Create a static library
add_library(${LIBNAME} ${LIBTYPE} ${SOURCE_FILES})
target_link_libraries(${LIBNAME} ${LIBS})
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
link_directories(${PROJECT_SOURCE_DIR}/lib)
cmake_minimum_required(VERSION 2.6)
set(EXENAME ork-test)
# Sources
include_directories("${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/libraries" "${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB SOURCE_FILES *.cpp)
add_definitions("-DORK_API=")
add_executable(${EXENAME} ${SOURCE_FILES})
target_link_libraries(${EXENAME} ork)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment