forked from riscv/sail-riscv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a draft of a CMake build system. It doesn't yet include RVFI, JSON docs, formal stuff, etc.
- Loading branch information
Showing
514 changed files
with
48,328 additions
and
47,434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,7 @@ _build/ | |
_sbuild/ | ||
*.o | ||
*.a | ||
/z3_problems | ||
z3_problems | ||
|
||
# Typical CMake build directory. | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
cmake_minimum_required(VERSION 3.27) | ||
|
||
project(sail_riscv) | ||
|
||
# Enable CTest | ||
enable_testing() | ||
|
||
# We technically require C++20 since the C generated by Sail - which we compile | ||
# as C++ - uses designated initialisers, a C++20 feature. However in practice | ||
# much older compilers support this feature so everything does work with C++17, | ||
# but you get lots of warnings on compilers that support C++20 if you use | ||
# this feature without -std=c++20. | ||
if (cxx_std_20 IN_LIST CMAKE_CXX_COMPILE_FEATURES) | ||
set(CMAKE_CXX_STANDARD 20) | ||
else() | ||
set(CMAKE_CXX_STANDARD 17) | ||
endif() | ||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE) | ||
|
||
# Export compile_commands.json for IDE support. | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) | ||
|
||
# Always use Position Independent Code. By default it is only used for | ||
# shared libraries (which require it), but you also need it for static | ||
# libraries if you link them into shared libraries. | ||
# Generally it just simplifies everything for a negligable performance cost. | ||
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) | ||
|
||
# Don't allow undefined symbols in shared libraries. This is generally a pain. | ||
if (UNIX) | ||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined") | ||
endif() | ||
|
||
# Optional faster binary. Increases compilation time a lot though due to LTO. | ||
option(EXTRA_FAST "Enable aggressive optimisation flags (-march=native, -flto, etc)" FALSE) | ||
|
||
if (EXTRA_FAST) | ||
include("cmake/extra_fast.cmake") | ||
endif() | ||
|
||
# Extra CMake files. | ||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") | ||
|
||
# These are the main requirements. | ||
# Don't use `REQUIRED` so that we can print custom help messages. | ||
find_package(ZLIB) | ||
if (NOT ZLIB_FOUND) | ||
message(FATAL_ERROR "Zlib not found. Try 'sudo apt install zlib1g-dev' or 'sudo dnf install zlib-devel'.") | ||
endif() | ||
|
||
find_package(GMP) | ||
if (NOT GMP_FOUND) | ||
message(FATAL_ERROR "GMP not found. Try 'sudo apt install libgmp3-dev' or 'sudo dnf install gmp-devel'.") | ||
endif() | ||
|
||
find_program(sail "sail") | ||
if (NOT sail) | ||
message(FATAL_ERROR "Sail not found. See README.md for installation instructions.") | ||
endif() | ||
|
||
set(ENABLED_ARCHITECTURES "rv32;rv64" CACHE STRING "Enabled architectures to build (rv32, rv64, rv32d, rv64f)" ) | ||
|
||
# Softfloat support. | ||
add_subdirectory("dependencies/softfloat") | ||
|
||
# Sail C runtime. | ||
add_subdirectory("sail_runtime") | ||
|
||
# Sail model generated C code. | ||
add_subdirectory("model") | ||
|
||
# Emulator binary. | ||
add_subdirectory("emulator") | ||
|
||
# Old pre-compiled riscv-tests. | ||
add_subdirectory("test/riscv-tests") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
105 changes: 0 additions & 105 deletions
105
c_emulator/SoftFloat-3e/source/8086/s_propagateNaNF128UI.c
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
include(CheckCXXCompilerFlag) | ||
|
||
# Enable agressive optimisation flags. | ||
|
||
# Try to use -march=x86-64-v3, but fall back to -march=native if we are | ||
# using an old compiler that doesn't support that flag. | ||
check_cxx_compiler_flag("-march=x86-64-v3" COMPILER_SUPPORTS_MARCH_X86_V3) | ||
if (COMPILER_SUPPORTS_MARCH_X86_V3) | ||
message(STATUS "Enabling -march=x86-64-v3") | ||
add_compile_options("-march=x86-64-v3") | ||
else() | ||
# Must be quite old so try -march=native. | ||
check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) | ||
if (COMPILER_SUPPORTS_MARCH_NATIVE) | ||
message(STATUS "Enabling -march=native") | ||
add_compile_options("-march=native") | ||
endif() | ||
endif() | ||
|
||
# This makes a measurable difference. | ||
check_cxx_compiler_flag("-fomit-frame-pointer" COMPILER_SUPPORTS_FOMIT_FRAME_POINTER) | ||
if (COMPILER_SUPPORTS_FOMIT_FRAME_POINTER) | ||
message(STATUS "Enabling -fomit-frame-pointer") | ||
add_compile_options("-fomit-frame-pointer") | ||
endif() | ||
|
||
# LTO | ||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) |
Oops, something went wrong.