Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,20 @@ link_libraries(
)


# Include core source and precomp header
set(PCH_FILE ${CMAKE_SOURCE_DIR}/src/precomp/pch.h)
file_dependent_read_list("${CMAKE_SOURCE_DIR}/cmake/core-sources.txt" CORE_SOURCES)

# Make src/ a valid include directory
include_directories(
${CMAKE_SOURCE_DIR}/src
)

# Include core source and precomp header
set(PCH_FILE ${CMAKE_SOURCE_DIR}/src/precomp/pch.h)
file_dependent_read_list("${CMAKE_SOURCE_DIR}/cmake/core-sources.txt" CORE_SOURCES)

# Include openshc source files
file_dependent_read_list("${CMAKE_SOURCE_DIR}/cmake/openshc-sources.txt" OPENSHC_SOURCES)

# Add source to this project's executable.
add_executable(OpenSHC.exe WIN32 ${CORE_SOURCES})
add_executable(OpenSHC.exe WIN32 src/entry.cpp ${CORE_SOURCES} ${OPENSHC_SOURCES})
set_target_properties(OpenSHC.exe PROPERTIES OUTPUT_NAME ${OPEN_SHC_NAME})
target_compile_definitions(OpenSHC.exe PRIVATE OPEN_SHC_EXE)
target_precompile_headers(OpenSHC.exe PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${PCH_FILE}>)
Expand All @@ -124,7 +127,7 @@ target_file_copy_if_different(OpenSHC.exe "${CRUSADER_DIR}/shfolder.dll" "$<TARG

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

add_library(OpenSHC.dll SHARED ${CORE_SOURCES})
add_library(OpenSHC.dll SHARED src/entry.cpp ${CORE_SOURCES} ${OPENSHC_SOURCES})
set_target_properties(OpenSHC.dll PROPERTIES OUTPUT_NAME ${OPEN_SHC_NAME})
target_compile_definitions(OpenSHC.dll PRIVATE OPEN_SHC_DLL)
target_precompile_headers(OpenSHC.dll PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${PCH_FILE}>)
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Visual Studio Code with the proper extensions only needs to open the folder and
Additionally, it configures format-on-save and a debug target for the UCP3.

If the scripts are preferred, the following triggers a build using the scripts:

1. Open a terminal.
2. Navigate to this project folder
3. Execute build.bat:
Expand All @@ -80,10 +81,11 @@ If CMake is installed and not in PATH, for example if installed via Visual Studi

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.

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:
```bat
.\cmakew -P create-include-lists.cmake
```
If any `.cpp` or `.c` files are added to the source code, they should be listed in one of the txt files in `cmake/`:

- `cmake/core-sources.txt` containing the core sources to compile the project.
- `cmake/pklib-sources.txt` containing the source files for compiling the pklib dependency.
- `cmake/openshc-sources.txt` containing the files with reimplementations of the original game's functions.

#### Manual configuration

Expand Down
1 change: 0 additions & 1 deletion cmake/core-sources.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
src/core/MainImplementation.cpp
src/core/Resolver.cpp
src/core/ViewportRenderState.cpp
src/core/entry.cpp
53 changes: 0 additions & 53 deletions create-include-lists.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion src/core/entry.cpp → src/entry.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#include "MainResolver.h"
#include "core/MainResolver.h"

#include "lua.h"

Expand Down