[ox] Make code only compile as PIC if a bare metal build
This commit is contained in:
parent
238bc58f66
commit
30ff7be0e4
1
deps/ox/CMakeLists.txt
vendored
1
deps/ox/CMakeLists.txt
vendored
@ -8,6 +8,7 @@ include(address_sanitizer)
|
||||
set(OX_BUILD_EXEC "ON" CACHE STRING "Build executables (ON/OFF)")
|
||||
set(OX_RUN_TESTS "ON" CACHE STRING "Run tests (ON/OFF)")
|
||||
set(OX_USE_STDLIB "ON" CACHE STRING "Build libraries that need the std lib (ON/OFF)")
|
||||
set(OX_BARE_METAL FALSE CACHE STRING "Bare metal build (TRUE/FALSE)")
|
||||
|
||||
# can't run tests without building them
|
||||
if(OX_BUILD_EXEC STREQUAL "OFF" OR OX_USE_STDLIB STREQUAL "OFF")
|
||||
|
15
deps/ox/src/ox/fs/CMakeLists.txt
vendored
15
deps/ox/src/ox/fs/CMakeLists.txt
vendored
@ -9,12 +9,18 @@ add_library(
|
||||
filesystem/passthroughfs.cpp
|
||||
)
|
||||
|
||||
if(OX_USE_STDLIB)
|
||||
if(NOT OX_BARE_METAL)
|
||||
target_link_libraries(
|
||||
OxFS PUBLIC
|
||||
$<$<CXX_COMPILER_ID:Clang>:c++fs>
|
||||
$<$<CXX_COMPILER_ID:GNU>:stdc++fs>
|
||||
)
|
||||
set_property(
|
||||
TARGET
|
||||
OxFS
|
||||
PROPERTY
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
@ -22,13 +28,6 @@ target_link_libraries(
|
||||
OxMetalClaw
|
||||
)
|
||||
|
||||
set_property(
|
||||
TARGET
|
||||
OxFS
|
||||
PROPERTY
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
|
||||
if(OX_BUILD_EXEC STREQUAL "ON")
|
||||
#add_executable(
|
||||
# oxfstool
|
||||
|
2
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
2
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
@ -148,8 +148,8 @@ FileSystemTemplate<FileStore, Directory>::~FileSystemTemplate() {
|
||||
template<typename FileStore, typename Directory>
|
||||
Error FileSystemTemplate<FileStore, Directory>::format(void *buff, uint64_t buffSize) {
|
||||
oxReturnError(FileStore::format(buff, buffSize));
|
||||
|
||||
FileStore fs(buff, buffSize);
|
||||
|
||||
constexpr auto rootDirInode = MaxValue<typename FileStore::InodeId_t> / 2;
|
||||
Directory rootDir(fs, rootDirInode);
|
||||
oxReturnError(rootDir.init());
|
||||
|
14
deps/ox/src/ox/mc/CMakeLists.txt
vendored
14
deps/ox/src/ox/mc/CMakeLists.txt
vendored
@ -11,12 +11,14 @@ target_link_libraries(
|
||||
OxStd
|
||||
)
|
||||
|
||||
set_property(
|
||||
TARGET
|
||||
OxMetalClaw
|
||||
PROPERTY
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
if(NOT OX_BARE_METAL)
|
||||
set_property(
|
||||
TARGET
|
||||
OxMetalClaw
|
||||
PROPERTY
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
endif()
|
||||
|
||||
install(
|
||||
FILES
|
||||
|
14
deps/ox/src/ox/model/CMakeLists.txt
vendored
14
deps/ox/src/ox/model/CMakeLists.txt
vendored
@ -9,12 +9,14 @@ target_link_libraries(
|
||||
OxStd
|
||||
)
|
||||
|
||||
set_property(
|
||||
TARGET
|
||||
OxModel
|
||||
PROPERTY
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
if(NOT OX_BARE_METAL)
|
||||
set_property(
|
||||
TARGET
|
||||
OxModel
|
||||
PROPERTY
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
endif()
|
||||
|
||||
install(
|
||||
FILES
|
||||
|
14
deps/ox/src/ox/std/CMakeLists.txt
vendored
14
deps/ox/src/ox/std/CMakeLists.txt
vendored
@ -11,12 +11,14 @@ add_library(
|
||||
trace.cpp
|
||||
)
|
||||
|
||||
set_property(
|
||||
TARGET
|
||||
OxStd
|
||||
PROPERTY
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
if(NOT OX_BARE_METAL)
|
||||
set_property(
|
||||
TARGET
|
||||
OxStd
|
||||
PROPERTY
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
OxStd PUBLIC
|
||||
|
Loading…
x
Reference in New Issue
Block a user