Skip to content

Commit bb953cd

Browse files
authored
Merge pull request #38 from sourcehold/workflow/function-adding-one-by-one
[PROJECT] resolve #37: add reimplementation function by function (manually instead of through scripts)
2 parents 479a7f8 + 1292a21 commit bb953cd

5 files changed

Lines changed: 16 additions & 65 deletions

File tree

CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,20 @@ link_libraries(
9393
)
9494

9595

96-
# Include core source and precomp header
97-
set(PCH_FILE ${CMAKE_SOURCE_DIR}/src/precomp/pch.h)
98-
file_dependent_read_list("${CMAKE_SOURCE_DIR}/cmake/core-sources.txt" CORE_SOURCES)
99-
10096
# Make src/ a valid include directory
10197
include_directories(
10298
${CMAKE_SOURCE_DIR}/src
10399
)
104100

101+
# Include core source and precomp header
102+
set(PCH_FILE ${CMAKE_SOURCE_DIR}/src/precomp/pch.h)
103+
file_dependent_read_list("${CMAKE_SOURCE_DIR}/cmake/core-sources.txt" CORE_SOURCES)
104+
105+
# Include openshc source files
106+
file_dependent_read_list("${CMAKE_SOURCE_DIR}/cmake/openshc-sources.txt" OPENSHC_SOURCES)
107+
105108
# Add source to this project's executable.
106-
add_executable(OpenSHC.exe WIN32 ${CORE_SOURCES})
109+
add_executable(OpenSHC.exe WIN32 src/entry.cpp ${CORE_SOURCES} ${OPENSHC_SOURCES})
107110
set_target_properties(OpenSHC.exe PROPERTIES OUTPUT_NAME ${OPEN_SHC_NAME})
108111
target_compile_definitions(OpenSHC.exe PRIVATE OPEN_SHC_EXE)
109112
target_precompile_headers(OpenSHC.exe PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${PCH_FILE}>)
@@ -124,7 +127,7 @@ target_file_copy_if_different(OpenSHC.exe "${CRUSADER_DIR}/shfolder.dll" "$<TARG
124127

125128
set(OPEN_SHC_DLL_DEST "${CRUSADER_DIR}/ucp/modules/${OPEN_SHC_NAME}-${OPEN_SHC_VERSION}" CACHE PATH "Path for OpenSHC.dll and OpenSHC.pdb")
126129

127-
add_library(OpenSHC.dll SHARED ${CORE_SOURCES})
130+
add_library(OpenSHC.dll SHARED src/entry.cpp ${CORE_SOURCES} ${OPENSHC_SOURCES})
128131
set_target_properties(OpenSHC.dll PROPERTIES OUTPUT_NAME ${OPEN_SHC_NAME})
129132
target_compile_definitions(OpenSHC.dll PRIVATE OPEN_SHC_DLL)
130133
target_precompile_headers(OpenSHC.dll PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${PCH_FILE}>)

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Visual Studio Code with the proper extensions only needs to open the folder and
6565
Additionally, it configures format-on-save and a debug target for the UCP3.
6666

6767
If the scripts are preferred, the following triggers a build using the scripts:
68+
6869
1. Open a terminal.
6970
2. Navigate to this project folder
7071
3. Execute build.bat:
@@ -80,10 +81,11 @@ If CMake is installed and not in PATH, for example if installed via Visual Studi
8081

8182
Note that any code needs to be formatted properly using the provided `clang-format`. The way to do so it up to the developer. Many IDEs support it out of the box.
8283

83-
Should any files be added to the source code in `src/core` or the ucp files in `ucp`, the cmake script [create-include-lists.cmake](create-include-lists.cmake) needs to be rerun and the changed list files need to be committed:
84-
```bat
85-
.\cmakew -P create-include-lists.cmake
86-
```
84+
If any `.cpp` or `.c` files are added to the source code, they should be listed in one of the txt files in `cmake/`:
85+
86+
- `cmake/core-sources.txt` containing the core sources to compile the project.
87+
- `cmake/pklib-sources.txt` containing the source files for compiling the pklib dependency.
88+
- `cmake/openshc-sources.txt` containing the files with reimplementations of the original game's functions.
8789

8890
#### Manual configuration
8991

cmake/core-sources.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
src/core/MainImplementation.cpp
22
src/core/Resolver.cpp
33
src/core/ViewportRenderState.cpp
4-
src/core/entry.cpp

create-include-lists.cmake

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
#include "MainResolver.h"
2+
#include "core/MainResolver.h"
33

44
#include "lua.h"
55

0 commit comments

Comments
 (0)