-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This unifies the build system across platforms, including doing development inside Visual Studio. No change to other code. Some exceptions: - Switch port is still a Makefile - run_with_tcc.bat still exists
- Loading branch information
1 parent
578f90b
commit 03de46f
Showing
13 changed files
with
218 additions
and
675 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
.DS_Store | ||
*.dSYM | ||
/.vs/ | ||
/packages/ | ||
/saves/ | ||
*.o | ||
/sm | ||
/build/ | ||
/build*/ | ||
/sm.smc | ||
SDL2.dll | ||
/sm.exe | ||
/glsl-shaders/ | ||
/glsl-shaders/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
cmake_minimum_required(VERSION 3.22 FATAL_ERROR) | ||
|
||
project(sm | ||
VERSION 0.0.1 | ||
DESCRIPTION "Super Metroid PC Port" | ||
HOMEPAGE_URL "https://github.com/snesrev/sm" | ||
LANGUAGES C) | ||
|
||
if (CMAKE_BINARY_DIR EQUAL CMAKE_SOURCE_DIR) | ||
message(WARNING "You are compiling in the source tree, you probably don't want to do that. Use -B to set the build directory") | ||
endif() | ||
|
||
include(GNUInstallDirs) | ||
|
||
# For installation later | ||
set(ini_name "${PROJECT_SOURCE_DIR}/sm.ini") | ||
|
||
# Dependencies | ||
# ------------ | ||
# SDL | ||
if (WIN32 OR NINTENDO_SWITCH) | ||
# Force static on Windows and Switch, just because it's easier | ||
find_package(SDL2 REQUIRED COMPONENTS SDL2-static) | ||
else() | ||
find_package(SDL2 REQUIRED COMPONENTS SDL2) | ||
endif() | ||
|
||
# OpenGL | ||
# TODO: This should likely be removed | ||
add_library(gl STATIC "third_party/gl_core/gl_core_3_1.c") | ||
target_include_directories(gl PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") | ||
|
||
# Main Executable | ||
# --------------- | ||
add_executable(sm) | ||
add_subdirectory(src) | ||
target_link_libraries(sm PRIVATE m SDL2::SDL2 gl) | ||
target_compile_definitions(sm PRIVATE SYSTEM_VOLUME_MIXER_AVAILABLE=0) | ||
|
||
# Nintendo Switch extra setup | ||
if (NINTENDO_SWITCH) | ||
enable_language(CXX) | ||
nx_generate_nacp(sm.nacp | ||
NAME "Super Metroid" | ||
AUTHOR "snesrev & Lywx" | ||
VERSION "${PROJECT_VERSION}") | ||
|
||
nx_create_nro(sm | ||
NACP sm.nacp | ||
ICON "${PROJECT_SOURCE_DIR}/src/platform/switch/icon.jpg") | ||
|
||
set(ini_name "${PROJECT_SOURCE_DIR}/src/platform/switch/sm.ini") | ||
endif() | ||
|
||
# Installation | ||
# ------------ | ||
install(TARGETS sm RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") | ||
|
||
# TODO: should be in some config dir | ||
install(FILES "${ini_name}" DESTINATION "${CMAKE_INSTALL_BINDIR}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": 3, | ||
"cmakeMinimumRequired": { | ||
"major": 3, | ||
"minor": 21, | ||
"patch": 0 | ||
}, | ||
"configurePresets": [ | ||
{ | ||
"name": "nintendo-switch", | ||
"binaryDir": "${sourceDir}/build-switch", | ||
"toolchainFile": "$env{DEVKITPRO}/cmake/Switch.cmake", | ||
"condition": { | ||
"type": "notEquals", | ||
"lhs": "$env{DEVKITPRO}", | ||
"rhs": "" | ||
} | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
target_sources(sm PRIVATE | ||
"config.c" | ||
"config.h" | ||
"enemy_types.h" | ||
"features.h" | ||
"funcs.h" | ||
"glsl_shader.c" | ||
"glsl_shader.h" | ||
"ida_types.h" | ||
"main.c" | ||
"opengl.c" | ||
"sm_80.c" | ||
"sm_81.c" | ||
"sm_82.c" | ||
"sm_84.c" | ||
"sm_85.c" | ||
"sm_86.c" | ||
"sm_87.c" | ||
"sm_88.c" | ||
"sm_89.c" | ||
"sm_8b.c" | ||
"sm_8d.c" | ||
"sm_8f.c" | ||
"sm_90.c" | ||
"sm_91.c" | ||
"sm_92.c" | ||
"sm_93.c" | ||
"sm_94.c" | ||
"sm_9b.c" | ||
"sm_a0.c" | ||
"sm_a2.c" | ||
"sm_a3.c" | ||
"sm_a4.c" | ||
"sm_a5.c" | ||
"sm_a6.c" | ||
"sm_a7.c" | ||
"sm_a8.c" | ||
"sm_a9.c" | ||
"sm_aa.c" | ||
"sm_ad.c" | ||
"sm_b2.c" | ||
"sm_b3.c" | ||
"sm_b4.c" | ||
"sm_cpu_infra.c" | ||
"sm_cpu_infra.h" | ||
"sm_rtl.c" | ||
"sm_rtl.h" | ||
"spc_player.c" | ||
"spc_player.h" | ||
"spc_variables.h" | ||
"tracing.c" | ||
"tracing.h" | ||
"types.h" | ||
"util.c" | ||
"util.h" | ||
"variables_extra.h" | ||
"variables.h" | ||
|
||
"snes/apu.c" | ||
"snes/apu.h" | ||
"snes/cart.c" | ||
"snes/cart.h" | ||
"snes/cpu.c" | ||
"snes/cpu.h" | ||
"snes/dma.c" | ||
"snes/dma.h" | ||
"snes/dsp.c" | ||
"snes/dsp.h" | ||
"snes/dsp_regs.h" | ||
"snes/input.c" | ||
"snes/input.h" | ||
"snes/ppu.c" | ||
"snes/ppu.h" | ||
"snes/saveload.h" | ||
"snes/snes.c" | ||
"snes/snes.h" | ||
"snes/snes_other.c" | ||
"snes/spc.c" | ||
"snes/spc.h" | ||
) | ||
|
||
if (WIN32) | ||
enable_language(RC) | ||
target_sources(sm PRIVATE | ||
"platform/win32/resource.h" | ||
"platform/win32/sm.rc" | ||
"platform/win32/volume_control.c" | ||
"platform/win32/volume_control.h" | ||
) | ||
endif() | ||
|
||
if (NINTENDO_SWITCH) | ||
target_include_directories(sm PRIVATE "platform/switch/src") | ||
target_sources(sm PRIVATE | ||
"platform/switch/src/switch_impl.c" | ||
"platform/switch/src/switch_impl.h" | ||
) | ||
endif() |
Oops, something went wrong.