Skip to content

Commit

Permalink
CMake trial setup complete
Browse files Browse the repository at this point in the history
  • Loading branch information
NelisDrost committed Nov 6, 2012
1 parent 6469218 commit 6d3e2d5
Show file tree
Hide file tree
Showing 680 changed files with 45,203 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Thumbs.db
*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.sln.docstates
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
*.vssscc
$tf*/

# Libraries
*.lib
*.a

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app

# Compiled Object files
*.slo
*.lo
*.o

# Compiled Dynamic libraries
*.so
*.dylib

# Compiled Static libraries
*.lai
*.la

# CMake/build directory
[Bb]uild/
# CMake cache
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt

# NetBeans project directory
nbproject/
277 changes: 277 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
#/*
#-----------------------------------------------------------------------------
#Filename: CMakeLists.txt
#-----------------------------------------------------------------------------
#
#This source file is part of the
# ___ __ __ _ _ _
# /___\__ _ _ __ ___ / / /\ \ (_) | _(_)
# // // _` | '__/ _ \ \ \/ \/ / | |/ / |
#/ \_// (_| | | | __/ \ /\ /| | <| |
#\___/ \__, |_| \___| \/ \/ |_|_|\_\_|
# |___/
# Tutorial Framework
# http://www.ogre3d.org/tikiwiki/
#-----------------------------------------------------------------------------
#*/
cmake_minimum_required(VERSION 2.6)

project(Thrive)

# macro (add_sources)
# file (RELATIVE_PATH _relPath "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
# foreach (_src ${ARGN})
# if (_relPath)
# list (APPEND SRCS "${_relPath}/${_src}")
# else()
# list (APPEND SRCS "${_src}")
# endif()
# endforeach()
# if (_relPath)
# # propagate SRCS to parent directory
# set (SRCS ${SRCS} PARENT_SCOPE)
# endif()
# endmacro()

# function to collect all the sources from sub-directories
# into a single list
function(add_sources)
get_property(is_defined GLOBAL PROPERTY SRCS_LIST DEFINED)
if(NOT is_defined)
define_property(GLOBAL PROPERTY SRCS_LIST
BRIEF_DOCS "List of source files"
FULL_DOCS "List of source files to be compiled in one library")
endif()
# make absolute paths
set(SRCS)
foreach(s IN LISTS ARGN)
if(NOT IS_ABSOLUTE "${s}")
get_filename_component(s "${s}" ABSOLUTE)
endif()
list(APPEND SRCS "${s}")
endforeach()
# append to global list
set_property(GLOBAL APPEND PROPERTY SRCS_LIST "${SRCS}")
endfunction(add_sources)


if(WIN32)
set(CMAKE_MODULE_PATH "$ENV{OGRE_HOME}/CMake/;${CMAKE_MODULE_PATH}")
#set(Boost_INCLUDE_DIR "C:/boost/lib")
message("cm = ${Boost_INCLUDE_DIR}")
set(OGRE_SAMPLES_INCLUDEPATH
$ENV{OGRE_HOME}/Samples/include
)
endif(WIN32)

if(UNIX)
if(EXISTS "/usr/local/lib/OGRE/cmake")

set(CMAKE_MODULE_PATH "/usr/local/lib/OGRE/cmake/;${CMAKE_MODULE_PATH}")
set(OGRE_SAMPLES_INCLUDEPATH "/usr/local/share/OGRE/samples/Common/include/") # We could just *assume* that developers uses this basepath : /usr/local

elseif(EXISTS "/usr/lib/OGRE/cmake")

set(CMAKE_MODULE_PATH "/usr/lib/OGRE/cmake/;${CMAKE_MODULE_PATH}")
set(OGRE_SAMPLES_INCLUDEPATH "/usr/share/OGRE/samples/Common/include/") # Otherwise, this one

else ()
message(SEND_ERROR "Failed to find module path.")
endif(EXISTS "/usr/local/lib/OGRE")
endif(UNIX)

if (CMAKE_BUILD_TYPE STREQUAL "")
# CMake defaults to leaving CMAKE_BUILD_TYPE empty. This screws up
# differentiation between debug and release builds.
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()

set(CMAKE_DEBUG_POSTFIX "_d")

set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/dist")

find_package(OGRE REQUIRED)

#if(NOT "${OGRE_VERSION_NAME}" STREQUAL "Cthugha")
# message(SEND_ERROR "You need Ogre 1.7 Cthugha to build this.")
#endif()

find_package(OIS REQUIRED)

if(NOT OIS_FOUND)
message(SEND_ERROR "Failed to find OIS.")
endif()

# Find Boost
set(Boost_Dir $ENV{BOOST_ROOT})
if (NOT OGRE_BUILD_PLATFORM_IPHONE)
if (WIN32 OR APPLE)
set(Boost_USE_STATIC_LIBS TRUE)
else ()
# Statically linking boost to a dynamic Ogre build doesn't work on Linux 64bit
set(Boost_USE_STATIC_LIBS ${OGRE_STATIC})
endif ()
# find_package(Boost)
# message("${Boost_FOUND}, ${Boost_INCLUDE_DIR}")
# set(BOOST_LIBRARYDIR "c:/boost/boost_1_51/lib")
if (MINGW)
# this is probably a bug in CMake: the boost find module tries to look for
# boost libraries with name libboost_*, but CMake already prefixes library
# search names with "lib". This is the workaround.
set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} "")
endif ()
# find_package(Boost)
# message("${Boost_FOUND}, ${Boost_DIR}")

set(Boost_ADDITIONAL_VERSIONS "1.51" "1.44" "1.44.0" "1.42" "1.42.0" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" )
# Components that need linking (NB does not include header-only components like bind)
# message("${Boost_COMPILER}")s
# set(Boost_COMPILER -mgw45)
set(OGRE_BOOST_COMPONENTS thread date_time system) # <--
find_package(Boost 1.51.0 COMPONENTS ${OGRE_BOOST_COMPONENTS} REQUIRED)

if (NOT Boost_FOUND)
# Try again with the other type of libs
set(Boost_USE_STATIC_LIBS NOT ${Boost_USE_STATIC_LIBS})
find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} REQUIRED)
message("${Boost_FOUND}, ${Boost_DIR}")

endif()
find_package(Boost REQUIRED)

# Set up referencing of Boost
#find_package(Boost COMPONENTS system REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
add_definitions(-DBOOST_ALL_NO_LIB)
# set(Boost_LIBRARIES "c:/boost/lib")
# message("ogre libs ${Boost_LIBRARIES}")
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${Boost_LIBRARIES})
endif()

# set(HDRS
# )

# set(SRCS
# )

# add subdirectories
add_subdirectory(src)

# preprocess sources
set(PREP_SRCS)
get_property(SRCS GLOBAL PROPERTY SRCS_LIST)
foreach(s IN LISTS SRCS)
file(RELATIVE_PATH rs "${CMAKE_CURRENT_SOURCE_DIR}" "${s}")
string(REGEX REPLACE "r$" "" o "${CMAKE_CURRENT_BINARY_DIR}/${rs}")
add_custom_command(
OUTPUT "${o}"
COMMAND ${CMAKE_COMMAND} -E copy "${s}" "${o}"
DEPENDS "${s}"
COMMENT "Creating ${o}"
VERBATIM
)
list(APPEND PREP_SRCS "${o}")
endforeach()

include_directories( ${OIS_INCLUDE_DIRS}
${OGRE_INCLUDE_DIRS}
${OGRE_SAMPLES_INCLUDEPATH}
)

add_executable(Thrive WIN32 ${PREP_SRCS}) #${HDRS} ${SRCS})

set_target_properties(Thrive PROPERTIES DEBUG_POSTFIX _d)

target_link_libraries(Thrive ${OGRE_LIBRARIES} ${OIS_LIBRARIES})

file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dist/bin)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dist/media)

# post-build copy for win32
if(WIN32 AND NOT MINGW)
add_custom_command( TARGET Thrive PRE_BUILD
COMMAND if not exist .\\dist\\bin mkdir .\\dist\\bin )
add_custom_command( TARGET Thrive POST_BUILD
COMMAND copy \"$(TargetPath)\" .\\dist\\bin )
endif(WIN32 AND NOT MINGW)

if(MINGW OR UNIX)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/dist/bin)
endif(MINGW OR UNIX)

if(WIN32)

message("configuration3 = ${CMAKE_BUILD_TYPE}")
install(TARGETS Thrive
RUNTIME DESTINATION bin
CONFIGURATIONS All)

install(DIRECTORY ${CMAKE_SOURCE_DIR}/res/dist/Media
DESTINATION ./
CONFIGURATIONS Release RelWithDebInfo Debug
)

install(FILES ${CMAKE_SOURCE_DIR}/res/dist/bin/plugins.cfg
${CMAKE_SOURCE_DIR}/res/dist/bin/resources.cfg
DESTINATION bin
CONFIGURATIONS Release RelWithDebInfo
)

install(FILES ${CMAKE_SOURCE_DIR}/res/dist/bin/plugins_d.cfg
${CMAKE_SOURCE_DIR}/res/dist/bin/resources_d.cfg
DESTINATION bin
CONFIGURATIONS Debug
)

# NOTE: for the 1.7.1 sdk the OIS dll is called OIS.dll instead of libOIS.dll
# so you'll have to change that to make it work with 1.7.1
install(FILES ${OGRE_PLUGIN_DIR_REL}/OgreMain.dll
# ${OGRE_PLUGIN_DIR_REL}/RenderSystem_Direct3D9.dll
${OGRE_PLUGIN_DIR_REL}/RenderSystem_GL.dll
${OGRE_PLUGIN_DIR_REL}/OIS.dll
DESTINATION bin
CONFIGURATIONS Release RelWithDebInfo
)

install(FILES ${OGRE_PLUGIN_DIR_DBG}/OgreMain_d.dll
# ${OGRE_PLUGIN_DIR_DBG}/RenderSystem_Direct3D9_d.dll
${OGRE_PLUGIN_DIR_DBG}/RenderSystem_GL_d.dll
${OGRE_PLUGIN_DIR_DBG}/OIS_d.dll
DESTINATION bin
CONFIGURATIONS Debug
)

# as of sdk 1.7.2 we need to copy the boost dll's as well
# because they're not linked statically (it worked with 1.7.1 though)
# install(FILES ${Boost_DATE_TIME_LIBRARY_RELEASE}
# ${Boost_THREAD_LIBRARY_RELEASE}
# DESTINATION bin
# CONFIGURATIONS Release RelWithDebInfo
# )

# install(FILES ${Boost_DATE_TIME_LIBRARY_DEBUG}
# ${Boost_THREAD_LIBRARY_DEBUG}
# DESTINATION bin
# CONFIGURATIONS Debug
# )
endif(WIN32)

if(UNIX)

install(TARGETS Thrive
RUNTIME DESTINATION bin
CONFIGURATIONS All)

install(DIRECTORY ${CMAKE_SOURCE_DIR}/res/dist/media
DESTINATION ./
CONFIGURATIONS Release RelWithDebInfo Debug
)

install(FILES ${CMAKE_SOURCE_DIR}/res/dist/bin/plugins.cfg
${CMAKE_SOURCE_DIR}/res/dist/bin/resources.cfg
DESTINATION bin
CONFIGURATIONS Release RelWithDebInfo Debug
)

endif(UNIX)

18 changes: 18 additions & 0 deletions res/dist/media/DeferredShadingMedia/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright (c) W.J. van der Laan

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so, subject
to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 6d3e2d5

Please sign in to comment.