2021-04-03 11:31:41 +02:00
|
|
|
# Build system for the fxSDK
|
|
|
|
|
2021-05-10 15:25:47 +02:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
2023-04-01 23:21:34 +02:00
|
|
|
project(fxSDK VERSION 2.10.0 LANGUAGES C)
|
2021-04-03 11:31:41 +02:00
|
|
|
|
2021-04-03 11:58:30 +02:00
|
|
|
option(FXLINK_DISABLE_UDISKS2 "Do not build the UDisks2-based features of fxlink")
|
2021-08-11 01:44:40 +02:00
|
|
|
option(FXLINK_DISABLE_SDL2 "Do not build the SDL2-based features of fxlink")
|
2021-04-03 11:58:30 +02:00
|
|
|
|
2021-04-03 11:31:41 +02:00
|
|
|
find_package(PkgConfig REQUIRED)
|
2021-04-11 20:27:25 +02:00
|
|
|
pkg_check_modules(libpng REQUIRED libpng16 IMPORTED_TARGET)
|
2021-04-03 11:31:41 +02:00
|
|
|
pkg_check_modules(libusb REQUIRED libusb-1.0 IMPORTED_TARGET)
|
2021-04-03 11:58:30 +02:00
|
|
|
if(NOT FXLINK_DISABLE_UDISKS2)
|
|
|
|
pkg_check_modules(udisks2 REQUIRED udisks2 IMPORTED_TARGET)
|
|
|
|
endif()
|
2021-08-11 01:44:40 +02:00
|
|
|
if(NOT FXLINK_DISABLE_SDL2)
|
|
|
|
pkg_check_modules(sdl2 REQUIRED sdl2 IMPORTED_TARGET)
|
|
|
|
endif()
|
2023-03-03 00:29:00 +01:00
|
|
|
pkg_check_modules(ncurses REQUIRED ncurses IMPORTED_TARGET)
|
2021-04-03 11:31:41 +02:00
|
|
|
|
|
|
|
set(CMAKE_INSTALL_MESSAGE LAZY)
|
|
|
|
set(SRC "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
set(BIN "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
|
|
|
|
add_compile_options(-Wall -Wextra -std=c11 -Og -g -D_GNU_SOURCE)
|
|
|
|
|
2022-03-20 20:45:51 +01:00
|
|
|
# fxgxa
|
|
|
|
add_executable(fxgxa fxgxa/dump.c fxgxa/edit.c fxgxa/file.c fxgxa/icon.c
|
2022-03-20 13:34:08 +01:00
|
|
|
fxgxa/main.c fxgxa/util.c)
|
2022-03-20 20:45:51 +01:00
|
|
|
target_include_directories(fxgxa PUBLIC fxgxa/)
|
|
|
|
target_link_libraries(fxgxa PkgConfig::libpng)
|
2022-03-20 13:34:08 +01:00
|
|
|
|
2023-03-03 00:29:00 +01:00
|
|
|
# fxg1a as a symlink (for compatibility)
|
2022-03-20 20:45:51 +01:00
|
|
|
add_custom_target(fxg1a ALL
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E create_symlink "fxgxa" "fxg1a")
|
2021-04-03 11:31:41 +02:00
|
|
|
|
|
|
|
# fxsdk
|
|
|
|
add_custom_command(OUTPUT "${BIN}/fxsdk.sh"
|
2022-08-19 14:38:19 +02:00
|
|
|
COMMAND sed
|
|
|
|
-e "'s#@CMAKE_INSTALL_PREFIX@#${CMAKE_INSTALL_PREFIX}#'"
|
|
|
|
-e "'s#@CMAKE_PROJECT_VERSION@#${CMAKE_PROJECT_VERSION}#'"
|
2021-04-03 11:31:41 +02:00
|
|
|
"${SRC}/fxsdk/fxsdk.sh" > "${BIN}/fxsdk.sh"
|
|
|
|
DEPENDS "${SRC}/fxsdk/fxsdk.sh")
|
|
|
|
add_custom_target(fxsdk ALL DEPENDS "${BIN}/fxsdk.sh")
|
|
|
|
|
2023-03-26 12:20:50 +02:00
|
|
|
# libfxlink
|
|
|
|
configure_file(libfxlink/include/fxlink/config.h.in
|
2023-03-03 00:29:00 +01:00
|
|
|
"${BIN}/include/fxlink/config.h")
|
2023-03-26 12:20:50 +02:00
|
|
|
add_library(libfxlink STATIC
|
|
|
|
libfxlink/defs.c
|
|
|
|
libfxlink/devices.c
|
|
|
|
libfxlink/filter.c
|
|
|
|
libfxlink/logging.c
|
|
|
|
libfxlink/protocol.c)
|
|
|
|
target_link_libraries(libfxlink PUBLIC PkgConfig::libusb)
|
|
|
|
target_include_directories(libfxlink PUBLIC
|
|
|
|
"${BIN}/include"
|
|
|
|
"${SRC}/libfxlink/include")
|
|
|
|
set_target_properties(libfxlink PROPERTIES
|
|
|
|
OUTPUT_NAME "fxlink") # libfxlink.a
|
|
|
|
|
|
|
|
# fxlink
|
2023-03-03 00:29:00 +01:00
|
|
|
add_executable(fxlink
|
|
|
|
fxlink/main.c
|
|
|
|
fxlink/modes/interactive.c
|
|
|
|
fxlink/modes/list.c
|
|
|
|
fxlink/modes/push.c
|
|
|
|
fxlink/modes/udisks2.c
|
|
|
|
fxlink/tooling/libpng.c
|
|
|
|
fxlink/tooling/sdl2.c
|
|
|
|
fxlink/tooling/udisks2.c
|
2023-03-17 21:32:01 +01:00
|
|
|
fxlink/tui/commands.c
|
2023-03-26 11:41:55 +02:00
|
|
|
fxlink/tui/command-util.c
|
2023-03-03 00:29:00 +01:00
|
|
|
fxlink/tui/input.c
|
|
|
|
fxlink/tui/layout.c
|
2023-03-17 21:32:01 +01:00
|
|
|
fxlink/tui/render.c
|
|
|
|
fxlink/tui/tui-interactive.c)
|
2023-03-03 00:29:00 +01:00
|
|
|
target_link_libraries(fxlink
|
2023-03-26 12:20:50 +02:00
|
|
|
libfxlink PkgConfig::libpng PkgConfig::ncurses -lm)
|
2023-03-03 00:29:00 +01:00
|
|
|
target_include_directories(fxlink PRIVATE
|
|
|
|
"${SRC}/fxlink/include")
|
2021-04-03 11:58:30 +02:00
|
|
|
if(NOT FXLINK_DISABLE_UDISKS2)
|
|
|
|
target_link_libraries(fxlink PkgConfig::udisks2)
|
|
|
|
endif()
|
2021-08-11 01:44:40 +02:00
|
|
|
if(NOT FXLINK_DISABLE_SDL2)
|
|
|
|
target_link_libraries(fxlink PkgConfig::sdl2)
|
|
|
|
endif()
|
2021-04-03 11:58:30 +02:00
|
|
|
|
2024-03-30 09:29:28 +01:00
|
|
|
# fxsdk-gdb-bridge
|
|
|
|
add_executable(fxsdk-gdb-bridge fxsdk/gdb-bridge.c)
|
|
|
|
target_link_libraries(fxsdk-gdb-bridge libfxlink)
|
|
|
|
target_include_directories(fxsdk-gdb-bridge PRIVATE
|
|
|
|
"${SRC}/fxlink/include")
|
|
|
|
|
2021-04-03 11:31:41 +02:00
|
|
|
# Install rules
|
|
|
|
|
|
|
|
# fxsdk
|
|
|
|
install(PROGRAMS "${BIN}/fxsdk.sh" TYPE BIN RENAME fxsdk)
|
|
|
|
install(DIRECTORY fxsdk/assets DESTINATION share/fxsdk)
|
2024-06-02 16:07:26 +02:00
|
|
|
install(DIRECTORY fxsdk/scripts DESTINATION share/fxsdk USE_SOURCE_PERMISSIONS)
|
2021-04-03 11:31:41 +02:00
|
|
|
install(DIRECTORY fxsdk/cmake/ DESTINATION lib/cmake/fxsdk)
|
2024-03-30 09:29:28 +01:00
|
|
|
install(TARGETS fxsdk-gdb-bridge)
|
2022-03-20 20:45:51 +01:00
|
|
|
# fxgxa, fxg1a
|
|
|
|
install(TARGETS fxgxa)
|
|
|
|
install(FILES "${BIN}/fxg1a" TYPE BIN)
|
2021-04-03 11:31:41 +02:00
|
|
|
# fxconv
|
|
|
|
install(PROGRAMS fxconv/fxconv-main.py TYPE BIN RENAME fxconv)
|
|
|
|
install(FILES fxconv/fxconv.py TYPE BIN)
|
2023-03-27 19:46:29 +02:00
|
|
|
# libfxlink
|
|
|
|
install(FILES "${BIN}/include/fxlink/config.h" DESTINATION include/fxlink/)
|
|
|
|
install(DIRECTORY libfxlink/include/ DESTINATION include
|
|
|
|
FILES_MATCHING PATTERN "*.h")
|
|
|
|
install(DIRECTORY libfxlink/cmake/ DESTINATION lib/cmake)
|
|
|
|
install(TARGETS libfxlink DESTINATION lib)
|
2023-03-26 12:20:50 +02:00
|
|
|
# fxlink
|
2021-04-03 11:58:30 +02:00
|
|
|
install(TARGETS fxlink)
|