metaforce/Editor/icons/CMakeLists.txt

64 lines
2.4 KiB
CMake
Raw Normal View History

2017-12-07 04:13:12 +00:00
if(NOT CMAKE_CROSSCOMPILING)
2016-01-18 00:40:11 +00:00
add_executable(packicons packicons.c)
2017-12-31 00:56:46 +00:00
find_library(M_LIB m)
2017-12-31 02:44:18 +00:00
if(NOT M_LIB)
unset(M_LIB CACHE)
endif()
2020-06-12 12:44:33 +00:00
target_link_libraries(packicons ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${M_LIB})
target_include_directories(packicons PRIVATE ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
2016-01-18 00:40:11 +00:00
2017-12-07 04:13:12 +00:00
##################
# Package Export #
##################
# Add all targets to the build-tree export set
2021-04-10 08:42:06 +00:00
export(TARGETS packicons FILE "${CMAKE_CURRENT_BINARY_DIR}/metaforce-packiconsTargets.cmake")
2017-12-07 04:13:12 +00:00
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
2021-04-10 08:42:06 +00:00
export(PACKAGE metaforce-packicons)
2017-12-07 04:13:12 +00:00
# Create the atdnaConfig.cmake
# ... for the build tree
2021-04-10 08:42:06 +00:00
configure_file(metaforce-packiconsConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/metaforce-packiconsConfig.cmake" @ONLY)
2017-12-07 04:13:12 +00:00
# ... for the install tree
2021-04-10 08:42:06 +00:00
configure_file(metaforce-packiconsConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/metaforce-packiconsConfig.cmake" @ONLY)
2017-12-07 04:13:12 +00:00
# ... for both
2021-04-10 08:42:06 +00:00
configure_file(metaforce-packiconsConfigVersion.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/metaforce-packiconsConfigVersion.cmake" @ONLY)
2017-12-07 04:13:12 +00:00
else()
2021-04-10 08:42:06 +00:00
find_package(metaforce-packicons REQUIRED)
2017-12-07 04:13:12 +00:00
endif()
2016-01-18 00:40:11 +00:00
unset(INKSCAPE_BIN CACHE)
set(CMAKE_FIND_APPBUNDLE "NEVER")
2016-01-18 02:12:01 +00:00
if(WIN32)
find_program(INKSCAPE_BIN inkscape.exe PATHS
"$ENV{PROGRAMFILES}/Inkscape"
"$ENV{ProgramW6432}/Inkscape"
2017-12-06 03:26:15 +00:00
"$ENV{PROGRAMFILES\(X86\)}/Inkscape")
2016-01-18 02:12:01 +00:00
else()
2016-12-08 04:55:44 +00:00
set(CMAKE_FIND_APPBUNDLE FIRST)
2016-01-18 02:12:01 +00:00
find_program(INKSCAPE_BIN inkscape)
endif()
2016-12-11 01:54:08 +00:00
if(NOT INKSCAPE_BIN)
add_custom_command(OUTPUT icons.bin COMMAND ${CMAKE_COMMAND} ARGS -P
${CMAKE_CURRENT_SOURCE_DIR}/IconDownload.cmake)
2016-01-18 00:40:11 +00:00
else()
2018-10-16 03:17:02 +00:00
if(APPLE)
get_filename_component(INKSCAPE_DIR ${INKSCAPE_BIN} DIRECTORY)
if(EXISTS "${INKSCAPE_DIR}/../Resources/bin/inkscape")
set(INKSCAPE_BIN "${INKSCAPE_DIR}/../Resources/bin/inkscape")
endif()
endif()
2016-01-18 00:40:11 +00:00
message(STATUS "Inkscape found; will render icons locally")
add_custom_command(OUTPUT icons.bin COMMAND $<TARGET_FILE:packicons>
ARGS ${INKSCAPE_BIN} ${CMAKE_CURRENT_SOURCE_DIR}/icons.svg
${CMAKE_CURRENT_BINARY_DIR}/icons.bin
MAIN_DEPENDENCY icons.svg COMMENT "Generating icons.bin")
endif()
2017-12-29 08:08:12 +00:00
bintoc(icons_dat.cpp ${CMAKE_CURRENT_BINARY_DIR}/icons.bin URDE_ICONS)
2021-04-10 08:42:06 +00:00
add_library(MetaforceIcons icons.cpp icons.hpp icons.bin icons_dat.cpp)
target_link_libraries(MetaforceIcons PUBLIC specter)