Embedded Resources: Fix for Ninja 1.9
Refactor to break circular references. New custom target generates the resource files. FGFS and Test_Suite targets declare a dependency to the generated files.
This commit is contained in:
parent
be628b36b7
commit
a9365cd34e
4 changed files with 25 additions and 10 deletions
|
@ -25,12 +25,4 @@ function(setup_fgfs_embedded_resources)
|
||||||
"Either MSVC_3RDPARTY_ROOT or MSVC_3RDPARTY_DIR is empty or unset")
|
"Either MSVC_3RDPARTY_ROOT or MSVC_3RDPARTY_DIR is empty or unset")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.cxx
|
|
||||||
${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx
|
|
||||||
COMMAND fgrcc --root=${CMAKE_SOURCE_DIR} --output-cpp-file=${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.cxx --init-func-name=initFlightGearEmbeddedResources --output-header-file=${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx --output-header-identifier=_FG_FLIGHTGEAR_EMBEDDED_RESOURCES ${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml
|
|
||||||
DEPENDS
|
|
||||||
fgrcc ${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml
|
|
||||||
)
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -1,2 +1,18 @@
|
||||||
add_executable(fgrcc fgrcc.cxx fgrcc.hxx)
|
add_executable(fgrcc fgrcc.cxx fgrcc.hxx)
|
||||||
target_link_libraries(fgrcc SimGearCore ${PLATFORM_LIBS})
|
target_link_libraries(fgrcc SimGearCore ${PLATFORM_LIBS})
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
embeddedresources
|
||||||
|
COMMAND
|
||||||
|
fgrcc --root=${CMAKE_SOURCE_DIR}
|
||||||
|
--output-cpp-file=${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.cxx
|
||||||
|
--init-func-name=initFlightGearEmbeddedResources
|
||||||
|
--output-header-file=${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx
|
||||||
|
--output-header-identifier=_FG_FLIGHTGEAR_EMBEDDED_RESOURCES
|
||||||
|
${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml
|
||||||
|
BYPRODUCTS
|
||||||
|
${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.cxx
|
||||||
|
${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx
|
||||||
|
DEPENDS
|
||||||
|
fgrcc ${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml
|
||||||
|
)
|
||||||
|
|
|
@ -73,6 +73,9 @@ get_property(FG_HEADERS GLOBAL PROPERTY FG_HEADERS)
|
||||||
get_property(EMBEDDED_RESOURCE_SOURCES GLOBAL PROPERTY EMBEDDED_RESOURCE_SOURCES)
|
get_property(EMBEDDED_RESOURCE_SOURCES GLOBAL PROPERTY EMBEDDED_RESOURCE_SOURCES)
|
||||||
get_property(EMBEDDED_RESOURCE_HEADERS GLOBAL PROPERTY EMBEDDED_RESOURCE_HEADERS)
|
get_property(EMBEDDED_RESOURCE_HEADERS GLOBAL PROPERTY EMBEDDED_RESOURCE_HEADERS)
|
||||||
|
|
||||||
|
set_source_files_properties(${EMBEDDED_RESOURCE_SOURCES} PROPERTIES GENERATED TRUE)
|
||||||
|
set_source_files_properties(${EMBEDDED_RESOURCE_HEADERS} PROPERTIES GENERATED TRUE)
|
||||||
|
|
||||||
# important we pass WIN32 here so the console is optional. Other
|
# important we pass WIN32 here so the console is optional. Other
|
||||||
# platforms ignore this option. If a console is needed we allocate
|
# platforms ignore this option. If a console is needed we allocate
|
||||||
# it manually via AllocConsole()
|
# it manually via AllocConsole()
|
||||||
|
@ -87,7 +90,7 @@ add_executable(fgfs
|
||||||
${EMBEDDED_RESOURCE_HEADERS}
|
${EMBEDDED_RESOURCE_HEADERS}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_dependencies(fgfs buildId)
|
add_dependencies(fgfs buildId embeddedresources)
|
||||||
# explicitly disable automoc for main fgfs target
|
# explicitly disable automoc for main fgfs target
|
||||||
set_property(TARGET fgfs PROPERTY AUTOMOC OFF)
|
set_property(TARGET fgfs PROPERTY AUTOMOC OFF)
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,9 @@ get_property(FG_HEADERS GLOBAL PROPERTY FG_HEADERS)
|
||||||
get_property(EMBEDDED_RESOURCE_SOURCES GLOBAL PROPERTY EMBEDDED_RESOURCE_SOURCES)
|
get_property(EMBEDDED_RESOURCE_SOURCES GLOBAL PROPERTY EMBEDDED_RESOURCE_SOURCES)
|
||||||
get_property(EMBEDDED_RESOURCE_HEADERS GLOBAL PROPERTY EMBEDDED_RESOURCE_HEADERS)
|
get_property(EMBEDDED_RESOURCE_HEADERS GLOBAL PROPERTY EMBEDDED_RESOURCE_HEADERS)
|
||||||
|
|
||||||
|
set_source_files_properties(${EMBEDDED_RESOURCE_SOURCES} PROPERTIES GENERATED TRUE)
|
||||||
|
set_source_files_properties(${EMBEDDED_RESOURCE_HEADERS} PROPERTIES GENERATED TRUE)
|
||||||
|
|
||||||
# Set up the separate executable for running the test suite.
|
# Set up the separate executable for running the test suite.
|
||||||
add_executable(fgfs_test_suite
|
add_executable(fgfs_test_suite
|
||||||
${FG_SOURCES}
|
${FG_SOURCES}
|
||||||
|
@ -125,7 +128,8 @@ add_executable(fgfs_test_suite
|
||||||
${TESTSUITE_SOURCES}
|
${TESTSUITE_SOURCES}
|
||||||
${TESTSUITE_HEADERS}
|
${TESTSUITE_HEADERS}
|
||||||
)
|
)
|
||||||
add_dependencies(fgfs_test_suite buildId)
|
|
||||||
|
add_dependencies(fgfs_test_suite buildId embeddedresources)
|
||||||
set_target_properties(fgfs_test_suite
|
set_target_properties(fgfs_test_suite
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${TESTSUITE_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${TESTSUITE_OUTPUT_DIR}"
|
||||||
|
|
Loading…
Reference in a new issue