Fixed it up a little

This commit is contained in:
oneechanhax 2018-05-04 16:31:48 -05:00
parent d2d92394a7
commit f92b94d96d
2 changed files with 26 additions and 7 deletions

BIN
cmake-embed Normal file

Binary file not shown.

View File

@ -1,23 +1,42 @@
# #
# #
# Purpose, make a macro to automaticly convert files to headers with cross platform support # Purpose, make a macro to automaticly convert files to headers for inclusion with cross platform support
# #
# #
# TODO, fix embed adding cmake-embed target but not compiling the headers with the command
# FIX, just compile the embed program and make your stuff manually
set(embed_target_dir ${CMAKE_CURRENT_LIST_DIR})
macro(embed_files) macro(embed_files)
set(args ${ARGN})
if(NOT TARGET cmake-embed) if(NOT TARGET cmake-embed)
project(cmake-embed) project(cmake-embed)
add_executable(nekohook embed.cpp) add_executable(cmake-embed ${embed_target_dir}/embed.cpp)
endif() endif()
for() foreach(i ${ARGN})
foreach(i IN LISTS ARGN)
get_filename_component(WORKING_DIR ${i} DIRECTORY) get_filename_component(WORKING_DIR ${i} DIRECTORY)
add_custom_command( add_custom_command(
TARGET ${i}.h TARGET ${project}
PRE_BUILD PRE_BUILD
cmake-embed "${i}" "${i}.h" COMMAND "cmake-embed ${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i} ${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i}.h"
WORKING_DIRECTORY ${WORKING_DIR} DEPENDS ${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i}
COMMENT "Generating header for: ${i}.h"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM
) )
#add_dependencies(${project} "${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i}.h")
endforeach() endforeach()
endmacro() endmacro()
# add_custom_command that doesnt really let us make it a dependancy of
#add_custom_command(
# COMMAND "cmake-embed ${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i} ${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i}.h"
# DEPENDS cmake-embed
# DEPENDS ${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i}
# COMMENT "Generating header for: ${i}.h"
# OUTPUT "${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i}.h"
# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
# VERBATIM
#)