Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/CMakeLists.txt
193873 views
1
# First link all subdirectories
2
add_subdirectory(changes)
3
add_subdirectory(dialogs)
4
add_subdirectory(frames)
5
add_subdirectory(elements)
6
add_subdirectory(tools)
7
8
# create set with all main netedit source code files
9
set(netedit_SRCS
10
GNEApplicationWindow.cpp
11
GNEApplicationWindow.h
12
GNEApplicationWindowHelper.cpp
13
GNEApplicationWindowHelper.h
14
GNEAttributeProperties.cpp
15
GNEAttributeProperties.h
16
GNEEvent_FileLoaded.cpp
17
GNEEvent_FileLoaded.h
18
GNEExternalRunner.cpp
19
GNEExternalRunner.h
20
GNEInternalTest.cpp
21
GNEInternalTest.h
22
GNELane2laneConnection.cpp
23
GNELane2laneConnection.h
24
GNELoadThread.cpp
25
GNELoadThread.h
26
GNENet.cpp
27
GNENet.h
28
GNENetHelper.cpp
29
GNENetHelper.h
30
GNEPathManager.cpp
31
GNEPathManager.h
32
GNEReferenceCounter.h
33
GNESegment.cpp
34
GNESegment.h
35
GNETagProperties.cpp
36
GNETagProperties.h
37
GNETagPropertiesDatabase.cpp
38
GNETagPropertiesDatabase.h
39
GNEUndoList.cpp
40
GNEUndoList.h
41
GNEViewNet.cpp
42
GNEViewNet.h
43
GNEViewNetHelper.cpp
44
GNEViewNetHelper.h
45
GNEViewParent.cpp
46
GNEViewParent.h
47
netedit_main.cpp
48
templates.h
49
)
50
51
# create netedit executable using the main netedit source code files defined previously in netedit_SRCS
52
# and icon defined in file netedit.rc
53
add_executable(netedit ${netedit_SRCS} netedit.rc)
54
55
# Add suffix to netedit executable in RELEASE mode if was defined in variable BINARY_SUFFIX
56
set_target_properties(netedit PROPERTIES OUTPUT_NAME netedit${BINARY_SUFFIX})
57
58
# Add suffix + D to netedit executable in DEBUG mode if was defined in variable BINARY_SUFFIX
59
set_target_properties(netedit PROPERTIES OUTPUT_NAME_DEBUG netedit${BINARY_SUFFIX}D)
60
61
# link all previously compiled libraries to netedit. Every library was compiled in their own folder using own CMakeList.txt
62
target_link_libraries(netedit gui_dialogs utils_gui_cursors utils_gui_shortcuts utils_tests utils_foxtools foreign_eulerspiral
63
netedit_frames_common netedit_frames_network netedit_frames_demand netedit_frames_data netedit_frames
64
netedit_elements netedit_elements_network netedit_elements_additional netedit_elements_demand netedit_elements_moving
65
netedit_elements_data netedit_changes utils_gui_div utils_gui_settings utils_gui_images netedit_dialogs_run
66
netedit_dialogs_tools netedit_dialogs_basic netedit_dialogs_file netedit_dialogs_fix netedit_dialogs_elements
67
netedit_dialogs_elements_lists netedit_dialogs_options netedit_tools netedit_dialogs utils_gui_windows utils_gui_globjects
68
utils_gui_tracker utils_foxtools utils_vehicle utils_emissions foreign_phemlight foreign_phemlight_V5
69
${netconvertlibs} ${FOX_LIBRARY} ${GL2PS_LIBRARIES} ${BOOST_LIBRARIES})
70
71
# if we're compiling using Visual Studio, add extra options
72
if (MSVC)
73
# Enable or disable console in release mode depending of variable CONSOLE_RELEASE
74
# and set VC variable ENTRY, see https://learn.microsoft.com/en-us/cpp/build/reference/entry-entry-point-symbol
75
if (CONSOLE_RELEASE)
76
set_target_properties(netedit PROPERTIES LINK_FLAGS_RELEASE "/ENTRY:mainCRTStartup")
77
else ()
78
set_target_properties(netedit PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
79
endif()
80
# Disable DPI Aware if we're using a old CMAKE Version
81
if (CMAKE_VERSION VERSION_LESS "3.16.0")
82
message(STATUS "DPI awareness for netedit will be disabled. Please consider using CMake version >= 3.16 to enable it")
83
else ()
84
set_target_properties(netedit PROPERTIES VS_DPI_AWARE "ON")
85
endif ()
86
# Target system libraries opengl32 and glu32 (common for all operating systems)
87
target_link_libraries(netedit opengl32 glu32)
88
endif ()
89
90
# define dependencies of NETEDIT (needs templates.h, version.h and DLLs installed in bin folder)
91
add_dependencies(netedit generate-templates-h generate-version-h install_dll)
92
93
# finally, define output folder (in our case, SUMO/bin)
94
install(TARGETS netedit RUNTIME DESTINATION bin COMPONENT runtime)
95
96
# now we're going to define the templates.h dependency.
97
# First we define a custom target for templates.h
98
add_custom_target(generate-templates-h DEPENDS templates.h)
99
100
# place custom target in tree folder CMake (in Visual studio)
101
set_property(TARGET generate-templates-h PROPERTY FOLDER "CMake")
102
103
# for generating dependences we need a SUMO binary compiled, then add sumo as dependency of generate-templates-h.
104
# this will compile SUMO BEFORE generate templates.h
105
add_dependencies(generate-templates-h sumo netconvert netgenerate)
106
107
# create CMake custom command that generates templates.h file (OUTPUT) giving as argument python executable (Python_EXECUTABLE),
108
# the python script <SUMO>/tools/build_config/templates.py (<SUMO/src/netedit>/../../tools/build_config/templates.py) and the sumo binary
109
add_custom_command(OUTPUT templates.h
110
COMMAND ${Python_EXECUTABLE} ${SUMO_TOOLS_DIR}/build_config/templates.py $<TARGET_FILE:sumo> $<TARGET_FILE:netconvert> $<TARGET_FILE:netgenerate>
111
DEPENDS sumo netconvert netgenerate
112
)
113
114
# Finally mark the generated templates.h as a generated file
115
set_source_files_properties(${CMAKE_BINARY_DIR}/src/netedit/templates.h PROPERTIES GENERATED TRUE)
116
117