2016-07-09 02:49:08 +00:00
|
|
|
cmake_minimum_required(VERSION 3.1)
|
2015-07-01 17:45:31 +00:00
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
|
|
|
2016-06-28 16:06:56 +00:00
|
|
|
include(CheckCSourceCompiles)
|
2016-06-18 22:24:07 +00:00
|
|
|
include(CheckIncludeFiles)
|
2015-10-20 23:48:33 +00:00
|
|
|
include(CheckFunctionExists)
|
2015-08-27 18:57:19 +00:00
|
|
|
include(ExternalProject)
|
|
|
|
include(SourceGroupByDir)
|
|
|
|
|
2015-08-01 03:59:33 +00:00
|
|
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
|
|
message(STATUS "No build type selected, default to Release")
|
2015-10-21 07:56:13 +00:00
|
|
|
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
|
2015-08-01 03:59:33 +00:00
|
|
|
endif()
|
|
|
|
|
2016-02-18 04:59:04 +00:00
|
|
|
list(APPEND REDREAM_LANGUAGES C CXX)
|
|
|
|
if(WIN32)
|
2016-07-09 02:49:08 +00:00
|
|
|
list(APPEND REDREAM_LANGUAGES ASM_MASM)
|
2016-02-18 04:59:04 +00:00
|
|
|
else()
|
2016-07-09 02:49:08 +00:00
|
|
|
list(APPEND REDREAM_LANGUAGES ASM)
|
2016-02-18 04:59:04 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
project(redream ${REDREAM_LANGUAGES})
|
2015-07-01 17:45:31 +00:00
|
|
|
|
2015-10-31 21:48:00 +00:00
|
|
|
# export compile_commands.json for clang-tidy
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
2015-07-01 17:45:31 +00:00
|
|
|
|
2016-07-09 02:49:08 +00:00
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
|
2015-10-20 23:48:33 +00:00
|
|
|
#--------------------------------------------------
|
2016-01-29 04:29:09 +00:00
|
|
|
# config file
|
2015-10-20 23:48:33 +00:00
|
|
|
#--------------------------------------------------
|
|
|
|
|
2016-06-28 16:06:56 +00:00
|
|
|
check_include_files(stdatomic.h HAVE_STDATOMIC_H)
|
2016-06-18 22:24:07 +00:00
|
|
|
check_include_files(strings.h HAVE_STRINGS_H)
|
2016-01-29 04:29:09 +00:00
|
|
|
check_function_exists(strcasecmp HAVE_STRCASECMP)
|
2016-06-18 22:24:07 +00:00
|
|
|
check_function_exists(strnlen HAVE_STRNLEN)
|
2015-10-20 23:48:33 +00:00
|
|
|
check_function_exists(strnstr HAVE_STRNSTR)
|
2016-01-29 04:29:09 +00:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/core/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/core/config.h)
|
2016-02-06 09:25:18 +00:00
|
|
|
list(APPEND REDREAM_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/src)
|
2015-10-20 23:48:33 +00:00
|
|
|
|
2015-07-01 17:45:31 +00:00
|
|
|
#--------------------------------------------------
|
|
|
|
# dynamic libs
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
|
|
|
# opengl
|
|
|
|
find_package(OpenGL REQUIRED)
|
2016-02-06 09:25:18 +00:00
|
|
|
list(APPEND REDREAM_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
|
|
|
|
list(APPEND REDREAM_LIBS ${OPENGL_LIBRARIES})
|
2015-07-01 17:45:31 +00:00
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# static libs
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
|
|
|
# sdl2
|
|
|
|
set(DIRECTX OFF CACHE BOOL "")
|
|
|
|
set(RENDER_D3D OFF CACHE BOOL "")
|
|
|
|
set(SDL_ATOMIC OFF CACHE BOOL "")
|
|
|
|
set(SDL_CPUINFO OFF CACHE BOOL "")
|
|
|
|
set(SDL_FILESYSTEM OFF CACHE BOOL "")
|
|
|
|
set(SDL_HAPTIC OFF CACHE BOOL "")
|
|
|
|
set(SDL_POWER OFF CACHE BOOL "")
|
|
|
|
set(SDL_RENDER OFF CACHE BOOL "")
|
|
|
|
set(SDL_SHARED OFF CACHE BOOL "")
|
|
|
|
set(SDL_STATIC ON CACHE BOOL "")
|
2015-08-23 07:35:51 +00:00
|
|
|
if(APPLE)
|
|
|
|
set(SDL_FRAMEWORK_CARBON 1)
|
2015-10-10 08:13:20 +00:00
|
|
|
endif()
|
2016-04-10 23:11:37 +00:00
|
|
|
add_subdirectory(deps/sdl2-2.0.4 EXCLUDE_FROM_ALL)
|
|
|
|
list(APPEND REDREAM_INCLUDE_DIRS deps/sdl2-2.0.4/include)
|
2016-02-06 09:25:18 +00:00
|
|
|
list(APPEND REDREAM_LIBS SDL2main SDL2-static)
|
2015-07-01 17:45:31 +00:00
|
|
|
|
2016-04-14 03:22:29 +00:00
|
|
|
# capstone
|
|
|
|
add_subdirectory(deps/capstone EXCLUDE_FROM_ALL)
|
|
|
|
set(CAPSTONE_ARM_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_ARM64_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_MIPS_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_PPC_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_SPARC_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_SYSZ_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_XCORE_SUPPORT OFF CACHE BOOL "")
|
|
|
|
list(APPEND REDREAM_INCLUDE_DIRS deps/capstone/include)
|
|
|
|
list(APPEND REDREAM_LIBS capstone-static)
|
2016-04-08 06:43:56 +00:00
|
|
|
|
2016-04-10 18:12:28 +00:00
|
|
|
# dirent
|
|
|
|
list(APPEND REDREAM_INCLUDE_DIRS deps/dirent-1.21)
|
|
|
|
|
2016-02-24 08:11:22 +00:00
|
|
|
# gdb_server
|
|
|
|
list(APPEND REDREAM_INCLUDE_DIRS deps/gdb_server)
|
|
|
|
|
2015-08-26 23:48:43 +00:00
|
|
|
# glew
|
|
|
|
set(BUILD_UTILS OFF CACHE BOOL "")
|
|
|
|
add_subdirectory(deps/glew-1.13.0/build/cmake EXCLUDE_FROM_ALL)
|
2016-02-06 09:25:18 +00:00
|
|
|
list(APPEND REDREAM_INCLUDE_DIRS deps/glew-1.13.0/include)
|
|
|
|
list(APPEND REDREAM_LIBS glew_s)
|
2015-08-26 23:48:43 +00:00
|
|
|
|
2016-05-23 02:57:47 +00:00
|
|
|
# inih
|
|
|
|
add_library(inih STATIC deps/inih/ini.c)
|
|
|
|
list(APPEND REDREAM_INCLUDE_DIRS deps/inih)
|
|
|
|
list(APPEND REDREAM_LIBS inih)
|
2015-07-01 17:45:31 +00:00
|
|
|
|
|
|
|
# microprofile
|
2016-02-06 09:25:18 +00:00
|
|
|
list(APPEND REDREAM_INCLUDE_DIRS deps/microprofile)
|
2015-07-01 17:45:31 +00:00
|
|
|
|
2016-06-21 16:07:26 +00:00
|
|
|
# nuklear
|
|
|
|
list(APPEND REDREAM_INCLUDE_DIRS deps/nuklear)
|
|
|
|
|
2015-07-02 04:40:05 +00:00
|
|
|
# xbyak
|
2016-04-07 05:16:39 +00:00
|
|
|
list(APPEND REDREAM_INCLUDE_DIRS deps/xbyak-4.901)
|
2015-07-02 04:40:05 +00:00
|
|
|
|
2015-08-27 18:57:19 +00:00
|
|
|
|
2015-07-01 17:45:31 +00:00
|
|
|
#--------------------------------------------------
|
|
|
|
# format
|
|
|
|
#--------------------------------------------------
|
2016-02-18 04:41:38 +00:00
|
|
|
find_package(ClangFormat)
|
2015-07-01 17:45:31 +00:00
|
|
|
|
2016-02-18 04:41:38 +00:00
|
|
|
if(CLANG_FORMAT_FOUND)
|
2016-05-23 02:57:47 +00:00
|
|
|
file(GLOB_RECURSE CLANG_FORMAT_ARGS "src/*.c" "src/*.cc" "src/*.h" "test/*.c" "test/*.cc" "test/*.h" "tools/*.c" "tools/*.cc" "tools/*.h")
|
2015-07-01 17:45:31 +00:00
|
|
|
|
2016-05-23 02:57:47 +00:00
|
|
|
add_custom_target(format ${CLANG_FORMAT_EXECUTABLE} -i ${CLANG_FORMAT_ARGS})
|
2016-02-18 04:41:38 +00:00
|
|
|
endif()
|
2015-07-01 17:45:31 +00:00
|
|
|
|
2015-10-31 21:48:00 +00:00
|
|
|
#--------------------------------------------------
|
|
|
|
# tidy
|
|
|
|
#--------------------------------------------------
|
2016-02-18 04:44:41 +00:00
|
|
|
find_package(ClangTidy)
|
2015-10-31 21:48:00 +00:00
|
|
|
|
2016-02-18 04:41:38 +00:00
|
|
|
if(CLANG_TIDY_FOUND)
|
2015-10-31 21:48:00 +00:00
|
|
|
file(GLOB_RECURSE CLANG_TIDY_ARGS "src/*.cc" "test/*.cc")
|
|
|
|
|
|
|
|
add_custom_target(tidy ${CLANG_TIDY_EXECUTABLE} -p=${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json -checks=-*,readability-* ${CLANG_TIDY_ARGS})
|
2016-02-18 04:41:38 +00:00
|
|
|
endif()
|
2015-10-31 21:48:00 +00:00
|
|
|
|
2015-08-26 17:49:56 +00:00
|
|
|
#--------------------------------------------------
|
|
|
|
# emulator
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
2016-02-06 09:25:18 +00:00
|
|
|
set(REDREAM_SOURCES
|
2016-10-15 23:13:56 +00:00
|
|
|
src/audio/sdl_backend.c
|
2016-05-23 02:57:47 +00:00
|
|
|
src/core/assert.c
|
|
|
|
src/core/interval_tree.c
|
|
|
|
src/core/list.c
|
|
|
|
src/core/log.c
|
2016-06-04 21:21:15 +00:00
|
|
|
src/core/mm_heap.c
|
2016-05-23 02:57:47 +00:00
|
|
|
src/core/option.c
|
|
|
|
src/core/profiler.c
|
|
|
|
src/core/rb_tree.c
|
|
|
|
src/core/string.c
|
2016-06-12 22:00:36 +00:00
|
|
|
src/emu/emulator.c
|
2016-06-23 05:48:16 +00:00
|
|
|
src/emu/tracer.c
|
2016-05-23 02:57:47 +00:00
|
|
|
src/hw/aica/aica.c
|
2016-10-18 04:05:04 +00:00
|
|
|
src/hw/arm7/arm7.c
|
2016-05-23 02:57:47 +00:00
|
|
|
src/hw/gdrom/disc.c
|
|
|
|
src/hw/gdrom/gdrom.c
|
|
|
|
src/hw/holly/holly.c
|
|
|
|
src/hw/maple/controller.c
|
|
|
|
src/hw/maple/maple.c
|
2016-10-06 05:25:38 +00:00
|
|
|
src/hw/pvr/pvr.c
|
|
|
|
src/hw/pvr/ta.c
|
|
|
|
src/hw/pvr/tr.c
|
|
|
|
src/hw/pvr/trace.c
|
2016-10-09 22:48:15 +00:00
|
|
|
src/hw/rom/boot.c
|
|
|
|
src/hw/rom/flash.c
|
2016-06-16 15:50:51 +00:00
|
|
|
src/hw/sh4/sh4.c
|
2016-10-19 06:54:30 +00:00
|
|
|
src/hw/sh4/sh4_ccn.c
|
|
|
|
src/hw/sh4/sh4_dmac.c
|
|
|
|
src/hw/sh4/sh4_intc.c
|
|
|
|
src/hw/sh4/sh4_tmu.c
|
2016-05-23 02:57:47 +00:00
|
|
|
src/hw/debugger.c
|
|
|
|
src/hw/dreamcast.c
|
|
|
|
src/hw/memory.c
|
|
|
|
src/hw/scheduler.c
|
2015-09-10 20:52:41 +00:00
|
|
|
src/jit/backend/x64/x64_backend.cc
|
2016-06-04 21:21:15 +00:00
|
|
|
src/jit/backend/x64/x64_disassembler.c
|
2016-11-17 04:22:43 +00:00
|
|
|
src/jit/frontend/armv3/armv3_analyze.c
|
|
|
|
src/jit/frontend/armv3/armv3_context.c
|
|
|
|
src/jit/frontend/armv3/armv3_disasm.c
|
|
|
|
src/jit/frontend/armv3/armv3_fallback.c
|
|
|
|
src/jit/frontend/armv3/armv3_frontend.c
|
|
|
|
src/jit/frontend/armv3/armv3_translate.c
|
2016-06-04 21:21:15 +00:00
|
|
|
src/jit/frontend/sh4/sh4_analyze.c
|
|
|
|
src/jit/frontend/sh4/sh4_disasm.c
|
|
|
|
src/jit/frontend/sh4/sh4_frontend.c
|
|
|
|
src/jit/frontend/sh4/sh4_translate.c
|
|
|
|
src/jit/ir/ir.c
|
|
|
|
src/jit/ir/ir_read.c
|
|
|
|
src/jit/ir/ir_write.c
|
2016-06-16 15:50:51 +00:00
|
|
|
#src/jit/ir/passes/constant_propagation_pass.c
|
2016-06-04 21:21:15 +00:00
|
|
|
src/jit/ir/passes/conversion_elimination_pass.c
|
|
|
|
src/jit/ir/passes/dead_code_elimination_pass.c
|
|
|
|
src/jit/ir/passes/load_store_elimination_pass.c
|
|
|
|
src/jit/ir/passes/pass_stat.c
|
|
|
|
src/jit/ir/passes/register_allocation_pass.c
|
2016-10-19 06:54:30 +00:00
|
|
|
src/jit/jit.c
|
2016-05-23 02:57:47 +00:00
|
|
|
src/sys/exception_handler.c
|
|
|
|
src/sys/filesystem.c
|
|
|
|
src/sys/memory.c
|
|
|
|
src/ui/microprofile.cc
|
|
|
|
src/ui/keycode.c
|
2016-06-21 16:07:26 +00:00
|
|
|
src/ui/nuklear.c
|
2016-05-23 02:57:47 +00:00
|
|
|
src/ui/window.c
|
2016-10-15 22:53:05 +00:00
|
|
|
src/video/gl_backend.c
|
2016-05-23 02:57:47 +00:00
|
|
|
src/main.c)
|
2015-08-26 17:49:56 +00:00
|
|
|
|
2015-09-27 04:26:54 +00:00
|
|
|
if(WIN32)
|
2016-02-06 09:25:18 +00:00
|
|
|
list(APPEND REDREAM_DEFS PLATFORM_WINDOWS=1)
|
2016-06-18 22:24:07 +00:00
|
|
|
list(APPEND REDREAM_SOURCES src/sys/exception_handler_win.c)
|
2016-05-23 02:57:47 +00:00
|
|
|
list(APPEND REDREAM_SOURCES src/sys/filesystem_win.c)
|
|
|
|
list(APPEND REDREAM_SOURCES src/sys/memory_win.c)
|
2016-06-28 16:06:56 +00:00
|
|
|
list(APPEND REDREAM_SOURCES src/sys/thread_win.c)
|
2016-05-23 02:57:47 +00:00
|
|
|
list(APPEND REDREAM_SOURCES src/sys/time_win.c)
|
2015-09-27 04:26:54 +00:00
|
|
|
elseif(APPLE)
|
2016-02-06 09:25:18 +00:00
|
|
|
list(APPEND REDREAM_DEFS PLATFORM_DARWIN=1)
|
2016-05-23 02:57:47 +00:00
|
|
|
list(APPEND REDREAM_SOURCES src/sys/exception_handler_mac.c)
|
|
|
|
list(APPEND REDREAM_SOURCES src/sys/filesystem_posix.c)
|
|
|
|
list(APPEND REDREAM_SOURCES src/sys/memory_posix.c)
|
2016-06-28 16:06:56 +00:00
|
|
|
list(APPEND REDREAM_SOURCES src/sys/thread_posix.c)
|
2016-05-23 02:57:47 +00:00
|
|
|
list(APPEND REDREAM_SOURCES src/sys/time_mac.c)
|
2015-09-27 04:26:54 +00:00
|
|
|
else()
|
2016-02-06 09:25:18 +00:00
|
|
|
list(APPEND REDREAM_DEFS PLATFORM_LINUX=1)
|
2016-06-18 22:24:07 +00:00
|
|
|
list(APPEND REDREAM_SOURCES src/sys/exception_handler_linux.c)
|
2016-05-23 02:57:47 +00:00
|
|
|
list(APPEND REDREAM_SOURCES src/sys/filesystem_posix.c)
|
|
|
|
list(APPEND REDREAM_SOURCES src/sys/memory_posix.c)
|
2016-06-28 16:06:56 +00:00
|
|
|
list(APPEND REDREAM_SOURCES src/sys/thread_posix.c)
|
2016-05-23 02:57:47 +00:00
|
|
|
list(APPEND REDREAM_SOURCES src/sys/time_linux.c)
|
2015-09-27 04:26:54 +00:00
|
|
|
endif()
|
|
|
|
|
2015-09-12 05:13:29 +00:00
|
|
|
|
2015-08-27 18:57:19 +00:00
|
|
|
# assign source groups for visual studio projects
|
2016-02-06 09:25:18 +00:00
|
|
|
source_group_by_dir(REDREAM_SOURCES)
|
2015-08-27 18:57:19 +00:00
|
|
|
|
2016-07-09 02:49:08 +00:00
|
|
|
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
|
2016-09-26 02:00:13 +00:00
|
|
|
set(REDREAM_COMPILE_FLAGS -fms-extensions -Wall -Wextra -Werror -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wno-strict-aliasing -D_GNU_SOURCE)
|
2015-08-26 17:49:56 +00:00
|
|
|
|
2016-04-22 01:27:31 +00:00
|
|
|
# some flavors of GCC require this to be defined for the PR* macros in inttypes.h
|
|
|
|
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
set(REDREAM_COMPILE_FLAGS ${REDREAM_COMPILE_FLAGS} -D__STDC_FORMAT_MACROS)
|
2015-08-26 17:49:56 +00:00
|
|
|
endif()
|
2015-10-10 08:13:20 +00:00
|
|
|
|
|
|
|
# used by shm_open / shm_unlink on linux
|
|
|
|
if(NOT WIN32 AND NOT APPLE)
|
2016-02-06 09:25:18 +00:00
|
|
|
list(APPEND REDREAM_LIBS rt)
|
2015-10-10 08:13:20 +00:00
|
|
|
endif()
|
2015-08-26 17:49:56 +00:00
|
|
|
else()
|
2016-02-06 09:25:18 +00:00
|
|
|
set(REDREAM_COMPILE_FLAGS -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DWIN32_LEAN_AND_MEAN -DNOMINMAX /GR- /bigobj /W3 /WX /wd4100 /wd4127 /wd4505 /wd4512 /wd4800 /wd4351)
|
2015-08-26 17:49:56 +00:00
|
|
|
|
2016-02-06 09:25:18 +00:00
|
|
|
list(APPEND REDREAM_LIBS userenv ws2_32)
|
2015-08-26 17:49:56 +00:00
|
|
|
endif()
|
|
|
|
|
2016-02-06 09:25:18 +00:00
|
|
|
add_executable(redream ${REDREAM_SOURCES})
|
|
|
|
target_include_directories(redream SYSTEM PUBLIC ${REDREAM_INCLUDE_DIRS})
|
|
|
|
target_include_directories(redream PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
|
|
target_link_libraries(redream ${REDREAM_LIBS})
|
|
|
|
target_compile_definitions(redream PRIVATE ${REDREAM_DEFS})
|
|
|
|
target_compile_options(redream PRIVATE ${REDREAM_COMPILE_FLAGS})
|
2015-08-26 17:49:56 +00:00
|
|
|
|
2016-04-26 02:56:41 +00:00
|
|
|
if(APPLE)
|
|
|
|
add_executable(bundle MACOSX_BUNDLE ${REDREAM_SOURCES})
|
|
|
|
set_target_properties(bundle PROPERTIES OUTPUT_NAME redream)
|
|
|
|
target_include_directories(bundle SYSTEM PUBLIC ${REDREAM_INCLUDE_DIRS})
|
|
|
|
target_include_directories(bundle PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
|
|
target_link_libraries(bundle ${REDREAM_LIBS})
|
|
|
|
target_compile_definitions(bundle PRIVATE ${REDREAM_DEFS})
|
|
|
|
target_compile_options(bundle PRIVATE ${REDREAM_COMPILE_FLAGS})
|
|
|
|
endif()
|
2015-08-26 17:49:56 +00:00
|
|
|
|
2016-04-09 09:29:50 +00:00
|
|
|
#--------------------------------------------------
|
|
|
|
# tools
|
|
|
|
#--------------------------------------------------
|
2016-06-27 06:18:58 +00:00
|
|
|
set(RECC_SOURCES tools/recc.c)
|
2016-04-09 09:29:50 +00:00
|
|
|
|
|
|
|
foreach(file ${REDREAM_SOURCES})
|
|
|
|
if(file MATCHES "(deps|src/(core|jit|sys))")
|
|
|
|
list(APPEND RECC_SOURCES ${file})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# assign source groups for visual studio projects
|
|
|
|
source_group_by_dir(RECC_SOURCES)
|
|
|
|
|
2016-11-17 04:22:43 +00:00
|
|
|
#add_executable(recc ${RECC_SOURCES})
|
|
|
|
#target_include_directories(recc SYSTEM PUBLIC ${REDREAM_INCLUDE_DIRS})
|
|
|
|
#target_include_directories(recc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
|
|
#target_link_libraries(recc ${REDREAM_LIBS})
|
|
|
|
#target_compile_definitions(recc PRIVATE MICROPROFILE_ENABLED=0 ${REDREAM_DEFS})
|
|
|
|
#target_compile_options(recc PRIVATE ${REDREAM_COMPILE_FLAGS})
|
2016-04-09 09:29:50 +00:00
|
|
|
|
2015-07-01 17:45:31 +00:00
|
|
|
#--------------------------------------------------
|
|
|
|
# tests
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
2016-09-26 02:00:13 +00:00
|
|
|
#set(gtest_force_shared_crt ON CACHE BOOL "")
|
|
|
|
#add_subdirectory(deps/gtest-1.7.0 EXCLUDE_FROM_ALL)
|
|
|
|
#
|
|
|
|
## compile master .inc file from .s files in test/asm
|
|
|
|
#set(TEST_ASM
|
|
|
|
# test/asm/add.s
|
|
|
|
# test/asm/addc.s
|
|
|
|
# test/asm/addv.s
|
|
|
|
# test/asm/and.s
|
|
|
|
# test/asm/bf.s
|
|
|
|
# test/asm/bra.s
|
|
|
|
# test/asm/braf.s
|
|
|
|
# test/asm/bsr.s
|
|
|
|
# test/asm/bsrf.s
|
|
|
|
# test/asm/bt.s
|
|
|
|
# test/asm/cmp.s
|
|
|
|
# test/asm/div0.s
|
|
|
|
# test/asm/div1s.s
|
|
|
|
# test/asm/div1u.s
|
|
|
|
# test/asm/dmul.s
|
|
|
|
# test/asm/dt.s
|
|
|
|
# test/asm/ext.s
|
|
|
|
# test/asm/fabs.s
|
|
|
|
# test/asm/fadd.s
|
|
|
|
# test/asm/fcmpeq.s
|
|
|
|
# test/asm/fcmpgt.s
|
|
|
|
# test/asm/fcnv.s
|
|
|
|
# test/asm/fdiv.s
|
|
|
|
# test/asm/fipr.s
|
|
|
|
# test/asm/fld.s
|
|
|
|
# test/asm/float.s
|
|
|
|
# test/asm/fmac.s
|
|
|
|
# test/asm/fmov.s
|
|
|
|
# test/asm/fmov_load.s
|
|
|
|
# test/asm/fmov_index_load.s
|
|
|
|
# test/asm/fmov_store.s
|
|
|
|
# test/asm/fmov_index_store.s
|
|
|
|
# test/asm/fmov_save.s
|
|
|
|
# test/asm/fmov_restore.s
|
|
|
|
# test/asm/fmul.s
|
|
|
|
# test/asm/fneg.s
|
|
|
|
# test/asm/frchg.s
|
|
|
|
# test/asm/fsca.s
|
|
|
|
# test/asm/fschg.s
|
|
|
|
# test/asm/fsrra.s
|
|
|
|
# test/asm/fsqrt.s
|
|
|
|
# test/asm/fsub.s
|
|
|
|
# test/asm/ftrc.s
|
|
|
|
# test/asm/ftrv.s
|
|
|
|
# test/asm/jmp.s
|
|
|
|
# test/asm/jsr.s
|
|
|
|
# test/asm/ldc.s
|
|
|
|
# test/asm/ldcl.s
|
|
|
|
# test/asm/lds.s
|
|
|
|
# test/asm/ldsl.s
|
|
|
|
# test/asm/mova.s
|
|
|
|
# test/asm/movb.s
|
|
|
|
# test/asm/movl.s
|
|
|
|
# test/asm/movt.s
|
|
|
|
# test/asm/movw.s
|
|
|
|
# test/asm/mul.s
|
|
|
|
# test/asm/neg.s
|
|
|
|
# test/asm/negc.s
|
|
|
|
# test/asm/not.s
|
|
|
|
# test/asm/or.s
|
|
|
|
# test/asm/rot.s
|
|
|
|
# test/asm/sha.s
|
|
|
|
# test/asm/shl.s
|
|
|
|
# test/asm/sub.s
|
|
|
|
# test/asm/subc.s
|
|
|
|
# test/asm/subv.s
|
|
|
|
# test/asm/swap.s
|
|
|
|
# test/asm/tst.s
|
|
|
|
# test/asm/xor.s
|
|
|
|
# )
|
|
|
|
#set(asm_inc ${CMAKE_CURRENT_SOURCE_DIR}/test/test_sh4.inc)
|
|
|
|
#
|
|
|
|
## compile tests into include file if the sh4 toolchain is available
|
|
|
|
#find_package(PythonInterp)
|
|
|
|
#find_program(SH_AS NAMES sh-elf-as)
|
|
|
|
#find_program(SH_LD NAMES sh-elf-ld)
|
|
|
|
#find_program(SH_NM NAMES sh-elf-nm)
|
|
|
|
#find_program(SH_OBJCOPY NAMES sh-elf-objcopy)
|
|
|
|
#if(NOT PYTHONINTERP_FOUND)
|
|
|
|
# message(WARNING "Could not find python interpreter, won't be able to generate tests")
|
|
|
|
#elseif(NOT SH_AS)
|
|
|
|
# message(WARNING "Could not find sh-elf-as, won't be able to generate tests")
|
|
|
|
#elseif(NOT SH_LD)
|
|
|
|
# message(WARNING "Could not find sh-elf-ld, won't be able to generate tests")
|
|
|
|
#elseif(NOT SH_NM)
|
|
|
|
# message(WARNING "Could not find sh-elf-nm, won't be able to generate tests")
|
|
|
|
#elseif(NOT SH_OBJCOPY)
|
|
|
|
# message(WARNING "Could not find sh-elf-objcopy, won't be able to generate tests")
|
|
|
|
#else()
|
|
|
|
# add_custom_command(OUTPUT ${asm_inc}
|
|
|
|
# COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/test_sh4.py -as ${SH_AS} -ld ${SH_LD} -nm ${SH_NM} -objcopy ${SH_OBJCOPY} -o ${asm_inc} ${TEST_ASM}
|
|
|
|
# DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/test_sh4.py ${TEST_ASM}
|
|
|
|
# COMMENT "Assembling ${asm_inc} for ${TEST_ASM}"
|
|
|
|
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
# VERBATIM)
|
|
|
|
#endif()
|
|
|
|
#
|
|
|
|
## build test binary
|
|
|
|
#set(RETEST_SOURCES
|
|
|
|
# ${REDREAM_SOURCES}
|
|
|
|
# #test/test_interval_tree.cc
|
|
|
|
# #test/test_intrusive_list.cc
|
|
|
|
# test/test_list.cc
|
|
|
|
# test/test_dead_code_elimination_pass.cc
|
|
|
|
# test/test_load_store_elimination_pass.cc
|
|
|
|
# #test/test_minmax_heap.cc
|
|
|
|
# test/test_sh4.cc
|
|
|
|
# ${asm_inc})
|
|
|
|
#list(REMOVE_ITEM RETEST_SOURCES src/main.c)
|
|
|
|
#
|
|
|
|
## assign source groups for visual studio projects
|
|
|
|
#source_group_by_dir(RETEST_SOURCES)
|
|
|
|
#
|
|
|
|
#add_executable(retest ${RETEST_SOURCES})
|
|
|
|
#target_include_directories(retest PUBLIC deps/gtest-1.7.0/include src/ test/ ${REDREAM_INCLUDE_DIRS})
|
|
|
|
#target_link_libraries(retest gtest gtest_main ${REDREAM_LIBS})
|
|
|
|
#target_compile_definitions(retest PRIVATE ${REDREAM_DEFS})
|
|
|
|
#target_compile_options(retest PRIVATE ${REDREAM_COMPILE_FLAGS})
|