From 321cd275ee942b5fd0c8144dbf854bb88e83cbb7 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 13 Oct 2019 00:05:13 +0100 Subject: [PATCH] Separate list devices for Linux. --- CMakeLists.txt | 8 +++++++- linux/linux.h | 25 +++++++++++++++++++++++++ linux/list_devices.c | 23 +++++++++++++++++++++++ list_devices.c | 8 ++++++++ 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 linux/linux.h create mode 100644 linux/list_devices.c diff --git a/CMakeLists.txt b/CMakeLists.txt index bfe584b..ed0c129 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,4 +3,10 @@ project(dicremote C) set(CMAKE_C_STANDARD 90) -add_executable(dicremote main.c list_devices.c) \ No newline at end of file +set(PLATFORM_SOURCES ) + +IF("${CMAKE_SYSTEM}" MATCHES "Linux") + list(APPEND PLATFORM_SOURCES linux/list_devices.c linux/linux.h) +endif() + +add_executable(dicremote main.c list_devices.c ${PLATFORM_SOURCES}) \ No newline at end of file diff --git a/linux/linux.h b/linux/linux.h new file mode 100644 index 0000000..e78cbc7 --- /dev/null +++ b/linux/linux.h @@ -0,0 +1,25 @@ +/* + * This file is part of the DiscImageChef Remote Server. + * Copyright (c) 2019 Natalia Portillo. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef DICREMOTE_LINUX_H +#define DICREMOTE_LINUX_H + +#include "../dicmote.h" + +DeviceInfoList* linux_list_devices(); + +#endif // DICREMOTE_LINUX_H diff --git a/linux/list_devices.c b/linux/list_devices.c new file mode 100644 index 0000000..274add5 --- /dev/null +++ b/linux/list_devices.c @@ -0,0 +1,23 @@ +/* + * This file is part of the DiscImageChef Remote Server. + * Copyright (c) 2019 Natalia Portillo. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "../dicmote.h" + +DeviceInfoList* linux_list_devices() +{ + return 0; +} \ No newline at end of file diff --git a/list_devices.c b/list_devices.c index 54badca..33ec03f 100644 --- a/list_devices.c +++ b/list_devices.c @@ -17,7 +17,15 @@ #include "dicmote.h" +#if defined(__linux__) && !defined(__ANDROID__) +#include "linux/linux.h" +#endif + DeviceInfoList* ListDevices() { +#if defined(__linux__) && !defined(__ANDROID__) + return linux_list_devices(); +#else return 0; +#endif } \ No newline at end of file