Skip to content

Commit

Permalink
Merge pull request #361 from michaelheilmann/master
Browse files Browse the repository at this point in the history
Migration to a CMake-based build system, update for latest version of Idlib and Idlib: Game Engine, cleanups
  • Loading branch information
michaelheilmann authored Feb 5, 2018
2 parents 146b272 + a2e87c0 commit bd35da9
Show file tree
Hide file tree
Showing 594 changed files with 7,303 additions and 23,267 deletions.
35 changes: 27 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,34 @@
*.suo
*.VC.db
*.VC.VC.opendb
*.vcxproj
*.vcxproj.filters
*.vcxproj.user
*.sln
/intermediate
/product
/products
Win32/Debug
Win32/Release
egolib/Debug
egolib/Release
egoboo/Debug
egoboo/Release

# CMake.
CMakeDoxyfile.in
CMakeDoxygenDefaults.cmake
cmake_install.cmake

# Google Mock, Google Test.
gmock.pc
gmock_main.pc
gtest.pc
gtest_main.pc

# CMake.
*\.dir/
CMakeFiles
CMakeCache.txt

# Code::Blocks.
*.layout
Expand All @@ -28,10 +54,3 @@ xcuserdata

# Doxygen.
/doc/doxygen

# Generated files.
gen

# CMake.
CMakeFiles
CMakeCache.txt
7 changes: 6 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@
url = https://github.com/egoboo/egoboo-external
[submodule "idlib"]
path = idlib
url = https://github.com/egoboo/idlib
url = https://github.com/primordialmachine/idlib
branch = develop
[submodule "idlib-game-engine"]
path = idlib-game-engine
url = https://github.com/egoboo/idlib-game-engine.git
branch = develop
125 changes: 89 additions & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,121 @@
sudo: required
dist: trusty

language: cpp

# Operating system selection
os:
- linux
- osx
# Compiler selection
compiler:
- clang
- gcc

addons:
apt:
sources:
# add PPAs with more up-to-date toolchains
- ubuntu-toolchain-r-test
- sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.8 main'
key_url: 'http://apt.llvm.org/llvm-snapshot.gpg.key'
packages:
# GCC 6
- gcc-6
- g++-6
# CLANG 3.8
- clang-3.8
- libc++-dev
# PhysFS
- libphysfs-dev
# SDL 2
- libsdl2-dev
- libsdl2-image-dev
- libsdl2-mixer-dev
- libsdl2-ttf-dev
# CMake (outdated)
- cmake
matrix:
# Remove default jobs.
exclude:
- compiler: gcc
- compiler: clang
# Add non-default jobs.
include:
- compiler: gcc
os: linux
addons:
apt:
sources:
# add PPAs with more up-to-date toolchains
- ubuntu-toolchain-r-test
- george-edison55-precise-backports
- sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.8 main'
key_url: 'http://apt.llvm.org/llvm-snapshot.gpg.key'
packages:
# GCC 6
- gcc-6
- g++-6
# PhysFS
- libphysfs-dev
# SDL 2
- libsdl2-dev
- libsdl2-image-dev
- libsdl2-mixer-dev
- libsdl2-ttf-dev
# CMake (outdated)
- cmake-data
- cmake
env:
- MATRIX_EVAL_BEFORE_INSTALL="CC=gcc-6 && CXX=g++-6"
- MATRIX_EVAL_BEFORE_SCRIPT="export CC=gcc-6 && export CXX=g++-6"
- compiler: clang
os: linux
addons:
apt:
sources:
# add PPAs with more up-to-date toolchains
- ubuntu-toolchain-r-test
- george-edison55-precise-backports
- sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-4.0 main'
key_url: 'http://apt.llvm.org/llvm-snapshot.gpg.key'
packages:
# GCC 6
- gcc-6
- g++-6
# CLANG 4.0
- clang-4.0
- libc++-dev
# PhysFS
- libphysfs-dev
# SDL 2
- libsdl2-dev
- libsdl2-image-dev
- libsdl2-mixer-dev
- libsdl2-ttf-dev
# CMake (outdated)
- cmake-data
- cmake
env:
- MATRIX_EVAL_BEFORE_INSTALL="CC=clang-4.0 && CXX=clang++-4.0 && CXXFLAGS=\"-ftemplate-depth=1024 -std=c++11\""
- MATRIX_EVAL_BEFORE_SCRIPT="export CC=clang-4.0 && CXX=clang++-4.0 && CXXFLAGS=\"-ftemplate-depth=1024 -std=c++11 -stdlib=libc++\""
- compiler: clang
os: osx

before_install:
- if [ "$CC" = "clang" ]; then
export CC="clang-3.8" CXX="clang++-3.8" CXXFLAGS="-ftemplate-depth=1024";
else
export CC="gcc-6" CXX="g++-6";
- eval "${MATRIX_EVAL_BEFORE_INSTALL}"
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
brew update;
brew install sdl2;
brew info sdl2;
brew install sdl2_image;
brew info sdl2_image;
brew install sdl2_mixer;
brew info sdl2_mixer;
brew install sdl2_ttf;
brew info sdl2_ttf;
brew install physfs;
fi

# Donwload CMake binaries.
install:
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p "${DEPS_DIR}" && cd "${DEPS_DIR}"
# Download CMake 3.9.3 binary.
# Download CMake 3.10.1 binary.
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then CMAKE_BIN_URL="https://cmake.org/files/v3.10/cmake-3.10.1-Darwin-x86_64.tar.gz" ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then CMAKE_BIN_URL="https://cmake.org/files/v3.10/cmake-3.10.1-Linux-x86_64.tar.gz" ; fi
- |
CMAKE_BIN_URL="https://cmake.org/files/v3.9/cmake-3.9.3-Linux-x86_64.tar.gz"
mkdir -p cmake-bin
cd cmake-bin
wget --no-check-certificate -O - -q "${CMAKE_BIN_URL}" | tar xsz --strip-components=1 -f -
cd ..
export PATH="${DEPS_DIR}/cmake-bin/bin:${PATH}"
# Invoke CMake on CMakeLists.txt.
before_script:
- export CC=gcc-6
- export CXX=g++-6
- gcc -v && g++ -v && cmake --version
- eval "${MATRIX_EVAL_BEFORE_SCRIPT}"
- cd "${TRAVIS_BUILD_DIR}"
- cmake CMakeLists.txt


script:
- cd "${TRAVIS_BUILD_DIR}"
- make

- make all && make check

notifications:
webhooks:
Expand Down
82 changes: 14 additions & 68 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,74 +1,20 @@
cmake_minimum_required(VERSION 3.8)
project(egoboo CXX)
cmake_minimum_required(VERSION 3.6)

#Enable ccache if it is available
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
project(egoboo)

#Set compile flags
set(CMAKE_CXX_STANDARD 17)
add_definitions("-std=c++17 -Wall -Wextra")
#add_definitions("-O3 -flto -fuse-ld=gold")
add_definitions(-ggdb3 -Og)
# Add Idlib.
add_subdirectory(idlib)

#Disable some warnings
add_definitions("-Wno-reorder -Wno-sign-compare -Wno-missing-braces -Wno-unused-parameter ")
include(${CMAKE_CURRENT_SOURCE_DIR}/idlib/buildsystem/set_project_default_properties.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/idlib-game-engine/buildsystem/download_and_unpack.cmake)

#Include directory locations
INCLUDE_DIRECTORIES(
game/src
egolib/src
idlib/src)
# Add Idlib: Game Engine.
set(idlib-with-tests OFF CACHE BOOL "enable/disable compilation of tests. ON enables compilation of tests, OFF disables compilation of tests. Initial value is OFF." FORCE)
set(IDLIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/idlib)
add_subdirectory(idlib-game-engine)

#TODO: Tests
file(GLOB_RECURSE IDLIB_SOURCE_FILES idlib/src/idlib/*.cpp)
file(GLOB_RECURSE EGOLIB_SOURCE_FILES egolib/src/egolib/*.cpp egolib/src/egolib/*.c)
file(GLOB_RECURSE GAME_SOURCE_FILES game/src/game/*.cpp game/src/game/*.c)
# Add Egolib.
add_subdirectory(egolib)

#Exclude OS specific files, they are added later
list(REMOVE_ITEM EGOLIB_SOURCE_FILES "${PROJECT_SOURCE_DIR}/egolib/src/egolib/Platform/file_win.c")
list(REMOVE_ITEM EGOLIB_SOURCE_FILES "${PROJECT_SOURCE_DIR}/egolib/src/egolib/Platform/file_linux.c")

set(EGOBOO_SOURCE_FILES ${GAME_SOURCE_FILES})

#OS specific files
if (UNIX)
set(EGOBOO_SOURCE_FILES ${EGOBOO_SOURCE_FILES} unix/main.cpp egolib/src/egolib/Platform/file_linux.c)
endif (UNIX)
if (APPLE)
set(EGOBOO_SOURCE_FILES ${EGOBOO_SOURCE_FILES} egolib/src/egolib/Platform/file_mac.m)
endif (APPLE)
if (WINDOWS)
set(EGOBOO_SOURCE_FILES ${EGOBOO_SOURCE_FILES} egolib/src/egolib/Platform/file_win.c)
endif (WINDOWS)

#Compile everything as C++
SET_SOURCE_FILES_PROPERTIES(${IDLIB_SOURCE_FILES} PROPERTIES LANGUAGE CXX )
SET_SOURCE_FILES_PROPERTIES(${EGOBLIB_SOURCE_FILES} PROPERTIES LANGUAGE CXX )
SET_SOURCE_FILES_PROPERTIES(${EGOBOO_SOURCE_FILES} PROPERTIES LANGUAGE CXX )

#Define compilation output
add_library(idlib STATIC ${IDLIB_SOURCE_FILES})
add_library(egolib STATIC ${EGOLIB_SOURCE_FILES})
add_executable(egoboo ${EGOBOO_SOURCE_FILES})

#Include dependency on SDL
INCLUDE(FindPkgConfig)

PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
PKG_SEARCH_MODULE(SDL2_IMAGE REQUIRED SDL2_image>=2.0.0)
PKG_SEARCH_MODULE(SDL2_MIXER REQUIRED SDL2_mixer>=2.0.0)
PKG_SEARCH_MODULE(SDL2_TTF REQUIRED SDL2_ttf>=2.0.0)
#PKG_SEARCH_MODULE(PHYSFS REQUIRED PHYSFS>=2.0.0)
FIND_PACKAGE(Threads REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
FIND_PACKAGE(PhysFS REQUIRED)

INCLUDE_DIRECTORIES(${PHYSFS_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIRS} ${SDL2_TTF_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} ${SDL2_MIXER_LIBRARIES} ${SDL2_TTF_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${OPENGL_gl_LIBRARY})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PHYSFS_LIBRARY})
# Link "game" to "egolib" and "idlib".
TARGET_LINK_LIBRARIES(egoboo idlib egolib)
# Add Egoboo.
add_subdirectory(egoboo)
Loading

0 comments on commit bd35da9

Please sign in to comment.