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)
|
2021-07-04 17:35:42 +02:00
|
|
|
project(fxSDK VERSION 2.5.2 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
|
|
|
# pkg_check_modules(libudev libudev IMPORTED_TARGET)
|
|
|
|
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()
|
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)
|
|
|
|
|
|
|
|
# fxg1a
|
|
|
|
add_executable(fxg1a fxg1a/dump.c fxg1a/edit.c fxg1a/file.c fxg1a/icon.c
|
|
|
|
fxg1a/main.c fxg1a/util.c)
|
|
|
|
target_include_directories(fxg1a PUBLIC fxg1a/)
|
2021-04-11 20:27:25 +02:00
|
|
|
target_link_libraries(fxg1a PkgConfig::libpng)
|
2021-04-03 11:31:41 +02:00
|
|
|
|
|
|
|
# fxsdk
|
|
|
|
add_custom_command(OUTPUT "${BIN}/fxsdk.sh"
|
|
|
|
COMMAND sed "'s#@FXSDK_PREFIX@#${CMAKE_INSTALL_PREFIX}#'"
|
|
|
|
"${SRC}/fxsdk/fxsdk.sh" > "${BIN}/fxsdk.sh"
|
|
|
|
DEPENDS "${SRC}/fxsdk/fxsdk.sh")
|
|
|
|
add_custom_target(fxsdk ALL DEPENDS "${BIN}/fxsdk.sh")
|
|
|
|
|
2021-04-03 11:58:30 +02:00
|
|
|
# fxlink
|
|
|
|
configure_file(fxlink/config.h.in "${BIN}/include/fxlink/config.h")
|
2021-05-25 20:46:27 +02:00
|
|
|
add_executable(fxlink fxlink/usb.c fxlink/filter.c fxlink/interactive.c
|
|
|
|
fxlink/main.c fxlink/png.c fxlink/properties.c fxlink/ud2.c fxlink/util.c
|
2021-08-11 01:44:40 +02:00
|
|
|
fxlink/protocol.c fxlink/sdl2.c)
|
2021-05-25 20:46:27 +02:00
|
|
|
target_link_libraries(fxlink PkgConfig::libpng PkgConfig::libusb) # PkgConfig::libudev
|
2021-04-03 11:58:30 +02:00
|
|
|
target_include_directories(fxlink PRIVATE "${BIN}/include/fxlink")
|
|
|
|
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
|
|
|
|
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)
|
|
|
|
install(DIRECTORY fxsdk/cmake/ DESTINATION lib/cmake/fxsdk)
|
|
|
|
# fxg1a
|
|
|
|
install(TARGETS fxg1a)
|
|
|
|
# fxconv
|
|
|
|
install(PROGRAMS fxconv/fxconv-main.py TYPE BIN RENAME fxconv)
|
|
|
|
install(FILES fxconv/fxconv.py TYPE BIN)
|
2021-04-03 11:58:30 +02:00
|
|
|
#fxlink
|
|
|
|
install(TARGETS fxlink)
|