aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml4
-rw-r--r--CMakeLists.txt3
-rw-r--r--Makefile2
-rw-r--r--src/CMakeLists.txt36
-rw-r--r--src/command.h1
-rw-r--r--src/defines.h6
-rw-r--r--src/lutris.c8
-rw-r--r--src/main.c24
8 files changed, 57 insertions, 27 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bd1a969..8a9b277 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -25,14 +25,14 @@ jobs:
run: sudo apt-get update
- name: Install dependencies
- run: sudo apt-get install libcurl4-openssl-dev libjson-c-dev libarchive-dev cmake make wget
+ run: sudo apt-get install libcurl4-openssl-dev libjson-c-dev libyaml-dev libarchive-dev cmake make wget
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
working-directory: ${{runner.workspace}}/build
- run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_MOCK:BOOL=ON
+ run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_WINE=ON -DENABLE_DXVK=ON -DENABLE_LUTRIS=ON -DBUILD_MOCK:BOOL=ON
- name: Build
working-directory: ${{runner.workspace}}/build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ccefdc9..a153afd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,9 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
option(BUILD_MOCK "build polecat against mock libraries" OFF)
+option(ENABLE_WINE "enables wine support [Not on Windows]" ON)
+option(ENABLE_DXVK "enables dxvk support" ON)
+option(ENABLE_LUTRIS "enables lutris support" OFF)
project(polecat VERSION 0.1.9 LANGUAGES C)
diff --git a/Makefile b/Makefile
index 3a785b2..0f21562 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ PRETTY_OUTPUT := 1
STATIC := 0
# COMMAND VARIABLES
-DOXYGEN := doxygen
+DOXYGEN := doxygen
RM := rm -rf
MKDIR := mkdir -p
PKGCONFIG := pkg-config
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b982b32..72c4a76 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,8 +6,27 @@ set(MAINSOURCES
${CMAKE_CURRENT_SOURCE_DIR}/common.h
${CMAKE_CURRENT_SOURCE_DIR}/config.c
${CMAKE_CURRENT_SOURCE_DIR}/config.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/main.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/net.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/net.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/tar.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/tar.h
+)
+
+if(ENABLE_DXVK)
+add_compile_definitions(DXVK_ENABLED)
+set(MAINSOURCES
+ ${MAINSOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/dxvk.c
${CMAKE_CURRENT_SOURCE_DIR}/dxvk.h
+)
+endif()
+
+if(ENABLE_LUTRIS)
+add_compile_definitions(LUTRIS_ENABLED)
+set(MAINSOURCES
+ ${MAINSOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/lutris.c
${CMAKE_CURRENT_SOURCE_DIR}/lutris.h
${CMAKE_CURRENT_SOURCE_DIR}/lutris/array.h
@@ -15,15 +34,12 @@ set(MAINSOURCES
${CMAKE_CURRENT_SOURCE_DIR}/lutris/keyword.h
${CMAKE_CURRENT_SOURCE_DIR}/lutris/runner.h
${CMAKE_CURRENT_SOURCE_DIR}/lutris/task.h
- ${CMAKE_CURRENT_SOURCE_DIR}/main.c
- ${CMAKE_CURRENT_SOURCE_DIR}/main.h
- ${CMAKE_CURRENT_SOURCE_DIR}/net.c
- ${CMAKE_CURRENT_SOURCE_DIR}/net.h
- ${CMAKE_CURRENT_SOURCE_DIR}/tar.c
- ${CMAKE_CURRENT_SOURCE_DIR}/tar.h
)
+endif()
-if (NOT WIN32)
+
+if (ENABLE_WINE AND NOT WIN32)
+add_compile_definitions(WINE_ENABLED)
set(MAINSOURCES
${MAINSOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/wine.c
@@ -41,24 +57,24 @@ set(CFLAGS
-Winit-self -Wcast-align -Wpointer-arith
-Wmissing-declarations -Wmissing-include-dirs
-Wno-unused-parameter -Wuninitialized
+ ${LIBCURL_CFLAGS}
${JSONC_CFLAGS}
${LIBARCHIVE_CFLAGS}
- ${LIBCURL_CFLAGS}
)
add_library(core OBJECT ${MAINSOURCES})
+target_include_directories(core PUBLIC ${LIBCURL_INCLUDE_DIRS})
target_include_directories(core PUBLIC ${JSONC_INCLUDE_DIRS})
target_include_directories(core PUBLIC ${LIBARCHIVE_INCLUDE_DIRS})
-target_include_directories(core PUBLIC ${LIBCURL_INCLUDE_DIRS})
target_compile_options(core PUBLIC ${CFLAGS})
add_executable(${CMAKE_PROJECT_NAME} $<TARGET_OBJECTS:core>)
+target_link_libraries(${CMAKE_PROJECT_NAME} LINK_PUBLIC ${LIBCURL_LIBRARIES})
target_link_libraries(${CMAKE_PROJECT_NAME} LINK_PUBLIC ${JSONC_LIBRARIES})
target_link_libraries(${CMAKE_PROJECT_NAME} LINK_PUBLIC ${LIBARCHIVE_LIBRARIES})
-target_link_libraries(${CMAKE_PROJECT_NAME} LINK_PUBLIC ${LIBCURL_LIBRARIES})
install(TARGETS ${CMAKE_PROJECT_NAME})
diff --git a/src/command.h b/src/command.h
index 8a7c101..0f631a4 100644
--- a/src/command.h
+++ b/src/command.h
@@ -2,6 +2,7 @@
#define COMMAND_H
#include <stdio.h>
+#include <string.h>
#include "common.h"
/*
diff --git a/src/defines.h b/src/defines.h
index 5b37427..eb9989f 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -8,9 +8,9 @@
#define WINE_API LUTRIS_API "/runners/wine"
#define DXVK_API GITHUB_API"/repos/lutris/dxvk/releases"
#define INSTALLER_API LUTRIS_API "/installers/"
-#define GAME_API LUTRIS_API "/games"
-#define GAME_SEARCH_API GAME_API "?search=%s"
-#define GAME_INSTALLER_API GAME_API "/%s/installers"
+#define LUTRIS_GAME_API LUTRIS_API "/games"
+#define LUTRIS_GAME_SEARCH_API LUTRIS_GAME_API "?search=%s"
+#define LUTRIS_GAME_INSTALLER_API LUTRIS_GAME_API "/%s/installers"
#ifndef NAME
diff --git a/src/lutris.c b/src/lutris.c
index abef447..3f20f37 100644
--- a/src/lutris.c
+++ b/src/lutris.c
@@ -49,8 +49,8 @@ COMMAND(lutris, search)
str = realloc(str, allocsize);
if (!str) return 1;
lutris_escapeString(str, allocsize);
- char* url = malloc(strlen(GAME_SEARCH_API) + strlen(str));
- sprintf(url, GAME_SEARCH_API, str);
+ char* url = malloc(strlen(LUTRIS_GAME_SEARCH_API) + strlen(str));
+ sprintf(url, LUTRIS_GAME_SEARCH_API, str);
struct json_object* queryresult = fetchJSON(url);
free(str);
@@ -103,8 +103,8 @@ COMMAND(lutris, list)
str = realloc(str, allocsize);
if (!str) return 1;
lutris_escapeString(str, allocsize);
- char* url = malloc(strlen(GAME_INSTALLER_API) + strlen(str));
- sprintf(url, GAME_INSTALLER_API, str);
+ char* url = malloc(strlen(LUTRIS_GAME_INSTALLER_API) + strlen(str));
+ sprintf(url, LUTRIS_GAME_INSTALLER_API, str);
struct json_object* queryresult = fetchJSON(url);
free(str);
diff --git a/src/main.c b/src/main.c
index 9c1eef8..8995556 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4,13 +4,19 @@
#include <libgen.h>
#include "main.h"
+#ifdef WINE_ENABLED
#include "wine.h"
+#endif
+#ifdef DXVK_ENABLED
#include "dxvk.h"
+#endif
+#ifdef LUTRIS_ENABLED
#include "lutris.h"
+#endif
#include "common.h"
#include "config.h"
-#ifndef _WIN32
+#ifndef WINE_ENABLED
// if something fails
// we need to free the new argv
char** nargv;
@@ -18,12 +24,16 @@ static void free_nargv() { free(nargv); }
#endif
static const struct Command main_commands[] = {
-#ifndef _WIN32
- { .name = "wine", .func = winecmd, .description = "manage wine versions" },
+#ifdef WINE_ENABLED
+ { .name = "wine", .func = winecmd, .description = "manage wine versions" },
+#endif
+#ifdef DXVK_ENABLED
+ { .name = "dxvk", .func = dxvk, .description = "manage DXVK versions" },
+#endif
+#ifdef LUTRIS_ENABLED
+ { .name = "lutris", .func = lutris, .description = "run lutris instraller"},
#endif
- { .name = "dxvk", .func = dxvk, .description = "manage DXVK versions" },
- { .name = "lutris", .func = lutris, .description = "run lutris instraller"},
- { .name = "env", .func = main_env, .description = "show some information about polecat" },
+ { .name = "env", .func = main_env, .description = "show some information about polecat" },
};
static const struct Flag main_flags[] = {
@@ -33,7 +43,7 @@ static const struct Flag main_flags[] = {
COMMAND_GROUP(main)
{
-#ifndef _WIN32
+#ifndef WINE_ENABLED
char* arg0 = basename(argv[0]);
if (!strncmp(WINE_PREFIX, arg0, strlen(WINE_PREFIX)))
{