-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some build system tweaks #1879
base: master
Are you sure you want to change the base?
Some build system tweaks #1879
Changes from 3 commits
ef8d687
d119241
48e6294
1ff0a50
633e402
b977526
d8a50c0
b8ac142
54484d9
d40d076
c930e56
39917ef
a631c20
6efcc49
bd5e553
b7686a9
d965ca1
5370653
ce26da5
6ddd5f5
3f50daa
2129194
c5a68e0
a735994
0138422
08d81e8
a46b67f
de27dc4
33db0da
4423f55
a367291
ed96c9b
623e992
981c958
b7cf111
b5c9c74
a975625
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -387,7 +387,7 @@ function(configureProject) | |
# Support Xcode's multi configuration paradigm by placing built artifacts into separate directories | ||
set(IMHEX_MAIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Configs/$<CONFIG>" PARENT_SCOPE) | ||
else() | ||
set(IMHEX_MAIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" PARENT_SCOPE) | ||
set(IMHEX_MAIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" PARENT_SCOPE) | ||
endif() | ||
endfunction() | ||
|
||
|
@@ -499,16 +499,16 @@ function(downloadImHexPatternsFiles dest) | |
|
||
# Maybe patterns are cloned to a subdirectory | ||
if (NOT EXISTS ${imhex_patterns_SOURCE_DIR}) | ||
set(imhex_patterns_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ImHex-Patterns") | ||
set(imhex_patterns_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ImHex-Patterns") | ||
endif() | ||
|
||
# Or a sibling directory | ||
if (NOT EXISTS ${imhex_patterns_SOURCE_DIR}) | ||
set(imhex_patterns_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../ImHex-Patterns") | ||
set(imhex_patterns_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../ImHex-Patterns") | ||
endif() | ||
endif () | ||
|
||
if (NOT EXISTS ${imhex_patterns_SOURCE_DIR}) | ||
if (NOT EXISTS ${imhex_patterns_SOURCE_DIR}) | ||
message(WARNING "Failed to locate ImHex-Patterns repository, some resources will be missing during install!") | ||
elseif(XCODE) | ||
# The Xcode build has multiple configurations, which each need a copy of these files | ||
|
@@ -526,8 +526,18 @@ function(downloadImHexPatternsFiles dest) | |
file(GENERATE OUTPUT "${dest}/${relativePath}" INPUT "${imhex_patterns_SOURCE_DIR}/${relativePath}") | ||
endforeach() | ||
else() | ||
# Make sure the IMHEX_MAIN_OUTPUT_DIRECTORY exists, as CREATE_LINK doesn't create missing intermediate directories | ||
file(MAKE_DIRECTORY "${IMHEX_MAIN_OUTPUT_DIRECTORY}") | ||
set(PATTERNS_FOLDERS_TO_INSTALL constants encodings includes patterns magic nodes) | ||
foreach (FOLDER ${PATTERNS_FOLDERS_TO_INSTALL}) | ||
# Make the pattern files available to ImHex binaries started from the build directory | ||
if (NOT IMHEX_OFFLINE_BUILD) | ||
file(COPY "${imhex_patterns_SOURCE_DIR}/${FOLDER}" DESTINATION "${IMHEX_MAIN_OUTPUT_DIRECTORY}" PATTERN "**/_schema.json" EXCLUDE) | ||
else() | ||
# If it is an offline build, the imhex_patterns_SOURCE_DIR location is likely a git clone | ||
# Create the directories as symbolic links, so that any changes get mirrored both ways | ||
file(CREATE_LINK "${imhex_patterns_SOURCE_DIR}/${FOLDER}" "${IMHEX_MAIN_OUTPUT_DIRECTORY}/${FOLDER}" SYMBOLIC) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is a symbolic link a good idea? Not all file systems support it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I have been making modifications in the PatternLibrary too, I found it useful to edit in-place next to the binary. I mostly was intending to avoid changes there getting lost. I notice that there is a |
||
endif() | ||
install(DIRECTORY "${imhex_patterns_SOURCE_DIR}/${FOLDER}" DESTINATION "${dest}" PATTERN "**/_schema.json" EXCLUDE) | ||
endforeach () | ||
endif () | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably only be done on Linux as Windows and macOS use a different structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that Windows was set up to use MinGW (effectively GCC), which would also work with these changes. In terms of file layout (e.g. executable next to shared objects next to pattern files), I anticipated that they should be compatible though I didn't test the windows build yet.
I also didn't touch the XCODE output path, which I assumed was the macOS build method. I don't have a mac to test with, but it looked like it would correctly separate out the differently configured builds.