From e609b859758dd2323aed79a8a48b9d4fb48269a0 Mon Sep 17 00:00:00 2001 From: beaglejoe Date: Sun, 19 Jun 2022 03:01:03 +0000 Subject: [PATCH] Add OPTION_TRACKEDITOR and cmake changes for trackeditor git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8212 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 97fe1ceaffdc195e69a8db384a3be5feb16c2349 Former-commit-id: e72318bbd02fbd752edd6a8e5781498ca9d43555 --- cmake/options.cmake | 2 + src/tools/CMakeLists.txt | 5 + src/tools/trackeditor/CMakeLists.txt | 181 +++++++++++++++++++++ src/tools/trackeditor/META-INF/MANIFEST.MF | 6 +- 4 files changed, 191 insertions(+), 3 deletions(-) create mode 100644 src/tools/trackeditor/CMakeLists.txt diff --git a/cmake/options.cmake b/cmake/options.cmake index ecbaba170..497a6a7ff 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -86,6 +86,8 @@ MACRO(ADD_SD_COMPILE_OPTIONS) SET(OPTION_PACKAGING true CACHE BOOL "Enable Packaging for distribution") + SET(OPTION_TRACKEDITOR true CACHE BOOL "Build the TrackEditor (Requires Java)") + IF(APPLE) # Automatically set OPTION_USE_MACPORTS (at least until someone fixes the regular APPLE build) MESSAGE(STATUS "Automatically set OPTION_USE_MACPORTS (at least until someone fixes the regular APPLE build)") diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 85b954f8a..d8f205b45 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -4,6 +4,11 @@ SD_ADD_SUBDIRECTORY(accc) SD_ADD_SUBDIRECTORY(nfs2ac) SD_ADD_SUBDIRECTORY(nfsperf) SD_ADD_SUBDIRECTORY(trackgen) + +IF(OPTION_TRACKEDITOR) + SD_ADD_SUBDIRECTORY(trackeditor) +ENDIF(OPTION_TRACKEDITOR) + ADD_SUBDIRECTORY(xmlversion) IF(NOT OPTION_OFFICIAL_ONLY) diff --git a/src/tools/trackeditor/CMakeLists.txt b/src/tools/trackeditor/CMakeLists.txt new file mode 100644 index 000000000..1e7396fb0 --- /dev/null +++ b/src/tools/trackeditor/CMakeLists.txt @@ -0,0 +1,181 @@ +INCLUDE(../../../cmake/macros.cmake) + +FIND_PACKAGE(Java) +FIND_PACKAGE(Java COMPONENTS Development) +IF(Java_Development_FOUND AND Java_FOUND) + INCLUDE(UseJava) + + + PROJECT(trackeditor NONE) + + SET(_TARGET_NAME ${SD_TOOLS_EXECPREFIX}trackeditor) + + SET(_JAVA_SRC + gui/DeltaPanel.java + gui/EditorFrame.java + gui/NewProjectDialog.java + gui/TrackgenPanel.java + gui/properties/CameraProperties.java + gui/properties/EnvMapProperties.java + gui/properties/GeneralProperties.java + gui/properties/GraphicProperties.java + gui/properties/ImageProperties.java + gui/properties/LocalInfoProperties.java + gui/properties/ObjectProperties.java + gui/properties/PitProperties.java + gui/properties/PropertiesDialog.java + gui/properties/PropertyPanel.java + gui/properties/StartingGridProperties.java + gui/properties/SurfaceProperties.java + gui/properties/TerrainProperties.java + gui/properties/TrackLightProperties.java + gui/properties/TrackProperties.java + gui/properties/TurnMarksProperties.java + gui/segment/GroupButton.java + gui/segment/ProfileButton.java + gui/segment/SegmentComboBox.java + gui/segment/SegmentEditorDlg.java + gui/segment/SegmentSideProperties.java + gui/segment/SegmentSlider.java + gui/segment/SliderListener.java + gui/splash/SplashPanel.java + gui/splash/SplashScreen.java + gui/splash/StatusBar.java + gui/view/CircuitView.java + gui/view/CircuitViewSelectionEvent.java + gui/view/CircuitViewSelectionListener.java + miscel/EPMath.java + miscel/TorcsTuneFileFilter.java + plugin/Plugin.java + plugin/torcs/NoOpEntityResolver.java + plugin/torcs/TorcsPlugin.java + plugin/torcs/XMLOutput.java + plugin/torcs/XmlReader.java + plugin/torcs/XmlWriter.java + utils/CustomFileFilter.java + utils/Editor.java + utils/EditorPoint.java + utils/GroupButtonLayout.java + utils/Project.java + utils/Properties.java + utils/SegmentSliderLayout.java + utils/TrackData.java + utils/TrackEditor.java + utils/circuit/Camera.java + utils/circuit/Curve.java + utils/circuit/EnvironmentMapping.java + utils/circuit/Graphic.java + utils/circuit/Header.java + utils/circuit/LocalInfo.java + utils/circuit/MainTrack.java + utils/circuit/ObjShapeHandle.java + utils/circuit/ObjShapeTerrain.java + utils/circuit/ObjectMap.java + utils/circuit/Pits.java + utils/circuit/Segment.java + utils/circuit/SegmentListener.java + utils/circuit/SegmentSide.java + utils/circuit/SegmentSideListener.java + utils/circuit/StartingGrid.java + utils/circuit/Straight.java + utils/circuit/Surface.java + utils/circuit/TerrainGeneration.java + utils/circuit/TrackLight.java + utils/circuit/TrackObject.java + utils/circuit/TurnMarks.java + utils/circuit/XmlObjPits.java + utils/undo/Undo.java + utils/undo/UndoAddSegment.java + utils/undo/UndoDeleteSegment.java + utils/undo/UndoInterface.java + utils/undo/UndoSegmentChange.java) + + #file(GLOB_RECURSE _JAVA_SRC ./*.java) + #foreach(_jfile ${_JAVA_SRC}) + # message(STATUS "${_jfile}") + #endforeach() + + SET(_PNGS gui/splash/Splash.png icon.png) + #file(GLOB_RECURSE _PNGS *.png) + + SET(_ICONS gui/icons/Calc24.gif + gui/icons/Cut24.gif + gui/icons/Export24.gif + gui/icons/FindAgain24.gif + gui/icons/Help24.gif + gui/icons/Movie24.gif + gui/icons/New24.gif + gui/icons/Open24.gif + gui/icons/Redo24.gif + gui/icons/Save24.gif + gui/icons/Search24.gif + gui/icons/Straight24.gif + gui/icons/Subdivide24.gif + gui/icons/TurnLeft24.gif + gui/icons/TurnRight24.gif + gui/icons/Undo24.gif + gui/icons/Zoom24.gif + gui/icons/ZoomIn24.gif + gui/icons/ZoomOut24.gif + ) + + SET(JAVA_JARS bsh-2.0b4.jar + jdom-1.1.3.jar + looks-1.2.2.jar ) + + # ========= Debug + #message(STATUS "JAVA_JARS = ${JAVA_JARS}") + #message(STATUS "_JAVA_SRC = ${_JAVA_SRC}") + #message(STATUS "_PNGS = ${_PNGS}") + #message(STATUS "_ICONS = ${_ICONS}") + # ========= Debug + + SET(CMAKE_JAVA_COMPILE_FLAGS "-source" "1.7" "-target" "1.7") + + SET(_TGT_DIR "${CMAKE_BINARY_DIR}/${SD_BINDIR}") + + ADD_JAR(${_TARGET_NAME} + SOURCES ${_JAVA_SRC} gui/splash/Splash.png icon.png ${_ICONS} + INCLUDE_JARS ${JAVA_JARS} + MANIFEST ./META-INF/MANIFEST.MF + OUTPUT_DIR ${_TGT_DIR} + ) + + # Copy each jar dependency to the bin folder (for running without installing). + ADD_CUSTOM_COMMAND(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory "${_TGT_DIR}" + VERBATIM) + FOREACH(_JAR ${JAVA_JARS}) + ADD_CUSTOM_COMMAND(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo Copying "${_JAR}" to "${_TGT_DIR}" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_LIST_DIR}/${_JAR}" "${_TGT_DIR}" + VERBATIM) + ENDFOREACH() + + + INSTALL_JAR(${_TARGET_NAME} DESTINATION ${SD_BINDIR}) + + # install the jar dependencies + SD_INSTALL_FILES(BIN FILES ${JAVA_JARS}) + + # ========= Debug + #get_target_property(_jarFile TrackEditor JAR_FILE) + #get_target_property(_classDir TrackEditor CLASSDIR) + + #message(STATUS "Jar file ${_jarFile}") + #message(STATUS "Class compiled to ${_classDir}") + # ========= Debug + + + # add_custom_target() makes the java sources available in the generated IDE project + ADD_CUSTOM_TARGET(${_TARGET_NAME}-src SOURCES ${_JAVA_SRC} ${_PNGS} ${_ICONS} META-INF/MANIFEST.MF) + + # https://github.com/beanshell/beanshell/releases + # http://www.jdom.org/dist/binary/archive/jdom-1.1.3.zip + # http://www.java2s.com/Code/JarDownload/looks/looks-1.2.2.jar.zip + +ELSE(Java_Development_FOUND AND Java_FOUND) + MESSAGE(WARNING "Java_FOUND = ${Java_FOUND}") + MESSAGE(WARNING "Java_Development_FOUND = ${Java_Development_FOUND}") + MESSAGE(WARNING "TrackEditor NOT included!") +ENDIF(Java_Development_FOUND AND Java_FOUND) \ No newline at end of file diff --git a/src/tools/trackeditor/META-INF/MANIFEST.MF b/src/tools/trackeditor/META-INF/MANIFEST.MF index 281ebbc12..e60cc7193 100644 --- a/src/tools/trackeditor/META-INF/MANIFEST.MF +++ b/src/tools/trackeditor/META-INF/MANIFEST.MF @@ -1,3 +1,3 @@ -Manifest-Version: 1.0 -Main-Class: utils.TrackEditor - +Manifest-Version: 1.0 +Main-Class: utils.TrackEditor +Class-Path: ./ bsh-2.0b4.jar jdom-1.1.3.jar looks-1.2.2.jar