2018-10-25 14:19:07 +00:00
|
|
|
# Copyright (C) 2018 Ortega Froysa, Nicolás <nortega@themusicinnoise.net> All rights reserved.
|
|
|
|
# Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
|
|
|
#
|
|
|
|
# This software is provided 'as-is', without any express or implied
|
|
|
|
# warranty. In no event will the authors be held liable for any damages
|
|
|
|
# arising from the use of this software.
|
|
|
|
#
|
|
|
|
# Permission is granted to anyone to use this software for any purpose,
|
|
|
|
# including commercial applications, and to alter it and redistribute it
|
|
|
|
# freely, subject to the following restrictions:
|
|
|
|
#
|
|
|
|
# 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
# claim that you wrote the original software. If you use this software
|
|
|
|
# in a product, an acknowledgment in the product documentation would be
|
|
|
|
# appreciated but is not required.
|
|
|
|
#
|
|
|
|
# 2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
# misrepresented as being the original software.
|
|
|
|
#
|
|
|
|
# 3. This notice may not be removed or altered from any source
|
|
|
|
# distribution.
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2018-10-25 18:13:12 +00:00
|
|
|
project(TrippyCube C CXX)
|
2018-10-25 14:19:07 +00:00
|
|
|
|
|
|
|
# Binary filename
|
|
|
|
set(TARGET_NAME "trippy-cube")
|
2018-10-25 17:56:30 +00:00
|
|
|
set(TARGET_VERSION "v2.0")
|
2018-10-25 14:19:07 +00:00
|
|
|
|
|
|
|
# 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(GLUT REQUIRED)
|
|
|
|
find_package(GLEW REQUIRED)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_search_module(SDL2 REQUIRED sdl2)
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${SDL2_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
set(SRCS
|
|
|
|
"src/camera.cpp"
|
2018-10-25 15:57:52 +00:00
|
|
|
"src/cube.cpp"
|
2018-10-25 14:19:07 +00:00
|
|
|
"src/input.cpp"
|
|
|
|
"src/main.cpp"
|
2018-10-25 15:57:52 +00:00
|
|
|
"src/shaders.cpp"
|
|
|
|
"src/simulation.cpp")
|
2018-10-25 14:19:07 +00:00
|
|
|
|
|
|
|
# Define C++ compiler flags
|
|
|
|
set(CMAKE_CXX_FLAGS "-std=c++11 -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")
|
2018-10-25 17:56:30 +00:00
|
|
|
add_definitions("-DDEBUG")
|
2018-10-25 14:19:07 +00:00
|
|
|
else()
|
2018-10-25 17:56:30 +00:00
|
|
|
add_definitions("-DNDEBUG")
|
2018-10-25 14:19:07 +00:00
|
|
|
endif()
|
|
|
|
|
2018-10-25 17:56:30 +00:00
|
|
|
add_definitions("-DVERSION=\"${TARGET_VERSION}\"")
|
|
|
|
|
2018-10-25 14:19:07 +00:00
|
|
|
add_executable(${TARGET_NAME}
|
|
|
|
${SRCS})
|
|
|
|
|
|
|
|
target_link_libraries(${TARGET_NAME}
|
|
|
|
OpenGL::OpenGL
|
|
|
|
OpenGL::GLU
|
|
|
|
${GLUT_LIBRARIES}
|
|
|
|
${GLEW_LIBRARIES}
|
|
|
|
${SDL2_LIBRARIES})
|