77 lines
1.7 KiB
CMake
77 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(scallywag C)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
# Find required packages
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
|
pkg_check_modules(CURL REQUIRED libcurl)
|
|
pkg_check_modules(LIBXML2 REQUIRED libxml-2.0)
|
|
|
|
# Compile GResource for embedded assets
|
|
find_program(GLIB_COMPILE_RESOURCES glib-compile-resources REQUIRED)
|
|
set(GRESOURCE_XML ${CMAKE_SOURCE_DIR}/src/gui/resources.gresource.xml)
|
|
set(GRESOURCE_C ${CMAKE_BINARY_DIR}/resources.c)
|
|
|
|
add_custom_command(
|
|
OUTPUT ${GRESOURCE_C}
|
|
COMMAND ${GLIB_COMPILE_RESOURCES}
|
|
--target=${GRESOURCE_C}
|
|
--sourcedir=${CMAKE_SOURCE_DIR}/src/gui
|
|
--generate-source
|
|
${GRESOURCE_XML}
|
|
DEPENDS ${GRESOURCE_XML} ${CMAKE_SOURCE_DIR}/src/gui/logo.svg
|
|
COMMENT "Compiling GResource"
|
|
)
|
|
|
|
# Source files
|
|
set(SOURCES
|
|
scallywag-ng.c
|
|
src/app.c
|
|
src/config.c
|
|
src/http.c
|
|
src/scraper/proxylister.c
|
|
src/scraper/searcher.c
|
|
src/gui/window.c
|
|
src/gui/callbacks.c
|
|
src/gui/loading.c
|
|
src/util/strutil.c
|
|
${GRESOURCE_C}
|
|
)
|
|
|
|
# Executable
|
|
add_executable(scallywag ${SOURCES})
|
|
|
|
# Include directories
|
|
target_include_directories(scallywag PRIVATE
|
|
${CMAKE_SOURCE_DIR}/src
|
|
${GTK3_INCLUDE_DIRS}
|
|
${CURL_INCLUDE_DIRS}
|
|
${LIBXML2_INCLUDE_DIRS}
|
|
)
|
|
|
|
# Link libraries
|
|
target_link_libraries(scallywag
|
|
${GTK3_LIBRARIES}
|
|
${CURL_LIBRARIES}
|
|
${LIBXML2_LIBRARIES}
|
|
)
|
|
|
|
# Compiler flags
|
|
target_compile_options(scallywag PRIVATE
|
|
${GTK3_CFLAGS_OTHER}
|
|
${CURL_CFLAGS_OTHER}
|
|
${LIBXML2_CFLAGS_OTHER}
|
|
-Wall -Wextra -Wpedantic
|
|
)
|
|
|
|
# Debug build option
|
|
option(DEBUG_BUILD "Enable debug logging" OFF)
|
|
if(DEBUG_BUILD)
|
|
target_compile_definitions(scallywag PRIVATE DEBUG)
|
|
endif()
|
|
|