aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2020-10-11 18:17:01 +0200
committerJan200101 <sentrycraft123@gmail.com>2020-10-11 18:17:01 +0200
commit7d4e2f33a619b1f46a8f2ba00afa22edca6579e8 (patch)
treec4af21c3d2c727929d9489b3c931cc4b64898bf2
parent26b0417ced82ad849e08db8e8aed0d5529c2b433 (diff)
downloadpolecat-7d4e2f33a619b1f46a8f2ba00afa22edca6579e8.tar.gz
polecat-7d4e2f33a619b1f46a8f2ba00afa22edca6579e8.zip
replace meson with cmake
meson is nice but its completly foreign to me and leaves targets to compile to (e.g Makefile) might revisit in the future but now right now
-rw-r--r--CMakeLists.txt34
-rw-r--r--cmake/FindJsonC.cmake41
-rw-r--r--cmake/FindLibarchive.cmake41
-rw-r--r--cmake/FindLibcurl.cmake41
-rw-r--r--meson.build39
-rw-r--r--meson_options.txt6
-rw-r--r--src/common.c1
-rw-r--r--src/config.c1
-rw-r--r--src/dxvk.c3
-rw-r--r--src/lutris.c1
-rw-r--r--src/lutris.h2
-rw-r--r--src/main.c1
-rw-r--r--src/meson.build28
-rw-r--r--src/net.c3
-rw-r--r--src/net.h2
-rw-r--r--src/tar.c1
-rw-r--r--src/wine.c3
17 files changed, 162 insertions, 86 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..750c419
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,34 @@
+cmake_minimum_required(VERSION 3.0)
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
+ "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
+endif()
+
+project(polecat VERSION 0.1.5)
+
+add_compile_definitions(NAME="${CMAKE_PROJECT_NAME}")
+add_compile_definitions(VERSION="${CMAKE_PROJECT_VERSION}")
+
+message("-- Name: ${CMAKE_PROJECT_NAME}\n-- Version: ${CMAKE_PROJECT_VERSION}")
+
+set(FILES common config dxvk lutris main net tar wine)
+
+foreach(FILE ${FILES})
+ set(SOURCES ${SOURCES} ${CMAKE_CURRENT_LIST_DIR}/src/${FILE}.c)
+endforeach()
+
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
+
+find_package(Libcurl REQUIRED)
+find_package(JsonC REQUIRED)
+find_package(Libarchive REQUIRED)
+
+if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
+ add_compile_definitions(DEBUG)
+endif()
+
+add_executable(${CMAKE_PROJECT_NAME} ${SOURCES})
+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}) \ No newline at end of file
diff --git a/cmake/FindJsonC.cmake b/cmake/FindJsonC.cmake
new file mode 100644
index 0000000..9dfcf4a
--- /dev/null
+++ b/cmake/FindJsonC.cmake
@@ -0,0 +1,41 @@
+#
+# JSONC_INCLUDE_DIRS
+# JSONC_LIBRARIES
+
+find_package(PkgConfig QUIET)
+if (PKG_CONFIG_FOUND)
+ pkg_check_modules(_JSONC QUIET json-c)
+endif()
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(_lib_suffix 64)
+else()
+ set(_lib_suffix 32)
+endif()
+
+find_path(JSONC_INC
+ NAMES json-c/json.h
+ HINTS
+ ENV jsoncPath${_lib_suffix}
+ ENV jsoncPath
+ ${_JSONC_INCLUDE_DIRS}
+ PATHS
+ /usr/include /usr/local/include)
+
+find_library(JSONC_LIB
+ NAMES ${_JSONC_LIBRARIES} jsonc json-c
+ HINTS
+ ENV jsoncPath${_lib_suffix}
+ ENV jsoncPath
+ ${_JSONC_LIBRARY_DIRS}
+ PATHS
+ /usr/lib /usr/local/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(JsonC DEFAULT_MSG JSONC_LIB JSONC_INC)
+mark_as_advanced(JSON_INC JSON_LIB)
+
+if(JSONC_FOUND)
+ set(JSONC_INCLUDE_DIRS ${JSONC_INC})
+ set(JSONC_LIBRARIES ${JSONC_LIB})
+endif() \ No newline at end of file
diff --git a/cmake/FindLibarchive.cmake b/cmake/FindLibarchive.cmake
new file mode 100644
index 0000000..bba3a35
--- /dev/null
+++ b/cmake/FindLibarchive.cmake
@@ -0,0 +1,41 @@
+#
+# LIBARCHIVE_INCLUDE_DIRS
+# LIBARCHIVE_LIBRARIES
+
+find_package(PkgConfig QUIET)
+if (PKG_CONFIG_FOUND)
+ pkg_check_modules(_LIBARCHIVE QUIET libarchive)
+endif()
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(_lib_suffix 64)
+else()
+ set(_lib_suffix 32)
+endif()
+
+find_path(LIBARCHIVE_INC
+ NAMES archive.h archive_entry.h
+ HINTS
+ ENV libarcguvePath${_lib_suffix}
+ ENV libarcguvePath
+ ${_JSONC_INCLUDE_DIRS}
+ PATHS
+ /usr/include /usr/local/include)
+
+find_library(LIBARCHIVE_LIB
+ NAMES ${_LIBARCHIVE_LIBRARIES} archive
+ HINTS
+ ENV libarcguvePath${_lib_suffix}
+ ENV libarcguvePath
+ ${_LIBARCHIVE_LIBRARY_DIRS}
+ PATHS
+ /usr/lib /usr/local/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Libarchive DEFAULT_MSG LIBARCHIVE_LIB LIBARCHIVE_INC)
+mark_as_advanced(LIBARCHIVE_INC LIBARCHIVE_LIB)
+
+if(LIBARCHIVE_FOUND)
+ set(LIBARCHIVE_INCLUDE_DIRS ${LIBARCHIVE_INC})
+ set(LIBARCHIVE_LIBRARIES ${LIBARCHIVE_LIB})
+endif() \ No newline at end of file
diff --git a/cmake/FindLibcurl.cmake b/cmake/FindLibcurl.cmake
new file mode 100644
index 0000000..9be1b9d
--- /dev/null
+++ b/cmake/FindLibcurl.cmake
@@ -0,0 +1,41 @@
+#
+# LIBCURL_INCLUDE_DIRS
+# LIBCURL_LIBRARIES
+
+find_package(PkgConfig QUIET)
+if (PKG_CONFIG_FOUND)
+ pkg_check_modules(_CURL QUIET curl)
+endif()
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(_lib_suffix 64)
+else()
+ set(_lib_suffix 32)
+endif()
+
+find_path(CURL_INC
+ NAMES curl/curl.h
+ HINTS
+ ENV curlPath${_lib_suffix}
+ ENV curlPath
+ ${_CURL_INCLUDE_DIRS}
+ PATHS
+ /usr/include /usr/local/include)
+
+find_library(CURL_LIB
+ NAMES ${_CURL_LIBRARIES} curl libcurl
+ HINTS
+ ENV curlPath${_lib_suffix}
+ ENV curlPath
+ ${_CURL_LIBRARY_DIRS}
+ PATHS
+ /usr/lib /usr/local/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Libcurl DEFAULT_MSG CURL_LIB CURL_INC)
+mark_as_advanced(CURL_INC CURL_LIB)
+
+if(LIBCURL_FOUND)
+ set(LIBCURL_INCLUDE_DIRS ${CURL_INC})
+ set(LIBCURL_LIBRARIES ${CURL_LIB})
+endif() \ No newline at end of file
diff --git a/meson.build b/meson.build
deleted file mode 100644
index c4d1bff..0000000
--- a/meson.build
+++ /dev/null
@@ -1,39 +0,0 @@
-project(
- 'polecat',
- 'c',
- default_options : [
- 'buildtype=debugoptimized',
- ],
- license : 'MIT',
- version : '0.1.5',
-)
-
-libarchive_dep = dependency('libarchive')
-libcurl_dep = dependency('libcurl')
-libjson_c_dep = dependency('json-c')
-
-conf_data = configuration_data()
-conf_data.set_quoted('NAME', meson.project_name())
-conf_data.set_quoted('VERSION', meson.project_version())
-if get_option('release')
- conf_data.set('NDEBUG', true)
-else
- conf_data.set('DEBUG', true)
-endif
-configure_file(output : 'polecat-config.h', configuration : conf_data)
-
-conf_inc = include_directories('.')
-
-run_target(
- 'loc',
- command : [
- 'sh',
- '-c',
- 'find src'
- + ' -type f'
- + ' -name "*.cpp" -o -name "*.c" -o -name "*.h" -o -name "*.hpp"'
- + ' | xargs wc -l',
- ],
-)
-
-subdir('src')
diff --git a/meson_options.txt b/meson_options.txt
deleted file mode 100644
index 386d85f..0000000
--- a/meson_options.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-option(
- 'release',
- type : 'boolean',
- value : false,
- description : 'Release build'
-)
diff --git a/src/common.c b/src/common.c
index c2691fe..352a706 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1,4 +1,3 @@
-#include <polecat-config.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/config.c b/src/config.c
index 26c775a..0126646 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1,4 +1,3 @@
-#include <polecat-config.h>
#include <string.h>
#include <stdio.h>
diff --git a/src/dxvk.c b/src/dxvk.c
index da78851..b4b4fd9 100644
--- a/src/dxvk.c
+++ b/src/dxvk.c
@@ -1,8 +1,7 @@
-#include <polecat-config.h>
#include <stdio.h>
#include <string.h>
-#include <json.h>
+#include <json-c/json.h>
#include <libgen.h>
#include <linux/limits.h>
diff --git a/src/lutris.c b/src/lutris.c
index b06ce40..aa3e085 100644
--- a/src/lutris.c
+++ b/src/lutris.c
@@ -1,4 +1,3 @@
-#include <polecat-config.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/lutris.h b/src/lutris.h
index f3f648d..f3db00f 100644
--- a/src/lutris.h
+++ b/src/lutris.h
@@ -1,7 +1,7 @@
#ifndef LUTRIS_H
#define LUTRIS_H
-#include <json.h>
+#include <json-c/json.h>
enum keyword {
MOVE = 0,
diff --git a/src/main.c b/src/main.c
index 78ad4fe..03dc73c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,4 +1,3 @@
-#include <polecat-config.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/meson.build b/src/meson.build
deleted file mode 100644
index 06aae89..0000000
--- a/src/meson.build
+++ /dev/null
@@ -1,28 +0,0 @@
-polecat_deps = [libarchive_dep, libcurl_dep, libjson_c_dep]
-
-polecat_sources = files(
- 'common.c',
- 'common.h',
- 'config.c',
- 'config.h',
- 'dxvk.c',
- 'dxvk.h',
- 'lutris.c',
- 'lutris.h',
- 'main.c',
- 'main.h',
- 'net.c',
- 'net.h',
- 'tar.c',
- 'tar.h',
- 'wine.c',
- 'wine.h',
-)
-
-executable(
- 'polecat',
- polecat_sources,
- dependencies : polecat_deps,
- include_directories : conf_inc,
- install : true,
-)
diff --git a/src/net.c b/src/net.c
index 1a9cbdd..5fb1093 100644
--- a/src/net.c
+++ b/src/net.c
@@ -1,11 +1,10 @@
-#include <polecat-config.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <curl/curl.h>
-#include <json.h>
+#include <json-c/json.h>
#include "net.h"
#include "common.h"
diff --git a/src/net.h b/src/net.h
index 91f6828..5bc5c6e 100644
--- a/src/net.h
+++ b/src/net.h
@@ -1,7 +1,7 @@
#ifndef NET_H
#define NET_H
-#include <json.h>
+#include <json-c/json.h>
size_t WriteMemoryCallback(void*, size_t, size_t, void*);
struct MemoryStruct* downloadToRam(const char* URL);
diff --git a/src/tar.c b/src/tar.c
index 9e6d499..1ffdbe8 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -1,4 +1,3 @@
-#include <polecat-config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/wine.c b/src/wine.c
index 16de494..28f523f 100644
--- a/src/wine.c
+++ b/src/wine.c
@@ -1,9 +1,8 @@
-#include <polecat-config.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <json.h>
+#include <json-c/json.h>
#include <libgen.h>
#include <unistd.h>
#include <linux/limits.h>