JustUI/CMakeLists.txt

65 lines
1.7 KiB
Text
Raw Normal View History

2021-03-12 16:19:43 +01:00
# Just UI
cmake_minimum_required(VERSION 3.16)
2023-04-10 14:19:54 +02:00
project(JustUI VERSION 1.3.0 LANGUAGES C)
2022-06-25 01:10:56 +02:00
find_package(Gint 2.8 REQUIRED)
2021-03-12 16:19:43 +01:00
include(Fxconv)
set(CMAKE_INSTALL_MESSAGE LAZY)
2021-03-12 16:19:43 +01:00
configure_file(include/justui/config.h.in include/justui/config.h)
set(ASSETS_fx
assets/input-modes-fx.png
assets/font-fkeys-fx.png
2021-03-12 16:19:43 +01:00
)
set(ASSETS_cg
assets/input-modes-cg.png
)
2024-05-26 18:18:31 +02:00
set(ASSETS_cp ${ASSETS_cg})
2022-06-18 20:49:46 +02:00
fxconv_declare_assets(${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
2021-03-12 16:19:43 +01:00
set(NAME "justui-${FXSDK_PLATFORM}")
add_library(${NAME} STATIC
src/jwidget.c
src/jlayout_box.c
src/jlayout_stack.c
src/jlayout_grid.c
src/jlabel.c
src/jscene.c
src/jinput.c
src/jpainted.c
src/jfkeys.c
src/jfileselect.c
src/jframe.c
src/jlist.c
src/jscrolledlist.c
2021-03-12 16:19:43 +01:00
src/vec.c
src/keymap.c
${ASSETS_${FXSDK_PLATFORM}}
)
target_compile_options(${NAME} PUBLIC
2024-05-26 18:18:39 +02:00
-Wall -Wextra -std=c11 -Os -flto)
2021-03-12 16:19:43 +01:00
target_include_directories(${NAME} PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/include"
2022-08-21 17:37:45 +02:00
"${CMAKE_CURRENT_BINARY_DIR}/include")
2021-03-12 16:19:43 +01:00
target_link_libraries(${NAME}
2022-08-21 17:37:45 +02:00
Gint::Gint -lm)
2021-03-12 16:19:43 +01:00
2024-05-26 18:18:39 +02:00
# Generate the archive with gcc-ar instead of ar as it will load the LTO plugin
# which is required to generate a usable archive.
set(CMAKE_C_ARCHIVE_CREATE "${CMAKE_C_COMPILER_AR} qcs <TARGET> <OBJECTS>")
# Also the ranlib rule (useless because ar is passed the s flag anyway)
set(CMAKE_C_ARCHIVE_FINISH "${CMAKE_C_COMPILER_RANLIB} <TARGET>")
2021-03-12 16:19:43 +01:00
install(TARGETS ${NAME}
2022-08-21 17:37:45 +02:00
DESTINATION "${FXSDK_LIB}")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
DESTINATION "${FXSDK_INCLUDE}"
2021-03-12 16:19:43 +01:00
FILES_MATCHING PATTERN "*.h")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/justui/config.h"
2022-08-21 17:37:45 +02:00
DESTINATION "${FXSDK_INCLUDE}/justui")
2021-03-12 16:19:43 +01:00
install(FILES cmake/FindJustUI.cmake
DESTINATION "${FXSDK_CMAKE_MODULE_PATH}")