2018-12-08 18:39:23 +00:00
|
|
|
# Copyright (C) 2018 Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
|
|
|
# Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
project(TTT3D CXX)
|
|
|
|
|
|
|
|
# Binary filename
|
|
|
|
set(TARGET_NAME "ttt3d")
|
|
|
|
set(TARGET_VERSION "v1.0")
|
|
|
|
|
|
|
|
# Use DEBUG by default
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE "release")
|
|
|
|
endif()
|
|
|
|
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
|
|
|
|
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
|
|
|
|
|
|
|
|
# prefer newer versions of OpenGL
|
|
|
|
set(OpenGL_GL_PREFERENCE "GLVND")
|
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
find_package(GLEW REQUIRED)
|
2018-12-12 07:57:14 +00:00
|
|
|
find_package(GLUT REQUIRED)
|
2018-12-08 18:39:23 +00:00
|
|
|
find_package(PkgConfig REQUIRED)
|
2018-12-12 07:57:14 +00:00
|
|
|
pkg_search_module(ASSIMP REQUIRED assimp)
|
2018-12-08 18:39:23 +00:00
|
|
|
pkg_search_module(SDL2 REQUIRED sdl2)
|
|
|
|
|
|
|
|
include_directories(
|
2018-12-12 07:57:14 +00:00
|
|
|
SYSTEM ${ASSIMP_INCLUDE_DIRS}
|
2018-12-08 18:39:23 +00:00
|
|
|
SYSTEM ${SDL2_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
set(SRCS
|
2018-12-17 10:27:54 +00:00
|
|
|
"src/AssetManager.cpp"
|
2018-12-17 13:22:23 +00:00
|
|
|
"src/Camera.cpp"
|
2018-12-08 18:39:23 +00:00
|
|
|
"src/Logger.cpp"
|
|
|
|
"src/Main.cpp"
|
2018-12-17 10:27:54 +00:00
|
|
|
"src/Model.cpp"
|
|
|
|
"src/Shader.cpp"
|
2018-12-08 18:39:23 +00:00
|
|
|
"src/System.cpp")
|
|
|
|
|
|
|
|
# Define C++ compiler flags
|
|
|
|
set(CMAKE_CXX_FLAGS "-std=c++14 -Wall -Wextra -Wpedantic -Wfatal-errors -Werror -pedantic-errors -fno-elide-constructors")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3")
|
|
|
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
|
|
|
|
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "debug" OR CMAKE_BUILD_TYPE STREQUAL "relwithdebinfo")
|
|
|
|
add_definitions("-DDEBUG")
|
|
|
|
else()
|
|
|
|
add_definitions("-DNDEBUG")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_definitions("-DVERSION=\"${TARGET_VERSION}\"")
|
|
|
|
|
|
|
|
add_executable(${TARGET_NAME}
|
|
|
|
${SRCS})
|
|
|
|
|
|
|
|
target_link_libraries(${TARGET_NAME}
|
|
|
|
OpenGL::OpenGL
|
|
|
|
OpenGL::GLU
|
2018-12-12 07:57:14 +00:00
|
|
|
${ASSIMP_LIBRARIES}
|
2018-12-08 18:39:23 +00:00
|
|
|
${GLEW_LIBRARIES}
|
2018-12-12 07:57:14 +00:00
|
|
|
${GLUT_LIBRARIES}
|
2018-12-08 18:39:23 +00:00
|
|
|
${SDL2_LIBRARIES})
|