project(apShaders)
cmake_minimum_required(VERSION 3.2)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
                      ${CMAKE_SOURCE_DIR}/cmake/modules
                      ${CMAKE_SOURCE_DIR}/cmake/macros)

include(CheckCXXCompilerFlag)

CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)

if(WIN32)
    # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0")
    add_definitions("-W3 -MP -D_CRT_SECURE_NO_WARNINGS -wd4005 -wd4996 -wd4305 -wd4244 -nologo")
    add_definitions(-DPLATFORM_WINDOWS -DPLATFORM=WINDOWS)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
elseif(APPLE)
    add_definitions(-DPLATFORM_DARWIN -DPLATFORM=DARWIN)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
else()
    add_definitions(-DPLATFORM_LINUX -DPLATFORM=LINUX -D_LINUX)
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()

if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
    add_definitions(-DDEBUG=1 -UNDEBUG)
elseif("${CMAKE_BUILD_TYPE}" MATCHES "Release")
    add_definitions(-DNDEBUG=1 -UDEBUG)
    if(NOT WIN32)
        add_definitions(-O3)
    endif()
endif()

Find_Package(Arnold)
Find_Package(Mtoa)

add_subdirectory(src)