Skip to content

Commit

Permalink
Merge branch 'lua' of https://github.com/Nimbal/Thrive
Browse files Browse the repository at this point in the history
Conflicts:
	CMakeLists.txt
	mingw_setup/boost/install.ps1
	mingw_setup/gtest/install.sh
	mingw_setup/readme.txt
	mingw_setup/setup.ps1
	mingw_setup/toolchain_win.cmake.in
  • Loading branch information
Daniferrito committed May 13, 2013
2 parents 0a8ab54 + 041fc4b commit 56d96fd
Show file tree
Hide file tree
Showing 186 changed files with 42,248 additions and 1,529 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@ install_manifest.txt

# NetBeans project directory
nbproject/

# Vim swap files
*.swp
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "contrib/googletest"]
path = contrib/googletest
url = git://github.com/liquid-mirror/googletest.git
[submodule "contrib/luabind"]
path = contrib/luabind
url = git://github.com/rpavlik/luabind.git
130 changes: 106 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ SET(OGRE_SDK ""
CACHE STRING "Path to the Ogre SDK"
)

# Google test
set(GOOGLE_TEST_DIR ""
CACHE STRING "Path to Google Test"
)


###############
# CMake Setup #
Expand Down Expand Up @@ -59,7 +54,7 @@ set(CMAKE_INSTALL_PREFIX
# Find OGRE #
#############

find_package(OGRE REQUIRED QUIET)
find_package(OGRE REQUIRED)

# OGRE Plugins used
set(OGRE_PLUGINS
Expand All @@ -83,37 +78,78 @@ find_package(OIS REQUIRED QUIET)
##############

set(BOOST_COMPONENTS
date_time # Required by OGRE
thread # Required by OGRE
system # Required by OGRE
chrono
date_time
filesystem
thread
system
)

find_package(Boost 1.51 COMPONENTS ${BOOST_COMPONENTS} REQUIRED QUIET)
find_package(Boost COMPONENTS ${BOOST_COMPONENTS} REQUIRED QUIET)

###############
# Google Test #
###############

if (GOOGLE_TEST_DIR)
add_subdirectory(${GOOGLE_TEST_DIR} ${CMAKE_CURRENT_BINARY_DIR}/gtest)
include_directories(${GOOGLE_TEST_DIR}/include)
add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/contrib/googletest
)

include_directories(
SYSTEM
${CMAKE_CURRENT_SOURCE_DIR}/contrib/googletest/include
)

#######
# Lua #
#######

include_directories(
SYSTEM
${CMAKE_CURRENT_SOURCE_DIR}/contrib/lua/lua/src
${CMAKE_CURRENT_SOURCE_DIR}/contrib/luabind/
)

if(WIN32)
add_definitions(-DLUA_BUILD_AS_DLL)
endif()

add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/contrib/lua/
)

set(LUA_FOUND TRUE)
set(LUA_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/lua/lua/src)
set(LUA_LIBRARIES lua)
#set(BUILD_SHARED_LUABIND ON)
#set(INSTALL_LUABIND ON)
set(LIB_DIR bin)
add_definitions(-DLUABIND_CPLUSPLUS_LUA)

add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/contrib/luabind/
)

######################
# Configure Compiler #
######################

include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src
include_directories(SYSTEM
${Boost_INCLUDE_DIRS}
${OIS_INCLUDE_DIRS}
${OGRE_INCLUDE_DIRS}
${OGRE_INCLUDE_DIRS}
)

include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src
)

# Compile using c++11
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")


find_package(Threads)

##################
# Compile Thrive #
##################
Expand All @@ -122,15 +158,25 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
add_subdirectory(src)
get_property(SOURCE_FILES GLOBAL PROPERTY SOURCE_FILES)

# Set extensive warning flags
include(compiler_flags)
set_source_files_properties(
${SOURCE_FILES}
PROPERTIES COMPILE_FLAGS ${WARNING_FLAGS}
)

# Compile library
add_library(ThriveLib SHARED ${SOURCE_FILES})
add_library(ThriveLib STATIC ${SOURCE_FILES})

target_link_libraries(ThriveLib
${Boost_LIBRARIES}
${OGRE_LIBRARIES}
${OIS_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
luabind
)


set_target_properties(ThriveLib PROPERTIES
OUTPUT_NAME Thrive
)
Expand All @@ -140,29 +186,59 @@ add_executable(Thrive WIN32 ${CMAKE_CURRENT_SOURCE_DIR}/src/Main.cpp)

target_link_libraries(Thrive ThriveLib)


#################
# Compile tests #
#################

# Collect sources from sub directories
get_property(TEST_SOURCE_FILES GLOBAL PROPERTY TEST_SOURCE_FILES)

if (TEST_SOURCE_FILES)
add_executable(RunTests ${TEST_SOURCE_FILES})
target_link_libraries(RunTests ThriveLib gtest_main)
set_source_files_properties(
${TEST_SOURCE_FILES}
PROPERTIES COMPILE_FLAGS ${WARNING_FLAGS}
)

add_executable(RunTests ${TEST_SOURCE_FILES})
target_link_libraries(RunTests ThriveLib gtest_main)

#################
# Documentation #
#################

set(DOC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/doc CACHE PATH "Documentation output directory.")
set(DOC_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/src)

set( DOXYGEN_CONFIG_FILE
${CMAKE_CURRENT_SOURCE_DIR}/doc/doxygen.cfg.in
)

find_package(Doxygen)

if(DOXYGEN_FOUND)
configure_file(${DOXYGEN_CONFIG_FILE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc
COMMENT "Generating API documentation with Doxygen" VERBATIM
SOURCES ${DOXYGEN_CONFIG_FILE}
)
endif()


###########
# Install #
###########

# Executable
install(TARGETS Thrive ThriveLib
install(TARGETS Thrive
RUNTIME DESTINATION bin
LIBRARY DESTINATION bin
)

install(EXPORT lua
DESTINATION bin
)

# OGRE config and media

install(FILES
Expand All @@ -188,6 +264,12 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/res/dist/media
CONFIGURATIONS Release Debug
)

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

# Install Runtime Libraries
if(WIN32)

Expand Down Expand Up @@ -222,7 +304,7 @@ if(WIN32)
${OGRE_PLUGIN_DIR_REL}/OgreMain.dll
${OGRE_PLUGIN_DIR_REL}/RenderSystem_GL.dll
${OGRE_PLUGIN_DIR_REL}/OIS.dll
${OGRE_PLUGIN_DIR_REL}/cg.dll
#${OGRE_PLUGIN_DIR_REL}/cg.dll
DESTINATION bin
CONFIGURATIONS Release
)
Expand All @@ -231,7 +313,7 @@ if(WIN32)
${OGRE_PLUGIN_DIR_DBG}/OgreMain_d.dll
${OGRE_PLUGIN_DIR_DBG}/RenderSystem_GL_d.dll
${OGRE_PLUGIN_DIR_DBG}/OIS_d.dll
${OGRE_PLUGIN_DIR_DBG}/cg.dll
#${OGRE_PLUGIN_DIR_DBG}/cg.dll
DESTINATION bin
CONFIGURATIONS Debug
)
Expand Down
54 changes: 54 additions & 0 deletions cmake_modules/compiler_flags.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
################################################################################
# Join function to make a string out of the lists
################################################################################

function(join TARGET)
set(_list)
foreach(_element ${ARGN})
set(_list "${_list} ${_element}")
endforeach()
string(STRIP ${_list} _list)
set(${TARGET} ${_list} PARENT_SCOPE)
endfunction()


################################################################################
# GCC warning flags
################################################################################

if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)

join(WARNING_FLAGS
-pedantic
-Werror
-Wall
-Wextra
# Miscellaneous warnings:
-Wcast-align
-Wcast-qual
-Wdisabled-optimization
-Wfloat-equal
-Wformat=2
-Winit-self
#-Winline # Generates many useless warnings about destructors
-Wlogical-op
-Wmissing-declarations
-Wmissing-include-dirs
-Wpointer-arith
-Wredundant-decls
-Wstrict-overflow=5
-Wswitch-default
-Wswitch-enum
-Wundef
-Wunreachable-code
# C++ specific
-Wctor-dtor-privacy
#-Weffc++ # Annoying member initialization
-Wold-style-cast
-Woverloaded-virtual
-Wsign-promo
-Wstrict-null-sentinel
)

endif()

1 change: 1 addition & 0 deletions contrib/googletest
Submodule googletest added at b3d0b4
86 changes: 86 additions & 0 deletions contrib/lua/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
cmake_minimum_required(VERSION 2.8)

project(lua CXX)

set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lua/src)

set(LIB_SOURCES
${SOURCE_DIR}/lapi.c
${SOURCE_DIR}/lauxlib.c
${SOURCE_DIR}/lbaselib.c
${SOURCE_DIR}/lbitlib.c
${SOURCE_DIR}/lcode.c
${SOURCE_DIR}/lcorolib.c
${SOURCE_DIR}/lctype.c
${SOURCE_DIR}/ldblib.c
${SOURCE_DIR}/ldebug.c
${SOURCE_DIR}/ldo.c
${SOURCE_DIR}/ldump.c
${SOURCE_DIR}/lfunc.c
${SOURCE_DIR}/lgc.c
${SOURCE_DIR}/linit.c
${SOURCE_DIR}/liolib.c
${SOURCE_DIR}/llex.c
${SOURCE_DIR}/lmathlib.c
${SOURCE_DIR}/lmem.c
${SOURCE_DIR}/loadlib.c
${SOURCE_DIR}/lobject.c
${SOURCE_DIR}/lopcodes.c
${SOURCE_DIR}/loslib.c
${SOURCE_DIR}/lparser.c
${SOURCE_DIR}/lstate.c
${SOURCE_DIR}/lstring.c
${SOURCE_DIR}/lstrlib.c
${SOURCE_DIR}/ltable.c
${SOURCE_DIR}/ltablib.c
${SOURCE_DIR}/ltm.c
${SOURCE_DIR}/lundump.c
${SOURCE_DIR}/lvm.c
${SOURCE_DIR}/lzio.c
)

set(LIB_HEADERS
${SOURCE_DIR}/lapi.h
${SOURCE_DIR}/lauxlib.h
${SOURCE_DIR}/lcode.h
${SOURCE_DIR}/lctype.h
${SOURCE_DIR}/ldebug.h
${SOURCE_DIR}/ldo.h
${SOURCE_DIR}/lfunc.h
${SOURCE_DIR}/lgc.h
${SOURCE_DIR}/llex.h
${SOURCE_DIR}/llimits.h
${SOURCE_DIR}/lmem.h
${SOURCE_DIR}/lobject.h
${SOURCE_DIR}/lopcodes.h
${SOURCE_DIR}/lparser.h
${SOURCE_DIR}/lstate.h
${SOURCE_DIR}/lstring.h
${SOURCE_DIR}/ltable.h
${SOURCE_DIR}/ltm.h
${SOURCE_DIR}/luaconf.h
${SOURCE_DIR}/lualib.h
${SOURCE_DIR}/lundump.h
${SOURCE_DIR}/lvm.h
${SOURCE_DIR}/lzio.h
)

set_source_files_properties(
${LIB_SOURCES}
PROPERTIES LANGUAGE CXX
)

include_directories(
${SOURCE_DIR}
)

add_library(lua SHARED
${LIB_SOURCES}
${LIB_HEADERS}
)

install(TARGETS lua
EXPORT lua
RUNTIME DESTINATION bin
LIBRARY DESTINATION bin
)
6 changes: 6 additions & 0 deletions contrib/lua/lua/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

This is Lua 5.2.2, released on 21 Mar 2013.

For installation instructions, license details, and
further information about Lua, see doc/readme.html.

Loading

0 comments on commit 56d96fd

Please sign in to comment.