include(${CMAKE_CURRENT_LIST_DIR}/HermitCore-Utils.cmake) include_guard() include(${CMAKE_CURRENT_LIST_DIR}/HermitCore-Paths.cmake) include(${CMAKE_CURRENT_LIST_DIR}/HermitCore-Configuration.cmake) # scripts to detect HermitCore Go compiler list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/golang/) if(NOT HERMIT_ARCH) execute_process(COMMAND uname -m OUTPUT_VARIABLE HERMIT_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) endif() if(PROFILING) # link everything against XRay link_libraries(-lxray) # generate symbol map file for XRay to resolve function names link_libraries(-Wl,-Map=$.map) # enable profiling with XRay add_compile_options(-falign-functions=32 -finstrument-functions -finstrument-functions-exclude-function-list=_mm_pause,_mm_setcsr,_mm_getcsr) add_definitions(-DXRAY -DXRAY_DISABLE_BROWSER_INTEGRATION -DXRAY_NO_DEMANGLE -DXRAY_ANNOTATE) endif() # use default toolchain if not specified by user if(NOT CMAKE_TOOLCHAIN_FILE) if(BOOTSTRAP) # use bootstrap toolchain if requested set(_BOOTSTRAP_ARCH_SUFFIX -bootstrap) endif() set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/HermitCore-Toolchain-${HERMIT_ARCH}${_BOOTSTRAP_ARCH_SUFFIX}.cmake) endif() # NASM is only required on x86_64 if("${HERMIT_ARCH}" STREQUAL "x86_64") # NASM detection will change binary format depending on host system, but # we only want to generate elf64 for HermitCore # Note: Has to be set *before* ASM_NASM is enabled set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) enable_language(ASM_NASM) # NASM hack, because it requires include paths to have a trailing /, whereas # CMake explicitly will remove it when adding includes the usual way # Note: Has to be set *after* ASM_NASM is enabled set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -I ${CMAKE_BINARY_DIR}/include/") endif() if(MTUNE) set(HERMIT_KERNEL_FLAGS ${HERMIT_KERNEL_FLAGS} -mtune=${MTUNE}) set(HERMIT_APP_FLAGS ${HERMIT_APP_FLAGS} -mtune=${MTUNE}) endif() set(HERMIT_KERNEL_INCLUDES ${CMAKE_BINARY_DIR}/include ${HERMIT_ROOT}/include ${HERMIT_ROOT}/arch/${HERMIT_ARCH}/include ${HERMIT_ROOT}/lwip/src/include ${HERMIT_ROOT}/drivers) # HACK: when CMake detects compilers it taints CMAKE_INSTALL_PREFIX, so in # order to rely on that variable (we redefine it), enable all languages # here and source pathes again. # # Furthermore this will produce a sensible error message if the toolchain cannot # be found. if(NOT BOOTSTRAP) enable_language(C CXX Fortran Go) include(${CMAKE_CURRENT_LIST_DIR}/HermitCore-Paths.cmake) endif() # find elfedit, CMake doesn't use this program, so we have to find it ourself find_toolchain_program(elfedit)