2019-07-07 06:10:32 +00:00
|
|
|
cmake_minimum_required(VERSION 3.1)
|
|
|
|
project(dingusppc)
|
2019-12-16 15:31:33 +00:00
|
|
|
|
2019-07-07 06:10:32 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
2019-12-14 19:56:43 +00:00
|
|
|
|
2019-07-07 06:10:32 +00:00
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
2020-05-09 12:29:37 +00:00
|
|
|
#set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
2020-02-28 04:03:01 +00:00
|
|
|
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
2020-05-08 20:32:29 +00:00
|
|
|
|
2020-03-23 03:15:12 +00:00
|
|
|
if (NOT WIN32)
|
2020-03-19 14:09:24 +00:00
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
include_directories(${SDL2_INCLUDE_DIRS})
|
2020-06-04 08:29:36 +00:00
|
|
|
if (UNIX AND NOT APPLE)
|
|
|
|
find_package (Threads)
|
|
|
|
endif()
|
2020-03-23 03:15:12 +00:00
|
|
|
endif()
|
2020-03-19 14:09:24 +00:00
|
|
|
|
2020-12-03 01:18:13 +00:00
|
|
|
option(ENABLE_68K_DEBUGGER "Enable 68k debugging" OFF)
|
|
|
|
|
|
|
|
if (ENABLE_68K_DEBUGGER)
|
|
|
|
# Build capstone as static library.
|
|
|
|
set(CAPSTONE_BUILD_STATIC ON CACHE BOOL "")
|
|
|
|
|
|
|
|
# Turn off anything unnecessary.
|
|
|
|
set(CAPSTONE_BUILD_SHARED OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_BUILD_TESTS OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_BUILD_CSTOOL OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_BUILD_DIET OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_OSXKERNEL_SUPPORT OFF CACHE BOOL "")
|
|
|
|
|
|
|
|
# Disable unused Capstone architectures.
|
|
|
|
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 "")
|
|
|
|
set(CAPSTONE_X86_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_TMS320C64X_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_M680X_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_EVM_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_MOS65XX_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_WASM_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_BPF_SUPPORT OFF CACHE BOOL "")
|
|
|
|
set(CAPSTONE_RISCV_SUPPORT OFF CACHE BOOL "")
|
|
|
|
|
|
|
|
ADD_DEFINITIONS(-DENABLE_68K_DEBUGGER)
|
|
|
|
|
|
|
|
add_subdirectory(thirdparty/capstone EXCLUDE_FROM_ALL)
|
|
|
|
endif()
|
2020-07-13 21:39:31 +00:00
|
|
|
|
2020-02-03 13:36:30 +00:00
|
|
|
add_subdirectory("${PROJECT_SOURCE_DIR}/cpu/ppc/")
|
2020-04-20 18:32:09 +00:00
|
|
|
add_subdirectory("${PROJECT_SOURCE_DIR}/debugger/")
|
2020-02-03 13:36:30 +00:00
|
|
|
add_subdirectory("${PROJECT_SOURCE_DIR}/devices/")
|
2020-11-28 00:08:34 +00:00
|
|
|
add_subdirectory("${PROJECT_SOURCE_DIR}/execution")
|
2020-03-13 21:49:58 +00:00
|
|
|
add_subdirectory("${PROJECT_SOURCE_DIR}/machines/")
|
2020-03-23 03:15:12 +00:00
|
|
|
add_subdirectory("${PROJECT_SOURCE_DIR}/thirdparty/loguru/")
|
2020-02-03 13:36:30 +00:00
|
|
|
|
2020-05-15 00:36:40 +00:00
|
|
|
#set(BUILD_EXAMPLE_PROGRAMS OFF CACHE BOOL "Build libsoundio example programs")
|
|
|
|
#set(BUILD_TESTS OFF CACHE BOOL "Build libsoundio tests")
|
|
|
|
#set(BUILD_DYNAMIC_LIBS ON CACHE BOOL "Build libsoundio dynamic libs")
|
|
|
|
#set(BUILD_STATIC_LIBS ON CACHE BOOL "Build libsoundio static libs")
|
2020-05-08 21:48:02 +00:00
|
|
|
|
2020-05-15 00:36:40 +00:00
|
|
|
#add_subdirectory("${PROJECT_SOURCE_DIR}/thirdparty/libsoundio")
|
|
|
|
|
|
|
|
set(BUILD_TESTS OFF CACHE BOOL "Build Cubeb tests")
|
|
|
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries")
|
|
|
|
set(BUILD_TOOLS OFF CACHE BOOL "Build Cubeb tools")
|
|
|
|
|
|
|
|
add_subdirectory(thirdparty/cubeb EXCLUDE_FROM_ALL)
|
2020-05-08 20:32:29 +00:00
|
|
|
|
2020-09-20 21:25:29 +00:00
|
|
|
set(CLI11_ROOT ${PROJECT_SOURCE_DIR}/thirdparty/CLI11)
|
|
|
|
|
2019-12-16 15:31:33 +00:00
|
|
|
include_directories("${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/devices"
|
2020-02-03 13:36:30 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/cpu/ppc"
|
2020-02-28 04:03:01 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/debugger"
|
2020-03-23 03:15:12 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/thirdparty/loguru/"
|
2020-05-15 00:36:40 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/thirdparty/SDL2/")
|
|
|
|
# "${PROJECT_SOURCE_DIR}/thirdparty/cubeb/include")
|
|
|
|
# ${LIBSOUNDIO_HEADERS})
|
2020-02-03 13:36:30 +00:00
|
|
|
|
|
|
|
file(GLOB SOURCES "${PROJECT_SOURCE_DIR}/*.cpp"
|
2020-03-23 03:15:12 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/*.c"
|
|
|
|
"${PROJECT_SOURCE_DIR}/*.hpp"
|
2020-04-20 18:32:09 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/*.h")
|
2019-12-16 15:31:33 +00:00
|
|
|
|
2020-05-15 00:36:40 +00:00
|
|
|
#get_directory_property(LIBSOUNDIO_LIBS DIRECTORY thirdparty/libsoundio DEFINITION LIBSOUNDIO_LIBS)
|
2020-05-08 21:48:02 +00:00
|
|
|
|
2020-02-03 13:36:30 +00:00
|
|
|
file(GLOB TEST_SOURCES "${PROJECT_SOURCE_DIR}/cpu/ppc/test/*.cpp")
|
2019-12-16 15:31:33 +00:00
|
|
|
|
2020-04-20 18:32:09 +00:00
|
|
|
add_executable(dingusppc ${SOURCES} $<TARGET_OBJECTS:debugger>
|
|
|
|
$<TARGET_OBJECTS:cpu_ppc>
|
2020-03-13 21:49:58 +00:00
|
|
|
$<TARGET_OBJECTS:devices>
|
2020-11-28 00:08:34 +00:00
|
|
|
$<TARGET_OBJECTS:execution>
|
2020-03-13 21:49:58 +00:00
|
|
|
$<TARGET_OBJECTS:machines>
|
2020-02-28 04:03:01 +00:00
|
|
|
$<TARGET_OBJECTS:loguru>)
|
2020-05-08 20:32:29 +00:00
|
|
|
|
2020-03-23 03:15:12 +00:00
|
|
|
if (WIN32)
|
|
|
|
target_link_libraries(dingusppc "${PROJECT_SOURCE_DIR}/thirdparty/SDL2/lib/x64/SDL2.lib"
|
2020-05-09 12:29:37 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/thirdparty/SDL2/lib/x64/SDL2main.lib"
|
2020-05-18 00:51:56 +00:00
|
|
|
cubeb)
|
2020-03-23 03:15:12 +00:00
|
|
|
else()
|
2020-05-15 00:36:40 +00:00
|
|
|
#target_link_libraries(dingusppc libsoundio_static ${LIBSOUNDIO_LIBS} ${SDL2_LIBRARIES})
|
2020-06-04 08:29:36 +00:00
|
|
|
target_link_libraries(dingusppc cubeb ${SDL2_LIBRARIES} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
2020-09-20 21:25:29 +00:00
|
|
|
target_include_directories(dingusppc PRIVATE ${CLI11_ROOT})
|
2020-03-23 03:15:12 +00:00
|
|
|
endif()
|
|
|
|
|
2020-12-03 01:18:13 +00:00
|
|
|
if (ENABLE_68K_DEBUGGER)
|
|
|
|
target_link_libraries(dingusppc capstone-static)
|
|
|
|
endif()
|
|
|
|
|
2020-03-19 14:09:24 +00:00
|
|
|
|
2020-04-20 18:32:09 +00:00
|
|
|
add_executable(testppc ${TEST_SOURCES} $<TARGET_OBJECTS:debugger>
|
|
|
|
$<TARGET_OBJECTS:cpu_ppc>
|
2020-03-13 21:49:58 +00:00
|
|
|
$<TARGET_OBJECTS:devices>
|
2020-11-28 00:08:34 +00:00
|
|
|
$<TARGET_OBJECTS:execution>
|
2020-03-14 14:39:34 +00:00
|
|
|
$<TARGET_OBJECTS:machines>
|
2020-02-28 04:03:01 +00:00
|
|
|
$<TARGET_OBJECTS:loguru>)
|
2020-05-08 20:32:29 +00:00
|
|
|
|
2020-03-23 03:15:12 +00:00
|
|
|
if (WIN32)
|
|
|
|
target_link_libraries(testppc "${PROJECT_SOURCE_DIR}/thirdparty/SDL2/lib/x64/SDL2.lib"
|
2020-05-09 12:29:37 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/thirdparty/SDL2/lib/x64/SDL2main.lib"
|
2020-05-18 00:51:56 +00:00
|
|
|
cubeb)
|
2020-03-23 03:15:12 +00:00
|
|
|
else()
|
2020-05-15 00:36:40 +00:00
|
|
|
#target_link_libraries(testppc libsoundio_static ${LIBSOUNDIO_LIBS} ${SDL2_LIBRARIES})
|
2020-06-04 08:29:36 +00:00
|
|
|
target_link_libraries(testppc cubeb ${SDL2_LIBRARIES} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
2020-03-23 03:15:12 +00:00
|
|
|
endif()
|
2020-03-19 14:09:24 +00:00
|
|
|
|
2020-12-03 01:18:13 +00:00
|
|
|
if (ENABLE_68K_DEBUGGER)
|
|
|
|
target_link_libraries(testppc capstone-static)
|
2020-03-23 03:15:12 +00:00
|
|
|
endif()
|
2020-03-19 14:09:24 +00:00
|
|
|
|
2020-11-28 00:08:34 +00:00
|
|
|
file(GLOB BENCH_SOURCES "${PROJECT_SOURCE_DIR}/benchmark/*.cpp")
|
|
|
|
add_executable(bench1 ${BENCH_SOURCES} $<TARGET_OBJECTS:debugger>
|
|
|
|
$<TARGET_OBJECTS:cpu_ppc>
|
|
|
|
$<TARGET_OBJECTS:devices>
|
|
|
|
$<TARGET_OBJECTS:execution>
|
|
|
|
$<TARGET_OBJECTS:machines>
|
|
|
|
$<TARGET_OBJECTS:loguru>)
|
|
|
|
|
2020-12-03 01:18:13 +00:00
|
|
|
target_link_libraries(bench1 cubeb ${SDL2_LIBRARIES} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
|
|
|
|
if (ENABLE_68K_DEBUGGER)
|
|
|
|
target_link_libraries(bench1 capstone-static)
|
|
|
|
endif()
|
2020-11-28 00:08:34 +00:00
|
|
|
|
2020-02-03 13:36:30 +00:00
|
|
|
add_custom_command(
|
2020-02-10 15:41:40 +00:00
|
|
|
TARGET testppc POST_BUILD
|
2020-02-03 13:36:30 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
"${PROJECT_SOURCE_DIR}/cpu/ppc/test/ppcinttests.csv"
|
2020-02-12 21:58:24 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/cpu/ppc/test/ppcdisasmtest.csv"
|
2020-02-03 13:36:30 +00:00
|
|
|
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
|
2020-01-31 03:10:53 +00:00
|
|
|
|
2020-10-25 23:23:53 +00:00
|
|
|
install (TARGETS dingusppc DESTINATION ${PROJECT_SOURCE_DIR}/build)
|