Skip to content

Commit

Permalink
cmake: build more libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziemas committed Oct 5, 2024
1 parent 6166372 commit a32d20b
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 9 deletions.
15 changes: 12 additions & 3 deletions ee/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 8 additions & 0 deletions ee/dma/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
21 changes: 21 additions & 0 deletions ee/draw/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
18 changes: 18 additions & 0 deletions ee/eedebug/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
16 changes: 16 additions & 0 deletions ee/elf-loader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
7 changes: 4 additions & 3 deletions ee/kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
cmake_minimum_required(VERSION 3.10)

include(${PS2SDKSRC_ROOT}/cmake/utils.cmake)

add_subdirectory(src/eenull)
add_subdirectory(src/osdsrc)
add_subdirectory(src/srcfile)
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
Expand Down
5 changes: 4 additions & 1 deletion ee/kernel/src/osdsrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 0 additions & 2 deletions ee/libcglue/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit a32d20b

Please sign in to comment.