Skip to content

Commit 0272c68

Browse files
Rethinking executable dependecies
1 parent 16545e0 commit 0272c68

File tree

5 files changed

+9
-146
lines changed

5 files changed

+9
-146
lines changed

CmakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
22

33
if (NOT WIN32)
4-
message(FATAL_ERROR "This program has been specified to compile on Microsoft Windows OS only.")
4+
message(FATAL_ERROR "This program has been specified to compile on Microsoft Windows only.")
55
endif()
66

77
set(CMAKE_CXX_STANDARD 20)
@@ -23,7 +23,7 @@ file(MAKE_DIRECTORY ${PROJECT_DESTINATION_RESOURCES_FOLDER})
2323
file(MAKE_DIRECTORY ${PROJECT_DESTINATION_BIN_FOLDER})
2424
file(MAKE_DIRECTORY ${PROJECT_DESTINATION_LOGS_FOLDER})
2525

26-
# TODO: temporary
26+
# Do not remove this prefix path
2727
set(CMAKE_PREFIX_PATH "C:/Qt/5.15.2/mingw81_64" "C:/Qt/Tools/mingw_64")
2828

2929
set(CMAKE_BUILD_PARALLEL_LEVEL 10)

src/CmakeLists.txt

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
# Editor target name
2222
set(MAIN_TARGET_NAME "HotkeyEditor")
23-
set(ACTUAL_EXE_NAME "LoadEditor")
23+
set(ACTUAL_EXE_NAME "GenHotkeys")
2424

2525
# Define editor executable
2626
add_executable(${MAIN_TARGET_NAME})
@@ -39,9 +39,6 @@
3939

4040
# Remove all GUI sources from main sources list
4141
list(REMOVE_ITEM SOURCES ${EXCLUDED_GRAPHIC_SOURCES})
42-
43-
# Remove launch target source file from main sources list
44-
list(REMOVE_ITEM SOURCES "MainStarter.cpp")
4542

4643
# Assign source files to the main target
4744
target_sources(
@@ -55,7 +52,7 @@
5552
set_target_properties(
5653
${MAIN_TARGET_NAME}
5754
PROPERTIES
58-
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_DESTINATION_BIN_FOLDER}
55+
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_DESTINATION_FOLDER}
5956
OUTPUT_NAME ${ACTUAL_EXE_NAME}
6057
)
6158

@@ -67,31 +64,6 @@
6764

6865
# Add graphic dependency to the main target
6966
target_link_libraries(${MAIN_TARGET_NAME} PRIVATE GUI)
70-
71-
# Starter target configuration
72-
73-
# Starter target name
74-
set(STARTER_TARGET_NAME "HotkeyEditorStarter")
75-
76-
# Define starter executable with source files
77-
add_executable(
78-
${STARTER_TARGET_NAME}
79-
"MainStarter.cpp"
80-
"GUI/QtSources/StarterDescription.rc"
81-
)
82-
83-
# Define output directory and file name
84-
set_target_properties(
85-
${STARTER_TARGET_NAME}
86-
PROPERTIES
87-
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_DESTINATION_FOLDER}
88-
OUTPUT_NAME ${MAIN_TARGET_NAME}
89-
)
90-
91-
# Create a preprocessor variable with the path to the main program relative to the starter
92-
target_compile_definitions(${STARTER_TARGET_NAME} PRIVATE
93-
-DPROJECT_EXE_RELATIVE_PATH="$<PATH:RELATIVE_PATH,$<TARGET_FILE:${MAIN_TARGET_NAME}>,${PROJECT_DESTINATION_FOLDER}>"
94-
)
9567

9668
# Managing additional source files
9769

@@ -138,7 +110,6 @@
138110
find_program(QTENV_BAT qtenv2.bat)
139111

140112
if(CMAKE_BUILD_TYPE STREQUAL "Release")
141-
142113
# Deploy Qt and other dlls to the Editor/Resource folder
143114
add_custom_command(
144115
TARGET ${MAIN_TARGET_NAME}
@@ -149,8 +120,7 @@
149120
COMMAND ${WINDEPLOYQT_PROGRAM}
150121
--compiler-runtime
151122
--force
152-
--dir $<TARGET_PROPERTY:${MAIN_TARGET_NAME},RUNTIME_OUTPUT_DIRECTORY>
123+
--dir ${PROJECT_DESTINATION_BIN_FOLDER} # Actually redirects qt's libraries to the different folder
153124
$<TARGET_FILE:${MAIN_TARGET_NAME}>
154125
)
155-
156-
endif()
126+
endif()

src/GUI/QtSources/StarterDescription.rc

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

src/Logger.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ using namespace std;
1717
// Disable console if it is really opened.
1818
ShowWindow(GetConsoleWindow(), SW_HIDE);
1919

20-
int i = 0;
21-
2220
vector<filesystem::directory_entry> files;
23-
for (const auto& entry : filesystem::directory_iterator("..\\..\\Logs"))
21+
for (const auto& entry : filesystem::directory_iterator("Logs"))
2422
if (entry.is_regular_file())
2523
files.push_back(entry);
2624

@@ -48,8 +46,8 @@ using namespace std;
4846
// Due to Logger is a singleton, we must create check if folder Logs exists.
4947
if (!LogFile.is_open())
5048
{
51-
filesystem::create_directory("..\\..\\Logs");
52-
LogFile.open(string("..\\..\\") + GetLogFileName());
49+
filesystem::create_directory("Logs");
50+
LogFile.open(string("Logs") + GetLogFileName());
5351
}
5452

5553
if (!LogFile.is_open())

src/MainStarter.cpp

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

0 commit comments

Comments
 (0)