Build UI in a new generated dir
This commit is contained in:
@ -1,37 +1,38 @@
|
|||||||
# Copyright (c) 2022 Dominic Masters
|
# Copyright (c) 2022 Dominic Masters
|
||||||
#
|
#
|
||||||
# This software is released under the MIT License.
|
# This software is released under the MIT License.
|
||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
set(CMAKE_C_STANDARD 99)
|
set(CMAKE_C_STANDARD 99)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
||||||
|
|
||||||
# Initialize Project First.
|
# Initialize Project First.
|
||||||
project(Dawn
|
project(Dawn
|
||||||
VERSION 1.0.0
|
VERSION 1.0.0
|
||||||
LANGUAGES C CXX
|
LANGUAGES C CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set Common Build Variables
|
# Set Common Build Variables
|
||||||
set(DAWN_ROOT_DIR "${CMAKE_SOURCE_DIR}")
|
set(DAWN_ROOT_DIR "${CMAKE_SOURCE_DIR}")
|
||||||
set(DAWN_BUILD_DIR "${CMAKE_BINARY_DIR}")
|
set(DAWN_BUILD_DIR "${CMAKE_BINARY_DIR}")
|
||||||
set(DAWN_TOOLS_DIR "${DAWN_ROOT_DIR}/tools")
|
set(DAWN_TOOLS_DIR "${DAWN_ROOT_DIR}/tools")
|
||||||
set(DAWN_ASSETS_SOURCE_DIR "${DAWN_ROOT_DIR}/assets")
|
set(DAWN_ASSETS_SOURCE_DIR "${DAWN_ROOT_DIR}/assets")
|
||||||
set(DAWN_ASSETS_BUILD_DIR "${DAWN_BUILD_DIR}/assets")
|
set(DAWN_ASSETS_BUILD_DIR "${DAWN_BUILD_DIR}/assets")
|
||||||
set(DAWN_TEMP_DIR "${DAWN_BUILD_DIR}/temp")
|
set(DAWN_GENERATED_DIR "${DAWN_BUILD_DIR}/generated")
|
||||||
|
set(DAWN_TEMP_DIR "${DAWN_BUILD_DIR}/temp")
|
||||||
# Variable Caches
|
|
||||||
set(DAWN_CACHE_TARGET "Target")
|
# Variable Caches
|
||||||
|
set(DAWN_CACHE_TARGET "Target")
|
||||||
# Add CMake Tools
|
|
||||||
add_subdirectory(cmake)
|
# Add CMake Tools
|
||||||
|
add_subdirectory(cmake)
|
||||||
# Add Libraries
|
|
||||||
add_subdirectory(lib)
|
# Add Libraries
|
||||||
|
add_subdirectory(lib)
|
||||||
# Add Project Files
|
|
||||||
|
# Add Project Files
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
@ -39,12 +39,12 @@ endfunction()
|
|||||||
# UI Tool
|
# UI Tool
|
||||||
function(tool_ui target in)
|
function(tool_ui target in)
|
||||||
add_custom_target(${target}
|
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}"
|
COMMENT "Generating ui ${target} from ${in}"
|
||||||
DEPENDS uigen
|
DEPENDS uigen
|
||||||
)
|
)
|
||||||
target_include_directories(${DAWN_TARGET_NAME}
|
target_include_directories(${DAWN_TARGET_NAME}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${DAWN_ASSETS_BUILD_DIR}
|
${DAWN_GENERATED_DIR}/ui
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
@ -187,15 +187,10 @@ int main(int argc, char *args[]) {
|
|||||||
return 1;
|
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.
|
// Open input file.
|
||||||
|
char fileIn[FILENAME_MAX];
|
||||||
|
fileNormalizeSlashes(args[1]);
|
||||||
|
sprintf(fileIn, "%s", args[1]);
|
||||||
FILE *fin = fopen(fileIn, "rb");
|
FILE *fin = fopen(fileIn, "rb");
|
||||||
if(fin == NULL) {
|
if(fin == NULL) {
|
||||||
std::cout << "Failed to open input file " << fileIn << std::endl;
|
std::cout << "Failed to open input file " << fileIn << std::endl;
|
||||||
@ -327,9 +322,13 @@ int main(int argc, char *args[]) {
|
|||||||
bufferOut += " };\n";
|
bufferOut += " };\n";
|
||||||
bufferOut += "}";
|
bufferOut += "}";
|
||||||
|
|
||||||
// Finished with XML data, now we can write data out.
|
|
||||||
xmlDispose(&xml);
|
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");
|
FILE *fout = fopen(fileOut, "wb");
|
||||||
if(fout == NULL) {
|
if(fout == NULL) {
|
||||||
std::cout << "Failed to open output file." << std::endl;
|
std::cout << "Failed to open output file." << std::endl;
|
||||||
|
Reference in New Issue
Block a user