cmake_minimum_required(VERSION 3.1)

# External cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/cmake ${CMAKE_MODULE_PATH})

project("ThreeDEngine")

include(Buildupng)
include(GetGitRevisionDescription)
git_describe(VERSION --tags --dirty=-dirty)

option(WARN_AS_ERROR "Enable warning as error" OFF)

set(COMP_FLAGS "-march=native -Wall -Wextra -Wno-unused-parameter -Wno-unused-result -Wno-write-strings")

if (WARN_AS_ERROR)
    set(COMP_FLAGS "${COMP_FLAGS} -Werror")
endif()

set(CMAKE_C_FLAGS ${COMP_FLAGS})
set(CMAKE_CXX_FLAGS ${COMP_FLAGS})

message("-- Building version ${VERSION}")

add_compile_definitions(VERSION="${VERSION}")

add_subdirectory(source)