-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Added cheribsd preset #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mereacre
wants to merge
20
commits into
main
Choose a base branch
from
cheri-pure
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7352247
feat: Added cheribsd preset
mereacre c17469d
chore: cleanup
mereacre 64a9bb7
Update CMakePresets.json
mereacre 0233264
feat: Added a new target cherbsd cross compile
mereacre 88ca70e
feat: Added CFLAGS to libs
mereacre da18f74
chore: cleanup
mereacre 252d883
fix: removed the test preset for cheribsd-cc
mereacre bdfec7f
Merge branch 'main' into cheri-pure
mereacre cbeb718
featr: Added search for ifconfig
mereacre 12460ed
feat: Added option to build sqlhook
mereacre 8f65db9
feat: Added preset options
mereacre b778871
Merge branch 'main' into cheri-pure
aloisklink 28ed1b1
Merge branch 'main' into cheri-pure
mereacre 17451c4
Merge branch 'main' into cheri-pure
mereacre 19b0ab9
Update CMakeModules/CMakeToolchains/cheri-cross.cmake
mereacre 7bb52cf
Merge branch 'main' into cheri-pure
mereacre 4854e60
chore: pre-commit
mereacre 45fe2d7
Merge branch 'main' into cheri-pure
mereacre 299e316
Merge branch 'main' into cheri-pure
mereacre de84d93
Merge branch 'main' into cheri-pure
mereacre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,91 @@ | ||
| # Below replaced later with actual toolchaibn download and compile, which takes hours | ||
| set(CheriBSD_output_location "/home/alexandru/cheri/output") | ||
| set(CheriBSD_toolchain_location "${CheriBSD_output_location}/morello-sdk") | ||
| set(CheriBSD_tools_location "${CheriBSD_toolchain_location}/bin") | ||
| set(CheriBSD_rootfs_location "${CheriBSD_output_location}/rootfs-morello-purecap") | ||
| set(CheriBSD_usr_location "${CheriBSD_rootfs_location}/usr") | ||
| set(CheriBSD_package_location "${CheriBSD_usr_location}/local/morello-purecap") | ||
| set(CheriBSD_pkgconfig_locations "${CheriBSD_usr_location}/libdata/pkgconfig") | ||
| set(CheriBSD_pkgconfig_locations "${CheriBSD_pkgconfig_locations}:${CheriBSD_usr_location}/local/morello-purecap/lib/pkgconfig") | ||
| set(CheriBSD_pkgconfig_locations "${CheriBSD_pkgconfig_locations}:${CheriBSD_usr_location}/local/morello-purecap/share/pkgconfig") | ||
| set(CheriBSD_pkgconfig_locations "${CheriBSD_pkgconfig_locations}:${CheriBSD_usr_location}/local/morello-purecap/libdata/pkgconfig") | ||
| set(CheriBSD_pkgconfig_locations "${CheriBSD_pkgconfig_locations}:${CheriBSD_usr_location}/local/lib/pkgconfig") | ||
| set(CheriBSD_pkgconfig_locations "${CheriBSD_pkgconfig_locations}:${CheriBSD_usr_location}/local/share/pkgconfig") | ||
| set(CheriBSD_pkgconfig_locations "${CheriBSD_pkgconfig_locations}:${CheriBSD_usr_location}/local/libdata/pkgconfig") | ||
|
|
||
| set(CheriBSD_SDK_GNU_TARGET "aarch64-unknown-freebsd") | ||
| set(CheriBSD_c_flags "-target ${CheriBSD_SDK_GNU_TARGET} --sysroot=${CheriBSD_rootfs_location} -B${CheriBSD_tools_location} -mcpu=rainier -march=morello+c64 -mabi=purecap -Xclang -morello-vararg=new") | ||
| set(CheriBSD_cxx_flags "-target ${CheriBSD_SDK_GNU_TARGET} --sysroot=${CheriBSD_rootfs_location} -B${CheriBSD_tools_location} -mcpu=rainier -march=morello+c64 -mabi=purecap -Xclang -morello-vararg=new") | ||
|
|
||
| if (NOT IS_DIRECTORY "${CheriBSD_tools_location}") | ||
| message(FATAL_ERROR "CheriBSD SDK toolchain directory TOOLCHAIN_DIR=${CheriBSD_tools_location} is not found") | ||
| endif() | ||
|
|
||
| set(ENV{STAGING_DIR} "${CMAKE_STAGING_PREFIX}") | ||
|
|
||
| # need to add toolchain prefix to path, as dependencies use autoconf ./configure to find compilers | ||
| set(ENV{PATH} "$ENV{PATH}:${CheriBSD_tools_location}") | ||
|
|
||
| # setting CMAKE_REQUIRED_DEFINITIONS should be better for `check_include_file()` | ||
| list(APPEND CMAKE_REQUIRED_DEFINITIONS "-Dcheribsd_toolchain_location=${cheribsd_toolchain_location}") | ||
| set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") | ||
|
|
||
| set(CMAKE_SYSROOT "${CheriBSD_rootfs_location}") | ||
|
|
||
| # where is the target environment | ||
| set(CMAKE_FIND_ROOT_PATH "${CheriBSD_rootfs_location}") | ||
|
|
||
| set(CMAKE_SYSTEM_NAME FreeBSD) # FreeBSD | ||
| set(CMAKE_ASM_COMPILER_TARGET "${CheriBSD_SDK_GNU_TARGET}") | ||
| set(CMAKE_C_COMPILER_TARGET "${CheriBSD_SDK_GNU_TARGET}") | ||
| set(CMAKE_CXX_COMPILER_TARGET "${CheriBSD_SDK_GNU_TARGET}") | ||
| set(CROSS_COMPILE_PREFIX "${CheriBSD_tools_location}/${CheriBSD_SDK_GNU_TARGET}-") # used by lib/openssl.cmake only | ||
| #set(CMAKE_SYSTEM_PROCESSOR "${CheriBSD_SDK_SYSTEM_PROCESSOR}") | ||
|
|
||
| set(c_compiler "${CheriBSD_tools_location}/${CheriBSD_SDK_GNU_TARGET}-cc${CMAKE_EXECUTABLE_SUFFIX}") | ||
| if(NOT EXISTS "${c_compiler}") | ||
| message(FATAL_ERROR "C compiler ${c_compiler} does not exist. Please make sure that you have set GNU_TARGET to the GNU target prefix in ${CheriBSD_tools_location}") | ||
| endif() | ||
|
|
||
| set(CMAKE_AR "${CheriBSD_tools_location}/${CheriBSD_SDK_GNU_TARGET}-ar${CMAKE_EXECUTABLE_SUFFIX}") | ||
| set(CMAKE_ASM_COMPILER "${CheriBSD_tools_location}/${CheriBSD_SDK_GNU_TARGET}-cc${CMAKE_EXECUTABLE_SUFFIX}") | ||
| set(CMAKE_C_COMPILER "${c_compiler}") | ||
| set(CMAKE_CXX_COMPILER "${CheriBSD_tools_location}/${CheriBSD_SDK_GNU_TARGET}-c++${CMAKE_EXECUTABLE_SUFFIX}") | ||
| set(CMAKE_LINKER "${CheriBSD_tools_location}/${CheriBSD_SDK_GNU_TARGET}-ld${CMAKE_EXECUTABLE_SUFFIX}") | ||
| set(CMAKE_OBJCOPY "${CheriBSD_tools_location}/${CheriBSD_SDK_GNU_TARGET}-objcopy${CMAKE_EXECUTABLE_SUFFIX}") | ||
| set(CMAKE_RANLIB "${CheriBSD_tools_location}/${CheriBSD_SDK_GNU_TARGET}-ranlib${CMAKE_EXECUTABLE_SUFFIX}") | ||
| set(CMAKE_STRIP "${CheriBSD_tools_location}/${CheriBSD_SDK_GNU_TARGET}-strip${CMAKE_EXECUTABLE_SUFFIX}") | ||
|
|
||
| set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CheriBSD_c_flags}") | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CheriBSD_cxx_flags}") | ||
|
|
||
| # Without this flag CMake is not able to pass test compilation check | ||
| set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) | ||
|
|
||
| set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH FALSE) | ||
|
|
||
| # PKG_CONFIG_LIBDIR overrides PKG_CONFIG_PATH | ||
| set(PKG_CONFIG_LIBDIR "${CheriBSD_pkgconfig_locations}") | ||
| set(ENV{PKG_CONFIG_LIBDIR} "${CheriBSD_pkgconfig_locations}") | ||
| set(PKG_CONFIG_SYSROOT_DIR ${CheriBSD_rootfs_location}) | ||
| set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CheriBSD_rootfs_location}) | ||
| set(PKG_CONFIG_PATH "") | ||
| set(ENV{PKG_CONFIG_PATH} "") | ||
|
|
||
| # Use -pthread flag https://gitlab.kitware.com/cmake/cmake/issues/16920 | ||
| set(THREADS_HAVE_PTHREAD_ARG TRUE) | ||
|
|
||
| # Ensure we search in the custom install prefix that we install everything to: | ||
| set(CMAKE_PREFIX_PATH "${CheriBSD_package_location};${CMAKE_PREFIX_PATH}") | ||
|
|
||
|
|
||
| # Standard propgrams like flex, etc | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
|
|
||
| # for libraries and headers in the target directories | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) | ||
|
|
||
| # Debug mode | ||
| # set(CMAKE_FIND_DEBUG_MODE TRUE) |
This file contains hidden or 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,4 @@ | ||
| set(CMAKE_C_COMPILER clang) | ||
| set(CMAKE_CXX_COMPILER clang++) | ||
|
|
||
| set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -target aarch64-unknown-freebsd -march=morello+c64 -mabi=purecap -Xclang -morello-vararg=new") | ||
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We many want to adapt the official recommended cheri toolchain file from https://github.com/CTSRD-CHERI/cheribuild/blob/a1bdfa225b575606f7303435c4c75ea9942d697f/pycheribuild/files/CrossToolchain.cmake.in