All: CMake cleanup
@@ -33,22 +33,22 @@ set(BUILD_GL ON CACHE STRING "Build with OpenGL")
set(BUILD_GLES2 OFF CACHE STRING "Build with OpenGL|ES 2") set(USE_EPOXY ON CACHE STRING "Build with libepoxy") set(DISABLE_DEPS OFF CACHE BOOL "Build without dependencies") -file(GLOB ARM_SRC ${CMAKE_SOURCE_DIR}/src/arm/*.c) -file(GLOB LR35902_SRC ${CMAKE_SOURCE_DIR}/src/lr35902/*.c) -file(GLOB GBA_SRC ${CMAKE_SOURCE_DIR}/src/gba/*.c) -file(GLOB GB_SRC ${CMAKE_SOURCE_DIR}/src/gb/*.c) -file(GLOB GBA_CHEATS_SRC ${CMAKE_SOURCE_DIR}/src/gba/cheats/*.c) -file(GLOB GBA_RR_SRC ${CMAKE_SOURCE_DIR}/src/gba/rr/*.c) -file(GLOB GBA_SV_SRC ${CMAKE_SOURCE_DIR}/src/gba/supervisor/*.c) -file(GLOB GBA_CTX_SRC ${CMAKE_SOURCE_DIR}/src/gba/context/*.c) -file(GLOB UTIL_SRC ${CMAKE_SOURCE_DIR}/src/util/*.[cSs] ${CMAKE_SOURCE_DIR}/src/core/*.c) -file(GLOB GUI_SRC ${CMAKE_SOURCE_DIR}/src/util/gui/*.c ${CMAKE_SOURCE_DIR}/src/gba/gui/*.c) -file(GLOB GBA_RENDERER_SRC ${CMAKE_SOURCE_DIR}/src/gba/renderers/*.c) -file(GLOB SIO_SRC ${CMAKE_SOURCE_DIR}/src/gba/sio/lockstep.c) -file(GLOB GB_RENDERER_SRC ${CMAKE_SOURCE_DIR}/src/gb/renderers/*.c) -file(GLOB THIRD_PARTY_SRC ${CMAKE_SOURCE_DIR}/src/third-party/inih/*.c) -set(CLI_SRC ${CMAKE_SOURCE_DIR}/src/platform/commandline.c) -set(CORE_VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-mem.c) +file(GLOB ARM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/arm/*.c) +file(GLOB LR35902_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/lr35902/*.c) +file(GLOB GBA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/*.c) +file(GLOB GB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gb/*.c) +file(GLOB GBA_CHEATS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/cheats/*.c) +file(GLOB GBA_RR_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/rr/*.c) +file(GLOB GBA_SV_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/supervisor/*.c) +file(GLOB GBA_CTX_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/context/*.c) +file(GLOB UTIL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/*.[cSs] ${CMAKE_CURRENT_SOURCE_DIR}/src/core/*.c) +file(GLOB GUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/gui/*.c ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/gui/*.c) +file(GLOB GBA_RENDERER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/renderers/*.c) +file(GLOB SIO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/sio/lockstep.c) +file(GLOB GB_RENDERER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gb/renderers/*.c) +file(GLOB THIRD_PARTY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/inih/*.c) +set(CLI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/commandline.c) +set(CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-mem.c) set(VFS_SRC) source_group("ARM core" FILES ${ARM_SRC}) source_group("LR35902 core" FILES ${LR35902_SRC})@@ -56,8 +56,7 @@ source_group("GBA board" FILES ${GBA_SRC} ${GBA_RENDERER_SRC} ${SIO_SRC})
source_group("GBA extra" FILES ${GBA_CHEATS_SRC} ${GBA_CTX_SRC} ${GBA_SV_SRC} ${GBA_RR_SRC}) source_group("GB board" FILES ${GB_SRC}) source_group("Utilities" FILES ${UTIL_SRC}) -include_directories(${CMAKE_SOURCE_DIR}/src/arm) -include_directories(${CMAKE_SOURCE_DIR}/src) +include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/src) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type (e.g. Release or Debug)" FORCE)@@ -108,18 +107,18 @@ endforeach()
endfunction() # Version information -add_custom_target(version-info ALL ${CMAKE_COMMAND} -E touch ${CMAKE_SOURCE_DIR}/src/util/version.c.in +add_custom_target(version-info ALL ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/src/util/version.c.in COMMAND ${CMAKE_COMMAND} -DBINARY_NAME=${BINARY_NAME} - -DCONFIG_FILE=${CMAKE_SOURCE_DIR}/src/util/version.c.in + -DCONFIG_FILE=${CMAKE_CURRENT_SOURCE_DIR}/src/util/version.c.in -DOUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/version.c - -P ${CMAKE_SOURCE_DIR}/version.cmake - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + -P ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -include(${CMAKE_SOURCE_DIR}/version.cmake) -configure_file(${CMAKE_SOURCE_DIR}/src/util/version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c) -list(APPEND UTIL_SRC ${CMAKE_BINARY_DIR}/version.c) -source_group("Generated sources" FILES ${CMAKE_BINARY_DIR}/version.c) +include(${CMAKE_CURRENT_SOURCE_DIR}/version.cmake) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/util/version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c) +list(APPEND UTIL_SRC ${CMAKE_CURRENT_BINARY_DIR}/version.c) +source_group("Generated sources" FILES ${CMAKE_CURRENT_BINARY_DIR}/version.c) # Advanced settings set(BUILD_LTO ON CACHE BOOL "Build with link-time optimization")@@ -145,8 +144,8 @@ if(WIN32)
set(WIN32_VERSION "${LIB_VERSION_MAJOR},${LIB_VERSION_MINOR},${LIB_VERSION_PATCH}") add_definitions(-D_WIN32_WINNT=0x0600) list(APPEND OS_LIB ws2_32 shlwapi) - list(APPEND CORE_VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-fd.c ${CMAKE_SOURCE_DIR}/src/platform/windows/vfs-w32.c) - file(GLOB OS_SRC ${CMAKE_SOURCE_DIR}/src/platform/windows/*.c) + list(APPEND CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-fd.c ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/vfs-w32.c) + file(GLOB OS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/*.c) source_group("Windows-specific code" FILES ${OS_SRC}) if(MSVC) add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)@@ -161,8 +160,8 @@ if(NOT APPLE AND NOT HAIKU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") endif() - list(APPEND CORE_VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-fd.c ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-dirent.c) - file(GLOB OS_SRC ${CMAKE_SOURCE_DIR}/src/platform/posix/*.c) + list(APPEND CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-fd.c ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-dirent.c) + file(GLOB OS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/posix/*.c) source_group("POSIX-specific code" FILES ${OS_SRC}) endif()@@ -179,7 +178,7 @@
if(APPLE OR CMAKE_C_COMPILER_ID STREQUAL "GNU" AND BUILD_LTO) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto") - set_source_files_properties(${CMAKE_SOURCE_DIR}/src/arm/isa-arm.c ${CMAKE_SOURCE_DIR}/src/arm/isa-thumb.c PROPERTIES COMPILE_FLAGS -fno-lto) + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/arm/isa-arm.c ${CMAKE_CURRENT_SOURCE_DIR}/src/arm/isa-thumb.c PROPERTIES COMPILE_FLAGS -fno-lto) endif() if(BUILD_BBB OR BUILD_RASPI OR BUILD_PANDORA)@@ -317,7 +316,7 @@ find_feature(USE_MAGICK "MagickWand")
find_feature(USE_EPOXY "epoxy") # Features -set(DEBUGGER_SRC ${CMAKE_SOURCE_DIR}/src/debugger/debugger.c) +set(DEBUGGER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger/debugger.c) set(FEATURE_SRC) set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6")@@ -327,9 +326,9 @@ endif()
if(USE_CLI_DEBUGGER) list(APPEND FEATURES CLI_DEBUGGER) - list(APPEND DEBUGGER_SRC ${CMAKE_SOURCE_DIR}/src/debugger/cli-debugger.c) - list(APPEND DEBUGGER_SRC ${CMAKE_SOURCE_DIR}/src/debugger/parser.c) - list(APPEND DEBUGGER_SRC ${CMAKE_SOURCE_DIR}/src/gba/supervisor/cli.c) + list(APPEND DEBUGGER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger/cli-debugger.c) + list(APPEND DEBUGGER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger/parser.c) + list(APPEND DEBUGGER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/supervisor/cli.c) include_directories(AFTER ${LIBEDIT_INCLUDE_DIRS}) link_directories(${LIBEDIT_LIBRARY_DIRS}) set(DEBUGGER_LIB ${LIBEDIT_LIBRARIES})@@ -340,7 +339,7 @@ endif()
if(USE_GDB_STUB) list(APPEND FEATURES GDB_STUB) - list(APPEND DEBUGGER_SRC ${CMAKE_SOURCE_DIR}/src/debugger/gdb-stub.c) + list(APPEND DEBUGGER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger/gdb-stub.c) endif() source_group("ARM debugger" FILES ${DEBUGGER_SRC})@@ -352,7 +351,7 @@ list(APPEND FEATURES LIBAV)
endif() include_directories(AFTER ${LIBAVCODEC_INCLUDE_DIRS} ${LIBAVFORMAT_INCLUDE_DIRS} ${LIBAVRESAMPLE_INCLUDE_DIRS} ${LIBAVUTIL_INCLUDE_DIRS} ${LIBSWSCALE_INCLUDE_DIRS}) link_directories(${LIBAVCODEC_LIBRARY_DIRS} ${LIBAVFORMAT_LIBRARY_DIRS} ${LIBAVRESAMPLE_LIBRARY_DIRS} ${LIBAVUTIL_LIBRARY_DIRS} ${LIBSWSCALE_LIBRARY_DIRS}) - list(APPEND FEATURE_SRC "${CMAKE_SOURCE_DIR}/src/platform/ffmpeg/ffmpeg-encoder.c") + list(APPEND FEATURE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/platform/ffmpeg/ffmpeg-encoder.c") string(REGEX MATCH "^[0-9]+" LIBAVCODEC_VERSION_MAJOR ${libavcodec_VERSION}) string(REGEX MATCH "^[0-9]+" LIBAVFORMAT_VERSION_MAJOR ${libavformat_VERSION}) string(REGEX MATCH "^[0-9]+" LIBAVRESAMPLE_VERSION_MAJOR ${libavresample_VERSION})@@ -371,13 +370,13 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework VideoDecodeAcceleration -framework CoreVideo")
endif() endif() -list(APPEND THIRD_PARTY_SRC "${CMAKE_SOURCE_DIR}/src/third-party/blip_buf/blip_buf.c") +list(APPEND THIRD_PARTY_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/blip_buf/blip_buf.c") if(USE_MAGICK) list(APPEND FEATURES MAGICK) include_directories(AFTER ${MAGICKWAND_INCLUDE_DIRS}) link_directories(${MAGICKWAND_LIBRARY_DIRS}) - list(APPEND FEATURE_SRC "${CMAKE_SOURCE_DIR}/src/platform/imagemagick/imagemagick-gif-encoder.c") + list(APPEND FEATURE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/platform/imagemagick/imagemagick-gif-encoder.c") list(APPEND DEPENDENCY_LIB ${MAGICKWAND_LIBRARIES}) string(REGEX MATCH "^[0-9]+\\.[0-9]+" MAGICKWAND_VERSION_PARTIAL ${MagickWand_VERSION}) if(${MAGICKWAND_VERSION_PARTIAL} EQUAL "6.7")@@ -390,13 +389,13 @@ endif()
if(WANT_ZLIB AND NOT USE_ZLIB) set(SKIP_INSTALL_ALL ON) - add_subdirectory(${CMAKE_SOURCE_DIR}/src/third-party/zlib zlib) - set_property(TARGET zlibstatic PROPERTY INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/zlib;${CMAKE_SOURCE_DIR}/src/third-party/zlib) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib zlib) + set_property(TARGET zlibstatic PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/zlib;${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib) set_property(TARGET zlib PROPERTY EXCLUDE_FROM_ALL ON) set_property(TARGET example PROPERTY EXCLUDE_FROM_ALL ON) set_property(TARGET minigzip PROPERTY EXCLUDE_FROM_ALL ON) - set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/third-party/zlib ${CMAKE_BINARY_DIR}/zlib) - set(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/third-party/zlib ${CMAKE_BINARY_DIR}/zlib) + set(ZLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib) + set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib) set(ZLIB_LIBRARY zlibstatic) list(APPEND DEPENDENCY_LIB zlibstatic) set(USE_ZLIB ON)@@ -414,9 +413,9 @@ set(PNG_STATIC ON CACHE BOOL "" FORCE)
set(PNG_SHARED OFF CACHE BOOL "" FORCE) set(PNG_TESTS OFF CACHE BOOL "" FORCE) set(SKIP_INSTALL_ALL ON) - add_subdirectory(${CMAKE_SOURCE_DIR}/src/third-party/libpng libpng) - set_property(TARGET png16_static PROPERTY INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/libpng;${CMAKE_SOURCE_DIR}/src/third-party/libpng;${ZLIB_INCLUDE_DIRS}) - set(PNG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/third-party/libpng ${CMAKE_BINARY_DIR}/libpng) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/libpng libpng) + set_property(TARGET png16_static PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/libpng;${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/libpng;${ZLIB_INCLUDE_DIRS}) + set(PNG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/libpng ${CMAKE_CURRENT_BINARY_DIR}/libpng) list(APPEND DEPENDENCY_LIB png16_static) set(USE_PNG ON) endif()@@ -433,45 +432,45 @@ include_directories(AFTER ${LIBZIP_INCLUDE_DIRS})
link_directories(${LIBZIP_LIBRARY_DIRS}) list(APPEND DEPENDENCY_LIB ${LIBZIP_LIBRARIES}) list(APPEND FEATURES LIBZIP) - list(APPEND VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-zip.c) + list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c) set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libzip2") elseif(USE_MINIZIP) include_directories(AFTER ${MINIZIP_INCLUDE_DIRS}) link_directories(${MINIZIP_LIBRARY_DIRS}) list(APPEND DEPENDENCY_LIB ${MINIZIP_LIBRARIES}) list(APPEND FEATURES MINIZIP) - list(APPEND VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-zip.c) + list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c) set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libminizip1") elseif(USE_ZLIB) - list(APPEND VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-zip.c - ${CMAKE_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/ioapi.c - ${CMAKE_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/unzip.c) + list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/ioapi.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/unzip.c) endif() if (USE_LZMA) - include_directories(AFTER ${CMAKE_SOURCE_DIR}/third-party/lzma) + include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/third-party/lzma) add_definitions(-D_7ZIP_PPMD_SUPPPORT) - list(APPEND VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-lzma.c) + list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-lzma.c) set(LZMA_SRC - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/7zAlloc.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/7zArcIn.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/7zBuf.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/7zBuf2.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/7zCrc.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/7zCrcOpt.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/7zDec.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/CpuArch.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/Delta.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/LzmaDec.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/Lzma2Dec.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/Bra.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/Bra86.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/BraIA64.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/Bcj2.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/Ppmd7.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/Ppmd7Dec.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/7zFile.c - ${CMAKE_SOURCE_DIR}/src/third-party/lzma/7zStream.c) + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zAlloc.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zArcIn.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zBuf.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zBuf2.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zCrc.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zCrcOpt.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zDec.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/CpuArch.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Delta.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/LzmaDec.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Lzma2Dec.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Bra.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Bra86.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/BraIA64.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Bcj2.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Ppmd7.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Ppmd7Dec.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zFile.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zStream.c) list(APPEND VFS_SRC ${LZMA_SRC}) list(APPEND FEATURES LZMA) endif()@@ -509,7 +508,7 @@ ${GBA_CTX_SRC}
${DEBUGGER_SRC} ${GBA_RENDERER_SRC}) if(NOT M_CORE_GB) - list(APPEND CORE_SRC ${CMAKE_SOURCE_DIR}/src/gb/audio.c) + list(APPEND CORE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gb/audio.c) endif() endif()@@ -519,15 +518,15 @@ source_group("Third-party code" FILES ${THIRD_PARTY_SRC})
# Platform binaries if(3DS) - add_subdirectory(${CMAKE_SOURCE_DIR}/src/platform/3ds ${CMAKE_BINARY_DIR}/3ds) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/3ds ${CMAKE_CURRENT_BINARY_DIR}/3ds) endif() if(WII) - add_subdirectory(${CMAKE_SOURCE_DIR}/src/platform/wii ${CMAKE_BINARY_DIR}/wii) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/wii ${CMAKE_CURRENT_BINARY_DIR}/wii) endif() if(PSP2) - add_subdirectory(${CMAKE_SOURCE_DIR}/src/platform/psp2 ${CMAKE_BINARY_DIR}/psp2) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/psp2 ${CMAKE_CURRENT_BINARY_DIR}/psp2) endif() # Binaries@@ -573,15 +572,15 @@
target_link_libraries(${BINARY_NAME} ${DEBUGGER_LIB} ${DEPENDENCY_LIB} ${OS_LIB}) install(TARGETS ${BINARY_NAME} LIBRARY DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME} NAMELINK_SKIP ARCHIVE DESTINATION ${LIBDIR} RUNTIME DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME}) if(UNIX AND NOT APPLE) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-16.png DESTINATION share/icons/hicolor/16x16/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-24.png DESTINATION share/icons/hicolor/24x24/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-32.png DESTINATION share/icons/hicolor/32x32/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-48.png DESTINATION share/icons/hicolor/48x48/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-64.png DESTINATION share/icons/hicolor/64x64/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-96.png DESTINATION share/icons/hicolor/96x96/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-128.png DESTINATION share/icons/hicolor/128x128/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-256.png DESTINATION share/icons/hicolor/256x256/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-512.png DESTINATION share/icons/hicolor/512x512/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-16.png DESTINATION share/icons/hicolor/16x16/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-24.png DESTINATION share/icons/hicolor/24x24/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-32.png DESTINATION share/icons/hicolor/32x32/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-48.png DESTINATION share/icons/hicolor/48x48/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-64.png DESTINATION share/icons/hicolor/64x64/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-96.png DESTINATION share/icons/hicolor/96x96/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-128.png DESTINATION share/icons/hicolor/128x128/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-256.png DESTINATION share/icons/hicolor/256x256/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-512.png DESTINATION share/icons/hicolor/512x512/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) endif() else() set(BUILD_SHARED OFF)@@ -608,7 +607,7 @@ set(BUILD_QT OFF)
endif() if(BUILD_LIBRETRO) - file(GLOB RETRO_SRC ${CMAKE_SOURCE_DIR}/src/platform/libretro/*.c) + file(GLOB RETRO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/libretro/*.c) add_library(${BINARY_NAME}_libretro SHARED ${CORE_SRC} ${RETRO_SRC}) set_target_properties(${BINARY_NAME}_libretro PROPERTIES PREFIX "" COMPILE_DEFINITIONS "COLOR_16_BIT;COLOR_5_6_5;DISABLE_THREADING;${OS_DEFINES};${FUNCTION_DEFINES};MINIMAL_CORE=2") target_link_libraries(${BINARY_NAME}_libretro ${OS_LIB})@@ -618,10 +617,10 @@
if(BUILD_OPENEMU) find_library(FOUNDATION Foundation) find_library(OPENEMUBASE OpenEmuBase) - file(GLOB OE_SRC ${CMAKE_SOURCE_DIR}/src/platform/openemu/*.m) + file(GLOB OE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/openemu/*.m) add_library(${BINARY_NAME}-openemu MODULE ${CORE_SRC} ${OE_SRC}) set_target_properties(${BINARY_NAME}-openemu PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/src/platform/openemu/Info.plist.in + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/openemu/Info.plist.in BUNDLE TRUE BUNDLE_EXTENSION oecoreplugin OUTPUT_NAME ${PROJECT_NAME}@@ -632,15 +631,15 @@ endif()
if(BUILD_SDL) add_definitions(-DBUILD_SDL) - add_subdirectory(${CMAKE_SOURCE_DIR}/src/platform/sdl ${CMAKE_BINARY_DIR}/sdl) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/sdl ${CMAKE_CURRENT_BINARY_DIR}/sdl) endif() if(BUILD_QT) - add_subdirectory(${CMAKE_SOURCE_DIR}/src/platform/qt ${CMAKE_BINARY_DIR}/qt) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/qt ${CMAKE_CURRENT_BINARY_DIR}/qt) endif() if(BUILD_PERF) - set(PERF_SRC ${CMAKE_SOURCE_DIR}/src/platform/test/perf-main.c ${CLI_SRC}) + set(PERF_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/test/perf-main.c ${CLI_SRC}) if(UNIX AND NOT APPLE) list(APPEND PERF_LIB rt) endif()@@ -649,27 +648,27 @@ add_executable(${BINARY_NAME}-perf ${PERF_SRC})
target_link_libraries(${BINARY_NAME}-perf ${BINARY_NAME} ${PERF_LIB} ${OS_LIB}) set_target_properties(${BINARY_NAME}-perf PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}") install(TARGETS ${BINARY_NAME}-perf DESTINATION bin COMPONENT ${BINARY_NAME}-perf) - install(FILES ${CMAKE_SOURCE_DIR}/tools/perf.py DESTINATION "${CMAKE_INSTALL_LIBDIR}/${BINARY_NAME}" COMPONENT ${BINARY_NAME}-perf) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/tools/perf.py DESTINATION "${CMAKE_INSTALL_LIBDIR}/${BINARY_NAME}" COMPONENT ${BINARY_NAME}-perf) endif() if(BUILD_TEST) - add_executable(${BINARY_NAME}-fuzz ${CMAKE_SOURCE_DIR}/src/platform/test/fuzz-main.c) + add_executable(${BINARY_NAME}-fuzz ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/test/fuzz-main.c) target_link_libraries(${BINARY_NAME}-fuzz ${BINARY_NAME}) set_target_properties(${BINARY_NAME}-fuzz PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}") install(TARGETS ${BINARY_NAME}-fuzz DESTINATION bin COMPONENT ${BINARY_NAME}-test) endif() if(BUILD_EXAMPLE) - add_executable(${BINARY_NAME}-example-server ${CMAKE_SOURCE_DIR}/src/platform/example/client-server/server.c) + add_executable(${BINARY_NAME}-example-server ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/example/client-server/server.c) target_link_libraries(${BINARY_NAME}-example-server ${BINARY_NAME}) set_target_properties(${BINARY_NAME}-example-server PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}") if(BUILD_SDL) - add_executable(${BINARY_NAME}-example-client ${CMAKE_SOURCE_DIR}/src/platform/example/client-server/client.c) + add_executable(${BINARY_NAME}-example-client ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/example/client-server/client.c) target_link_libraries(${BINARY_NAME}-example-client ${BINARY_NAME} ${SDL_LIBRARY} ${SDLMAIN_LIBRARY} ${OPENGL_LIBRARY} ${OPENGLES2_LIBRARY}) set_target_properties(${BINARY_NAME}-example-client PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}" - INCLUDE_DIRECTORIES "${SDL_INCLUDE_DIR};${CMAKE_SOURCE_DIR}/src") + INCLUDE_DIRECTORIES "${SDL_INCLUDE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/src") endif() endif()@@ -678,20 +677,20 @@ set(CPACK_PACKAGE_VERSION ${VERSION_STRING})
set(CPACK_PACKAGE_VERSION_MAJOR ${LIB_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${LIB_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${LIB_VERSION_PATCH}) -set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE) -set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.md) +set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE) +set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README.md) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "mGBA Game Boy Advance Emulator") set(CPACK_PACKAGE_VENDOR "Jeffrey Pfau") set(CPACK_PACKAGE_CONTACT "Jeffrey Pfau <jeffrey@endrift.com>") -set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") set(CPACK_DEBIAN_PACKAGE_SECTION "games") SET(CPACK_DEB_COMPONENT_INSTALL ON) set(CPACK_STRIP_FILES ${BINARY_NAME}) -install(FILES ${CMAKE_SOURCE_DIR}/README.md ${CMAKE_SOURCE_DIR}/CHANGES DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib${BINARY_NAME}) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${CMAKE_CURRENT_SOURCE_DIR}/CHANGES DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib${BINARY_NAME}) include(CPack)
@@ -7,7 +7,6 @@ #ifndef GBA_AUDIO_H
#define GBA_AUDIO_H #include "util/common.h" -#include "macros.h" #include "core/log.h" #include "gb/audio.h"
@@ -5,10 +5,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "bios.h" +#include "arm/isa-inlines.h" +#include "arm/macros.h" #include "gba/gba.h" #include "gba/io.h" #include "gba/memory.h" -#include "isa-inlines.h" const uint32_t GBA_BIOS_CHECKSUM = 0xBAAE187F; const uint32_t GBA_DS_BIOS_CHECKSUM = 0xBAAE1880;
@@ -8,10 +8,9 @@ #define GBA_HARDWARE_H
#include "util/common.h" +#include "arm/macros.h" #include "core/log.h" #include "gba/interface.h" - -#include "macros.h" #include <time.h>
@@ -5,9 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "memory.h" -#include "macros.h" - -#include "decoder.h" +#include "arm/decoder.h" #include "gba/hardware.h" #include "gba/io.h" #include "gba/serialize.h"
@@ -8,8 +8,7 @@ #define GBA_MEMORY_H
#include "util/common.h" -#include "arm.h" -#include "macros.h" +#include "arm/arm.h" #include "gba/hardware.h" #include "gba/savedata.h"
@@ -10,7 +10,6 @@ #include "util/common.h"
#include "core/core.h" #include "gba/memory.h" -#include "macros.h" #define GBA_R5(X) ((X) & 0x1F) #define GBA_G5(X) (((X) >> 5) & 0x1F)