bbbb
This commit is contained in:
parent
7ea34913fe
commit
92a3b6e20a
@ -1 +1,72 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2025 thorium1256
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.11)
|
cmake_minimum_required(VERSION 3.11)
|
||||||
|
project(tuimine LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
# Compiler flags
|
||||||
|
add_compile_options(-Wall -Wextra)
|
||||||
|
|
||||||
|
# Find ncursesw (wide character version)
|
||||||
|
# Use the CURSES module but specifically look for ncursesw
|
||||||
|
set(CURSES_NEED_NCURSES TRUE)
|
||||||
|
set(CURSES_NEED_WIDE TRUE) # This is key for wide character support
|
||||||
|
find_package(Curses REQUIRED)
|
||||||
|
|
||||||
|
message(STATUS "Found Curses include path: ${CURSES_INCLUDE_PATH}")
|
||||||
|
message(STATUS "Found Curses libraries: ${CURSES_LIBRARIES}")
|
||||||
|
message(STATUS "Curses include dir: ${CURSES_INCLUDE_DIRS}")
|
||||||
|
|
||||||
|
# Optional SDL2
|
||||||
|
option(WITH_SDL2 "Enable SDL2 controller support" ON)
|
||||||
|
|
||||||
|
if(WITH_SDL2)
|
||||||
|
find_package(SDL2 QUIET)
|
||||||
|
if(SDL2_FOUND)
|
||||||
|
message(STATUS "SDL2 found - controller support enabled")
|
||||||
|
add_definitions(-DWITH_SDL2)
|
||||||
|
else()
|
||||||
|
message(STATUS "SDL2 not found - controller support disabled")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Build type specific settings
|
||||||
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
add_compile_options(-g)
|
||||||
|
else()
|
||||||
|
add_compile_options(-O2)
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Create executable
|
||||||
|
file(GLOB SOURCES "src/*.cpp")
|
||||||
|
add_executable(tuimine ${SOURCES})
|
||||||
|
target_include_directories(tuimine PRIVATE include)
|
||||||
|
|
||||||
|
# Link ncursesw - use the variables found by find_package(Curses)
|
||||||
|
if(CURSES_LIBRARIES)
|
||||||
|
target_link_libraries(tuimine PRIVATE ${CURSES_LIBRARIES})
|
||||||
|
else()
|
||||||
|
# Fallback to linking ncursesw directly
|
||||||
|
target_link_libraries(tuimine PRIVATE ncursesw)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_SDL2 AND SDL2_FOUND)
|
||||||
|
target_link_libraries(tuimine PRIVATE SDL2::SDL2)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Output configuration
|
||||||
|
set_target_properties(tuimine PROPERTIES
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin/debug"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin/release"
|
||||||
|
OUTPUT_NAME_DEBUG "debug"
|
||||||
|
OUTPUT_NAME_RELEASE "tuimine"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Install
|
||||||
|
install(TARGETS tuimine RUNTIME DESTINATION bin)
|
||||||
41
README.md
41
README.md
@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
|
|
||||||
# Minesweeper... in the terminal!
|
# Minesweeper... in the terminal!
|
||||||
|
|
||||||
Minesweeper is a classic puzzle game where the objective is to clear a rectangular board without detonating any hidden mines.
|
Minesweeper is a puzzle game where the objective is to clear a rectangular board without detonating any hidden mines.
|
||||||
|
|
||||||
## How to Play
|
## How to Play
|
||||||
|
|
||||||
@ -32,45 +32,22 @@ You can't flag already revealed cells.
|
|||||||
|
|
||||||
## Compilation
|
## Compilation
|
||||||
|
|
||||||
### Windows
|
Make a `build` directory and enter it:
|
||||||
|
|
||||||
For compiling on Windows, you need MSYS2 and MinGW-w64.
|
|
||||||
If you want, you can compile on MSVC (if you get it to work), I don't care.
|
|
||||||
|
|
||||||
The prerequisites are _ncurses_. Only that.
|
|
||||||
|
|
||||||
The DLLs are not included in this repository, you should go get 'em yourself, and put them in the `lib` folder.
|
|
||||||
|
|
||||||
Rename the `Makefile.win` file, make, and you got Minesweeper.
|
|
||||||
|
|
||||||
But I have to mention something if it says something about no libraries found. MSYS2, for some reason, has been including dynamic libraries really weirdly in their packages. They only add the static libraries and don't get the dynamic ones. And that makes me angry. I don't know why they did this, but it's confusing. Please just put the DLLs in mingw64/lib and not in mingw64/bin.
|
|
||||||
|
|
||||||
Anyway, if it says something about that, just patch the Makefile with **normal** LDFLAGS and try again.
|
|
||||||
|
|
||||||
### Unix/Linux
|
|
||||||
|
|
||||||
Every normal Unix/Linux system has ncurses, but not always the development headers needed for compilation.
|
|
||||||
Installation for these:
|
|
||||||
|
|
||||||
**Debian/Ubuntu**:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt install libncurses-dev
|
mkdir build
|
||||||
|
cd build
|
||||||
```
|
```
|
||||||
|
|
||||||
**Arch**:
|
Make build files:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo pacman -S ncurses
|
cmake ..
|
||||||
```
|
```
|
||||||
|
|
||||||
**Fedora**:
|
Compile and install:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo dnf install ncurses-devel
|
make -j${nproc}
|
||||||
|
make install
|
||||||
```
|
```
|
||||||
|
|
||||||
**Other distros**:
|
|
||||||
Search engines are your best friend.
|
|
||||||
|
|
||||||
Then rename `Makefile.unix`, press the make button, and a moment later, you got it.
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user