1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
5 # Set required libraries.
7 set(LIBPTHREAD "pthread")
8 set(LIBGLIB2 "glib-2.0")
11 SET(REQUIRED_LIBRARIES ${LIBFUSE} ${LIBPTHREAD})
12 foreach(LIB ${REQUIRED_LIBRARIES})
13 find_library(FOUND${LIB} ${LIB} PATHS "/lib64" "/usr/lib64")
15 message(FATAL_ERROR "The required library '${LIB}' was not found. Please install it on your system first.")
16 endif(NOT FOUND${LIB})
19 ADD_DEFINITIONS(-g -O2 -D_FILE_OFFSET_BITS=64)
24 find_path(GLIB_INCLUDE_DIR NAMES glib.h PATH_SUFFIXES glib-2.0
26 ${GLIB_PKG_INCLUDE_DIRS}
31 find_path(GLIB_CONFIG_INCLUDE_DIR NAMES glibconfig.h PATHS ${GLIB_PKG_LIBDIR} PATH_SUFFIXES glib-2.0/include)
33 find_library(GLIB_LIBRARIES NAMES glib-2.0
35 ${GLIB_PKG_LIBRARY_DIRS}
41 # Find Glib even if pkg-config is not working (eg. cross compiling to Windows)
42 find_library(GLIB_LIBRARIES NAMES glib-2.0)
43 string (REGEX REPLACE "/[^/]*$" "" GLIB_LIBRARIES_DIR ${GLIB_LIBRARIES})
45 find_path(GLIB_INCLUDE_DIR NAMES glib.h PATH_SUFFIXES glib-2.0)
46 find_path(GLIB_CONFIG_INCLUDE_DIR NAMES glibconfig.h PATHS ${GLIB_LIBRARIES_DIR} PATH_SUFFIXES glib-2.0/include)
48 endif (GLIB_PKG_FOUND)
50 if (GLIB_INCLUDE_DIR AND GLIB_CONFIG_INCLUDE_DIR AND GLIB_LIBRARIES)
51 set(GLIB_INCLUDE_DIRS ${GLIB_INCLUDE_DIR} ${GLIB_CONFIG_INCLUDE_DIR})
52 endif (GLIB_INCLUDE_DIR AND GLIB_CONFIG_INCLUDE_DIR AND GLIB_LIBRARIES)
54 if(GLIB_INCLUDE_DIRS AND GLIB_LIBRARIES)
55 set(GLIB_FOUND TRUE CACHE INTERNAL "glib-2.0 found")
56 message(STATUS "Found glib-2.0: ${GLIB_INCLUDE_DIR}, ${GLIB_LIBRARIES}")
57 else(GLIB_INCLUDE_DIRS AND GLIB_LIBRARIES)
58 set(GLIB_FOUND FALSE CACHE INTERNAL "glib-2.0 found")
59 message(STATUS "glib-2.0 not found.")
60 endif(GLIB_INCLUDE_DIRS AND GLIB_LIBRARIES)
62 mark_as_advanced(GLIB_INCLUDE_DIR GLIB_CONFIG_INCLUDE_DIR GLIB_INCLUDE_DIRS GLIB_LIBRARIES)
66 INCLUDE_DIRECTORIES(. ${GLIB_INCLUDE_DIRS})
68 ADD_EXECUTABLE(AppRun AppRun.c)
69 add_custom_command(TARGET AppRun POST_BUILD COMMAND ${CMAKE_STRIP} AppRun)
71 ADD_LIBRARY(fuseiso fuseiso.c)
72 ADD_LIBRARY(isofs isofs.c)
74 ADD_EXECUTABLE(runtime runtime.c)
75 TARGET_LINK_LIBRARIES(runtime fuseiso isofs ${LIBFUSE} ${LIBPTHREAD} ${LIBGLIB2} ${LIBZ})
76 add_custom_command(TARGET runtime POST_BUILD COMMAND ${CMAKE_STRIP} runtime)
78 ADD_CUSTOM_TARGET(AppImageAssistant ALL DEPENDS runtime)
79 ADD_CUSTOM_COMMAND(TARGET AppImageAssistant
80 COMMAND cp runtime AppImageAssistant.AppDir/
81 COMMAND ./binary-dependencies/bundle
82 COMMAND ./AppImageAssistant.AppDir/package ./AppImageAssistant.AppDir ./AppImageAssistant
86 ADD_CUSTOM_TARGET(AppImageExtract ALL DEPENDS AppRun AppImageAssistant)
87 ADD_CUSTOM_COMMAND(TARGET AppImageExtract
88 COMMAND cp AppRun ./AppImageExtract.AppDir
89 COMMAND ./binary-dependencies/bundle
90 COMMAND ./AppImageAssistant.AppDir/package ./AppImageExtract.AppDir ./AppImageExtract
94 SET_DIRECTORY_PROPERTIES(PROPERTIES
95 ADDITIONAL_MAKE_CLEAN_FILES "AppImageAssistant;AppImageExtract;./AppImageAssistant.AppDir/runtime;./AppImageAssistant.AppDir/usr/share/pyshared/vte.so;./AppImageAssistant.AppDir/usr/lib/;./AppImageExtract.AppDir/AppRun;./AppImageExtract.AppDir/usr/lib/;./AppImageAssistant.AppDir/usr/bin/xorriso;./AppImageExtract.AppDir/usr/bin/xorriso")