Skip to content

Commit 8a20cdc

Browse files
authored
Update meta documentation and build scripts (#398)
This pull request aims to reformat the changelog, relocate both `CONTRIBUTING.md` and `CHANGELOG.md` to the solution root folder, and separate out the custom build commands into its own batch script. This is to help the CMake build pipeline. This pull request also updates the version release checklist to include Dn-help updating. This pull request has a corresponding pull request in Dn-Programming-Core-Management/Dn-help#15, please merge that first. --- Changes: - Reformat change log to not use bulleted headers (@Gumball2415 #398) - Move `CONTRIBUTING.md` and `CHANGELOG` to root folder (@Gumball2415 #398) - Refactor custom build commands in `.vcxproj`s (@Gumball2415 #398) - Update CMake build scripts (@Gumball2415 #398) - Update CMake source list in `exe.cmake` (@Gumball2415 #398)
2 parents 739e284 + 7b35c02 commit 8a20cdc

37 files changed

+846
-875
lines changed

docs/CHANGELOG.md renamed to CHANGELOG.md

Lines changed: 403 additions & 374 deletions
Large diffs are not rendered by default.

CMakeLists.txt

Lines changed: 80 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@ set(LIBSAMPLERATE_ENABLE_SINC_BEST_CONVERTER FALSE CACHE BOOL "[libsamplerate] E
2020
# does not set mt vs md
2121

2222
# Configure MFC
23-
if (CMAKE_BUILD_TYPE MATCHES DEBUG)
24-
# Debug build requires dynamic MFC.
25-
set(STATIC_MSVCRT 0)
26-
else ()
27-
# Otherwise link MFC statically.
28-
set(STATIC_MSVCRT 1)
29-
endif ()
23+
# Debug build requires dynamic MFC.
24+
# Otherwise link MFC statically.
25+
set(STATIC_MSVCRT $<NOT:$<CONFIG:Debug>>)
26+
3027
include(cmake/mfc.cmake)
3128

3229
# Acts like add_subdirectory(), but replaces Debug flags with RelWithDebugInfo flags.
@@ -45,20 +42,75 @@ add_subdirectory_optimized("Source/libsamplerate" EXCLUDE_FROM_ALL)
4542
# compiling
4643
include(cmake/exe.cmake)
4744

48-
# builds the .chm file
49-
add_custom_command(TARGET ${exe}
50-
PRE_BUILD
51-
COMMAND cmd /c ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compile-chm.bat
52-
COMMAND move Dn-Famitracker.chm ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>
53-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
54-
COMMENT "Generating help file...")
45+
find_package(Python 3.10)
46+
47+
# update version in Dn-FamiTracker.rc
48+
add_custom_command(
49+
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/Dn-FamiTracker.rc
50+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version.h
51+
COMMAND ${Python_EXECUTABLE} resource_version_update.py
52+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
53+
COMMENT "Updating version info in resource file."
54+
VERBATIM)
55+
56+
# generate HTMLDefines.h
57+
set(DNHELP_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Dn-help/hlp")
58+
add_custom_command(
59+
OUTPUT ${DNHELP_SRC_DIR}/HTMLDefines.h
60+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/resource.h
61+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
62+
COMMAND call ${CMAKE_CURRENT_SOURCE_DIR}/generate-helpmap.bat
63+
COMMENT "Generating map file for help compiler."
64+
VERBATIM)
65+
66+
# build the .chm file
67+
add_custom_command(
68+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${project}.chm
69+
DEPENDS ${DNHELP_SRC_DIR}/HTMLDefines.h
70+
WORKING_DIRECTORY ${DNHELP_SRC_DIR}
71+
COMMAND call ${DNHELP_SRC_DIR}/compile-chm.bat ${CMAKE_CURRENT_BINARY_DIR}
72+
COMMENT "Making help file."
73+
VERBATIM)
74+
75+
# update changelog
76+
add_custom_command(
77+
OUTPUT ${DNHELP_SRC_DIR}/changelog.htm
78+
DEPENDS ${DNHELP_SRC_DIR}/changelog-shell.htm
79+
CHANGELOG.md
80+
WORKING_DIRECTORY ${DNHELP_SRC_DIR}
81+
COMMAND call ${DNHELP_SRC_DIR}/update-changelog-htm.bat
82+
COMMENT "Updating changelog.htm."
83+
VERBATIM)
5584

5685
# builds the NSF driver
57-
add_custom_command(TARGET ${exe}
58-
PRE_BUILD
59-
COMMAND cmd /c ${CMAKE_CURRENT_SOURCE_DIR}/Source/drivers/build.cmd
60-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
61-
COMMENT "Compiling NSF driver...")
86+
set(DNNSF_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Source/drivers")
87+
add_custom_command(
88+
OUTPUT ${DNNSF_SRC_DIR}/drv_2a03.h
89+
${DNNSF_SRC_DIR}/drv_all.h
90+
${DNNSF_SRC_DIR}/drv_fds.h
91+
${DNNSF_SRC_DIR}/drv_mmc5.h
92+
${DNNSF_SRC_DIR}/drv_n163.h
93+
${DNNSF_SRC_DIR}/drv_s5b.h
94+
${DNNSF_SRC_DIR}/drv_vrc6.h
95+
${DNNSF_SRC_DIR}/drv_vrc7.h
96+
DEPENDS ${DNNSF_SRC_DIR}/asm/longbranch.mac
97+
${DNNSF_SRC_DIR}/asm/init.s
98+
${DNNSF_SRC_DIR}/asm/player.s
99+
${DNNSF_SRC_DIR}/asm/effects.s
100+
${DNNSF_SRC_DIR}/asm/instrument.s
101+
${DNNSF_SRC_DIR}/asm/apu.s
102+
${DNNSF_SRC_DIR}/asm/vrc6.s
103+
${DNNSF_SRC_DIR}/asm/vrc7.s
104+
${DNNSF_SRC_DIR}/asm/mmc5.s
105+
${DNNSF_SRC_DIR}/asm/fds.s
106+
${DNNSF_SRC_DIR}/asm/n163.s
107+
${DNNSF_SRC_DIR}/asm/s5b.s
108+
${DNNSF_SRC_DIR}/asm/periods.s
109+
${DNNSF_SRC_DIR}/asm/vibrato.s
110+
COMMAND call ${DNNSF_SRC_DIR}/build.cmd
111+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
112+
COMMENT "Building NSF driver headers."
113+
VERBATIM)
62114

63115
target_compile_features(${exe} PRIVATE cxx_std_17)
64116

@@ -71,27 +123,14 @@ endif()
71123

72124
# linking
73125
# Specify static MFC libraries nafxcw and Libcmt to avoid linker order issues
74-
if (STATIC_MSVCRT)
75-
if (CMAKE_BUILD_TYPE MATCHES DEBUG)
76-
TARGET_LINK_LIBRARIES(${exe}
77-
Dbghelp winmm comctl32 Avrt Version htmlhelp
78-
samplerate nafxcwd Libcmtd)
79-
else ()
80-
TARGET_LINK_LIBRARIES(${exe}
81-
Dbghelp winmm comctl32 Avrt Version htmlhelp
82-
samplerate nafxcw Libcmt)
83-
endif ()
84-
else ()
85-
if (CMAKE_BUILD_TYPE MATCHES DEBUG)
86-
TARGET_LINK_LIBRARIES(${exe}
87-
Dbghelp winmm comctl32 Avrt Version htmlhelp
88-
samplerate MSVCRTD)
89-
else ()
90-
TARGET_LINK_LIBRARIES(${exe}
91-
Dbghelp winmm comctl32 Avrt Version htmlhelp
92-
samplerate MSVCRT)
93-
endif ()
94-
endif ()
126+
set(static_msvcrt_libs "nafxcw$<$<CONFIG:Debug>:d>;libcmt$<$<CONFIG:Debug>:d>")
127+
set(dynamic_msvcrt_libs "msvcrt$<$<CONFIG:Debug>:d>")
128+
129+
target_link_libraries(${exe}
130+
$<IF:$<BOOL:STATIC_MSVCRT>,${static_msvcrt_libs},${dynamic_msvcrt_libs}>)
131+
132+
target_link_libraries(${exe}
133+
Dbghelp winmm comctl32 Avrt Version htmlhelp samplerate)
95134

96135
# Dn-FamiTracker.rc includes res/Dn-FamiTracker.manifest.
97136
# To prevent manifest linking errors:
@@ -104,7 +143,7 @@ set_property(
104143
)
105144

106145
# Generating .pdb files
107-
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND CMAKE_BUILD_TYPE MATCHES "Release")
146+
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND $<CONFIG:Release>)
108147
target_compile_options(${exe} PRIVATE /Zi)
109148

110149
# Tell linker to include symbol data
Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,7 @@
22

33
Welcome! Thank you for considering to contribute to Dn-FamiTracker. We really need all the help we can get, since there aren't many people who help maintain FamiTracker and its forks. The following serves as a guide to those who want to get started with contributing.
44

5-
## Code Guidelines and Formatting
6-
7-
- The code mostly follows Unix style (LF) line endings and TAB indentation format.
8-
- Remove trailing whitespace whenever you edit nearby lines.
9-
- There is not much documentation regarding the FamiTracker source code, so you might need to do some code reading first before you implement or modify a component.
10-
- Document Dn-FamiTracker code behavior as much as possible whenever you are learning about them, this may be useful to other contributors.
11-
- FamiTracker (and most of its forks) is an MFC application with project files made in Visual Studio. Dn-FamiTracker supports being built by Visual Studio and CMake, so if you have implemented a change, be sure to update the CMake files as required.
12-
- If implementing a new feature that affects tracker behavior (such as effects, UI), please update documentation in Dn-help and other areas of the tracker.
13-
- If implementing a new feature that affects file formats (such as envelopes, new data format storage), ***please increment the respective file block version***.
14-
- if this necessitates a new file block, please increment the module file version.
15-
16-
## Git guidelines
17-
18-
- Write pull requests that passes CI builds and tests.
19-
- Make sure to adhere to the [pull request template](Dn-FamiTracker/docs/pull_request_template.md) message guidelines.
20-
- Base your pull request on the `main` branch.
21-
- If a merge conflict happens due to not being updated in a long time, resolve merge conflicts and rebase your pull request to the latest compatible version of the `main` branch.
22-
- Be sure to update [Dn-help](https://github.com/Dn-Programming-Core-Management/Dn-help) on your pull request as needed.
23-
- Create a corresponding pull request on Dn-help that links to your main pull request.
24-
- Then once the PR in Dn-help is merged, update the submodule to point to the main branch
25-
26-
### For Dn-FT maintainers:
27-
28-
- ***Do not push directly to the `main` branch***. Instead, push your changes to a branch first before writing a pull request.
29-
- These branches are designated to be reoccurring may be used for the following:
30-
- `app-emu-module-nsf_driver-dev`
31-
- This branch is for modifying the application itself, such as the NSF driver, the module format, loading and saving code, emulator core, audio drivers, etc.
32-
- `docs-license-ver-meta-dev`
33-
- This branch is for meta related development, such as documentation, updating icons and logos, updating version info and license year text, etc.
34-
- `ci-dev`
35-
- This branch is for continuous integration development, such as GitHub Actions and AppVeyor.
36-
- You will most likely force push this branch to hell and back, so be sure to do it on your own fork repo.
37-
- Other branches may be made for more niche/specific modifications and fixes.
38-
- If your pull request touches two or more of these categories, it's fine but please keep it minimal.
39-
- Otherwise, create a new branch.
5+
---
406

417
## Dependencies and Building
428

@@ -52,7 +18,7 @@ To edit and/or build the source, you may use Visual Studio 2022, or alternativel
5218
- For miscellaneous custom build scripts:
5319
- [Python 3.10+](https://www.python.org/)
5420
- For any IDE that supports building via CMake:
55-
- CMake
21+
- CMake version 3.16+
5622
- The latest MSVC build tools
5723
- may be installed by VS Installer or by other sources
5824
- Windows 11 SDK (10.0.26100.0)
@@ -63,17 +29,61 @@ To edit and/or build the source, you may use Visual Studio 2022, or alternativel
6329
- For Visual Studio 2022:
6430
- Windows Universal CRT SDK
6531
- The **Desktop development with C++** workload, including:
66-
- MSVC v142 - VS 2019 C++ x64/x86 build tools (latest version)
32+
- MSVC v143 - VS 2022 C++ x64/x86 build tools (latest version)
6733
- C++ CMake tools for Windows
6834
- C++ AddressSanitizer
6935
- C++ ATL for latest v143 build tools (x86 & x64)
7036
- C++ MFC for latest v143 build tools (x86 & x64)
71-
- Windows 10 SDK version 2104 (10.0.20348.0)
37+
- Windows 11 SDK (10.0.26100.0)
7238
- Alternatively, you can install the components mentioned via the [provided .vsconfig file](../Dn-FT_VS_Dependencies.vsconfig).
7339

40+
---
41+
42+
## Code Guidelines and Formatting
43+
44+
- The code mostly follows Unix style (LF) line endings and TAB indentation format.
45+
- Remove trailing whitespace whenever you edit nearby lines.
46+
- Document Dn-FamiTracker code behavior as much as possible whenever you are learning about them, this may be useful to other contributors.
47+
- There is not much documentation regarding the FamiTracker source code, so you might need to do some code reading first before you implement or modify a component.
48+
- FamiTracker (and most of its forks) is an MFC application with project files made in Visual Studio. Dn-FamiTracker supports being built by Visual Studio and CMake, so if you have implemented a change, be sure to ***update the CMake files as required***.
49+
- If implementing a new feature that affects tracker behavior (such as effects, UI), please ***update documentation*** in Dn-help and other areas of the tracker.
50+
- If implementing a new feature that affects file formats (such as envelopes, new data format storage), ***please increment the respective file block version***.
51+
- if this necessitates a new file block, please increment the module file version.
52+
53+
---
54+
55+
## Git guidelines
56+
57+
- Write pull requests that passes CI builds and tests.
58+
- Make sure to adhere to the [pull request template](Dn-FamiTracker/docs/pull_request_template.md) message guidelines.
59+
- Base your pull request on the `main` branch.
60+
- If a merge conflict happens due to not being updated in a long time, resolve merge conflicts and rebase your pull request to the latest compatible version of the `main` branch.
61+
- Be sure to update [Dn-help](https://github.com/Dn-Programming-Core-Management/Dn-help) on your pull request as needed.
62+
- Create a corresponding pull request on Dn-help that links to your main pull request.
63+
- Then once the PR in Dn-help is merged, update the submodule to point to the main branch
64+
65+
---
66+
7467
## Important Things to Note
7568

7669
- When committing changes, ***file extension case must be the same as the original file!***
7770
- This might result in merge conflicts, because Git is case sensitive, but in Windows systems, the file system is case insensitive by default.
7871
- Additionally, case sensitivity in Windows can be enabled through WSL, but it **must only be enabled to resolve merge conflicts regarding file extension case sensitivity**.
7972
- If case sensitivity is left enabled, Visual Studio throws a lot of errors due to the way IntelliSense capitalizes paths internally.
73+
74+
---
75+
76+
## For D.P.C.M. maintainers
77+
78+
- ***Do not push directly to the `main` branch***. Instead, push your changes to a branch first before writing a pull request.
79+
- These branches are designated to be reoccurring may be used for the following:
80+
- `app-emu-module-nsf_driver-dev`
81+
- This branch is for modifying the application itself, such as the NSF driver, the module format, loading and saving code, emulator core, audio drivers, etc.
82+
- `docs-license-ver-meta-dev`
83+
- This branch is for meta related development, such as documentation, updating icons and logos, updating version info and license year text, etc.
84+
- `ci-dev`
85+
- This branch is for continuous integration development, such as GitHub Actions and AppVeyor.
86+
- You will most likely force push this branch to hell and back, so be sure to do it on your own fork repo.
87+
- Other branches may be made for more niche/specific modifications and fixes.
88+
- If your pull request touches two or more of these categories, it's fine but please keep it minimal.
89+
- Otherwise, create a new branch.

Dn-FT_VS_Dependencies.vsconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"Microsoft.VisualStudio.Component.VC.ATL.Spectre",
2222
"Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre",
2323
"Microsoft.VisualStudio.Component.VC.ASAN",
24-
"Microsoft.VisualStudio.Component.Windows10SDK.20348",
24+
"Microsoft.VisualStudio.Component.Windows11SDK.26100",
2525
"Microsoft.Component.VC.Runtime.UCRTSDK",
2626
"Microsoft.VisualStudio.Workload.NativeDesktop",
2727
"Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre"

0 commit comments

Comments
 (0)