Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
cmake_minimum_required(VERSION 3.12)

if (COMPILER_TARGET)
set(CMAKE_C_COMPILER_TARGET "${COMPILER_TARGET}")
set(CMAKE_CXX_COMPILER_TARGET "${COMPILER_TARGET}")
set(CMAKE_ASM_COMPILER_TARGET "${COMPILER_TARGET}")
endif()

project(native_client C CXX ASM)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

include(Yokai/Detection)
include(NaClFlags)

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()

option(BUILD_NACL_LOADER "Build the sel_ldr program." ON)

if (YOKAI_TARGET_SYSTEM_LINUX_COMPATIBILITY)
option(BUILD_NACL_HELPER_BOOTSTRAP "Build the nacl_helper_bootstrap program on platforms requiring it." ON)
endif()

if (BUILD_NACL_LOADER AND YOKAI_TARGET_SYSTEM_WINDOWS)
option(FORCE_NO_TRUSTED_BUILD "Prevent use of trusted toolchain." OFF)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to have any relevance when the build uses only one toolchain to begin with.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

endif()

if (BUILD_NACL_LOADER AND YOKAI_CXX_COMPILER_MSVC)
set(REQUIRE_MASM ON)
endif()

if (BUILD_NACL_LOADER AND YOKAI_TARGET_SYSTEM_MACOS)
set(REQUIRE_PYTHON ON)
endif()

if (BUILD_NACL_HELPER_BOOTSTRAP)
set(REQUIRE_PYTHON ON)
endif()

if (REQUIRE_PYTHON)
if (NOT PYTHON)
find_program(PATH_PYTHON NAMES "python3" DOC "Path to the python3 executable." REQUIRED)
endif()
endif()

if (REQUIRE_MASM)
enable_language(ASM_MASM)
# TODO: win64_asm_env = env.Clone(ASCOM='ml64 $ASFLAGS /c /Fo$TARGET $SOURCES')
# TODO: ldr_inputs += [win64_asm_env.ComponentObject('arch/x86_64/nacl_switch_unwind_win.asm')]
endif()

include_directories("include-hax")

if (YOKAI_TARGET_ARCH_I686)
set(VALIDATOR_ARCH_SUFFIX "_x86_32")
elseif (YOKAI_TARGET_ARCH_AMD64)
set(VALIDATOR_ARCH_SUFFIX "_x86_64")
elseif (YOKAI_TARGET_ARCH_ARMHF OR YOKAI_TARGET_ARCH_ARMEL)
set(VALIDATOR_ARCH_SUFFIX "_arm")
endif()

if (BUILD_NACL_LOADER)
add_subdirectory(src/shared/gio)
add_subdirectory(src/shared/imc)
add_subdirectory(src/shared/platform)
add_subdirectory(src/trusted/cpu_features)
add_subdirectory(src/trusted/debug_stub)
add_subdirectory(src/trusted/desc)
add_subdirectory(src/trusted/fault_injection)
add_subdirectory(src/trusted/interval_multiset)
add_subdirectory(src/trusted/nacl_base)
add_subdirectory(src/trusted/perf_counter)
add_subdirectory(src/trusted/platform_qualify)
add_subdirectory(src/trusted/validator)

if (YOKAI_TARGET_ARCH_I686 OR YOKAI_TARGET_ARCH_AMD64)
add_subdirectory(src/trusted/validator_x86)
add_subdirectory(src/trusted/validator_ragel)
elseif (YOKAI_TARGET_ARCH_ARMHF OR YOKAI_TARGET_ARCH_ARMEL)
add_subdirectory(src/trusted/validator_arm)
endif()
endif()

if (BUILD_NACL_LOADER)
add_subdirectory(src/trusted/service_runtime)
endif()

if (BUILD_NACL_HELPER_BOOTSTRAP)
add_subdirectory(src/trusted/service_runtime/linux)
endif()
Loading
Loading