Skip to content

Commit 73c4e56

Browse files
committed
cmake: make possible to build tls_edit
1 parent a1ff67d commit 73c4e56

3 files changed

Lines changed: 45 additions & 11 deletions

File tree

‎src/shared/platform/CMakeLists.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ if (YOKAI_TARGET_SYSTEM_WINDOWS)
3939
endif()
4040
elseif (YOKAI_TARGET_SYSTEM_LINUX_COMPATIBILITY)
4141
list(APPEND PLATFORM_INPUTS
42-
"linux/nacl_clock.c"
4342
"linux/nacl_host_dir.c"
4443
"linux/nacl_semaphore.c"
4544
)

‎src/tools/tls_edit/CMakeLists.txt‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cmake_minimum_required(VERSION 3.12)
2+
3+
project(tls_edit C CXX)
4+
5+
set(REPO_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../..")
6+
7+
list(APPEND CMAKE_MODULE_PATH "${REPO_DIR}/cmake")
8+
9+
include(Yokai/Detection)
10+
include(NaClFlags)
11+
12+
if (NOT CMAKE_BUILD_TYPE)
13+
set(CMAKE_BUILD_TYPE RelWithDebInfo)
14+
endif()
15+
16+
include_directories("${REPO_DIR}/include-hax")
17+
include_directories("${REPO_DIR}/include")
18+
19+
set(RDFA_VALIDATOR ON)
20+
add_subdirectory("${REPO_DIR}/src/trusted/validator_ragel" rdfa_validator)
21+
22+
add_subdirectory("${REPO_DIR}/src/shared/platform" platform)
23+
add_subdirectory("${REPO_DIR}/src/shared/gio" gio)
24+
25+
set(EXECUTABLE_PREFIX "" CACHE STRING "Prefix for executable names")
26+
27+
set(TLS_EDIT_NAME "${EXECUTABLE_PREFIX}tls_edit")
28+
29+
add_executable("${TLS_EDIT_NAME}" tls_edit.c)
30+
target_link_libraries("${TLS_EDIT_NAME}" rdfa_validator platform gio)
31+
install(TARGETS "${TLS_EDIT_NAME}" DESTINATION bin)

‎src/trusted/validator_ragel/CMakeLists.txt‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
add_definitions("-DVALIDATOR_EXPORT=DLLEXPORT")
22

3-
# src/trusted/validator_ragel/build.scons built both for both bitness
4-
# because it was needed for the rdfa_validator library which looks to
5-
# only be used for running some benchmark.
6-
if (YOKAI_TARGET_ARCH_I686)
7-
set(VALIDATOR_LIB validator32)
8-
add_library(${VALIDATOR_LIB} OBJECT "gen/validator_x86_32.c")
9-
elseif (YOKAI_TARGET_ARCH_AMD64)
10-
set(VALIDATOR_LIB validator64)
11-
add_library(${VALIDATOR_LIB} OBJECT "gen/validator_x86_64.c")
3+
# RDFA_VALIDATOR is set to ON when building tls_edit.
4+
5+
if (YOKAI_TARGET_ARCH_I686 OR RDFA_VALIDATOR)
6+
add_library(validator32 OBJECT "gen/validator_x86_32.c")
7+
list(APPEND VALIDATOR_LIBS validator32)
8+
elseif (YOKAI_TARGET_ARCH_AMD64 OR RDFA_VALIDATOR)
9+
add_library(validator64 OBJECT "gen/validator_x86_64.c")
10+
list(APPEND VALIDATOR_LIBS validator64)
1211
endif()
1312

1413
add_library(validator_features_all OBJECT "validator_features_all.c")
@@ -28,7 +27,12 @@ elseif (YOKAI_TARGET_ARCH_AMD64)
2827
)
2928
endif()
3029

30+
if (RDFA_VALIDATOR)
31+
add_library(rdfa_validator)
32+
target_link_libraries(rdfa_validator ${FEATURES_LIBS} ${VALIDATOR_LIBS})
33+
endif()
34+
3135
add_library(dfa_validate_caller${VALIDATOR_ARCH_SUFFIX} STATIC ${DFA_VALIDATE_CALLER_INPUTS})
32-
target_link_libraries(dfa_validate_caller${VALIDATOR_ARCH_SUFFIX} ${FEATURES_LIBS} ${VALIDATOR_LIB})
36+
target_link_libraries(dfa_validate_caller${VALIDATOR_ARCH_SUFFIX} ${FEATURES_LIBS} ${VALIDATOR_LIBS})
3337

3438
add_library(dfa_validate_caller ALIAS dfa_validate_caller${VALIDATOR_ARCH_SUFFIX})

0 commit comments

Comments
 (0)