Permalink
Browse files

Cleaned up spaces/tabs and reformatted some calls

  • Loading branch information...
1 parent 4771b59 commit 3ac1450d019f6568ad167e7b25930f9297ec89c6 @jakobwesthoff committed Dec 15, 2009
Showing with 68 additions and 53 deletions.
  1. +68 −53 vala/ValaPrecompile.cmake
View
@@ -78,64 +78,79 @@ find_package(Vala)
# an example to every of the optional sections:
#
# vala_precompile(VALA_C
-# source1.vala
-# source2.vala
-# source3.vala
-# PACKAGES
-# gtk+-2.0
-# gio-1.0
-# posix
-# OPTIONS
-# --thread
-# CUSTOM_VAPIS
-# some_vapi.vapi
-# GENERATE_VAPI
-# myvapi
-# GENERATE_HEADER
-# myheader
+# source1.vala
+# source2.vala
+# source3.vala
+# PACKAGES
+# gtk+-2.0
+# gio-1.0
+# posix
+# OPTIONS
+# --thread
+# CUSTOM_VAPIS
+# some_vapi.vapi
+# GENERATE_VAPI
+# myvapi
+# GENERATE_HEADER
+# myheader
+# )
+#
+# Most important is the variable VALA_C which will contain all the generated c
+# file names after the call.
##
macro(vala_precompile output)
- include_directories(${CMAKE_CURRENT_BINARY_DIR})
- parse_arguments(ARGS "PACKAGES;OPTIONS;GENERATE_HEADER;GENERATE_VAPI;CUSTOM_VAPIS" "" ${ARGN})
- set(vala_pkg_opts "")
- foreach(pkg ${ARGS_PACKAGES})
- list(APPEND vala_pkg_opts "--pkg=${pkg}")
- endforeach(pkg ${ARGS_PACKAGES})
- set(in_files "")
- set(out_files "")
- set(${output} "")
- foreach(src ${ARGS_DEFAULT_ARGS})
- list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
- string(REPLACE ".vala" ".c" src ${src})
- set(out_file "${CMAKE_CURRENT_BINARY_DIR}/${src}")
- list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${src}")
- list(APPEND ${output} ${out_file})
- endforeach(src ${ARGS_DEFAULT_ARGS})
-
- set(vapi_arguments "")
- if(ARGS_GENERATE_VAPI)
- list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${ARGS_GENERATE_VAPI}.vapi")
- set(vapi_arguments "--internal-vapi=${ARGS_GENERATE_VAPI}.vapi")
+ include_directories(${CMAKE_CURRENT_BINARY_DIR})
+ parse_arguments(ARGS "PACKAGES;OPTIONS;GENERATE_HEADER;GENERATE_VAPI;CUSTOM_VAPIS" "" ${ARGN})
+ set(vala_pkg_opts "")
+ foreach(pkg ${ARGS_PACKAGES})
+ list(APPEND vala_pkg_opts "--pkg=${pkg}")
+ endforeach(pkg ${ARGS_PACKAGES})
+ set(in_files "")
+ set(out_files "")
+ set(${output} "")
+ foreach(src ${ARGS_DEFAULT_ARGS})
+ list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
+ string(REPLACE ".vala" ".c" src ${src})
+ set(out_file "${CMAKE_CURRENT_BINARY_DIR}/${src}")
+ list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${src}")
+ list(APPEND ${output} ${out_file})
+ endforeach(src ${ARGS_DEFAULT_ARGS})
- # Header and internal header is needed to generate internal vapi
- if (NOT ARGS_GENERATE_HEADER)
- set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI})
- endif(NOT ARGS_GENERATE_HEADER)
- endif(ARGS_GENERATE_VAPI)
+ set(vapi_arguments "")
+ if(ARGS_GENERATE_VAPI)
+ list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${ARGS_GENERATE_VAPI}.vapi")
+ set(vapi_arguments "--internal-vapi=${ARGS_GENERATE_VAPI}.vapi")
- set(header_arguments "")
- if(ARGS_GENERATE_HEADER)
- list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${ARGS_GENERATE_HEADER}.h")
- list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${ARGS_GENERATE_HEADER}_internal.h")
- list(APPEND header_arguments "--header=${ARGS_GENERATE_HEADER}.h")
- list(APPEND header_arguments "--internal-header=${ARGS_GENERATE_HEADER}_internal.h")
- endif(ARGS_GENERATE_HEADER)
+ # Header and internal header is needed to generate internal vapi
+ if (NOT ARGS_GENERATE_HEADER)
+ set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI})
+ endif(NOT ARGS_GENERATE_HEADER)
+ endif(ARGS_GENERATE_VAPI)
+ set(header_arguments "")
+ if(ARGS_GENERATE_HEADER)
+ list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${ARGS_GENERATE_HEADER}.h")
+ list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${ARGS_GENERATE_HEADER}_internal.h")
+ list(APPEND header_arguments "--header=${ARGS_GENERATE_HEADER}.h")
+ list(APPEND header_arguments "--internal-header=${ARGS_GENERATE_HEADER}_internal.h")
+ endif(ARGS_GENERATE_HEADER)
- add_custom_command(OUTPUT ${out_files}
- COMMAND ${VALA_EXECUTABLE} ARGS "-C" ${header_arguments} ${vapi_arguments}
- "-b" ${CMAKE_CURRENT_SOURCE_DIR} "-d" ${CMAKE_CURRENT_BINARY_DIR}
- ${vala_pkg_opts} ${ARGS_OPTIONS} ${in_files} ${ARGS_CUSTOM_VAPIS}
- DEPENDS ${in_files} ${ARGS_CUSTOM_VAPIS})
+ add_custom_command(OUTPUT ${out_files}
+ COMMAND
+ ${VALA_EXECUTABLE}
+ ARGS
+ "-C"
+ ${header_arguments}
+ ${vapi_arguments}
+ "-b" ${CMAKE_CURRENT_SOURCE_DIR}
+ "-d" ${CMAKE_CURRENT_BINARY_DIR}
+ ${vala_pkg_opts}
+ ${ARGS_OPTIONS}
+ ${in_files}
+ ${ARGS_CUSTOM_VAPIS}
+ DEPENDS
+ ${in_files}
+ ${ARGS_CUSTOM_VAPIS}
+ )
endmacro(vala_precompile)

0 comments on commit 3ac1450

Please sign in to comment.