build: build am for multiple platform in parallel

This commit is contained in:
xinyangli 2024-04-13 21:15:56 +08:00
parent 6ab5d4c156
commit a54c0d6480
Signed by: xin
SSH key fingerprint: SHA256:qZ/tzd8lYRtUFSrfBDBMcUqV4GHKxqeqRA3huItgvbk
19 changed files with 206 additions and 146 deletions

View file

@ -2,5 +2,7 @@
**/build/ **/build/
**/.envrc **/.envrc
**/.cache **/.cache
out/
.vscode .vscode
compile_commands.json compile_commands.json
cmakeUserh

View file

@ -8,6 +8,7 @@ set(CMAKE_CXX_STANDARD 11)
include(CMakeDependentOption) include(CMakeDependentOption)
include(CMakePackageConfigHelpers) # Used to find libcheck include(CMakePackageConfigHelpers) # Used to find libcheck
include(CTest) include(CTest)
include(GNUInstallDirs)
# -- General options # -- General options
set(ISA CACHE STRING "Target ISA") set(ISA CACHE STRING "Target ISA")
@ -17,12 +18,15 @@ string(TOUPPER ${ISA} ISA_UPPER)
cmake_dependent_option( cmake_dependent_option(
__PLATFORM_NEMU__ "Run on NEMU" __PLATFORM_NEMU__ "Run on NEMU"
ON "ISA MATCHES \"(riscv | x86)\"" OFF) ON "ISA MATCHES \"(riscv | x86)\"" OFF)
cmake_dependent_option(
__PLATFORM_NPC__ "Run on NPC"
ON "ISA MATCHES riscv" OFF)
cmake_dependent_option( cmake_dependent_option(
__PLATFORM_NATIVE__ "Run on native" __PLATFORM_NATIVE__ "Run on native"
ON "ISA MATCHES native" OFF) ON "ISA MATCHES native" OFF)
# -- Set PLATFORM according to options # -- Set PLATFORM according to options
set(MATCH_PLATFORM_PATTERN "^__PLATFORM_([A-Z]*)__") set(MATCH_PLATFORM_PATTERN "^__PLATFORM_([A-Z]*)__$")
get_cmake_property(CACHE_VARS CACHE_VARIABLES) get_cmake_property(CACHE_VARS CACHE_VARIABLES)
message(STATUS "ISA: ${ISA}") message(STATUS "ISA: ${ISA}")
@ -32,16 +36,27 @@ foreach(VAR IN LISTS CACHE_VARS)
get_property(VAR_VALUE CACHE ${VAR} PROPERTY VALUE) get_property(VAR_VALUE CACHE ${VAR} PROPERTY VALUE)
set(PLATFORM_UPPER ${CMAKE_MATCH_1}) set(PLATFORM_UPPER ${CMAKE_MATCH_1})
string(TOLOWER ${PLATFORM_UPPER} PLATFORM) string(TOLOWER ${PLATFORM_UPPER} PLATFORM)
list(APPEND PLATFORMS ${PLATFORM})
message(STATUS "Variable: ${VAR}=${VAR_VALUE}, Platform: ${PLATFORM}") message(STATUS "Variable: ${VAR}=${VAR_VALUE}, Platform: ${PLATFORM}")
endif() endif()
endforeach() endforeach()
if(${PLATFORM} MATCHES "native") if((NOT PLATFORM) AND (NOT ISA MATCHES native))
set(ARCH "native") message(FATAL_ERROR "Platform not given!")
else()
set(ARCH ${ISA}-${PLATFORM})
endif() endif()
string(TOUPPER ${ARCH} ARCH_UPPER)
set(SUPPORTED_ARCH "riscv-nemu" "riscv-npc" "native")
foreach(PLATFORM IN LISTS PLATFORMS)
if(${ISA} MATCHES "native")
set(ARCH "native")
else()
set(ARCH ${ISA}-${PLATFORM})
endif()
if(NOT ARCH IN_LIST SUPPORTED_ARCH)
message(FATAL_ERROR "Given ISA-PLATFORM (${ISA}-${PLATFORM}) does not match one of the following: ${SUPPORTED_ARCH}")
endif()
endforeach()
# -- Target specific options # -- Target specific options
cmake_dependent_option( cmake_dependent_option(
@ -49,39 +64,34 @@ cmake_dependent_option(
ON "NOT __ISA_NATIVE__" OFF) ON "NOT __ISA_NATIVE__" OFF)
# -- Add compile definitions based on options # -- Add compile definitions based on options
add_compile_definitions(
$<MAKE_C_IDENTIFIER:__ARCH_${ARCH_UPPER}__>
__ISA_${ISA_UPPER}__
__PLATFORM_${PLATFORM_UPPER}__
)
add_compile_definitions(
$<$<BOOL:${NATIVE_USE_KLIB}>:__NATIVE_USE_KLIB__>
)
# -- Required compiler flags
add_compile_options(
# -Werror
-Wno-main
-fno-asynchronous-unwind-tables
-fno-builtin
-fno-stack-protector
-U_FORTIFY_SOURCE
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
$<$<COMPILE_LANGUAGE:CXX>:-ffreestanding>
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
add_link_options(
-znoexecstack
)
# -- Include linker script here. Use this linker script at link time if INCLUDE_LINKER_SCRIPT is set to true
set(LINKER_SCRIPT linker.ld)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
add_compile_options(-march=rv32if -mabi=ilp32) # NOTE: klib and am include header files in each other,
add_link_options(-march=rv32if -mabi=ilp32) # so we need to create interface libraries for correct dependency
add_library(am_interface INTERFACE)
target_include_directories(am_interface INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/am/include>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/am/src>
$<INSTALL_INTERFACE:include/abstract-machine>)
target_compile_definitions(am_interface INTERFACE ARCH_H=<arch/${ISA}.h>)
add_library(klib_interface INTERFACE)
target_include_directories(klib_interface
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/klib/include>
$<INSTALL_INTERFACE:include/abstract-machine>)
install(TARGETS am_interface klib_interface
EXPORT interfaceTargets
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/abstract-machine)
install(EXPORT interfaceTargets
FILE interfaceTargets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
add_subdirectory(klib) add_subdirectory(klib)
add_subdirectory(am) add_subdirectory(am)
# -- Test depends on klib and am should be added last.
add_subdirectory(klib/tests)

View file

@ -14,14 +14,14 @@
} }
}, },
{ {
"name": "riscv-nemu", "name": "riscv",
"displayName": "Riscv32 NEMU", "displayName": "RV32 all platform",
"generator": "Unix Makefiles", "generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/out/build/${presetName}", "binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "/home/xin/repo/ysyx-workbench/abstract-machine/out/install",
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug", "CMAKE_BUILD_TYPE": "Debug",
"ISA": "riscv", "ISA": "riscv",
"__PLATFORM_NPC__": true,
"__PLATFORM_NEMU__": true "__PLATFORM_NEMU__": true
} }
} }

View file

@ -0,0 +1,15 @@
{
"version": 6,
"configurePresets": [
{
"name": "Native install",
"inherits": "native",
"installDir": "/home/xin/repo/ysyx-workbench/abstract-machine/out/install"
},
{
"name": "RISCV install",
"inherits": "riscv",
"installDir": "/home/xin/repo/ysyx-workbench/abstract-machine/out/install"
}
]
}

View file

@ -1,10 +1,26 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_library(am_interface INTERFACE)
target_include_directories(am_interface INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/abstract-machine>)
add_subdirectory(src) add_subdirectory(src)
install(DIRECTORY include/ DESTINATION include/abstract-machine) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/abstract-machine)
foreach(PLATFORM IN LISTS PLATFORMS)
if(ISA MATCHES "native")
set(ARCH "native")
else()
set(ARCH ${ISA}-${PLATFORM})
endif()
install(TARGETS am-${ARCH}
EXPORT amTargets-${ARCH}
LIBRARY DESTINATION lib)
install(EXPORT amTargets-${ARCH}
FILE amTargets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/am-${ARCH})
configure_package_config_file(
${CMAKE_SOURCE_DIR}/cmake/am-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/am-${ARCH}-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/am-${ARCH})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/am-${ARCH}-config.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/am-${ARCH})
endforeach()

View file

@ -1,53 +1 @@
if(ISA MATCHES "native") add_subdirectory(${ISA})
set(SOURCEDIR "./${PLATFORM}")
else()
set(SOURCEDIR "./${ISA}/${PLATFORM}")
endif()
add_subdirectory(${SOURCEDIR})
target_include_directories(am-${ARCH}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
$<INSTALL_INTERFACE:include/abstract-machine>)
target_link_libraries(am-${ARCH}
PUBLIC klib_interface
INTERFACE m)
# TODO: Check
target_link_options(am-${ARCH} INTERFACE
$<BUILD_INTERFACE:-T${CMAKE_SOURCE_DIR}/scripts/${LINKER_SCRIPT}>
$<INSTALL_INTERFACE:-T${CMAKE_INSTALL_LIBDIR}/cmake/am-${ARCH}/${LINKER_SCRIPT}>)
# Interface compile flags
target_link_options(am-${ARCH} INTERFACE
-znoexecstack)
target_compile_options(am-${ARCH} INTERFACE
-fno-asynchronous-unwind-tables
-fno-builtin
-fno-stack-protector
-U_FORTIFY_SOURCE
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
$<$<COMPILE_LANGUAGE:CXX>:-ffreestanding>
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
install(TARGETS am-${ARCH} klib_interface am_interface
EXPORT amTargets
LIBRARY DESTINATION lib)
install(EXPORT amTargets
FILE amTargets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/am-${ARCH})
configure_package_config_file(${CMAKE_SOURCE_DIR}/cmake/am-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/am-${ARCH}-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/am-${ARCH})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/am-${ARCH}-config.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/am-${ARCH})
# TODO: check
install(FILES ${CMAKE_SOURCE_DIR}/scripts/${LINKER_SCRIPT}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/am-${ARCH})

View file

@ -1,6 +1,3 @@
include(CheckPIESupported)
check_pie_supported()
set(SOURCES set(SOURCES
trap.S trap.S
cte.c cte.c
@ -23,4 +20,4 @@ set_target_properties(am-native PROPERTIES
INTERFACE_POSITION_INDEPENDENT_CODE TRUE) INTERFACE_POSITION_INDEPENDENT_CODE TRUE)
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
target_link_libraries(am-${ARCH} PUBLIC SDL2::SDL2) target_link_libraries(am-native PUBLIC SDL2::SDL2 PRIVATE klib_interface am_interface)

View file

@ -0,0 +1,12 @@
foreach(PLATFORM IN LISTS PLATFORMS)
string(TOUPPER ${ARCH} ARCH_UPPER)
set(AM_COMMON_COMPILE_DEF
# -- Arch related
$<MAKE_C_IDENTIFIER:__ARCH_${ARCH_UPPER}__>
__ISA_${ISA_UPPER}__
__PLATFORM_${PLATFORM_UPPER}__
$<$<BOOL:${NATIVE_USE_KLIB}>:__NATIVE_USE_KLIB__>
)
add_subdirectory(${PLATFORM})
endforeach()

View file

@ -1,7 +1,7 @@
include(nemu-settings) include(nemu-settings)
include(riscv-settings) include(riscv-settings)
add_library(am-${ISA}-nemu add_library(am-riscv-nemu
cte.c cte.c
start.S start.S
trap.S trap.S
@ -9,26 +9,44 @@ add_library(am-${ISA}-nemu
${NEMU_SOURCES} ${NEMU_SOURCES}
) )
target_compile_options(am-${ISA}-nemu PRIVATE target_compile_options(am-riscv-nemu PRIVATE
${NEMU_COMPILE_OPTIONS} ${NEMU_COMPILE_OPTIONS}
${RISCV_COMPILE_OPTIONS}) ${RISCV_COMPILE_OPTIONS})
target_link_options(am-${ISA}-nemu PRIVATE
target_link_options(am-riscv-nemu PRIVATE
${NEMU_LINK_OPITIONS} ${NEMU_LINK_OPITIONS}
${RISCV_LINK_OPTIONS}) ${RISCV_LINK_OPTIONS})
target_include_directories(am-${ISA}-nemu PRIVATE
target_include_directories(am-riscv-nemu PRIVATE
${NEMU_INCLUDE_DIRECTORIES}) ${NEMU_INCLUDE_DIRECTORIES})
target_link_options(am-${ISA}-nemu INTERFACE
target_link_options(am-riscv-nemu INTERFACE
LINKER:--defsym=_pmem_start=0x80000000 LINKER:--defsym=_pmem_start=0x80000000
LINKER:--defsym=_entry_offset=0x0 LINKER:--defsym=_entry_offset=0x0
LINKER:--gc-sections LINKER:--gc-sections
LINKER:-e _start LINKER:-e _start
-nostartfiles) -nostartfiles)
target_compile_definitions(am-${ISA}-nemu PUBLIC target_link_options(am-riscv-nemu INTERFACE
ARCH_H="arch/riscv.h") $<BUILD_INTERFACE:-T${CMAKE_SOURCE_DIR}/scripts/linker.ld>
target_compile_definitions(am-${ISA}-nemu PRIVATE $<INSTALL_INTERFACE:-T${CMAKE_INSTALL_FULL_DATADIR}/linker.ld>)
ISA_H="riscv/riscv.h")
set_target_properties(am-${ISA}-nemu PROPERTIES target_include_directories(am-riscv-nemu
PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/am/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/abstract-machine>)
target_link_libraries(am-riscv-nemu
PUBLIC am_interface klib_interface
INTERFACE m)
target_compile_definitions(am-riscv-nemu PRIVATE
ISA_H=<riscv/riscv.h>)
set_target_properties(am-riscv-nemu PROPERTIES
POSITION_INDEPENDENT_CODE OFF POSITION_INDEPENDENT_CODE OFF
INTERFACE_POSITION_INDEPENDENT_CODE OFF) INTERFACE_POSITION_INDEPENDENT_CODE OFF)
install(FILES ${CMAKE_SOURCE_DIR}/scripts/linker.ld
DESTINATION ${CMAKE_INSTALL_DATADIR})

View file

@ -0,0 +1,39 @@
include(riscv-settings)
add_subdirectory(libgcc)
add_library(am-riscv-npc
cte.c
input.c
ioe.c
mpe.c
start.S
timer.c
trap.S
trm.c
vme.c
)
target_link_libraries(am-riscv-npc PRIVATE npcgcc PUBLIC am_interface klib_interface)
target_link_options(am-riscv-npc INTERFACE
$<BUILD_INTERFACE:-T${CMAKE_SOURCE_DIR}/scripts/linker.ld>
$<INSTALL_INTERFACE:-T${CMAKE_INSTALL_FULL_DATADIR}/linker.ld>)
target_link_options(am-riscv-npc INTERFACE
LINKER:--defsym=_pmem_start=0x80000000
LINKER:--defsym=_entry_offset=0x0
LINKER:--gc-sections
LINKER:-e _start
-nostartfiles)
target_link_options(am-riscv-npc INTERFACE
$<BUILD_INTERFACE:-T${CMAKE_SOURCE_DIR}/scripts/linker.ld>
$<INSTALL_INTERFACE:-T${CMAKE_INSTALL_FULL_DATADIR}/linker.ld>)
target_compile_definitions(am-riscv-npc
PUBLIC ${AM_COMMON_COMPILE_DEF} ARCH_H=<arch/riscv.h>
)
install(FILES ${CMAKE_SOURCE_DIR}/scripts/linker.ld
DESTINATION ${CMAKE_INSTALL_DATADIR})

View file

@ -0,0 +1,14 @@
add_library(npcgcc
ashldi3.c
div.S
muldi3.S
multi3.c
unused.c
)
target_link_libraries(npcgcc PRIVATE klib_interface am_interface)
target_link_options(npcgcc INTERFACE -nolibc -nostdlib)
install(TARGETS npcgcc
EXPORT amTargets-riscv-npc
LIBRARY DESTINATION lib)

View file

@ -6,7 +6,7 @@ int main(const char *args);
extern char _pmem_start; extern char _pmem_start;
#define PMEM_SIZE (128 * 1024 * 1024) #define PMEM_SIZE (128 * 1024 * 1024)
#define PMEM_END ((uintptr_t)&_pmem_start + PMEM_SIZE) #define PMEM_END ((uintptr_t)&_pmem_start + PMEM_SIZE)
Area heap = RANGE(&_heap_start, PMEM_END); Area heap = RANGE(&_heap_start, PMEM_END);
#ifndef MAINARGS #ifndef MAINARGS
@ -14,11 +14,12 @@ Area heap = RANGE(&_heap_start, PMEM_END);
#endif #endif
static const char mainargs[] = MAINARGS; static const char mainargs[] = MAINARGS;
void putch(char ch) { void putch(char ch) {}
}
void halt(int code) { void halt(int code) {
while (1); asm volatile("mv a0, %0; ebreak" : : "r"(code));
while (1)
;
} }
void _trm_init() { void _trm_init() {

View file

@ -6,4 +6,5 @@ find_dependency(SDL2 REQUIRED)
endif() endif()
# Include the targets file # Include the targets file
include("${CMAKE_CURRENT_LIST_DIR}/../interfaceTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/amTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/amTargets.cmake")

View file

@ -3,7 +3,7 @@
cmake, cmake,
SDL2, SDL2,
isa ? "native", isa ? "native",
platform ? "NEMU" platform ? [ ]
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "abstract-machine"; pname = "abstract-machine";
@ -13,8 +13,7 @@ stdenv.mkDerivation {
cmakeFlags = [ cmakeFlags = [
(lib.cmakeFeature "ISA" isa) (lib.cmakeFeature "ISA" isa)
(lib.cmakeBool "__PLATFORM_${lib.strings.toUpper platform}__" true) ] ++ map (p: (lib.cmakeBool "__PLATFORM_${lib.strings.toUpper p}__" true)) platform;
];
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
@ -22,5 +21,7 @@ stdenv.mkDerivation {
buildInputs = [ buildInputs = [
] ++ (if platform=="native" then [ SDL2 ] else [ ]); ] ++ (if isa=="native" then [ SDL2 ] else [ ]);
doCheck = true;
} }

View file

@ -1,12 +1 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_library(klib_interface INTERFACE)
target_include_directories(klib_interface
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/abstract-machine>)
add_subdirectory(src) add_subdirectory(src)
# add_subdirectory(tests)
install(DIRECTORY include/ DESTINATION include/abstract-machine)

View file

@ -13,8 +13,7 @@ set(SOURCES
) )
add_library(klib ${SOURCES}) add_library(klib ${SOURCES})
target_include_directories(klib PUBLIC $<TARGET_PROPERTY:am_interface,INTERFACE_INCLUDE_DIRECTORIES>) target_link_libraries(klib PRIVATE am_interface klib_interface)
target_compile_definitions(klib PUBLIC $<TARGET_PROPERTY:am-${ARCH},INTERFACE_COMPILE_DEFINITIONS>)
install(TARGETS klib install(TARGETS klib
EXPORT klibTargets EXPORT klibTargets

View file

@ -4,14 +4,11 @@ set(TEST_SOURCES
) )
foreach(TEST IN LISTS TEST_SOURCES) foreach(TEST IN LISTS TEST_SOURCES)
add_executable(${TEST} ${TEST}.c)
target_link_libraries(${TEST} am-${ARCH} klib m)
target_include_directories(${TEST}
PRIVATE $<TARGET_PROPERTY:am_interface,INTERFACE_INCLUDE_DIRECTORIES>
PRIVATE $<TARGET_PROPERTY:klib_interface,INTERFACE_INCLUDE_DIRECTORIES>
)
# TODO: Run tests in other configurations # TODO: Run tests in other configurations
if(__PLATFORM_NATIVE__) if(__PLATFORM_NATIVE__)
add_executable(${TEST} ${TEST}.c)
target_link_libraries(${TEST} PRIVATE am_interface klib_interface klib m)
target_link_libraries(${TEST} PRIVATE am-native)
add_test(NAME ${TEST} COMMAND ${TEST}) add_test(NAME ${TEST} COMMAND ${TEST})
endif() endif()
endforeach() endforeach()

View file

@ -42,6 +42,8 @@
src = ./.; src = ./.;
hooks = { hooks = {
trim-trailing-whitespace.enable = true; trim-trailing-whitespace.enable = true;
end-of-file-fixer.enable = true;
cmake-format.enable = true;
clang-format = { clang-format = {
enable = true; enable = true;
types_or = pkgs.lib.mkForce [ "c" "c++" ]; types_or = pkgs.lib.mkForce [ "c" "c++" ];
@ -52,7 +54,8 @@
packages.nemu = pkgs.callPackage ./nemu { am-kernels = self.packages.${system}.am-kernels; }; packages.nemu = pkgs.callPackage ./nemu { am-kernels = self.packages.${system}.am-kernels; };
packages.nemu-lib = pkgs.callPackage ./nemu { am-kernels = self.packages.${system}.am-kernels; defconfig = "riscv32-lib_defconfig"; }; packages.nemu-lib = pkgs.callPackage ./nemu { am-kernels = self.packages.${system}.am-kernels; defconfig = "riscv32-lib_defconfig"; };
packages.abstract-machine = crossPkgs.callPackage ./abstract-machine { isa = "riscv"; platform = "nemu"; }; packages.abstract-machine = crossPkgs.callPackage ./abstract-machine { isa = "riscv"; platform = [ "nemu" "npc" ]; };
packages.abstract-machine-native = pkgs.callPackage ./abstract-machine { isa = "native"; };
packages.am-kernels = crossPkgs.stdenv.mkDerivation rec { packages.am-kernels = crossPkgs.stdenv.mkDerivation rec {
pname = "am-kernels-cmake"; pname = "am-kernels-cmake";
@ -67,7 +70,6 @@
cmakeFlags = [ cmakeFlags = [
(pkgs.lib.cmakeFeature "ISA" "riscv") (pkgs.lib.cmakeFeature "ISA" "riscv")
(pkgs.lib.cmakeFeature "PLATFORM" "nemu") (pkgs.lib.cmakeFeature "PLATFORM" "nemu")
(pkgs.lib.cmakeFeature "CMAKE_INSTALL_DATADIR" "share")
]; ];
buildInputs = [ buildInputs = [
@ -87,13 +89,12 @@
IMAGES_PATH = "${self.packages.${system}.am-kernels}/share/binary"; IMAGES_PATH = "${self.packages.${system}.am-kernels}/share/binary";
}; };
devShells.npc = with pkgs; mkShell { devShells.npc = with pkgs; mkShell.override { stdenv = ccacheStdenv; } {
inherit (self.checks.${system}.pre-commit-check) shellHook; inherit (self.checks.${system}.pre-commit-check) shellHook;
CHISEL_FIRTOOL_PATH = "${nixpkgs-circt162.legacyPackages.${system}.circt}/bin"; CHISEL_FIRTOOL_PATH = "${nixpkgs-circt162.legacyPackages.${system}.circt}/bin";
packages = [ packages = [
clang-tools clang-tools
cmake cmake
ninja
coursier coursier
espresso espresso
bloop bloop