mirror of
https://github.com/lakinduakash/linux-wifi-hotspot.git
synced 2024-11-21 19:40:11 +00:00
Create makefile with proper install
This commit is contained in:
parent
3069f56777
commit
8fe3d6dd45
9
Makefile
9
Makefile
@ -1,13 +1,14 @@
|
|||||||
PREFIX=/usr
|
|
||||||
MANDIR=$(PREFIX)/share/man
|
|
||||||
BINDIR=$(PREFIX)/bin
|
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@echo "Run 'make install' for installation."
|
@echo "Run 'make install' for installation."
|
||||||
@echo "Run 'make uninstall' for uninstallation."
|
@echo "Run 'make uninstall' for uninstallation."
|
||||||
|
mkdir -p build
|
||||||
|
cd build && cmake -G "CodeBlocks - Unix Makefiles" ../src
|
||||||
|
$(MAKE) -C build
|
||||||
|
|
||||||
install:
|
install:
|
||||||
$(MAKE) -C src/scripts install
|
$(MAKE) -C src/scripts install
|
||||||
|
$(MAKE) -C build install_build
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
$(MAKE) -C src/scripts uninstall
|
$(MAKE) -C src/scripts uninstall
|
||||||
|
$(MAKE) -C build uninstall_build
|
||||||
|
@ -12,15 +12,35 @@ set (CMAKE_CXX_STANDARD 11)
|
|||||||
|
|
||||||
add_executable(wihotspot ui/main.c ui/h_prop.c ui/h_prop.h ui/ui.c ui/ui.h ui/read_config.cpp ui/read_config.h ui/util.c ui/util.h)
|
add_executable(wihotspot ui/main.c ui/h_prop.c ui/h_prop.h ui/ui.c ui/ui.h ui/read_config.cpp ui/read_config.h ui/util.c ui/util.h)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} ${GTK_LIBRARIES} ${X11_LIBRARIES} )
|
target_link_libraries(${PROJECT_NAME} ${GTK_LIBRARIES} ${X11_LIBRARIES})
|
||||||
|
|
||||||
include_directories(/usr/include)
|
include_directories(/usr/include)
|
||||||
|
|
||||||
set (source "${CMAKE_SOURCE_DIR}/ui/glade")
|
set (source "${CMAKE_SOURCE_DIR}/ui/glade")
|
||||||
set (destination "${CMAKE_CURRENT_BINARY_DIR}/glade")
|
set (destination "${CMAKE_CURRENT_BINARY_DIR}/glade")
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${PROJECT_NAME} POST_BUILD
|
TARGET ${PROJECT_NAME} POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${source} ${destination}
|
COMMAND ${CMAKE_COMMAND} -E create_symlink ${source} ${destination}
|
||||||
DEPENDS ${destination}
|
DEPENDS ${destination}
|
||||||
COMMENT "symbolic link resources folder from ${source} => ${destination}"
|
COMMENT "symbolic link resources folder from ${source} => ${destination}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set (appdir "/usr/share")
|
||||||
|
set (appbin "/usr/bin")
|
||||||
|
|
||||||
|
add_custom_target(install_build
|
||||||
|
COMMAND mkdir -p ${appdir}/${PROJECT_NAME}
|
||||||
|
COMMAND mkdir -p ${appdir}/${PROJECT_NAME}/glade
|
||||||
|
COMMAND install -Dm755 ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME} ${appdir}/${PROJECT_NAME}/${PROJECT_NAME}
|
||||||
|
COMMAND install -Dm755 ${CMAKE_CURRENT_BINARY_DIR}/glade/* ${appdir}/${PROJECT_NAME}/glade/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E create_symlink ${appdir}/${PROJECT_NAME}/${PROJECT_NAME} ${appbin}/${PROJECT_NAME}
|
||||||
|
DEPENDS ${PROJECT_NAME}
|
||||||
|
COMMENT Installing files...
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(uninstall_build
|
||||||
|
COMMAND rm -r ${appdir}/${PROJECT_NAME}
|
||||||
|
COMMAND rm -f ${appbin}/${PROJECT_NAME}
|
||||||
|
COMMENT Unstalling files...
|
||||||
|
)
|
29
src/ui/ui.c
29
src/ui/ui.c
@ -54,9 +54,7 @@ guint id;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void *stopHp();
|
static void *stopHp() {
|
||||||
|
|
||||||
void *stopHp() {
|
|
||||||
if(running_info[0]!=NULL){
|
if(running_info[0]!=NULL){
|
||||||
gtk_label_set_label(label_status,"Stopping ...");
|
gtk_label_set_label(label_status,"Stopping ...");
|
||||||
start_pb_pulse();
|
start_pb_pulse();
|
||||||
@ -108,13 +106,32 @@ int initUi(int argc, char *argv[]){
|
|||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
|
|
||||||
/* Construct a GtkBuilder instance and load our UI description */
|
/* Construct a GtkBuilder instance and load our UI description */
|
||||||
|
const char* debug_glade_file="glade/wifih.ui";
|
||||||
|
const char* prod_glade_file="/usr/share/wihotspot/glade/wifih.ui";
|
||||||
|
|
||||||
|
FILE *file;
|
||||||
builder = gtk_builder_new();
|
builder = gtk_builder_new();
|
||||||
if (gtk_builder_add_from_file(builder, "glade/wifih.ui", &error) == 0) {
|
|
||||||
g_printerr("Error loading file: %s\n", error->message);
|
if ((file = fopen(debug_glade_file, "r"))){
|
||||||
g_clear_error(&error);
|
fclose(file);
|
||||||
|
if (gtk_builder_add_from_file(builder, debug_glade_file, &error) == 0) {
|
||||||
|
g_printerr("Error loading file: %s\n", error->message);
|
||||||
|
g_clear_error(&error);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((file = fopen(prod_glade_file, "r"))){
|
||||||
|
fclose(file);
|
||||||
|
if (gtk_builder_add_from_file(builder, prod_glade_file, &error) == 0) {
|
||||||
|
g_printerr("Error loading file: %s\n", error->message);
|
||||||
|
g_clear_error(&error);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} else{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Connect signal handlers to the constructed widgets. */
|
/* Connect signal handlers to the constructed widgets. */
|
||||||
window = gtk_builder_get_object(builder, "window");
|
window = gtk_builder_get_object(builder, "window");
|
||||||
g_signal_connect (window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
|
g_signal_connect (window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
|
||||||
|
@ -32,4 +32,6 @@ static guint start_pb_pulse();
|
|||||||
|
|
||||||
static void on_create_hp_clicked(GtkWidget *widget,gpointer data);
|
static void on_create_hp_clicked(GtkWidget *widget,gpointer data);
|
||||||
|
|
||||||
|
static void *stopHp();
|
||||||
|
|
||||||
#endif //WIHOTSPOT_UI_H
|
#endif //WIHOTSPOT_UI_H
|
||||||
|
Loading…
Reference in New Issue
Block a user