Convert main source file from Vala to C

Bindings are incredible pain, this will be much easier.
This commit is contained in:
2020-09-23 14:12:58 +02:00
parent 0d35950715
commit 60bfaa1a97
11 changed files with 556 additions and 690 deletions

View File

@@ -33,19 +33,20 @@ pkg_check_modules (dependencies REQUIRED gtk+-3.0 sqlite3 x11 xext xextproto)
# Precompile Vala sources
include (ValaPrecompile)
set (config_path "${PROJECT_BINARY_DIR}/config.vala")
configure_file (${PROJECT_SOURCE_DIR}/config.vala.in "${config_path}")
set (config_path "${PROJECT_BINARY_DIR}/config.h")
configure_file (${PROJECT_SOURCE_DIR}/config.h.in "${config_path}")
include_directories ("${PROJECT_BINARY_DIR}")
# I'm not sure what this was about, look at slovnik-gui for more comments;
# seems to be so that symbols are exported for GModule to see
set (symbols_path "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.def")
set (symbols_path "${PROJECT_BINARY_DIR}/gui.def")
set (project_VALA_SOURCES ${config_path} ${PROJECT_NAME}.vala xext.vapi)
set (project_VALA_SOURCES gui.vala config.vapi)
vala_precompile (${project_VALA_SOURCES}
OUTPUTS project_VALA_C
HEADER ${PROJECT_NAME}.h
HEADER gui.h
SYMBOLS ${symbols_path}
PACKAGES posix gmodule-2.0 gio-2.0 gio-unix-2.0 gtk+-3.0 gee-0.8 sqlite3 x11)
PACKAGES gmodule-2.0 gtk+-3.0 gee-0.8 sqlite3)
# Include Vala sources as header files, so they appear in the IDE
# but CMake doesn't try to compile them directly
@@ -56,7 +57,7 @@ set (project_SOURCES ${project_VALA_SOURCES} ${project_VALA_C} ${symbols_path})
# Build the executable and install it
include_directories (${dependencies_INCLUDE_DIRS})
link_directories (${dependencies_LIBRARY_DIRS})
add_executable (${PROJECT_NAME} ${project_SOURCES})
add_executable (${PROJECT_NAME} ${PROJECT_NAME}.c ${project_SOURCES})
target_link_libraries (${PROJECT_NAME} ${dependencies_LIBRARIES})
install (TARGETS ${PROJECT_NAME} DESTINATION bin)