Commit 73580600 authored by Thomas Eppers's avatar Thomas Eppers
Browse files

build usable cmake file for linux machines

parent f7b595ed
cmake_minimum_required(VERSION 3.1)
project(gdw_ss15_cpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
#use clang instead of g++
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -stdlib=libc++")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -pedantic")
#define symbols for debug build
if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-DDEBUG)
if(NOT WIN32)
add_definitions(-DSTACKTRACE)
endif()
endif()
#define symbols for project
add_definitions(-DGLM_SWIZZLE)
add_definitions(-DGLEW_STATIC)
find_package(OpenGL)
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/include"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/gli/gli"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/glm/glm"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/gli"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/glm"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2/include"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2_mixer/x86_64-w64-mingw32/include/SDL2"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
)
FILE (GLOB_RECURSE clion_all_headers
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/include/*.h
${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/*.inl
)
add_executable(Game ${clion_all_headers})
\ No newline at end of file
#glew library
add_library(glew_static STATIC IMPORTED)
set_target_properties(glew_static PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/build/libGLEW.a
)
set(LINKED_LIBRARIES
"SDL2"
"SDL2main"
"SDL2_mixer"
"GL"
)
add_executable(Game ${clion_all_headers})
target_link_libraries(Game ${LINKED_LIBRARIES} glew_static)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment