mirror of
https://github.com/libretro/beetle-psx-libretro.git
synced 2024-11-23 16:59:49 +00:00
9f79743096
Fix subrepos due to squashing history git subrepo pull (merge) deps/lightrec subrepo: subdir: "deps/lightrec" merged: "81d07d4e" upstream: origin: "https://github.com/pcercuei/lightrec.git" branch: "master" commit: "807c6fe7" git-subrepo: version: "0.4.0" origin: "https://github.com/ingydotnet/git-subrepo" commit: "5d6aba9" git subrepo pull (merge) deps/lightrec subrepo: subdir: "deps/lightrec" merged: "5084f032" upstream: origin: "https://github.com/pcercuei/lightrec.git" branch: "master" commit: "e56284be" git-subrepo: version: "0.4.1" origin: "https://github.com/ingydotnet/git-subrepo" commit: "a04d8c2" git subrepo commit (merge) deps/lightrec subrepo: subdir: "deps/lightrec" merged: "a349e172" upstream: origin: "https://github.com/pcercuei/lightrec.git" branch: "master" commit: "e077ae7b" git-subrepo: version: "0.4.1" origin: "https://github.com/ingydotnet/git-subrepo" commit: "a04d8c2" git subrepo commit (merge) deps/lightrec subrepo: subdir: "deps/lightrec" merged: "f8db9295" upstream: origin: "https://github.com/pcercuei/lightrec.git" branch: "master" commit: "85195183" git-subrepo: version: "0.4.1" origin: "https://github.com/ingydotnet/git-subrepo" commit: "a04d8c2" git subrepo commit (merge) deps/lightrec subrepo: subdir: "deps/lightrec" merged: "11267e7c" upstream: origin: "https://github.com/pcercuei/lightrec.git" branch: "master" commit: "f7121d08" git-subrepo: version: "0.4.1" origin: "https://github.com/ingydotnet/git-subrepo" commit: "a04d8c2" git subrepo pull (merge) deps/lightrec subrepo: subdir: "deps/lightrec" merged: "57c58dbf" upstream: origin: "https://github.com/pcercuei/lightrec.git" branch: "master" commit: "6c9d6551" git-subrepo: version: "0.4.1" origin: "https://github.com/ingydotnet/git-subrepo" commit: "a04d8c2" git subrepo commit (merge) deps/lightrec subrepo: subdir: "deps/lightrec" merged: "eddfccd0" upstream: origin: "https://github.com/pcercuei/lightrec.git" branch: "master" commit: "452f23f0" git-subrepo: version: "0.4.1" origin: "https://github.com/ingydotnet/git-subrepo" commit: "a04d8c2" git subrepo commit (merge) deps/lightrec subrepo: subdir: "deps/lightrec" merged: "342c892e" upstream: origin: "https://github.com/pcercuei/lightrec.git" branch: "master" commit: "72881247" git-subrepo: version: "0.4.1" origin: "https://github.com/ingydotnet/git-subrepo" commit: "a04d8c2" git subrepo pull (merge) deps/lightrec subrepo: subdir: "deps/lightrec" merged: "3e1cf147" upstream: origin: "https://github.com/pcercuei/lightrec.git" branch: "master" commit: "a6ac0156" git-subrepo: version: "0.4.1" origin: "https://github.com/ingydotnet/git-subrepo" commit: "a04d8c2"
120 lines
3.4 KiB
CMake
120 lines
3.4 KiB
CMake
cmake_minimum_required(VERSION 3.0)
|
|
project(lightrec LANGUAGES C VERSION 0.2)
|
|
|
|
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
|
|
if (NOT BUILD_SHARED_LIBS)
|
|
add_definitions(-DLIGHTREC_STATIC)
|
|
endif (NOT BUILD_SHARED_LIBS)
|
|
|
|
if (NOT LOG_LEVEL)
|
|
set(LOG_LEVEL Info CACHE STRING "Log level" FORCE)
|
|
set_property(CACHE LOG_LEVEL PROPERTY STRINGS NoLog Error Warning Info Debug)
|
|
endif()
|
|
|
|
if (NOT CMAKE_BUILD_TYPE)
|
|
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
|
|
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel."
|
|
FORCE)
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS None Debug Release RelWithDebInfo MinSizeRel)
|
|
endif()
|
|
|
|
string(TOUPPER ${LOG_LEVEL} LIGHTREC_LOG_LEVEL)
|
|
add_definitions(-DLOG_LEVEL=${LIGHTREC_LOG_LEVEL}_L)
|
|
|
|
if (CMAKE_COMPILER_IS_GNUCC)
|
|
add_compile_options(-fvisibility=hidden)
|
|
endif()
|
|
|
|
list(APPEND LIGHTREC_SOURCES
|
|
blockcache.c
|
|
disassembler.c
|
|
emitter.c
|
|
interpreter.c
|
|
lightrec.c
|
|
memmanager.c
|
|
optimizer.c
|
|
regcache.c
|
|
)
|
|
list(APPEND LIGHTREC_HEADERS
|
|
blockcache.h
|
|
debug.h
|
|
disassembler.h
|
|
emitter.h
|
|
interpreter.h
|
|
lightrec-private.h
|
|
lightrec.h
|
|
memmanager.h
|
|
optimizer.h
|
|
recompiler.h
|
|
regcache.h
|
|
)
|
|
|
|
option(ENABLE_FIRST_PASS "Run the interpreter as first-pass optimization" ON)
|
|
|
|
option(ENABLE_THREADED_COMPILER "Enable threaded compiler" ON)
|
|
if (ENABLE_THREADED_COMPILER)
|
|
list(APPEND LIGHTREC_SOURCES recompiler.c)
|
|
|
|
if (NOT ENABLE_FIRST_PASS)
|
|
message(SEND_ERROR "Threaded compiler requires first-pass optimization")
|
|
endif (NOT ENABLE_FIRST_PASS)
|
|
endif (ENABLE_THREADED_COMPILER)
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
add_library(${PROJECT_NAME} ${LIGHTREC_SOURCES} ${LIGHTREC_HEADERS})
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
|
VERSION ${PROJECT_VERSION}
|
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
|
PUBLIC_HEADER lightrec.h
|
|
C_STANDARD 11
|
|
C_STANDARD_REQUIRED ON
|
|
C_EXTENSIONS OFF
|
|
)
|
|
|
|
option(ENABLE_TINYMM "Enable optional libtinymm dependency" OFF)
|
|
if (ENABLE_TINYMM)
|
|
find_library(TINYMM_LIBRARIES tinymm REQUIRED)
|
|
find_path(TINYMM_INCLUDE_DIR tinymm.h REQUIRED)
|
|
|
|
include_directories(${TINYMM_INCLUDE_DIR})
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE ${TINYMM_LIBRARIES})
|
|
endif (ENABLE_TINYMM)
|
|
|
|
if (ENABLE_THREADED_COMPILER)
|
|
find_library(PTHREAD_LIBRARIES pthread REQUIRED)
|
|
find_path(PTHREAD_INCLUDE_DIR pthread.h REQUIRED)
|
|
|
|
include_directories(${PTHREAD_INCLUDE_DIR})
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE ${PTHREAD_LIBRARIES})
|
|
endif (ENABLE_THREADED_COMPILER)
|
|
|
|
find_library(LIBLIGHTNING lightning REQUIRED)
|
|
find_path(LIBLIGHTNING_INCLUDE_DIR lightning.h REQUIRED)
|
|
|
|
include_directories(${LIBLIGHTNING_INCLUDE_DIR})
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBLIGHTNING})
|
|
|
|
if (LOG_LEVEL STREQUAL Debug)
|
|
find_library(LIBOPCODES NAMES opcodes-multiarch opcodes)
|
|
find_path(LIBOPCODES_INCLUDE_DIR dis-asm.h)
|
|
|
|
if (NOT LIBOPCODES OR NOT LIBOPCODES_INCLUDE_DIR)
|
|
message(SEND_ERROR "Debug log level requires libopcodes (from binutils) to be installed.")
|
|
endif ()
|
|
|
|
set(ENABLE_DISASSEMBLER ON)
|
|
include_directories(${LIBOPCODES_INCLUDE_DIR})
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBOPCODES})
|
|
endif()
|
|
|
|
configure_file(config.h.cmakein config.h @ONLY)
|
|
|
|
include(GNUInstallDirs)
|
|
install(TARGETS ${PROJECT_NAME}
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
)
|