aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-01 10:08:03 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-01 10:14:19 +0100
commit8950a533b414c39d9bf15b87ae57f28f5b4f154e (patch)
treef0181c991fc09c33691a449725cefcefcaad9199
parent79d2fc78ea1ab8df1bb85e19b1a1b6ee5d25cc25 (diff)
downloadlogdiag-8950a533b414c39d9bf15b87ae57f28f5b4f154e.tar.gz
logdiag-8950a533b414c39d9bf15b87ae57f28f5b4f154e.tar.xz
logdiag-8950a533b414c39d9bf15b87ae57f28f5b4f154e.zip
Don't generate marshallers in the source tree
This is much cleaner. I'm unsure of the original motivations, perhaps I just wanted to have all source files next to each other. There is no functional issue with the build directory, though.
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt43
2 files changed, 13 insertions, 31 deletions
diff --git a/.gitignore b/.gitignore
index b0705bf..143e3b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
/build
/win32-depends
-/liblogdiag/ld-marshal.[ch]
/CMakeLists.txt.user
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 843863e..98f0829 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,7 +100,7 @@ endforeach ()
# Project source files
set (liblogdiag_SOURCES
- liblogdiag/ld-marshal.c
+ ${PROJECT_BINARY_DIR}/ld-marshal.c
liblogdiag/ld-types.c
liblogdiag/ld-undo-action.c
liblogdiag/ld-diagram.c
@@ -117,9 +117,9 @@ set (liblogdiag_SOURCES
liblogdiag/ld-lua.c
liblogdiag/ld-lua-symbol.c)
set (liblogdiag_HEADERS
+ ${PROJECT_BINARY_DIR}/ld-marshal.h
${PROJECT_BINARY_DIR}/config.h
liblogdiag/liblogdiag.h
- liblogdiag/ld-marshal.h
liblogdiag/ld-types.h
liblogdiag/ld-undo-action.h
liblogdiag/ld-diagram.h
@@ -167,36 +167,19 @@ if (NOT GLIB_GENMARSHAL_EXECUTABLE)
message (FATAL_ERROR "glib-genmarshal not found")
endif ()
-function (glib_genmarshal base prefix)
- get_filename_component (base_path "${base}" PATH)
- get_filename_component (base_name "${base}" NAME)
- set (command_base ${GLIB_GENMARSHAL_EXECUTABLE}
- --prefix ${prefix} "${base_name}.list")
-
- # On Windows, the final makefile may contain:
- # cd e:\abc && ...
- # That won't actually change the directory. We have to do:
- # cd e:\abc && e: && ...
- if (WIN32 AND "${base_path}" MATCHES "^.:[/\\\\]")
- string (SUBSTRING "${base_path}" 0 2 base_drive)
- set (command_base "${base_drive}" && "${command_base}")
- endif ()
+function (glib_genmarshal listfile prefix)
+ get_filename_component (basename "${listfile}" NAME_WE)
+ set (command_base ${GLIB_GENMARSHAL_EXECUTABLE} --prefix ${prefix}
+ "${listfile}")
- # NOTE: VERBATIM would cause problems, so it is not used here
- add_custom_command (OUTPUT ${base}.c
- COMMAND ${command_base} --body > "${base_name}.c"
- DEPENDS "${base}.list"
- WORKING_DIRECTORY "${base_path}"
- COMMENT "Generating marshallers source file")
- add_custom_command (OUTPUT ${base}.h
- COMMAND ${command_base} --header > "${base_name}.h"
- DEPENDS "${base}.list"
- WORKING_DIRECTORY "${base_path}"
- COMMENT "Generating marshallers header file")
+ add_custom_command (OUTPUT ${basename}.c ${basename}.h
+ COMMAND ${command_base} --body > ${basename}.c
+ COMMAND ${command_base} --header > ${basename}.h
+ DEPENDS "${listfile}"
+ COMMENT "Generating marshallers source files" VERBATIM)
endfunction ()
-glib_genmarshal (${PROJECT_SOURCE_DIR}/liblogdiag/ld-marshal
- ld_marshal)
+glib_genmarshal (${PROJECT_SOURCE_DIR}/liblogdiag/ld-marshal.list ld_marshal)
include_directories (${PROJECT_SOURCE_DIR})
include_directories (${GTK3_INCLUDE_DIRS} ${Lua_INCLUDE_DIRS})
@@ -427,7 +410,7 @@ set (CPACK_RPM_PACKAGE_LICENSE "ISC")
set (CPACK_RPM_PACKAGE_URL "${project_URL}")
set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
-set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user;/win32-depends;/liblogdiag/ld-marshal.[ch]")
+set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user;/win32-depends")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
include (CPack)