Skip to content

Commit 3f08bb1

Browse files
authored
Merge branch 'master' into no_install_sfml
2 parents deb8c03 + 7f96df4 commit 3f08bb1

File tree

4 files changed

+20
-32
lines changed

4 files changed

+20
-32
lines changed

.github/workflows/ci.yml

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: CI
22

33
on: [push, pull_request]
44

5+
defaults:
6+
run:
7+
shell: bash
8+
59
jobs:
610
build:
711
name: ${{ matrix.platform.name }} ${{ matrix.config.name }}
@@ -26,16 +30,10 @@ jobs:
2630
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev
2731

2832
- name: Checkout
29-
uses: actions/checkout@v3
33+
uses: actions/checkout@v4
3034

3135
- name: Configure
32-
shell: bash
33-
run: cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install ${{matrix.platform.flags}} ${{matrix.config.flags}}
36+
run: cmake -B build ${{matrix.platform.flags}} ${{matrix.config.flags}}
3437

3538
- name: Build
36-
shell: bash
3739
run: cmake --build build --config Release
38-
39-
- name: Install
40-
shell: bash
41-
run: cmake --install build --config Release

CMakeLists.txt

+8-9
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,18 @@ FetchContent_Declare(sfml
99
GIT_REPOSITORY https://github.com/SFML/SFML.git
1010
GIT_TAG 2.6.x
1111
EXCLUDE_FROM_ALL
12-
SYSTEM)
13-
FetchContent_MakeAvailable(sfml)
12+
SYSTEM
13+
GIT_SHALLOW ON)
14+
FetchContent_MakeAvailable(SFML)
1415

15-
add_executable(CMakeSFMLProject src/main.cpp)
16-
target_link_libraries(CMakeSFMLProject PRIVATE sfml-graphics)
17-
target_compile_features(CMakeSFMLProject PRIVATE cxx_std_17)
16+
add_executable(main src/main.cpp)
17+
target_link_libraries(main PRIVATE sfml-graphics)
18+
target_compile_features(main PRIVATE cxx_std_17)
1819

1920
if(WIN32)
2021
add_custom_command(
21-
TARGET CMakeSFMLProject
22+
TARGET main
2223
COMMENT "Copy OpenAL DLL"
23-
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${SFML_SOURCE_DIR}/extlibs/bin/$<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,x64,x86>/openal32.dll $<TARGET_FILE_DIR:CMakeSFMLProject>
24+
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${SFML_SOURCE_DIR}/extlibs/bin/$<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,x64,x86>/openal32.dll $<TARGET_FILE_DIR:main>
2425
VERBATIM)
2526
endif()
26-
27-
install(TARGETS CMakeSFMLProject)

README.md

+5-14
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ The template starts out very basic, but might receive additional features over t
1010

1111
## How to Use
1212

13+
1. Install Git and CMake. Use your system's package manager if available.
1314
1. Follow the above instructions about how to use GitHub's project template feature to create your own project.
14-
1. Open [CMakeLists.txt](CMakeLists.txt). Rename the project and the executable to whatever name you want. The project and executable names don't have to match.
15+
1. Clone your new GitHub repo and open the repo in your text editor of choice.
16+
1. Open [CMakeLists.txt](CMakeLists.txt). Rename the project and the executable to whatever name you want.
1517
1. If you want to add or remove any .cpp files, change the source files listed in the [`add_executable`](CMakeLists.txt#L10) call in CMakeLists.txt to match the source files your project requires. If you plan on keeping the default main.cpp file then no changes are required.
1618
1. If you use Linux, install SFML's dependencies using your system package manager. On Ubuntu and other Debian-based distributions you can use the following commands:
1719
```
@@ -34,18 +36,12 @@ The template starts out very basic, but might receive additional features over t
3436
- [Qt Creator](https://doc.qt.io/qtcreator/creator-project-cmake.html)
3537
3638
Using CMake from the command line is straightforward as well.
39+
Be sure to run these commands in the root directory of the project you just created.
3740
38-
For a single-configuration generator (typically the case on Linux and macOS):
3941
```
40-
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
42+
cmake -B build
4143
cmake --build build
4244
```
43-
44-
For a multi-configuration generator (typically the case on Windows):
45-
```
46-
cmake -S . -B build
47-
cmake --build build --config Release
48-
```
4945
1. Enjoy!
5046
5147
## Upgrading SFML
@@ -64,11 +60,6 @@ The nice folks in the [SFML community](https://github.com/SFML/SFML#community) c
6460
6561
Modify CMake options by adding them as configuration parameters (with a `-D` flag) or by modifying the contents of CMakeCache.txt and rebuilding.
6662
67-
### Use Static Libraries
68-
69-
By default SFML builds shared libraries and this default is inherited by your project.
70-
CMake's [`BUILD_SHARED_LIBS`](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html) option lets you pick static or shared libraries for the entire project.
71-
7263
### Change Compilers
7364
7465
See the variety of [`CMAKE_<LANG>_COMPILER`](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html) options.

src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ int main()
1818
window.clear();
1919
window.display();
2020
}
21-
}
21+
}

0 commit comments

Comments
 (0)