Skip to content

Commit 6948524

Browse files
author
Gin
committed
cmake can find Resources folder on internal repo as well
1 parent 763c2e0 commit 6948524

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

SerialPrograms/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,12 +2273,21 @@ if (APPLE)
22732273
)
22742274

22752275
# make sure Packages repo, https://github.com/PokemonAutomation/Packages is placed in the same folder as this Arduino-Source repo
2276-
# so the post-build command can copy the resources folder Packages/SerialPrograms/Resources/ into the built app bundle
2276+
# so the post-build command can copy the resources folder Packages/SerialPrograms/Resources/ into the built app bundle:
2277+
string(FIND "${CMAKE_CURRENT_SOURCE_DIR}" "Arduino-Source-Internal" internal_repro_position) # determine if this is an internal repo
2278+
if (internal_repro_position EQUAL -1) # no "Arduino-Source-Internal" substr in the current source dir
2279+
# we are building the public repo
2280+
set(RESOURCES_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../Packages/SerialPrograms/Resources")
2281+
else()
2282+
# we are building the internal repo
2283+
set(RESOURCES_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../../Packages/SerialPrograms/Resources")
2284+
endif()
2285+
message(STATUS "Set Resources folder path from Packages repo: ${RESOURCES_PATH}")
22772286
add_custom_command(
22782287
TARGET SerialPrograms
22792288
POST_BUILD
22802289
COMMAND ${CMAKE_COMMAND} -E copy_directory
2281-
"${CMAKE_CURRENT_SOURCE_DIR}/../../Packages/SerialPrograms/Resources"
2290+
"${RESOURCES_PATH}"
22822291
"$<TARGET_FILE_DIR:SerialPrograms>/../Resources"
22832292
)
22842293
else() # WIN and Linux:

0 commit comments

Comments
 (0)