Skip to content
Snippets Groups Projects
Commit 0a747304 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Revert "Remove support for crosscompilation in luajit.cmake"

This reverts commit 3010b98b.
parent b9c461e2
No related branches found
No related tags found
No related merge requests found
...@@ -129,7 +129,6 @@ message (STATUS "Use LuaJIT includes: ${LUAJIT_INCLUDE}") ...@@ -129,7 +129,6 @@ message (STATUS "Use LuaJIT includes: ${LUAJIT_INCLUDE}")
message (STATUS "Use LuaJIT library: ${LUAJIT_LIB}") message (STATUS "Use LuaJIT library: ${LUAJIT_LIB}")
macro(luajit_build) macro(luajit_build)
set (luajit_cc ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1})
# Cmake rules concerning strings and lists of strings are weird. # Cmake rules concerning strings and lists of strings are weird.
# set (foo "1 2 3") defines a string, while # set (foo "1 2 3") defines a string, while
# set (foo 1 2 3) defines a list. # set (foo 1 2 3) defines a list.
...@@ -170,14 +169,30 @@ macro(luajit_build) ...@@ -170,14 +169,30 @@ macro(luajit_build)
set (luajit_xcflags ${luajit_xcflags} set (luajit_xcflags ${luajit_xcflags}
-DLUAJIT_USE_VALGRIND -DLUAJIT_USE_SYSMALLOC) -DLUAJIT_USE_VALGRIND -DLUAJIT_USE_SYSMALLOC)
endif() endif()
set (luajit_target_cc ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1})
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR})
# Regular mode - use CMake compiler for building host utils.
set (luajit_host_cc ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1})
else()
# Crosscompile mode - use a host CC compiler for building host utils.
# Since CMake does not support cross compilation properly
# we have to use system CC here.
set (luajit_host_cc "cc")
endif()
if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64" AND
${CMAKE_SIZEOF_VOID_P} EQUAL 4)
# The host compiler must have same pointer size as the target compiler.
set (luajit_host_cc "${luajit_host_cc} -m32")
endif()
set (luajit_buildoptions set (luajit_buildoptions
BUILDMODE=static BUILDMODE=static
CC="${luajit_cc}" CC="${luajit_host_cc}"
CFLAGS="${luajit_cflags}" CFLAGS="${luajit_cflags}"
LDFLAGS="${luajit_ldflags}" LDFLAGS="${luajit_ldflags}"
CCOPT="${luajit_ccopt}" CCOPT="${luajit_ccopt}"
CCDEBUG="${luajit_ccdebug}" CCDEBUG="${luajit_ccdebug}"
XCFLAGS="${luajit_xcflags}" XCFLAGS="${luajit_xcflags}"
TARGET_CC="${luajit_target_cc}"
Q='') Q='')
if (${PROJECT_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) if (${PROJECT_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/third_party/luajit/src/libluajit.a add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/third_party/luajit/src/libluajit.a
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment