-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compile makefsdata utility from pico SDK
- Loading branch information
Showing
4 changed files
with
80 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Finds (or builds) the makefsdata executable | ||
# | ||
# This will define the following variables | ||
# | ||
# MAKEFSDATA_FOUND | ||
# | ||
# and the following imported targets | ||
# | ||
# MAKEFSDATA | ||
# | ||
|
||
if (NOT MAKEFSDATA_FOUND) | ||
|
||
include(ExternalProject) | ||
find_program(MAKE_EXECUTABLE NAMES gmake make mingw32-make REQUIRED) | ||
# We need to use the main CMakeLists.txt from lwip, but we'll build only makefsdata | ||
set(MAKEFSDATA_SOURCE_DIR ${PICO_SDK_PATH}/lib/lwip) | ||
set(MAKEFSDATA_BINARY_DIR ${CMAKE_BINARY_DIR}/makefsdata) | ||
|
||
set(MAKEFSDATA_BUILD_TARGET MAKEFSDATABuild) | ||
set(MAKEFSDATA_TARGET makefsdata) | ||
|
||
# horrible, horrible thing because makefsdata.c has a #ifdef __linux__ clause not caring about macs | ||
if (APPLE) | ||
message(WARNING "Setting up the linux define for apple, this might break things") | ||
set(EXTRA_ARGS "-DCMAKE_C_FLAGS:STRING=\"-D__linux__\"") | ||
endif() | ||
|
||
if (NOT TARGET ${MAKEFSDATA_BUILD_TARGET}) | ||
ExternalProject_Add(${MAKEFSDATA_BUILD_TARGET} | ||
PREFIX makefsdata SOURCE_DIR ${MAKEFSDATA_SOURCE_DIR} | ||
BINARY_DIR ${MAKEFSDATA_BINARY_DIR} | ||
BUILD_ALWAYS 1 # force dependency checking | ||
CMAKE_ARGS ${EXTRA_ARGS} | ||
BUILD_COMMAND ${CMAKE_COMMAND} --build ${MAKEFSDATA_BINARY_DIR} -t makefsdata | ||
INSTALL_COMMAND "" | ||
) | ||
endif() | ||
|
||
# depending on the platform the executable will be in different path | ||
if(WIN32) | ||
set(MAKEFSDATA_EXECUTABLE ${MAKEFSDATA_BINARY_DIR}/contrib/ports/win32/example_app/makefsdata) | ||
get_target_property(TARGET_LIBRARIES ${MAKEFSDATA_BUILD_TARGET}::makefsdata LINK_LIBRARIES) | ||
message("Libraries at start") | ||
message(${TARGET_LIBRARIES}) | ||
LIST(REMOVE_ITEM TARGET_LIBRARIES lwipcontribportwindows ) | ||
message("Modified libraries list") | ||
message(${TARGET_LIBRARIES}) | ||
set_property(TARGET ${MAKEFSDATA_BUILD_TARGET}::makefsdata PROPERTY LINK_LIBRARIES ${TARGET_LIBRARIES} ) | ||
get_target_property(TARGET_LIBRARIES2 ${MAKEFSDATA_BUILD_TARGET}::makefsdata LINK_LIBRARIES) | ||
message("Libraries after change") | ||
message(${TARGET_LIBRARIES2}) | ||
else() | ||
set(MAKEFSDATA_EXECUTABLE ${MAKEFSDATA_BINARY_DIR}/contrib/ports/unix/example_app/makefsdata) | ||
endif() | ||
|
||
if(NOT TARGET ${MAKEFSDATA_TARGET}) | ||
add_executable(${MAKEFSDATA_TARGET} IMPORTED) | ||
endif() | ||
set_property(TARGET ${MAKEFSDATA_TARGET} PROPERTY IMPORTED_LOCATION | ||
${MAKEFSDATA_EXECUTABLE}) | ||
|
||
add_dependencies(${MAKEFSDATA_TARGET} ${MAKEFSDATA_BUILD_TARGET}) | ||
set(MAKEFSDATA_FOUND 1) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters