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