[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_BUILD_EXEC "ON" CACHE STRING "Build executables (ON/OFF)")
|
||||||
set(OX_RUN_TESTS "ON" CACHE STRING "Run tests (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_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
|
# can't run tests without building them
|
||||||
if(OX_BUILD_EXEC STREQUAL "OFF" OR OX_USE_STDLIB STREQUAL "OFF")
|
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
|
filesystem/passthroughfs.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(OX_USE_STDLIB)
|
if(NOT OX_BARE_METAL)
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
OxFS PUBLIC
|
OxFS PUBLIC
|
||||||
$<$<CXX_COMPILER_ID:Clang>:c++fs>
|
$<$<CXX_COMPILER_ID:Clang>:c++fs>
|
||||||
$<$<CXX_COMPILER_ID:GNU>:stdc++fs>
|
$<$<CXX_COMPILER_ID:GNU>:stdc++fs>
|
||||||
)
|
)
|
||||||
|
set_property(
|
||||||
|
TARGET
|
||||||
|
OxFS
|
||||||
|
PROPERTY
|
||||||
|
POSITION_INDEPENDENT_CODE ON
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
@ -22,13 +28,6 @@ target_link_libraries(
|
|||||||
OxMetalClaw
|
OxMetalClaw
|
||||||
)
|
)
|
||||||
|
|
||||||
set_property(
|
|
||||||
TARGET
|
|
||||||
OxFS
|
|
||||||
PROPERTY
|
|
||||||
POSITION_INDEPENDENT_CODE ON
|
|
||||||
)
|
|
||||||
|
|
||||||
if(OX_BUILD_EXEC STREQUAL "ON")
|
if(OX_BUILD_EXEC STREQUAL "ON")
|
||||||
#add_executable(
|
#add_executable(
|
||||||
# oxfstool
|
# 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>
|
template<typename FileStore, typename Directory>
|
||||||
Error FileSystemTemplate<FileStore, Directory>::format(void *buff, uint64_t buffSize) {
|
Error FileSystemTemplate<FileStore, Directory>::format(void *buff, uint64_t buffSize) {
|
||||||
oxReturnError(FileStore::format(buff, buffSize));
|
oxReturnError(FileStore::format(buff, buffSize));
|
||||||
|
|
||||||
FileStore fs(buff, buffSize);
|
FileStore fs(buff, buffSize);
|
||||||
|
|
||||||
constexpr auto rootDirInode = MaxValue<typename FileStore::InodeId_t> / 2;
|
constexpr auto rootDirInode = MaxValue<typename FileStore::InodeId_t> / 2;
|
||||||
Directory rootDir(fs, rootDirInode);
|
Directory rootDir(fs, rootDirInode);
|
||||||
oxReturnError(rootDir.init());
|
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
|
OxStd
|
||||||
)
|
)
|
||||||
|
|
||||||
set_property(
|
if(NOT OX_BARE_METAL)
|
||||||
TARGET
|
set_property(
|
||||||
OxMetalClaw
|
TARGET
|
||||||
PROPERTY
|
OxMetalClaw
|
||||||
POSITION_INDEPENDENT_CODE ON
|
PROPERTY
|
||||||
)
|
POSITION_INDEPENDENT_CODE ON
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES
|
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
|
OxStd
|
||||||
)
|
)
|
||||||
|
|
||||||
set_property(
|
if(NOT OX_BARE_METAL)
|
||||||
TARGET
|
set_property(
|
||||||
OxModel
|
TARGET
|
||||||
PROPERTY
|
OxModel
|
||||||
POSITION_INDEPENDENT_CODE ON
|
PROPERTY
|
||||||
)
|
POSITION_INDEPENDENT_CODE ON
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES
|
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
|
trace.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set_property(
|
if(NOT OX_BARE_METAL)
|
||||||
TARGET
|
set_property(
|
||||||
OxStd
|
TARGET
|
||||||
PROPERTY
|
OxStd
|
||||||
POSITION_INDEPENDENT_CODE ON
|
PROPERTY
|
||||||
)
|
POSITION_INDEPENDENT_CODE ON
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
OxStd PUBLIC
|
OxStd PUBLIC
|
||||||
|
Loading…
x
Reference in New Issue
Block a user