Skip to content

Commit

Permalink
[nix] add static build for libspike
Browse files Browse the repository at this point in the history
  • Loading branch information
Avimitin committed Jul 22, 2024
1 parent 236bef1 commit 3791ef0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion difftest/spike_interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(CMAKE_CXX_STANDARD 17)

find_package(libspike REQUIRED)

add_library(${CMAKE_PROJECT_NAME} SHARED spike_interfaces.cc)
add_library(${CMAKE_PROJECT_NAME} STATIC spike_interfaces.cc)

target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC libspike)

Expand Down
1 change: 0 additions & 1 deletion nix/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ rec {
espresso = final.callPackage ./pkgs/espresso.nix { };
dramsim3 = final.callPackage ./pkgs/dramsim3.nix { };
libspike = final.callPackage ./pkgs/libspike.nix { };
libspike_interfaces = final.callPackage ../difftest/libspike_interfaces { };
buddy-mlir = final.callPackage ./pkgs/buddy-mlir.nix { };
fetchMillDeps = final.callPackage ./pkgs/mill-builder.nix { };
circt-full = final.callPackage ./pkgs/circt-full.nix { };
Expand Down
3 changes: 2 additions & 1 deletion nix/pkgs/libspike.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ stdenv.mkDerivation {
env.cmakeConfig = ''
add_library(libspike STATIC IMPORTED GLOBAL)
set_target_properties(libspike PROPERTIES
IMPORTED_LOCATION "${placeholder "out"}/lib/libriscv.so")
IMPORTED_LOCATION "${placeholder "out"}/lib/libriscv.a")
target_include_directories(libspike AFTER INTERFACE
"${placeholder "out"}/include"
"${placeholder "out"}/include/riscv"
Expand Down Expand Up @@ -37,6 +37,7 @@ stdenv.mkDerivation {
cp softfloat/*.h $out/include/softfloat
cp config.h $out/include
cp *.so $out/lib
cp *.a $out/lib
echo "$cmakeConfig" > $out/lib/cmake/libspike/libspike-config.cmake
runHook postInstall
'';
Expand Down

0 comments on commit 3791ef0

Please sign in to comment.