mirror of
https://github.com/lakinduakash/linux-wifi-hotspot.git
synced 2024-11-24 21:20:12 +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:
|
||||
@echo "Run 'make install' for installation."
|
||||
@echo "Run 'make uninstall' for uninstallation."
|
||||
mkdir -p build
|
||||
cd build && cmake -G "CodeBlocks - Unix Makefiles" ../src
|
||||
$(MAKE) -C build
|
||||
|
||||
install:
|
||||
$(MAKE) -C src/scripts install
|
||||
$(MAKE) -C build install_build
|
||||
|
||||
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)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} ${GTK_LIBRARIES} ${X11_LIBRARIES} )
|
||||
target_link_libraries(${PROJECT_NAME} ${GTK_LIBRARIES} ${X11_LIBRARIES})
|
||||
|
||||
include_directories(/usr/include)
|
||||
|
||||
set (source "${CMAKE_SOURCE_DIR}/ui/glade")
|
||||
set (destination "${CMAKE_CURRENT_BINARY_DIR}/glade")
|
||||
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${source} ${destination}
|
||||
DEPENDS ${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();
|
||||
|
||||
void *stopHp() {
|
||||
static void *stopHp() {
|
||||
if(running_info[0]!=NULL){
|
||||
gtk_label_set_label(label_status,"Stopping ...");
|
||||
start_pb_pulse();
|
||||
@ -108,13 +106,32 @@ int initUi(int argc, char *argv[]){
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
/* 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();
|
||||
if (gtk_builder_add_from_file(builder, "glade/wifih.ui", &error) == 0) {
|
||||
g_printerr("Error loading file: %s\n", error->message);
|
||||
g_clear_error(&error);
|
||||
|
||||
if ((file = fopen(debug_glade_file, "r"))){
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/* Connect signal handlers to the constructed widgets. */
|
||||
window = gtk_builder_get_object(builder, "window");
|
||||
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 *stopHp();
|
||||
|
||||
#endif //WIHOTSPOT_UI_H
|
||||
|
Loading…
Reference in New Issue
Block a user