From 45976da975a21359cfcc9a05c575ed8b07575612 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 23 Aug 2014 22:22:05 -0300 Subject: CMake cleanup Several cleanups to the buildsystem: - Do better factoring of common libs between platforms. - Add support to building on Windows. - Remove Qt4 support. - Re-sort file lists and add missing headers. --- src/CMakeLists.txt | 13 ++++-- src/citra/CMakeLists.txt | 24 +++++++--- src/citra_qt/CMakeLists.txt | 39 +++++++++------- src/common/CMakeLists.txt | 23 +++++++--- src/core/CMakeLists.txt | 103 +++++++++++++++++++++++------------------- src/video_core/CMakeLists.txt | 39 ++++++++++------ 6 files changed, 147 insertions(+), 94 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e0227dc53..cb09f3cd1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,12 @@ +# Enable modules to include each other's files +include_directories(.) + add_subdirectory(common) add_subdirectory(core) add_subdirectory(video_core) -add_subdirectory(citra) -add_subdirectory(citra_qt) - -if(QT4_FOUND AND QT_QTCORE_FOUND AND QT_QTGUI_FOUND AND QT_QTOPENGL_FOUND AND NOT DISABLE_QT4) - #add_subdirectory(citra_qt) +if (ENABLE_GLFW) + add_subdirectory(citra) +endif() +if (ENABLE_QT) + add_subdirectory(citra_qt) endif() diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index bd6c4a1a8..f10f3e603 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt @@ -1,6 +1,13 @@ -set(SRCS citra.cpp - emu_window/emu_window_glfw.cpp) -set(HEADERS resource.h) +set(SRCS + emu_window/emu_window_glfw.cpp + citra.cpp + ) +set(HEADERS + emu_window/emu_window_glfw.h + resource.h + ) + +create_directory_groups(${SRCS} ${HEADERS}) # NOTE: This is a workaround for CMake bug 0006976 (missing X11_xf86vmode_LIB variable) if (NOT X11_xf86vmode_LIB) @@ -8,11 +15,16 @@ if (NOT X11_xf86vmode_LIB) endif() add_executable(citra ${SRCS} ${HEADERS}) +target_link_libraries(citra core common video_core) +target_link_libraries(citra ${OPENGL_gl_LIBRARY} ${GLFW_LIBRARIES}) if (APPLE) - target_link_libraries(citra core common video_core iconv pthread ${COREFOUNDATION_LIBRARY} ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES}) -else() - target_link_libraries(citra core common video_core pthread X11 Xxf86vm Xi Xcursor ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES} rt ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB} ${PNG_LIBRARIES}) + target_link_libraries(citra iconv pthread ${COREFOUNDATION_LIBRARY}) +elseif (WIN32) + target_link_libraries(citra winmm) +else() # Unix + target_link_libraries(citra pthread rt) + target_link_libraries(citra ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_Xcursor_LIB} ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB}) endif() #install(TARGETS citra RUNTIME DESTINATION ${bindir}) diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 055a585a0..426e4ef99 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -2,54 +2,61 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SRCS - bootmanager.cpp + config/controller_config.cpp + config/controller_config_util.cpp debugger/callstack.cpp debugger/disassembler.cpp debugger/graphics.cpp debugger/graphics_cmdlists.cpp debugger/ramview.cpp debugger/registers.cpp + bootmanager.cpp hotkeys.cpp main.cpp - config/controller_config.cpp - config/controller_config_util.cpp) + ) set(HEADERS - bootmanager.hxx + config/controller_config.hxx + config/controller_config_util.hxx debugger/callstack.hxx debugger/disassembler.hxx + debugger/graphics.hxx + debugger/graphics_cmdlists.hxx debugger/ramview.hxx debugger/registers.hxx + bootmanager.hxx hotkeys.hxx main.hxx version.h - config/controller_config.hxx - config/controller_config_util.hxx) + ) set(UIS + config/controller_config.ui debugger/callstack.ui debugger/disassembler.ui debugger/registers.ui hotkeys.ui main.ui - config/controller_config.ui) + ) + +create_directory_groups(${SRCS} ${HEADERS} ${UIS}) -if(USE_QT5) +if (Qt5_FOUND) qt5_wrap_ui(UI_HDRS ${UIS}) else() qt4_wrap_ui(UI_HDRS ${UIS}) endif() add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS}) -if(APPLE) - set(ICONV_LIBRARY iconv) -else() - set(RT_LIBRARY rt) -endif() +target_link_libraries(citra-qt core common video_core qhexedit) +target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) -target_link_libraries(citra-qt core common video_core qhexedit ${ICONV_LIBRARY} ${COREFOUNDATION_LIBRARY} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${RT_LIBRARY} ${PNG_LIBRARIES}) -if(USE_QT5) - target_link_libraries(citra-qt Qt5::Gui Qt5::Widgets Qt5::OpenGL) +if (APPLE) + target_link_libraries(citra-qt iconv ${COREFOUNDATION_LIBRARY}) +elseif (WIN32) + target_link_libraries(citra-qt winmm) +else() # Unix + target_link_libraries(citra-qt rt) endif() #install(TARGETS citra-qt RUNTIME DESTINATION ${bindir}) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index aae183393..f8a55c2a7 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -1,6 +1,8 @@ +# Generate cpp with Git revision from template configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in" "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp" @ONLY) -set(SRCS break_points.cpp +set(SRCS + break_points.cpp console_listener.cpp extended_trace.cpp file_search.cpp @@ -12,23 +14,25 @@ set(SRCS break_points.cpp memory_util.cpp misc.cpp msg_handler.cpp - string_util.cpp scm_rev.cpp + string_util.cpp symbols.cpp thread.cpp timer.cpp - utf8.cpp) + utf8.cpp + ) -set(HEADERS atomic.h +set(HEADERS + atomic.h atomic_gcc.h atomic_win32.h bit_field.h break_points.h chunk_file.h + common.h common_funcs.h common_paths.h common_types.h - common.h console_listener.h cpu_detect.h debug_interface.h @@ -37,10 +41,11 @@ set(HEADERS atomic.h fifo_queue.h file_search.h file_util.h + fixed_size_queue.h hash.h linear_disk_cache.h - log_manager.h log.h + log_manager.h math_util.h mem_arena.h memory_util.h @@ -54,8 +59,12 @@ set(HEADERS atomic.h swap.h symbols.h thread.h + thread_queue_list.h thunk.h timer.h - utf8.h) + utf8.h + ) + +create_directory_groups(${SRCS} ${HEADERS}) add_library(common STATIC ${SRCS} ${HEADERS}) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 207f39707..1f358ec8d 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,14 +1,18 @@ -set(SRCS core.cpp - core_timing.cpp - loader/elf.cpp - loader/loader.cpp - loader/ncch.cpp - mem_map.cpp - mem_map_funcs.cpp - system.cpp +set(SRCS arm/disassembler/arm_disasm.cpp arm/disassembler/load_symbol_map.cpp - file_sys/archive_romfs.cpp + arm/interpreter/mmu/arm1176jzf_s_mmu.cpp + arm/interpreter/mmu/cache.cpp + arm/interpreter/mmu/maverick.cpp + arm/interpreter/mmu/rb.cpp + arm/interpreter/mmu/sa_mmu.cpp + arm/interpreter/mmu/tlb.cpp + arm/interpreter/mmu/wb.cpp + arm/interpreter/mmu/xscale_copro.cpp + arm/interpreter/vfp/vfp.cpp + arm/interpreter/vfp/vfpdouble.cpp + arm/interpreter/vfp/vfpinstr.cpp + arm/interpreter/vfp/vfpsingle.cpp arm/interpreter/arm_interpreter.cpp arm/interpreter/armcopro.cpp arm/interpreter/armemu.cpp @@ -18,22 +22,7 @@ set(SRCS core.cpp arm/interpreter/armsupp.cpp arm/interpreter/armvirt.cpp arm/interpreter/thumbemu.cpp - arm/interpreter/vfp/vfp.cpp - arm/interpreter/vfp/vfpdouble.cpp - arm/interpreter/vfp/vfpinstr.cpp - arm/interpreter/vfp/vfpsingle.cpp - arm/interpreter/mmu/arm1176jzf_s_mmu.cpp - arm/interpreter/mmu/cache.cpp - arm/interpreter/mmu/maverick.cpp - arm/interpreter/mmu/rb.cpp - arm/interpreter/mmu/sa_mmu.cpp - arm/interpreter/mmu/tlb.cpp - arm/interpreter/mmu/wb.cpp - arm/interpreter/mmu/xscale_copro.cpp - hle/hle.cpp - hle/config_mem.cpp - hle/coprocessor.cpp - hle/svc.cpp + file_sys/archive_romfs.cpp hle/kernel/address_arbiter.cpp hle/kernel/archive.cpp hle/kernel/event.cpp @@ -48,27 +37,26 @@ set(SRCS core.cpp hle/service/ndm.cpp hle/service/service.cpp hle/service/srv.cpp + hle/config_mem.cpp + hle/coprocessor.cpp + hle/hle.cpp + hle/svc.cpp hw/gpu.cpp hw/hw.cpp - hw/ndma.cpp) + hw/ndma.cpp + loader/elf.cpp + loader/loader.cpp + loader/ncch.cpp + core.cpp + core_timing.cpp + mem_map.cpp + mem_map_funcs.cpp + system.cpp + ) -set(HEADERS core.h - core_timing.h - loader/elf.h - loader/loader.h - loader/ncch.h - mem_map.h - system.h +set(HEADERS arm/disassembler/arm_disasm.h arm/disassembler/load_symbol_map.h - arm/interpreter/arm_interpreter.h - arm/interpreter/arm_regformat.h - arm/interpreter/armcpu.h - arm/interpreter/armdefs.h - arm/interpreter/armemu.h - arm/interpreter/armmmu.h - arm/interpreter/armos.h - arm/interpreter/skyeye_defs.h arm/interpreter/mmu/arm1176jzf_s_mmu.h arm/interpreter/mmu/cache.h arm/interpreter/mmu/rb.h @@ -78,27 +66,48 @@ set(HEADERS core.h arm/interpreter/vfp/asm_vfp.h arm/interpreter/vfp/vfp.h arm/interpreter/vfp/vfp_helper.h + arm/interpreter/arm_interpreter.h + arm/interpreter/arm_regformat.h + arm/interpreter/armcpu.h + arm/interpreter/armdefs.h + arm/interpreter/armemu.h + arm/interpreter/armmmu.h + arm/interpreter/armos.h + arm/interpreter/skyeye_defs.h + arm/arm_interface.h file_sys/archive.h file_sys/archive_romfs.h - hle/config_mem.h - hle/coprocessor.h - hle/hle.h - hle/svc.h hle/kernel/address_arbiter.h hle/kernel/archive.h + hle/kernel/event.h hle/kernel/kernel.h hle/kernel/mutex.h hle/kernel/shared_memory.h hle/kernel/thread.h - hle/function_wrappers.h hle/service/apt.h hle/service/fs.h hle/service/gsp.h hle/service/hid.h + hle/service/ndm.h hle/service/service.h hle/service/srv.h + hle/config_mem.h + hle/coprocessor.h + hle/function_wrappers.h + hle/hle.h + hle/svc.h hw/gpu.h hw/hw.h - hw/ndma.h) + hw/ndma.h + loader/elf.h + loader/loader.h + loader/ncch.h + core.h + core_timing.h + mem_map.h + system.h + ) + +create_directory_groups(${SRCS} ${HEADERS}) add_library(core STATIC ${SRCS} ${HEADERS}) diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 48c5d1424..13c3f7b22 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -1,29 +1,42 @@ -set(SRCS clipper.cpp +set(SRCS + renderer_opengl/generated/gl_3_2_core.c + renderer_opengl/renderer_opengl.cpp + renderer_opengl/gl_shader_util.cpp + debug_utils/debug_utils.cpp + clipper.cpp command_processor.cpp primitive_assembly.cpp rasterizer.cpp utils.cpp vertex_shader.cpp video_core.cpp - renderer_opengl/generated/gl_3_2_core.c - renderer_opengl/renderer_opengl.cpp - renderer_opengl/gl_shader_util.cpp - debug_utils/debug_utils.cpp) + ) -set(HEADERS clipper.h +set(HEADERS + debug_utils/debug_utils.h + renderer_opengl/generated/gl_3_2_core.h + renderer_opengl/gl_shader_util.h + renderer_opengl/gl_shaders.h + renderer_opengl/renderer_opengl.h + clipper.h command_processor.h + gpu_debugger.h math.h + pica.h primitive_assembly.h rasterizer.h - utils.h - video_core.h renderer_base.h + utils.h vertex_shader.h video_core.h - renderer_opengl/generated/gl_3_2_core.h - renderer_opengl/renderer_opengl.h - renderer_opengl/gl_shader_util.h - renderer_opengl/gl_shaders.h - debug_utils/debug_utils.h) + ) + +create_directory_groups(${SRCS} ${HEADERS}) add_library(video_core STATIC ${SRCS} ${HEADERS}) + +if (PNG_FOUND) + target_link_libraries(video_core ${PNG_LIBRARIES}) + include_directories(${PNG_INCLUDE_DIRS}) + add_definitions(${PNG_DEFINITIONS}) +endif() -- cgit v1.2.3