Commit 1715fef1 authored by Justin Jagieniak's avatar Justin Jagieniak Committed by Daniel Black

Fix cross-compile to consider CMAKE_CROSSCOMPILING_EMULATOR

When CMAKE_CROSSCOMPILING_EMULATOR is defined, a cross-compile
can be made, however with native (emulated) execution possible.

This commit takes those points in the build system that
execute built targets natively and allow these to be executed
in a crosscompile if CMAKE_CROSSCOMPILING_EMULATOR is defined.

Closes #1805
parent d1f2001e
......@@ -393,7 +393,7 @@ CHECK_PCRE()
CHECK_SYSTEMD()
IF(CMAKE_CROSSCOMPILING)
IF(CMAKE_CROSSCOMPILING AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
SET(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Path to import_executables.cmake from a native build")
INCLUDE(${IMPORT_EXECUTABLES})
ENDIF()
......@@ -475,7 +475,7 @@ ADD_SUBDIRECTORY(scripts)
ADD_SUBDIRECTORY(support-files)
ADD_SUBDIRECTORY(extra/aws_sdk)
IF(NOT CMAKE_CROSSCOMPILING)
IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
SET(EXPORTED comp_err comp_sql factorial)
IF(NOT WITHOUT_SERVER)
SET(EXPORTED ${EXPORTED} gen_lex_hash gen_lex_token)
......
......@@ -670,7 +670,7 @@ int main()
" HAVE_PTHREAD_YIELD_ZERO_ARG)
IF(NOT STACK_DIRECTION)
IF(CMAKE_CROSSCOMPILING)
IF(CMAKE_CROSSCOMPILING AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
MESSAGE(FATAL_ERROR
"STACK_DIRECTION is not defined. Please specify -DSTACK_DIRECTION=1 "
"or -DSTACK_DIRECTION=-1 when calling cmake.")
......
......@@ -25,7 +25,7 @@ MAYBE_DISABLE_IPO(dbug)
ADD_EXECUTABLE(tests tests.c)
TARGET_LINK_LIBRARIES(tests dbug)
IF(NOT CMAKE_CROSSCOMPILING)
IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
ADD_EXECUTABLE(factorial my_main.c factorial.c)
TARGET_LINK_LIBRARIES(factorial dbug)
ENDIF()
......
......@@ -18,7 +18,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${ZLIB_INCLUDE_DIR})
# Default install component for the files is Server here
SET(MYSQL_INSTALL_COMPONENT Server)
IF(NOT CMAKE_CROSSCOMPILING)
IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
ADD_EXECUTABLE(comp_err comp_err.c)
TARGET_LINK_LIBRARIES(comp_err mysys)
ENDIF()
......
......@@ -28,14 +28,14 @@ MACRO(INSTALL_LINK old new destination component)
)
ENDMACRO()
IF(NOT CMAKE_CROSSCOMPILING)
IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_EXECUTABLE(comp_sql comp_sql.c)
TARGET_LINK_LIBRARIES(comp_sql)
ENDIF()
# Build mysql_fix_privilege_tables.sql (concatenate 3 sql scripts)
IF(NOT WIN32 OR CMAKE_CROSSCOMPILING)
IF(NOT WIN32 OR (CMAKE_CROSSCOMPILING AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR))
FIND_PROGRAM(CAT_EXECUTABLE cat DOC "path to the executable")
MARK_AS_ADVANCED(CAT_EXECUTABLE)
ENDIF()
......
......@@ -356,7 +356,7 @@ ELSE()
COMPILE_FLAGS "-p ORA")
ENDIF()
IF(NOT CMAKE_CROSSCOMPILING)
IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
ADD_EXECUTABLE(gen_lex_token gen_lex_token.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.hh)
ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
......@@ -406,7 +406,7 @@ ADD_CUSTOM_TARGET(distclean
)
# Install initial database (default on windows, optional target elsewhere)
IF(TARGET mariadbd AND NOT CMAKE_CROSSCOMPILING)
IF(TARGET mariadbd AND (NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR))
IF(GENERATOR_IS_MULTI_CONFIG)
SET (CONFIG_PARAM -DCONFIG=${CMAKE_CFG_INTDIR})
ENDIF()
......
......@@ -405,7 +405,7 @@ if(NOT ${GRN_WITH_MECAB} STREQUAL "no")
set(MECAB_LIBRARIES libmecab)
else()
set(GRN_MECAB_CONFIG "mecab-config" CACHE FILEPATH "mecab-config path")
if(NOT CMAKE_CROSSCOMPILING)
if(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
find_program(GRN_MECAB_CONFIG_ABSOLUTE_PATH "${GRN_MECAB_CONFIG}")
endif()
if(EXISTS "${GRN_MECAB_CONFIG_ABSOLUTE_PATH}")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment