# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# If set to true, build for IREE using clang. If false, build for gcc.
set(BUILD_WITH_CLANG ON CACHE BOOL "Build the library with clang.")

set(CMAKE_SYSTEM_NAME          Generic)
set(CMAKE_SYSTEM_ABI           ilp32)
set(CMAKE_EXECUTABLE_SUFFIX    ".elf")

set(VEC_DEFAULT_COPTS
     "-Wall"
     "-O0"
     "-g3"
     "-ggdb"
     "-Werror"
     "-ffreestanding"
     "-ffunction-sections"
     "-fstack-usage"
)

set(VEC_DEFAULT_LINKOPTS
     -Wl,--gc-sections
     -Wl,--print-memory-usage
     -Wl,-Map=${PROJECT_NAME}.map
)

if(${BUILD_WITH_CLANG})
     if(${BUILD_SIMPLIFIED_CORE})
       set(CMAKE_SYSTEM_PROCESSOR rv32im)
     else()
       set(CMAKE_SYSTEM_PROCESSOR rv32imfv1p0)
     endif()
     set(RISCV_TOOLCHAIN_ROOT "$ENV{CACHE}/toolchain_iree_rv32imf/bin/" CACHE PATH "RISC-V toolchain root path")
     message (STATUS "RISC-V toolchain path is ${RISCV_TOOLCHAIN_ROOT}")
     find_file(RISCV_COMPILER "clang" HINTS ${RISCV_TOOLCHAIN_ROOT} PATHS ENV INCLUDE)

     set(CMAKE_FIND_ROOT_PATH ${RISCV_TOOLCHAIN_ROOT})
     list(APPEND CMAKE_PREFIX_PATH "${RISCV_TOOLCHAIN_ROOT}")

     set(CMAKE_C_COMPILER "${RISCV_TOOLCHAIN_ROOT}/clang")
     set(CMAKE_CXX_COMPILER "${RISCV_TOOLCHAIN_ROOT}/clang++")
     set(CMAKE_AR "${RISCV_TOOLCHAIN_ROOT}/llvm-ar")
     set(CMAKE_RANLIB "${RISCV_TOOLCHAIN_ROOT}/llvm-ranlib")
     set(CMAKE_STRIP "${RISCV_TOOLCHAIN_ROOT}/llvm-strip")

     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -menable-experimental-extensions -march=${CMAKE_SYSTEM_PROCESSOR}  -mabi=${CMAKE_SYSTEM_ABI}")
     # Use Nano header and libraries.
     include_directories(BEFORE SYSTEM "${RISCV_TOOLCHAIN_ROOT}/../riscv32-unknown-elf/include/newlib-nano/")
     link_directories(BEFORE "${RISCV_TOOLCHAIN_ROOT}/../riscv32-unknown-elf/lib/newlib-nano")
     set(VEC_DEFAULT_LINKOPTS "${VEC_DEFAULT_LINKOPTS}" "-Wl,--no-warn-rwx-segments")
else()
     set(CMAKE_SYSTEM_PROCESSOR rv32imv)

     set(RISCV_TOOLCHAIN_ROOT "$ENV{CACHE}/toolchain_vp/bin" CACHE STRING "RISC-V toolchain path")
     message (STATUS "RISC-V toolchain path is ${RISCV_TOOLCHAIN_ROOT}")
     find_file( RISCV_COMPILER "riscv32-unknown-elf-gcc" HINTS ${RISCV_TOOLCHAIN_ROOT} PATHS ENV INCLUDE)

     get_filename_component(RISCV_TOOLCHAIN_BIN_PATH ${RISCV_COMPILER} DIRECTORY)
     get_filename_component(RISCV_TOOLCHAIN_BIN_GCC ${RISCV_COMPILER} NAME_WE)
     get_filename_component(RISCV_TOOLCHAIN_BIN_EXT ${RISCV_COMPILER} EXT)

     message( "RISC-V GCC Path: ${RISCV_TOOLCHAIN_BIN_PATH}" )

     STRING(REGEX REPLACE "\-gcc" "-" CROSS_COMPILE ${RISCV_COMPILER})
     message( "RISC-V Cross Compile Prefix: ${CROSS_COMPILE}" )

     set(CMAKE_AR ${CROSS_COMPILE}ar)
     set(CMAKE_ASM_COMPILER ${RISCV_COMPILER})
     set(CMAKE_C_COMPILER ${RISCV_COMPILER})
     set(CMAKE_CXX_COMPILER ${CROSS_COMPILE}g++)

     set( CMAKE_OBJCOPY      ${RISCV_TOOLCHAIN_BIN_PATH}/${CROSS_COMPILE}objcopy
          CACHE FILEPATH "The toolchain objcopy command " FORCE )

     set( CMAKE_OBJDUMP      ${RISCV_TOOLCHAIN_BIN_PATH}/${CROSS_COMPILE}objdump
          CACHE FILEPATH "The toolchain objdump command " FORCE )

     set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${CMAKE_SYSTEM_PROCESSOR}  -mabi=${CMAKE_SYSTEM_ABI}")

     set(VEC_DEFAULT_COPTS "${VEC_DEFAULT_COPTS}"
         "-Wno-format"
     )
     set(VEC_DEFAULT_LINKOPTS "${VEC_DEFAULT_LINKOPTS}"
         "-specs=nano.specs"
     )
endif(${BUILD_WITH_CLANG})

# Check compiler found
if (EXISTS ${RISCV_COMPILER})
     message(STATUS "RISC-V compiler found. Using ${RISCV_COMPILER}")
else()
     message(FATAL_ERROR "RISC-V compiler not found. ${RISCV_OMPILER}")
endif()

set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "" )
set( CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "" )
set( CMAKE_EXE_LINKER_FLAGS   "${CMAKE_EXE_LINKER_FLAGS}  -nostartfiles   " )
