avrdude: Fix: Generate the embedded conf in the bin dir, remove from repo

The generated file avrdude-slic3r.conf.h is not kept in repo any longer
- it was causing trouble for git diffing.
It's now generated in $CMAKE_CURRENT_BINARY_DIR and included from there.

The file embeds avrdude-slic3r.conf so that the conf doesn't need to
be loaded from disk.
This commit is contained in:
Vojtech Kral 2019-08-20 15:12:32 +02:00
parent 53939796a6
commit 03079d4928
3 changed files with 7 additions and 1192 deletions

View file

@ -85,13 +85,13 @@ add_executable(avrdude-conf-gen conf-generate.cpp)
# Config file embedding
add_custom_command(
DEPENDS avrdude-conf-gen ${CMAKE_CURRENT_SOURCE_DIR}/avrdude-slic3r.conf
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/avrdude-slic3r.conf.h
COMMAND $<TARGET_FILE:avrdude-conf-gen> avrdude-slic3r.conf avrdude_slic3r_conf avrdude-slic3r.conf.h
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/avrdude-slic3r.conf.h
COMMAND $<TARGET_FILE:avrdude-conf-gen> avrdude-slic3r.conf avrdude_slic3r_conf ${CMAKE_CURRENT_BINARY_DIR}/avrdude-slic3r.conf.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(gen_conf_h
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/avrdude-slic3r.conf.h
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/avrdude-slic3r.conf.h
)
add_library(avrdude STATIC ${AVRDUDE_SOURCES})
@ -103,6 +103,9 @@ target_link_libraries(avrdude-slic3r avrdude)
encoding_check(avrdude)
encoding_check(avrdude-slic3r)
# Make avrdude-slic3r.conf.h includable:
target_include_directories(avrdude SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
if (WIN32)
target_compile_definitions(avrdude PRIVATE WIN32NATIVE=1)
if(MSVC)

File diff suppressed because it is too large Load diff

View file

@ -21,7 +21,7 @@ int main(int argc, char const *argv[])
std::cerr << "Cannot read file: " << filename_in << std::endl;
}
std::fstream output(filename_out, std::ios::out | std::ios::trunc | std::ios::binary);
std::fstream output(filename_out, std::ios::out | std::ios::trunc);
if (!output.good()) {
std::cerr << "Cannot open output file: " << filename_out << std::endl;
}