diff --git a/CMakeLists.txt b/CMakeLists.txt index d16b76be..86b327ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,37 +1,38 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -cmake_minimum_required(VERSION 3.13) -set(CMAKE_C_STANDARD 99) -set(CMAKE_C_STANDARD_REQUIRED ON) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED True) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") - -# Initialize Project First. -project(Dawn - VERSION 1.0.0 - LANGUAGES C CXX -) - -# Set Common Build Variables -set(DAWN_ROOT_DIR "${CMAKE_SOURCE_DIR}") -set(DAWN_BUILD_DIR "${CMAKE_BINARY_DIR}") -set(DAWN_TOOLS_DIR "${DAWN_ROOT_DIR}/tools") -set(DAWN_ASSETS_SOURCE_DIR "${DAWN_ROOT_DIR}/assets") -set(DAWN_ASSETS_BUILD_DIR "${DAWN_BUILD_DIR}/assets") -set(DAWN_TEMP_DIR "${DAWN_BUILD_DIR}/temp") - -# Variable Caches -set(DAWN_CACHE_TARGET "Target") - -# Add CMake Tools -add_subdirectory(cmake) - -# Add Libraries -add_subdirectory(lib) - -# Add Project Files +# Copyright (c) 2022 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +cmake_minimum_required(VERSION 3.13) +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") + +# Initialize Project First. +project(Dawn + VERSION 1.0.0 + LANGUAGES C CXX +) + +# Set Common Build Variables +set(DAWN_ROOT_DIR "${CMAKE_SOURCE_DIR}") +set(DAWN_BUILD_DIR "${CMAKE_BINARY_DIR}") +set(DAWN_TOOLS_DIR "${DAWN_ROOT_DIR}/tools") +set(DAWN_ASSETS_SOURCE_DIR "${DAWN_ROOT_DIR}/assets") +set(DAWN_ASSETS_BUILD_DIR "${DAWN_BUILD_DIR}/assets") +set(DAWN_GENERATED_DIR "${DAWN_BUILD_DIR}/generated") +set(DAWN_TEMP_DIR "${DAWN_BUILD_DIR}/temp") + +# Variable Caches +set(DAWN_CACHE_TARGET "Target") + +# Add CMake Tools +add_subdirectory(cmake) + +# Add Libraries +add_subdirectory(lib) + +# Add Project Files add_subdirectory(src) \ No newline at end of file diff --git a/src/dawntools/display/CMakeLists.txt b/src/dawntools/display/CMakeLists.txt index a9ff41d7..c689d0df 100644 --- a/src/dawntools/display/CMakeLists.txt +++ b/src/dawntools/display/CMakeLists.txt @@ -39,12 +39,12 @@ endfunction() # UI Tool function(tool_ui target in) add_custom_target(${target} - COMMAND uigen "${DAWN_ASSETS_SOURCE_DIR}/${in}" "${DAWN_ASSETS_BUILD_DIR}/${target}" + COMMAND uigen "${DAWN_ASSETS_SOURCE_DIR}/${in}" "${DAWN_GENERATED_DIR}/ui/${target}" COMMENT "Generating ui ${target} from ${in}" DEPENDS uigen ) target_include_directories(${DAWN_TARGET_NAME} PUBLIC - ${DAWN_ASSETS_BUILD_DIR} + ${DAWN_GENERATED_DIR}/ui ) endfunction() \ No newline at end of file diff --git a/src/dawntools/display/uigen/main.cpp b/src/dawntools/display/uigen/main.cpp index fd980dcb..3f6321c3 100644 --- a/src/dawntools/display/uigen/main.cpp +++ b/src/dawntools/display/uigen/main.cpp @@ -187,15 +187,10 @@ int main(int argc, char *args[]) { return 1; } - char fileIn[FILENAME_MAX]; - char fileOut[FILENAME_MAX]; - - sprintf(fileIn, "%s", args[1]); - sprintf(fileOut, "%s.hpp", args[2]); - fileNormalizeSlashes(args[1]); - fileNormalizeSlashes(args[2]); - // Open input file. + char fileIn[FILENAME_MAX]; + fileNormalizeSlashes(args[1]); + sprintf(fileIn, "%s", args[1]); FILE *fin = fopen(fileIn, "rb"); if(fin == NULL) { std::cout << "Failed to open input file " << fileIn << std::endl; @@ -327,9 +322,13 @@ int main(int argc, char *args[]) { bufferOut += " };\n"; bufferOut += "}"; - // Finished with XML data, now we can write data out. xmlDispose(&xml); + // Finished with XML data, now we can write data out. + char fileOut[FILENAME_MAX]; + fileNormalizeSlashes(args[2]); + sprintf(fileOut, "%s.hpp", args[2]); + fileMkdirp(fileOut); FILE *fout = fopen(fileOut, "wb"); if(fout == NULL) { std::cout << "Failed to open output file." << std::endl;