Skip to content

Commit

Permalink
Merge branch 'release/tech-demo-00'
Browse files Browse the repository at this point in the history
  • Loading branch information
adam4813 committed Jul 24, 2015
2 parents c8875d6 + f12e758 commit 15b66db
Show file tree
Hide file tree
Showing 82 changed files with 28,347 additions and 819 deletions.
19 changes: 19 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,22 @@
[submodule "modules/glfw3"]
path = modules/glfw3
url = https://github.com/glfw/glfw/
[submodule "assets"]
path = assets
url=https://github.com/trillek-team/tec-assets
[submodule "modules/bullet3"]
path = modules/bullet3
url = https://github.com/bulletphysics/bullet3
[submodule "modules/openal-soft"]
path = modules/openal-soft
url = git://repo.or.cz/openal-soft.git
[submodule "modules/imgui"]
path = modules/imgui
url = https://github.com/ocornut/imgui
[submodule "modules/protobuf"]
path = modules/protobuf
url = https://github.com/google/protobuf
[submodule "modules/trillek-vcomputer"]
path = modules/trillek-vcomputer
url = https://github.com/trillek-team/trillek-vcomputer-module.git
branch = releases/tag/v0.5.2
77 changes: 77 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
language: cpp

os:
- linux

git:
submodules: false

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
- libx11-dev
- libgl1-mesa-dev

compiler:
- gcc
#- clang
# Bullet compiling fails with CLang, so we not use it yet..

before_install:
- git submodule update --init
- echo $LANG
- echo $LC_ALL
- sudo apt-get update -qq

install:
# Install CMake 3.1
- (cd /tmp && wget http://www.cmake.org/files/v3.1/cmake-3.1.3.tar.gz && tar zxf cmake-3.1.3.tar.gz)
- (cd /tmp/cmake-3.1.3 && cmake . && make && sudo make install) > /dev/null 2>&1
- cmake --version
# Enforces GCC 4.8
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
# Enforces CLang 3.7
- if [ "$CXX" == "clang++" ]; then export CXX="clang++-3.7"; fi
# Install OpenAL and GLEW
- sudo apt-get -q -y install libglew-dev libopenal-dev
# Install and build gtest
#- sudo apt-get -q -y install libgtest-dev
#- BUILD_PATH=$(pwd)
#- cd /usr/src/gtest
#- sudo cmake CMakeLists.txt
#- sudo make
#- GTEST_ROOT=/usr/src/gtest
#- export GTEST_ROOT
#- cd $BUILD_PATH

before_script:
- pwd
- mkdir build
- cd build

script:
- echo "Building dependencies (bullet) and installing it"
- cmake ..
- make
- sudo make install
- echo "Building TEC"
- rm -f cmakecache.txt
- cmake ..
- make
- ls
#- ./TECTests

notifications:
#email:
#- my.mail@bar.com
# I can also set up Glitch to output build results as well if we don't want the travis bot join/part spam
irc:
channels:
- "chat.freenode.net#project-trillek"
- "chat.freenode.net#trillek"
on_success: change
on_failure: always
204 changes: 160 additions & 44 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,90 +1,206 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)

PROJECT("TEC")

SET(CMAKE_CXX_STANDARD_REQUIRED 11)

# Set the directory of cmake modules
# If using MSVC you must change the 'Debugging->Working Directory' property in
# the project properties window to "$(SolutionDir)..\" for assets to load correctly.
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules")

# Put the executable in the bin folder
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)
IF ( MSVC )
# If using MSVC you must change the 'Debugging->Working Directory' property in
# the project properties window to "$(SolutionDir)..\" for assets to load correctly.
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib )
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib )
# Second, for multi-config builds (e.g. msvc)
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
STRING( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_SOURCE_DIR}/lib )
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_SOURCE_DIR}/lib )
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
# This is needed for OpenAL as the libaries were built using an older MSVC.
IF(${_MACHINE_ARCH_FLAG} MATCHES X86)
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
SET (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
ENDIF()
ENDIF ( MSVC )

# find all source files in the src directory
FILE(GLOB_RECURSE TEC_SRC "src/*.cpp")

# find all the files in the includes directory
FILE(GLOB_RECURSE TEC_INCLUDES "include/*.h" "include/*.hpp")

#Check if we can build with the current tool chain
INCLUDE(SetCompilerFlags)
# IMGUI setup
FILE(GLOB IMGUI_SRC "modules/imgui/imgui.cpp")
FILE(GLOB IMGUI_INCLUDES "modules/imgui/*.h")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/modules/imgui/)

SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/include/)
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include/")

# If we are on windows add in the local search directories as well.
IF (WIN32 AND NOT MINGW) # Windows
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/lib/include/)
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/lib/include/")
LINK_DIRECTORIES("${CMAKE_SOURCE_DIR}/lib/")
SET(CMAKE_LIBRARY_PATH ${CMAKE_SOURCE_DIR}/lib/)
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/lib/include/)
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/lib/include/")
LINK_DIRECTORIES("${CMAKE_SOURCE_DIR}/lib/")
SET(CMAKE_LIBRARY_PATH ${CMAKE_SOURCE_DIR}/lib/)
ENDIF (WIN32 AND NOT MINGW)

# This is used to flag if TEC should be built or if we are just doing a dependency build.
SET(BUILD_DEPS_FIRST false)

FIND_PACKAGE(OpenGL REQUIRED)

# GLFW3 check
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "modules/glfw3/include")
MESSAGE("GLFW3 will be built.")
# We are turning off all the extra bullet options before adding it to reduce compiling.
SET(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "Build the GLFW example programs")
SET(GLFW_BUILD_TESTS OFF CACHE BOOL "Build the GLFW test programs")
SET(GLFW_BUILD_DOCS OFF CACHE BOOL "Build the GLFW documentation")
SET(GLFW_INSTALL OFF CACHE BOOL "Generate installation target")
ADD_SUBDIRECTORY("modules/glfw3")
INCLUDE_DIRECTORIES("modules/glfw3/include")
ADD_SUBDIRECTORY("modules/glm" "lib/")
SET(GLFW_LIBRARIES glfw ${GLFW_LIBRARIES})

# PThread check
SET(CMAKE_THREAD_PREFER_PTHREAD TRUE)
FIND_PACKAGE( Threads )
IF(CMAKE_USE_PTHREADS_INIT)
SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-pthread")
ENDIF(CMAKE_USE_PTHREADS_INIT)

# GLM include
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "modules/glmi/glm/")
INCLUDE_DIRECTORIES("modules/glm")

# Protobuf setup
FILE(GLOB PB_FILES_SRC "proto/*.cc")
FILE(GLOB PB_FILES_INCLUDES "proto/*.h")
SET(BUILD_TESTING OFF CACHE BOOL "Build tests")
INCLUDE_DIRECTORIES("modules/protobuf/src")
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "modules/protobuf/src")
ADD_SUBDIRECTORY("modules/protobuf/cmake")

# Bullet check
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "modules/bullet3/src")
FIND_PACKAGE(Bullet)
IF (NOT ${BULLET_FOUND})
SET(BUILD_DEPS_FIRST true)
MESSAGE("Bullet will be built.")
# We are turning off all the extra bullet options before adding it to reduce compiling.
SET(USE_DOUBLE_PRECISION ON CACHE BOOL "Use double precision")
SET(USE_GLUT OFF CACHE BOOL "Use Glut")
SET(USE_GRAPHICAL_BENCHMARK OFF CACHE BOOL "Use Graphical Benchmark")
SET(BUILD_OPENGL3_DEMOS OFF CACHE BOOL "Set when you want to build the OpenGL3+ demos")
SET(BUILD_BULLET2_DEMOS OFF CACHE BOOL "Set when you want to build the Bullet 2 demos")
SET(BUILD_EXTRAS OFF CACHE BOOL "Set when you want to build the extras")
SET(BUILD_UNIT_TESTS OFF CACHE BOOL "Build Unit Tests")
SET(BUILD_CPU_DEMOS OFF CACHE BOOL "Build original Bullet CPU examples" )
SET(BUILD_BULLET3 OFF CACHE BOOL "Set when you want to build Bullet 3")
ADD_SUBDIRECTORY("modules/bullet3")
INCLUDE_DIRECTORIES("modules/bullet3/src")
ELSE (NOT ${BULLET_FOUND})
MESSAGE("Bullet already found skipping build.")
INCLUDE_DIRECTORIES (${BULLET_INCLUDE_DIRS})
ENDIF (NOT ${BULLET_FOUND})

# OpenAL check
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "modules/openal-soft/include/AL")
FIND_PACKAGE(OpenAL)
IF (NOT ${OPENAL_FOUND})
SET(BUILD_DEPS_FIRST true)
MESSAGE("Bullet will be built.")
SET(ALSOFT_UTILS OFF CACHE BOOL "Build and install utility programs")
SET(ALSOFT_EXAMPLES OFF CACHE BOOL "Build and install example programs")
SET(ALSOFT_REQUIRE_WINMM ON CACHE BOOL "Require Windows Multimedia backend")
ADD_SUBDIRECTORY("modules/openal-soft")
INCLUDE_DIRECTORIES("modules//openal-soft/include")
ELSE (NOT ${OPENAL_FOUND})
MESSAGE("OpenAL already found skipping build.")
INCLUDE_DIRECTORIES (${OPENAL_INCLUDE_DIR})
ENDIF (NOT ${OPENAL_FOUND})

# Some definitions we need to use bullet and GLM.
ADD_DEFINITIONS( -DBT_USE_DOUBLE_PRECISION -DGLM_FORCE_PURE)

# Give these some dummy values and if the platform is LINUX or OSX they will be set accordingly.
SET(X11_LIBRARIES "")
SET(OSX_LIBRARIES "")

IF (NOT APPLE) # X11 and GLEW are not needed on OSX.
FIND_PACKAGE(X11)
FIND_PACKAGE(GLEW REQUIRED) # We find GLEW here as OSX doesn't need it.
FIND_PACKAGE(X11)
FIND_PACKAGE(GLEW REQUIRED) # We find GLEW here as OSX doesn't need it.
ENDIF (NOT APPLE)

IF (APPLE) # Mac OSX
SET(GLEW_LIBRARY "") # Set a dummy value for GLEW.

SET(CMAKE_XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS macosx)

# Need the 10.7 SDK or later.
EXECUTE_PROCESS(COMMAND xcodebuild -sdk macosx -version SDKVersion OUTPUT_VARIABLE OSX_SDK_VERSION)
IF (NOT (OSX_SDK_VERSION VERSION_GREATER 10.7 OR OSX_SDK_VERSION VERSION_EQUAL 10.7))
MESSAGE(FATAL_ERROR "The installed version of Xcode does not support the 10.7 SDK or later. Please upgrade Xcode and try again.")
ENDIF (NOT (OSX_SDK_VERSION VERSION_GREATER 10.7 OR OSX_SDK_VERSION VERSION_EQUAL 10.7))

# Configure the project to use the correct SDK.
IF (XCODE_VERSION)
SET(CMAKE_OSX_SYSROOT macosx)
ELSE (XCODE_VERSION)
# Non-Xcode generators need the full path.
EXECUTE_PROCESS(COMMAND xcodebuild -sdk macosx -version Path | head -n 1 OUTPUT_VARIABLE CMAKE_OSX_SYSROOT)
STRING(REGEX REPLACE "(\r?\n)+$" "" CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}")
ENDIF (XCODE_VERSION)

# Can deploy back to 10.7, the first OS X to support the GL Core.
SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)

# Need Core Foundation and libobjc.
SET(OSX_LIBRARIES "-framework CoreFoundation /usr/lib/libobjc.dylib")
SET(GLEW_LIBRARY "") # Set a dummy value for GLEW.

SET(CMAKE_XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS macosx)

# Need the 10.7 SDK or later.
EXECUTE_PROCESS(COMMAND xcodebuild -sdk macosx -version SDKVersion OUTPUT_VARIABLE OSX_SDK_VERSION)
IF (NOT (OSX_SDK_VERSION VERSION_GREATER 10.7 OR OSX_SDK_VERSION VERSION_EQUAL 10.7))
MESSAGE(FATAL_ERROR "The installed version of Xcode does not support the 10.7 SDK or later. Please upgrade Xcode and try again.")
ENDIF (NOT (OSX_SDK_VERSION VERSION_GREATER 10.7 OR OSX_SDK_VERSION VERSION_EQUAL 10.7))

# Configure the project to use the correct SDK.
IF (XCODE_VERSION)
SET(CMAKE_OSX_SYSROOT macosx)
ELSE (XCODE_VERSION)
# Non-Xcode generators need the full path.
EXECUTE_PROCESS(COMMAND xcodebuild -sdk macosx -version Path | head -n 1 OUTPUT_VARIABLE CMAKE_OSX_SYSROOT)
STRING(REGEX REPLACE "(\r?\n)+$" "" CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}")
ENDIF (XCODE_VERSION)

# Can deploy back to 10.7, the first OS X to support the GL Core.
SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)

# Need Core Foundation and libobjc.
SET(OSX_LIBRARIES "-framework CoreFoundation /usr/lib/libobjc.dylib")
ENDIF (APPLE)

# Add the virtual computer
SET(BUILD_STATIC_VCOMPUTER TRUE CACHE BOOL "Build Trillek VCOMPUTER library - static
version")
SET(BUILD_DYNAMIC_VCOMPUTER FALSE CACHE BOOL "Build Trillek VCOMPUTER library - dynamic version")
SET(BUILD_TOOLS_VCOMPUTER FALSE CACHE BOOL "Build Trillek VCOMPUTER tools")
SET(BUILD_TESTS_VCOMPUTER FALSE CACHE BOOL "Build Trillek VCOMPUTER tests")
ADD_SUBDIRECTORY("modules/trillek-vcomputer")
INCLUDE_DIRECTORIES("modules/trillek-vcomputer/include")

# define all required external libraries
set(TEC_ALL_LIBS
${OPENGL_LIBRARIES}
${X11_LIBRARIES}
${OSX_LIBRARIES}
${GLEW_LIBRARIES}
glfw ${GLFW_LIBRARIES}
# the use of raw names allows MSVC to pick-up debug version automatically
IF (NOT ${BUILD_DEPS_FIRST})
MESSAGE("All dependencies found now building tec.")
SET(TEC_ALL_LIBS
${CMAKE_THREAD_LIBS_INIT}
${OPENGL_LIBRARIES}
${X11_LIBRARIES}
${OSX_LIBRARIES}
${GLEW_LIBRARIES}
${GLFW_LIBRARIES}
${BULLET_LIBRARIES}
${OPENAL_LIBRARY}
libprotobuf
VCOMPUTER_STATIC
)

ADD_EXECUTABLE("TEC"
${TEC_SRC}
${TEC_INCLUDES}
${TEC_SRC}
${TEC_INCLUDES}
${IMGUI_SRC}
${IMGUI_INCLUDES}
${PB_FILES_SRC}
${PB_FILES_INCLUDES}
)

SET_PROPERTY(TARGET TEC PROPERTY CXX_STANDARD 11)

TARGET_LINK_LIBRARIES("TEC" ${TEC_ALL_LIBS})
ENDIF (NOT ${BUILD_DEPS_FIRST})
41 changes: 40 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
# tec
# Trillek Engine C
[![Build Status](https://travis-ci.org/trillek-team/tec.svg)](https://travis-ci.org/trillek-team/tec)


## Building
TEC requires cmake 3.1 and a few libraries like GLEW, Bullet and OpenAL. Our CMake script can handle compiling and installing Bullet and OpenAL, but GLEW is necesary to be installed on your computer to build the engine properly.

If you do not have cmake 3.1 (try `cmake -version`), to install on Linux, use the same procedure that we do on Travis CI:

1. `(cd /tmp && wget http://www.cmake.org/files/v3.1/cmake-3.1.3.tar.gz && tar zxf cmake-3.1.3.tar.gz)`
2. `(cd /tmp/cmake-3.1.3 && cmake . && make && sudo make install)`
3. Close your terminal emulator and open a new instance. Now, you should get version 3.1.3 when you run `cmake -version`

Building takes a few steps to get everything set up for the first build.

1. `git submodule update --init` in the root directory.
2. `mkdir build/` in to root directory
3. `cd build/`
4. Follow platform specific instructions
1. Linux
- If you have Bullet, GLEW and OpenAL dev libs installed :
1. `cmake ..` in the build directory
2. `make TEC` in the build directory
- If you do not have Bullet or OpenAL dev libs installed :
1. `cmake ..` in the build directory
2. `make` in the build directory
3. `sudo make install` in the build directory (Warning! This will install Bullet and/or OpenAL on your /usr/local/)
4. `rm CMakeCache.txt` in the build directory
5. `cmake ..` in the build directory
6. `make TEC` in the build directory
2. Windows
1. Run cmake-gui setting the source line to the root directory and the build line to the build directory.
2. Configure and Generate using non-x64 as the target, with native compiles selected.
3. Build all dependencies in Release configuration (if it is just tec in the project list go to step 5).
**You must build bullet in both debug and release configurations**
4. Return to cmake-gui and rerun configure and generate. If you see "All dependencies found now building tec.",
you can delete your cache and rerun to clean up the cmake-gui window.
5. In the project properties for `TEC` change the `Debugging`->`Working Directory` to `$(SolutionDir)..\`.
6. Download and install oalinst.zip (OpenAL installer) http://openal.org/creative-installers/ and install it.
5. Run it from `tec/`
1 change: 1 addition & 0 deletions assets
Submodule assets added at beae12
Loading

0 comments on commit 15b66db

Please sign in to comment.