commit 850ae7db43952976f805010b6565402dbb3dfc30 Author: Mario Hüttel Date: Tue Mar 31 23:44:16 2020 +0200 Init cmake structure diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bbfd30a --- /dev/null +++ b/.gitignore @@ -0,0 +1,129 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + + +# Created by https://www.gitignore.io/api/c++,cmake +# Edit at https://www.gitignore.io/?templates=c++,cmake + +### C++ ### +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +### CMake ### +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps + +### CMake Patch ### +# External projects +*-prefix/ + +# End of https://www.gitignore.io/api/c++,cmake diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..516c06c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.5) +project(gtk-graph-view-dev) + +add_subdirectory(lib) +add_subdirectory(app) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt new file mode 100644 index 0000000..0b95d9d --- /dev/null +++ b/app/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project(gtk-graph-view-app LANGUAGES C) + +aux_source_directory("src" SRC_DIR) + +add_executable(${PROJECT_NAME} ${SRC_DIR}) +target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_link_libraries(${PROJECT_NAME} gtkgraphview) +add_dependencies(${PROJECT_NAME} gtkgraphview) diff --git a/app/src/main.c b/app/src/main.c new file mode 100644 index 0000000..1c2e57d --- /dev/null +++ b/app/src/main.c @@ -0,0 +1,19 @@ +#include +#include +#include + +int main(int argc, char **argv) +{ + GtkWidget *main_window; + + printf("Hello World!\n"); + + gtk_init(&argc, &argv); + + main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_widget_show(main_window); + + gtk_main(); + + return 0; +} diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt new file mode 100644 index 0000000..7c42e86 --- /dev/null +++ b/lib/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.5) +project(gtkgraphview LANGUAGES C) + +find_package(PkgConfig REQUIRED) +pkg_search_module(GLIB REQUIRED glib-2.0) +pkg_check_modules(GTK3 REQUIRED gtk+-3.0) + +add_compile_options(-Wall -Wextra -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter) +aux_source_directory("src" SRC_DIR) + +add_library(${PROJECT_NAME} SHARED ${SRC_DIR}) +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_link_libraries(${PROJECT_NAME} PUBLIC ${GLIB_LDFLAGS} ${GTK3_LDFLAGS}) +target_link_directories(${PROJECT_NAME} PUBLIC ${GLIB_LINK_DIRS} ${GTK3_LINK_DIRS}) +target_include_directories(${PROJECT_NAME} PUBLIC ${GLIB_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS}) diff --git a/lib/include/gtk-graph-view.h b/lib/include/gtk-graph-view.h new file mode 100644 index 0000000..e69de29 diff --git a/lib/src/gtk-graph-view.c b/lib/src/gtk-graph-view.c new file mode 100644 index 0000000..fff58e5 --- /dev/null +++ b/lib/src/gtk-graph-view.c @@ -0,0 +1,6 @@ +#include + +int test() +{ + return 1; +}