cmake_minimum_required(VERSION 3.18)
project(Transpose CXX)

if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    message(FATAL_ERROR "Only g++ compiler is supported!")
endif()
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
    message(FATAL_ERROR "Only 64-bit systems are supported!")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s -march=native -mtune=native -fopenmp -std=c++17 -Ofast -Wall -static-libgcc -static-libstdc++ -ftree-vectorize -funroll-loops -DNDEBUG -fPIC -fno-strict-aliasing -Wno-format -Wno-class-memaccess -Wno-deprecated-declarations -fvisibility=hidden")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s -march=native -mtune=native -Ofast -Wall -static-libgcc -ftree-vectorize -funroll-loops -DNDEBUG -fPIC -fvisibility=hidden")

if(APPLE AND ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flax-vector-conversions")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flax-vector-conversions")
endif()

add_subdirectory(contract)
add_subdirectory(sring)
add_subdirectory(sparse)
add_subdirectory(sesum_impl)
# final dynamic library
add_subdirectory(cwrapper)

