Skip to content

Commit

Permalink
Adding basic cmake config
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtrujy committed Oct 29, 2024
1 parent c04b583 commit d65a088
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.0)
project(libpspme)

# Output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/module)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# Add subdirectories for each component
add_subdirectory(src/lib) # Static library
add_subdirectory(src/module) # PRX module
add_subdirectory(src/example) # Example program
15 changes: 15 additions & 0 deletions src/example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Example executable
project(fooME)

# Collect source files for the example program
file(GLOB EXAMPLE_SOURCES *.c)

# Define the executable target
add_executable(fooME ${EXAMPLE_SOURCES})

# Link against the static library and the module
target_link_libraries(fooME pspme_static pspme_module)

# Set output name to "fooME.elf"
set_target_properties(fooME PROPERTIES OUTPUT_NAME "fooME")
target_include_directories(fooME PRIVATE ${CMAKE_SOURCE_DIR}/include)
12 changes: 12 additions & 0 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Static library
project(libpspme_lib)

# Collect source files for the static library
file(GLOB LIB_SOURCES *.c)

# Define the static library target
add_library(pspme_static STATIC ${LIB_SOURCES})

# Set output name to "libpspme.a"
set_target_properties(pspme_static PROPERTIES OUTPUT_NAME "pspme")
target_include_directories(pspme_static PUBLIC ${CMAKE_SOURCE_DIR}/include)
12 changes: 12 additions & 0 deletions src/module/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# PRX Module
project(pspme_prx)

# Collect source files for the PRX module
file(GLOB MODULE_SOURCES *.c)

# Define the PRX target
add_library(pspme_module MODULE ${MODULE_SOURCES})

# Set output name to "pspme.prx"
set_target_properties(pspme_module PROPERTIES OUTPUT_NAME "pspme")
target_include_directories(pspme_module PUBLIC ${CMAKE_SOURCE_DIR}/include)

0 comments on commit d65a088

Please sign in to comment.