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()
2017-12-31 00:56:46 +00:00
target_link_libraries(packicons ${PNG_LIB} ${ZLIB_LIBRARIES} ${M_LIB})
target_include_directories(packicons PRIVATE ${LIBPNG_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
export(TARGETS packicons FILE "${CMAKE_CURRENT_BINARY_DIR}/urde-packiconsTargets.cmake")
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export(PACKAGE urde-packicons)
# Create the atdnaConfig.cmake
# ... for the build tree
configure_file(urde-packiconsConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/urde-packiconsConfig.cmake" @ONLY)
# ... for the install tree
configure_file(urde-packiconsConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/urde-packiconsConfig.cmake" @ONLY)
# ... for both
configure_file(urde-packiconsConfigVersion.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/urde-packiconsConfigVersion.cmake" @ONLY)
else()
find_package(urde-packicons REQUIRED)
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)
add_library(UrdeIcons icons.cpp icons.hpp icons.bin icons_dat.cpp)
target_link_libraries(UrdeIcons PUBLIC specter)