-
Notifications
You must be signed in to change notification settings - Fork 34
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 e480022
Showing
14 changed files
with
225 additions
and
899 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,67 @@ | ||
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 CXX) | ||
|
||
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) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
SET(CMAKE_C_STANDRD 11) | ||
# 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) | ||
target_compile_definitions(sm PUBLIC __SWITCH__) | ||
|
||
# needs to be linked with g++ for C++ stdlib | ||
enable_language(CXX) | ||
set_target_properties(sm PROPERTIES LINKER_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.
Oops, something went wrong.