Skip to content

Commit 7d7d171

Browse files
committed
Set build type, to get striped binary, to not install database
1 parent cbe809d commit 7d7d171

File tree

4 files changed

+33
-19
lines changed

4 files changed

+33
-19
lines changed

CMakeLists.txt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ set(CMAKE_AUTOMOC ON)
88
set(CMAKE_AUTORCC ON)
99
set(CMAKE_AUTOUIC ON)
1010

11-
set(CMAKE_BUILD_TYPE Debug)
11+
if(NOT RELEASE)
12+
set(CMAKE_BUILD_TYPE Debug)
13+
else()
14+
set(CMAKE_BUILD_TYPE Release)
15+
endif()
1216

1317
find_package(Qt5 COMPONENTS Core Gui Test Widgets WebEngineWidgets Sql REQUIRED)
1418

@@ -150,8 +154,12 @@ if(NOT TEST)
150154
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
151155
)
152156

157+
install(DIRECTORY
158+
${CMAKE_SOURCE_DIR}/database/data
159+
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}
160+
)
161+
153162
install(FILES
154-
${CMAKE_SOURCE_DIR}/database/tombll.db
155163
${CMAKE_SOURCE_DIR}/database/data_factory.py
156164
${CMAKE_SOURCE_DIR}/database/get_leaf_cert.py
157165
${CMAKE_SOURCE_DIR}/database/https.py
@@ -161,6 +169,14 @@ if(NOT TEST)
161169
${CMAKE_SOURCE_DIR}/database/tombll_add_data.py
162170
${CMAKE_SOURCE_DIR}/database/tombll_get_data.py
163171
${CMAKE_SOURCE_DIR}/database/tombll_get_list.py
172+
${CMAKE_SOURCE_DIR}/database/make_tombll_database.py
164173
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}
165174
)
175+
176+
if(NOT NO_DATABASE)
177+
install(FILES
178+
${CMAKE_SOURCE_DIR}/database/tombll.db
179+
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}
180+
)
181+
endif()
166182
endif()

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ sudo pacman -S qt5-wayland qt5-webengine qt5-imageformats boost
3232
```shell
3333
mkdir build
3434
cd build
35-
cmake -DCMAKE_INSTALL_PREFIX=/home/$USER/.local ..
35+
cmake -DCMAKE_INSTALL_PREFIX=/home/$USER/.local -DRELEASE=on ..
36+
# or cmake -DCMAKE_INSTALL_PREFIX=/home/$USER/.local -DNO_DATABASE=ON -DRELEASE=on ..
3637
make install -j$(nproc)
3738
```
3839

database/make_tombll_database.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class INT,
230230

231231
# Add Game File data
232232
for i in range(1, 6):
233-
file = f'fileList-TR{i}.json'
233+
file = f'data/fileList-TR{i}.json'
234234

235235
# Load data from JSON file
236236
with open(file, 'r', encoding='utf-8') as json_file:
@@ -249,36 +249,36 @@ class INT,
249249

250250
if relative_path and file_md5:
251251
# Check if the file with the same md5sum already exists in File table
252-
C.execute("SELECT FileID FROM File WHERE md5sum = ? AND path = ?", \
253-
(file_md5, relative_path))
252+
C.execute("SELECT FileID FROM File WHERE md5sum = ? AND path = ?",
253+
(file_md5, relative_path))
254254
existing_file = C.fetchone()
255255

256256
if existing_file:
257257
# File already exists, use the existing FileID
258258
file_id = existing_file[0]
259-
print("File with md5sum %s and path %s already exists. Using existing FileID: %s", \
260-
file_md5, relative_path, file_id)
259+
print("File with md5sum %s and path %s already exists. Using existing FileID: %s",
260+
file_md5, relative_path, file_id)
261261
else:
262262
# File doesn't exist, insert it into File table
263-
C.execute("INSERT INTO File (md5sum, path) VALUES (?, ?)", \
264-
(file_md5, relative_path))
263+
C.execute("INSERT INTO File (md5sum, path) VALUES (?, ?)",
264+
(file_md5, relative_path))
265265
file_id = C.lastrowid
266266
print(f"Inserted new file with md5sum {file_md5}. New FileID: {file_id}")
267267

268268
try:
269269
# Check if the combination of fileID and gameID already exists in GameFileList
270-
C.execute("SELECT 1 FROM GameFileList WHERE fileID = ? AND gameID = ?", \
271-
(file_id, game_id))
270+
C.execute("SELECT 1 FROM GameFileList WHERE fileID = ? AND gameID = ?",
271+
(file_id, game_id))
272272
existing_combination = C.fetchone()
273273

274274
if not existing_combination:
275275
# Combination doesn't exist, insert it into GameFileList
276-
C.execute("INSERT INTO GameFileList (fileID, gameID) VALUES (?, ?)", \
277-
(file_id, game_id))
276+
C.execute("INSERT INTO GameFileList (fileID, gameID) VALUES (?, ?)",
277+
(file_id, game_id))
278278
else:
279279
# Combination already exists, print a message or handle it as needed
280-
print(f"Combination of FileID {file_id} and LevelID {game_id} " \
281-
"already exists in GameFileList. Skipping insertion.")
280+
print(f"Combination of FileID {file_id} and LevelID {game_id} "
281+
"already exists in GameFileList. Skipping insertion.")
282282

283283
except sqlite3.IntegrityError as file_list_error:
284284
# Print more details about the uniqueness violation

src/Model.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313

1414
#include "Model.hpp"
1515

16-
// Those lambda should be in another header file
17-
// I hate this and it should be able to recognize both the directory
18-
// when linking and the game exe to make a symbolic link to automatically
1916
Model::Model() {}
2017
Model::~Model() {}
2118

0 commit comments

Comments
 (0)