mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-27 06:35:16 +00:00
Fix compilation of gen utility (and tests) under Visual Studio solution (fix #541)
This commit is contained in:
parent
d1c0a61b40
commit
e0264787c6
@ -28,11 +28,7 @@ set(aseprite_libraries app-lib css-lib doc-lib raster-lib
|
||||
# Directories where .h files can be found
|
||||
include_directories(. .. ../third_party)
|
||||
|
||||
# Directory where generated files by "gen" utility will stay.
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# Third-party libraries
|
||||
|
||||
if(USE_SHARED_ALLEGRO4)
|
||||
# Find the shared Allegro 4 library
|
||||
find_library(LIBALLEGRO4_LIBRARY alleg)
|
||||
@ -245,29 +241,6 @@ if(EXISTS ../docs/quickref.pdf)
|
||||
DESTINATION share/aseprite/docs/quickref.pdf)
|
||||
endif()
|
||||
|
||||
######################################################################
|
||||
# Generate source files from widget XML files
|
||||
|
||||
file(GLOB widget_files ${CMAKE_SOURCE_DIR}/data/widgets/*.xml)
|
||||
foreach(widget_file ${widget_files})
|
||||
get_filename_component(widget_name ${widget_file} NAME_WE)
|
||||
set(target_name generated_${widget_name})
|
||||
set(output_fn ${CMAKE_CURRENT_BINARY_DIR}/generated_${widget_name}.h)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${output_fn}
|
||||
COMMAND gen/gen --input ${widget_file} --widgetid ${widget_name} > ${output_fn}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
MAIN_DEPENDENCY ${widget_file}
|
||||
DEPENDS gen)
|
||||
|
||||
add_custom_target(${target_name} DEPENDS ${output_fn})
|
||||
|
||||
set_source_files_properties(${target_name} PROPERTIES GENERATED TRUE)
|
||||
|
||||
add_dependencies(app-lib ${target_name})
|
||||
endforeach()
|
||||
|
||||
######################################################################
|
||||
# Tests
|
||||
|
||||
@ -290,6 +263,13 @@ function(find_tests dir dependencies)
|
||||
get_filename_component(testname ${testsourcefile} NAME_WE)
|
||||
|
||||
add_executable(${testname} ${testsourcefile})
|
||||
|
||||
if(MSVC)
|
||||
# Fix problem compiling gen from a Visual Studio solution
|
||||
set_target_properties(${testname}
|
||||
PROPERTIES LINK_FLAGS -ENTRY:"mainCRTStartup")
|
||||
endif()
|
||||
|
||||
target_link_libraries(${testname} gtest ${ARGV})
|
||||
if(LIBALLEGRO4_LINK_FLAGS)
|
||||
target_link_libraries(${testname} ${LIBALLEGRO4_LINK_FLAGS})
|
||||
|
@ -1,6 +1,31 @@
|
||||
# Aseprite
|
||||
# Copyright (C) 2001-2014 David Capello
|
||||
|
||||
######################################################################
|
||||
# Generate source files from widget XML files
|
||||
|
||||
file(GLOB widget_files ${CMAKE_SOURCE_DIR}/data/widgets/*.xml)
|
||||
foreach(widget_file ${widget_files})
|
||||
get_filename_component(widget_name ${widget_file} NAME_WE)
|
||||
set(target_name generated_${widget_name})
|
||||
set(output_fn ${CMAKE_CURRENT_BINARY_DIR}/generated_${widget_name}.h)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${output_fn}
|
||||
COMMAND ${CMAKE_BINARY_DIR}/bin/gen --input ${widget_file} --widgetid ${widget_name} > ${output_fn}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
MAIN_DEPENDENCY ${widget_file}
|
||||
DEPENDS gen)
|
||||
|
||||
list(APPEND generated_header_files ${output_fn})
|
||||
endforeach()
|
||||
|
||||
# Directory where generated files by "gen" utility will stay.
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
######################################################################
|
||||
# app-lib target
|
||||
|
||||
add_library(app-lib
|
||||
app.cpp
|
||||
app_menus.cpp
|
||||
@ -258,4 +283,5 @@ add_library(app-lib
|
||||
webserver.cpp
|
||||
widget_loader.cpp
|
||||
xml_document.cpp
|
||||
xml_exception.cpp)
|
||||
xml_exception.cpp
|
||||
${generated_header_files})
|
||||
|
@ -5,6 +5,12 @@ add_executable(gen
|
||||
gen.cpp
|
||||
ui_class.cpp)
|
||||
|
||||
if(MSVC)
|
||||
# Fix problem compiling gen from a Visual Studio solution
|
||||
set_target_properties(gen
|
||||
PROPERTIES LINK_FLAGS -ENTRY:"mainCRTStartup")
|
||||
endif()
|
||||
|
||||
target_link_libraries(gen base-lib)
|
||||
if(USE_SHARED_TINYXML)
|
||||
target_link_libraries(gen ${LIBTINYXML_LIBRARY})
|
||||
|
Loading…
x
Reference in New Issue
Block a user