Color names, sort out cmake wackiness
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_search_module(POPT REQUIRED popt)
|
||||
|
||||
add_executable(mazemaker)
|
||||
target_sources(mazemaker PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/mazemaker.c)
|
||||
target_link_libraries(mazemaker PUBLIC mazemaker_shared ${POPT_LIBRARIES})
|
||||
target_include_directories(mazemaker PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include PUBLIC ${POPT_INCLUDE_DIRS})
|
||||
target_compile_options(mazemaker PUBLIC ${POPT_CFLAGS_OTHER})
|
||||
include_directories("../include" ${POPT_INCLUDE_DIRS})
|
||||
|
||||
add_executable(mazemaker mazemaker.c)
|
||||
target_link_libraries(mazemaker mazemaker_shared ${POPT_LIBRARIES})
|
||||
|
||||
install (TARGETS mazemaker DESTINATION bin)
|
||||
|
||||
@@ -41,8 +41,18 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
mazegrid_t maze;
|
||||
mazeoptions_t* options = mazemaker_options_new();
|
||||
if (fg_color != NULL) mazemaker_options_set_wall_color(options, fg_color);
|
||||
if (bg_color != NULL) mazemaker_options_set_background_color(options, bg_color);
|
||||
if (fg_color != NULL) {
|
||||
if (0 > mazemaker_options_set_wall_color(options, fg_color)) {
|
||||
fprintf(stderr, "Unknown color: \"%s\"\n", fg_color);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (bg_color != NULL) {
|
||||
if (0 > mazemaker_options_set_background_color(options, bg_color)) {
|
||||
fprintf(stderr, "Unknown color: \"%s\"\n", bg_color);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
mazemaker_generate_maze(width, height, &maze);
|
||||
mazemaker_maze_to_png_opt(&maze, filename, options);
|
||||
mazemaker_free_maze(&maze);
|
||||
|
||||
Reference in New Issue
Block a user