Skip to content

Commit 5a8da01

Browse files
committed
Small bugfixes and minor project restructuring
Increase minimum CMake version. Use CMake FetchContent for glutils instead of a git submodule. Properly load Lua scripts from XDG directories. Properly add exe icon on Windows.
1 parent 027bc71 commit 5a8da01

22 files changed

Lines changed: 241 additions & 111 deletions

.github/workflows/cmake-multi-platform.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ jobs:
6565
sudo apt-get update
6666
sudo apt-get install bison flex libfl-dev libglew-dev libgtkmm-3.0-dev liblua5.4-dev
6767
68-
- name: Workaround for flex bug.
69-
# See https://github.com/msys2/MSYS2-packages/issues/1911#issuecomment-832199076
70-
if: ${{ matrix.os == 'windows-latest' }}
71-
run: cp /usr/include/FlexLexer.h /mingw64/include/FlexLexer.h
72-
7368
# Disable autocrlf for MSYS2 compatibility.
7469
- run: git config --global core.autocrlf input
7570
- uses: actions/checkout@v4
@@ -85,9 +80,6 @@ jobs:
8580
run: |
8681
echo "build-output-dir=$workspace/build" >> "$GITHUB_OUTPUT"
8782
88-
- name: Initialize and update submodules
89-
run: git submodule update --init --recursive
90-
9183
- name: Configure CMake
9284
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
9385
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/.vscode/
22
/build/
33
/notes/
4-
*.dll
54
*.glade~

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,17 @@
1313
# You should have received a copy of the GNU General Public License
1414
# along with this program. If not, see <https://www.gnu.org/licenses/>.
1515

16-
cmake_minimum_required(VERSION 3.13)
16+
cmake_minimum_required(VERSION 3.31)
1717

1818
file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOC_PATH)
1919
if(EXISTS "${LOC_PATH}")
2020
message(FATAL_ERROR "You cannot build in a source directory (or any directory with a CMakeLists.txt file). Please make a build subdirectory. Feel free to remove CMakeCache.txt and CMakeFiles.")
2121
endif()
2222

2323
project("Sickle Editor"
24-
VERSION 0.12.1
24+
VERSION 0.12.2
2525
DESCRIPTION "Open-Source GoldSrc Editor"
26-
LANGUAGES CXX
27-
)
26+
LANGUAGES CXX)
2827

2928
if(NOT CMAKE_BUILD_TYPE)
3029
message("CMAKE_BUILD_TYPE is unset, defaulting to Release")
@@ -41,7 +40,13 @@ endif()
4140

4241

4342
# --- Dependencies --- ###########################
44-
add_subdirectory(extern/glutils)
43+
44+
include(FetchContent)
45+
FetchContent_Declare(
46+
glutils
47+
GIT_REPOSITORY https://github.com/Treecase/glutils
48+
GIT_TAG 59ad12bdfbd0f292fe56524ee72ece755b4771c5)
49+
FetchContent_MakeAvailable(glutils)
4550

4651
find_package(BISON 3.2 REQUIRED)
4752
find_package(FLEX 2.6 REQUIRED)
@@ -60,9 +65,9 @@ set(CMAKE_CXX_STANDARD 17)
6065
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6166

6267
# Application ID
63-
set(APPLICATION_ID com.github.treecase.sicklegtk)
68+
set(APPLICATION_ID com.github.Treecase.SickleEditor)
6469
# GResource prefix
65-
set(GRESOURCE_PREFIX /com/github/treecase/sicklegtk/)
70+
set(GRESOURCE_PREFIX /com/github/Treecase/SickleEditor/)
6671
# GSchema path
6772
set(SCHEMA_DIR "${CMAKE_CURRENT_BINARY_DIR}")
6873

@@ -73,7 +78,6 @@ target_link_libraries(sickle PRIVATE ${CMAKE_DL_LIBS})
7378

7479
include(GNUInstallDirs)
7580

76-
7781
add_subdirectory(data)
7882
include_directories(sickle PUBLIC src)
7983
add_subdirectory(src)

README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Sickle Editor
22

3-
An open-source editor for GoldSrc maps. Both `.MAP` and `.RMF` formats are supported. Sickle Editor is released under the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html) license.
4-
5-
63
![Build Status Badge](https://img.shields.io/github/actions/workflow/status/Treecase/SickleEditor/cmake-multi-platform.yml)
74
![License Badge](https://img.shields.io/github/license/Treecase/SickleEditor)
85

6+
An open-source editor for GoldSrc maps. Both `.MAP` and `.RMF` formats are supported. Sickle Editor is released under the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html) license.
7+
98

109
## Getting Started
1110

@@ -35,7 +34,6 @@ And then build the program:
3534
```bash
3635
git clone https://github.com/Treecase/SickleEditor
3736
cd SickleEditor
38-
git submodule update --init --recursive
3937
cmake -B build .
4038
cmake --build build
4139
```
@@ -56,7 +54,6 @@ To build the program:
5654
```bash
5755
git clone https://github.com/Treecase/SickleEditor
5856
cd SickleEditor
59-
git submodule update --init --recursive
6057
cmake -B build .
6158
cmake --build build
6259
```
@@ -67,18 +64,17 @@ cmake --build build
6764
To install the Sickle Editor, use:
6865

6966
```bash
70-
cmake --install .
67+
cmake --install build
7168
```
7269

7370
By default, the program will be installed to `/usr/local` on Linux and `C:/Program Files/Sickle Editor` on Windows. If you want the installation to go somewhere else, use:
7471

7572
```bash
76-
cmake --install . --prefix=<your/desired/location>
73+
cmake --install build --prefix=<Install Prefix>
7774
```
7875

79-
You'll also have to compile the GSettings schema with the following command.
76+
Linux users will also have to compile the GSettings schema with the following command.
8077

8178
```bash
82-
cd <INSTALL_PREFIX>/share/glib-2.0/schemas
83-
glib-compile-schemas .
79+
glib-compile-schemas <Install Prefix>/share/glib-2.0/schemas
8480
```

data/gresource/CMakeLists.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# Generate the GResource XML file.
2-
configure_file(sicklegtk.gresource.xml.in sicklegtk.gresource.xml)
2+
configure_file(SickleEditor.gresource.xml.in SickleEditor.gresource.xml)
3+
4+
find_program(
5+
GLIB_COMPILE_RESOURCES
6+
NAMES glib-compile-resources
7+
DOC "Path to the glib-compile-resources program"
8+
REQUIRED)
39

410
# Build resources.cpp.
511
add_custom_command(
612
OUTPUT resources.cpp
7-
COMMAND glib-compile-resources
8-
sicklegtk.gresource.xml
13+
COMMAND "${GLIB_COMPILE_RESOURCES}"
14+
SickleEditor.gresource.xml
915
--target=resources.cpp
1016
--sourcedir="${CMAKE_CURRENT_SOURCE_DIR}"
1117
--generate-source
@@ -29,13 +35,7 @@ add_custom_command(
2935
LuaConsole.css
3036
MapArea2D.css
3137
)
32-
add_library(resources OBJECT resources.cpp)
33-
target_link_libraries(resources PRIVATE PkgConfig::GTKMM)
34-
35-
target_link_libraries(sickle PRIVATE resources)
38+
add_library(gresources OBJECT resources.cpp)
39+
target_link_libraries(gresources PRIVATE PkgConfig::GTKMM)
3640

37-
install(
38-
FILES logo.svg
39-
DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps"
40-
RENAME "${APPLICATION_ID}.svg"
41-
)
41+
target_link_libraries(sickle PRIVATE gresources)
File renamed without changes.

data/gresource/gtk/AppWin.glade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<object class="AppWin" id="theWindow">
66
<property name="can-focus">False</property>
77
<property name="title" translatable="yes">Sickle Editor</property>
8-
<property name="icon-name">com.github.treecase.sicklegtk</property>
8+
<property name="icon-name">com.github.Treecase.SickleEditor</property>
99
<child>
1010
<!-- n-columns=2 n-rows=2 -->
1111
<object class="GtkGrid">

data/share/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
add_subdirectory(applications)
22
add_subdirectory(glib-2.0/schemas)
33

4-
install(DIRECTORY sickle TYPE DATA)
4+
install(DIRECTORY icons sickle TYPE DATA)
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
configure_file(sicklegtk.desktop.in sicklegtk.desktop)
1+
configure_file(SickleEditor.desktop.in ${APPLICATION_ID}.desktop)
22

33
install(
4-
FILES "${CMAKE_CURRENT_BINARY_DIR}/sicklegtk.desktop"
5-
DESTINATION "${CMAKE_INSTALL_DATADIR}/applications"
6-
RENAME "${APPLICATION_ID}.desktop"
7-
)
4+
FILES "${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_ID}.desktop"
5+
DESTINATION "${CMAKE_INSTALL_DATADIR}/applications")

0 commit comments

Comments
 (0)