From a32d20b7f9f6218388a52c104919fa6ef1b9c556 Mon Sep 17 00:00:00 2001 From: Ziemas Date: Sat, 5 Oct 2024 13:07:15 +0200 Subject: [PATCH] cmake: build more libraries --- ee/CMakeLists.txt | 15 ++++++++++++--- ee/dma/CMakeLists.txt | 8 ++++++++ ee/draw/CMakeLists.txt | 21 +++++++++++++++++++++ ee/eedebug/CMakeLists.txt | 18 ++++++++++++++++++ ee/elf-loader/CMakeLists.txt | 16 ++++++++++++++++ ee/kernel/CMakeLists.txt | 7 ++++--- ee/kernel/src/osdsrc/CMakeLists.txt | 5 ++++- ee/libcglue/CMakeLists.txt | 2 -- 8 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 ee/dma/CMakeLists.txt create mode 100644 ee/draw/CMakeLists.txt create mode 100644 ee/eedebug/CMakeLists.txt create mode 100644 ee/elf-loader/CMakeLists.txt diff --git a/ee/CMakeLists.txt b/ee/CMakeLists.txt index e0623792f58..d8847193df6 100644 --- a/ee/CMakeLists.txt +++ b/ee/CMakeLists.txt @@ -2,12 +2,21 @@ cmake_minimum_required(VERSION 3.10) project(ps2sdk-ee C ASM) file(REAL_PATH ../ PS2SDKSRC_ROOT) -set(EE_INC ${PS2SDKSRC_ROOT}/common/include ${PROJECT_SOURCE_DIR}/kernel/include ${PROJECT_SOURCE_DIR}/rpc/cdvd/include - ${PROJECT_SOURCE_DIR}/erl/include) +set(EE_INC + ${PS2SDKSRC_ROOT}/common/include + ${PROJECT_SOURCE_DIR}/kernel/include + ${PROJECT_SOURCE_DIR}/erl/include +) +include(${PS2SDKSRC_ROOT}/cmake/utils.cmake) + +add_subdirectory(debug) +add_subdirectory(dma) +add_subdirectory(draw) +add_subdirectory(eedebug) +add_subdirectory(elf-loader) add_subdirectory(kernel) add_subdirectory(erl) add_subdirectory(libcglue) -add_subdirectory(debug) add_subdirectory(sbv) add_subdirectory(startup) diff --git a/ee/dma/CMakeLists.txt b/ee/dma/CMakeLists.txt new file mode 100644 index 00000000000..c8b38942664 --- /dev/null +++ b/ee/dma/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(dma) +target_include_directories(dma PUBLIC include) +target_include_directories(dma PRIVATE ${EE_INC} ${PROJECT_SOURCE_DIR}/packet2/include) +target_sources(dma PRIVATE src/dma.c src/erl-support.c) +file(GLOB DMA_INCLUDE_FILES "include/*.h*") +set_target_properties(dma PROPERTIES PUBLIC_HEADER "${DMA_INCLUDE_FILES}") +install(TARGETS dma) +target_add_erl(dma) diff --git a/ee/draw/CMakeLists.txt b/ee/draw/CMakeLists.txt new file mode 100644 index 00000000000..fde7eaf5117 --- /dev/null +++ b/ee/draw/CMakeLists.txt @@ -0,0 +1,21 @@ +add_library(draw) +target_include_directories(draw PUBLIC include) +target_include_directories(draw PRIVATE + ${EE_INC} + ${PROJECT_SOURCE_DIR}/math3d/include + ${PROJECT_SOURCE_DIR}/dma/include +) + +target_sources(draw PRIVATE + src/draw_environment.c + src/draw.c + src/draw2d.c + src/draw3d.c + src/erl-support.c +) + +file(GLOB DRAW_INCLUDE_FILES "include/*.h*") +set_target_properties(draw PROPERTIES PUBLIC_HEADER "${DRAW_INCLUDE_FILES}") +install(TARGETS draw) + +target_add_erl(draw) \ No newline at end of file diff --git a/ee/eedebug/CMakeLists.txt b/ee/eedebug/CMakeLists.txt new file mode 100644 index 00000000000..c60c3ffb6e6 --- /dev/null +++ b/ee/eedebug/CMakeLists.txt @@ -0,0 +1,18 @@ +add_library(eedebug) +target_include_directories(eedebug PUBLIC include) +target_include_directories(eedebug PRIVATE + ${EE_INC} +) + +target_sources(eedebug PRIVATE + src/ee_dbg_low.S + src/ee_debug.c + src/ee_exceptions.S + src/erl-support.c +) + +file(GLOB eedebug_INCLUDE_FILES "include/*.h*") +set_target_properties(eedebug PROPERTIES PUBLIC_HEADER "${eedebug_INCLUDE_FILES}") +install(TARGETS eedebug) + +target_add_erl(eedebug) \ No newline at end of file diff --git a/ee/elf-loader/CMakeLists.txt b/ee/elf-loader/CMakeLists.txt new file mode 100644 index 00000000000..5381b937976 --- /dev/null +++ b/ee/elf-loader/CMakeLists.txt @@ -0,0 +1,16 @@ +# TODO subfolder binary include +add_library(elf-loader) +target_include_directories(elf-loader PUBLIC include) +target_include_directories(elf-loader PRIVATE + ${EE_INC} +) + +target_sources(elf-loader PRIVATE + src/elf.c +) + +file(GLOB elf-loader_INCLUDE_FILES "include/*.h*") +set_target_properties(elf-loader PROPERTIES PUBLIC_HEADER "${elf-loader_INCLUDE_FILES}") +install(TARGETS elf-loader) + +target_add_erl(elf-loader) \ No newline at end of file diff --git a/ee/kernel/CMakeLists.txt b/ee/kernel/CMakeLists.txt index 8ddb612d90d..d5cbac12426 100644 --- a/ee/kernel/CMakeLists.txt +++ b/ee/kernel/CMakeLists.txt @@ -1,7 +1,5 @@ cmake_minimum_required(VERSION 3.10) -include(${PS2SDKSRC_ROOT}/cmake/utils.cmake) - add_subdirectory(src/eenull) add_subdirectory(src/osdsrc) add_subdirectory(src/srcfile) @@ -9,7 +7,10 @@ add_subdirectory(src/tlbsrc) add_library(kernel) target_include_directories(kernel PUBLIC include) -target_include_directories(kernel PRIVATE ${EE_INC}) +target_include_directories(kernel PRIVATE + ${EE_INC} + ${PROJECT_SOURCE_DIR}/rpc/cdvd/include +) compile_multiple(kernel src/sifcmd.c OBJECTS sif_cmd_send.o _sif_cmd_int_handler.o sif_cmd_main.o diff --git a/ee/kernel/src/osdsrc/CMakeLists.txt b/ee/kernel/src/osdsrc/CMakeLists.txt index 164832e1dd4..de4b2eaf9ff 100644 --- a/ee/kernel/src/osdsrc/CMakeLists.txt +++ b/ee/kernel/src/osdsrc/CMakeLists.txt @@ -3,5 +3,8 @@ add_executable(osdsrc) target_sources(osdsrc PRIVATE src/ExecPS2.c src/osd.c src/osdsrc.c) target_compile_definitions(osdsrc PRIVATE -DREUSE_EXECPS2) target_compile_options(osdsrc PRIVATE -fno-tree-loop-distribute-patterns -mno-gpopt) -target_include_directories(osdsrc PRIVATE ${EE_INC}) +target_include_directories(osdsrc PRIVATE + ${EE_INC} + ${PROJECT_SOURCE_DIR}/rpc/cdvd/include +) target_link_options(osdsrc PRIVATE -nostdlib -nostartfiles -T${CMAKE_CURRENT_SOURCE_DIR}/linkfile -s) \ No newline at end of file diff --git a/ee/libcglue/CMakeLists.txt b/ee/libcglue/CMakeLists.txt index e45457b1f6f..9ed864e4245 100644 --- a/ee/libcglue/CMakeLists.txt +++ b/ee/libcglue/CMakeLists.txt @@ -1,5 +1,3 @@ -include(${PS2SDKSRC_ROOT}/cmake/utils.cmake) - add_library(cglue) target_include_directories(cglue PUBLIC ${EE_INC} include) target_sources(cglue PRIVATE src/rtc.c)