2018-05-09 18:07:18 +08:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
|
|
|
project(box86)
|
|
|
|
|
2018-12-22 01:17:44 +08:00
|
|
|
enable_testing()
|
|
|
|
|
2018-05-09 18:07:18 +08:00
|
|
|
option(PANDORA "Set to ON if targeting an OpenPandora device" ${PANDORA})
|
2018-11-10 16:47:20 +08:00
|
|
|
option(USE_CCACHE "Set to ON to use ccache if present in the system" ${USE_CCACHE})
|
|
|
|
|
2018-05-09 18:07:18 +08:00
|
|
|
|
|
|
|
# Pandora
|
|
|
|
if(PANDORA)
|
|
|
|
add_definitions(-DPANDORA)
|
|
|
|
add_definitions(-mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -fsingle-precision-constant -ffast-math)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_definitions(-g -std=gnu99 -funwind-tables -O3 -fvisibility=hidden)
|
|
|
|
|
2018-11-10 16:47:20 +08:00
|
|
|
if(USE_CCACHE)
|
|
|
|
find_program(CCACHE_FOUND ccache)
|
|
|
|
if(CCACHE_FOUND)
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-05-09 18:07:18 +08:00
|
|
|
#include_directories(include)
|
|
|
|
|
|
|
|
SET(ELFLOADER_SRC
|
|
|
|
src/main.c
|
2018-07-01 22:36:02 +08:00
|
|
|
src/pathcoll.c
|
2018-10-14 16:24:50 +08:00
|
|
|
src/box86context.c
|
2018-10-14 16:50:19 +08:00
|
|
|
src/fileutils.c
|
2018-10-14 18:15:58 +08:00
|
|
|
src/elfloader.c
|
2018-12-15 19:55:14 +08:00
|
|
|
src/elfparser.c
|
2018-11-10 17:48:42 +08:00
|
|
|
src/elfload_dump.c
|
2018-12-22 04:50:47 +08:00
|
|
|
src/librarian.c
|
2018-12-15 23:17:19 +08:00
|
|
|
src/stack.c
|
2018-12-16 04:20:00 +08:00
|
|
|
src/x86emu.c
|
2018-12-17 04:03:20 +08:00
|
|
|
src/x86run.c
|
2018-12-18 06:24:44 +08:00
|
|
|
src/x86run66.c
|
|
|
|
src/x86run_private.c
|
2018-12-18 15:43:27 +08:00
|
|
|
src/x86syscall.c
|
2018-12-17 04:03:20 +08:00
|
|
|
src/x86primop.c
|
|
|
|
src/x86trace.c
|
2018-12-18 16:18:45 +08:00
|
|
|
src/x86int3.c
|
2018-05-09 18:07:18 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(box86 ${ELFLOADER_SRC})
|
|
|
|
target_link_libraries(box86 m dl rt)
|
2018-12-22 01:17:44 +08:00
|
|
|
|
|
|
|
add_test(test01 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
|
|
|
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test01 -D TEST_OUTPUT=tmpfile.txt
|
|
|
|
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref01.txt
|
2018-12-22 03:25:35 +08:00
|
|
|
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|
|
|
|
|
|
|
|
#add_test(test02 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
|
|
|
# -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test02 -D TEST_OUTPUT=tmpfile.txt
|
|
|
|
# -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref02.txt
|
|
|
|
# -P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|
|
|
|
|
|
|
|
#add_test(test03 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
|
|
|
# -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test03 -D TEST_OUTPUT=tmpfile.txt
|
|
|
|
# -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref03.txt
|
|
|
|
# -P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|
|
|
|
|
|
|
|
#add_test(test01 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
|
|
|
# -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test04 yeah -D TEST_OUTPUT=tmpfile.txt
|
|
|
|
# -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref04.txt
|
|
|
|
# -P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|