aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-07-04 02:54:54 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2025-09-08 21:10:23 +0200
commita0672be24d53ec78d1a2567cf60d9f774b0d158a (patch)
tree738e4880f5afd01802751e3847b36a4ea6eb3a7a /src/CMakeLists.txt
parentbb49e6bf0e4c299ad860a78441a58b7c3678bed0 (diff)
downloadwnix-a0672be24d53ec78d1a2567cf60d9f774b0d158a.tar.gz
Do not rely on PSXSDK libc or _start
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 51806be..419f60e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -14,6 +14,15 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
+add_subdirectory(nanowasm)
+
+if(PS1_BUILD)
+ add_subdirectory(libc)
+ target_link_libraries(nanowasm PRIVATE c)
+ target_link_libraries(${PROJECT_NAME} PRIVATE c)
+ target_sources(${PROJECT_NAME} PRIVATE start.c)
+endif()
+
# Avoid C11 since it is not supported by the i386-mingw32 toolchain.
set(cflags ${cflags} -Wall -ffunction-sections -fdata-sections -pedantic)
@@ -24,6 +33,7 @@ set(interfaces
)
target_compile_options(${PROJECT_NAME} PUBLIC ${cflags})
+target_compile_options(nanowasm PUBLIC ${cflags})
# Dependencies for main.c
# target_link_libraries(${PROJECT_NAME} PRIVATE)
@@ -32,6 +42,11 @@ foreach(c ${components})
target_compile_options(${c} PUBLIC ${cflags})
target_compile_features(${c} PUBLIC c_std_99)
set_target_properties(${c} PROPERTIES C_STANDARD 99 C_EXTENSIONS OFF)
+ target_link_libraries(${PROJECT_NAME} PRIVATE ${c})
+
+ if(PS1_BUILD)
+ target_link_libraries(${c} PRIVATE c)
+ endif()
endforeach()
foreach(i ${interfaces})
@@ -41,3 +56,8 @@ foreach(i ${interfaces})
endforeach()
target_link_options(${PROJECT_NAME} PRIVATE -Wl,--gc-sections)
+
+if(PS1_BUILD)
+ target_link_options(${PROJECT_NAME} PRIVATE
+ -T${CMAKE_CURRENT_LIST_DIR}/playstation.x)
+endif()