configure cmake to build java with maven #938

This commit is contained in:
Scott Fennell 2020-01-30 13:12:51 -06:00
parent 78ebc6fda3
commit 6887795f25
8 changed files with 40 additions and 82 deletions

View File

@ -3,7 +3,7 @@ project(trick)
set(TRICK_MAJOR 19)
set(TRICK_MINOR 1)
set(TRICK_TINY dev)
#set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -32,6 +32,7 @@ endif()
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)
include(UseJava)
find_package(Java REQUIRED)
find_package(Maven REQUIRED)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
find_package(LLVM 3.4 REQUIRED)
@ -385,5 +386,5 @@ add_subdirectory(trick_source/codegen/Interface_Code_Gen)
add_subdirectory(trick_source/er7_utils)
add_subdirectory(trick_source/sim_services)
add_subdirectory(trick_source/trick_utils)
add_subdirectory(trick_source/java/src)
add_subdirectory(trick_source/java)
add_subdirectory(trick_source/data_products)

View File

@ -0,0 +1,16 @@
# FindMaven
# --------
#
# Find mvn
#
# This module looks for mvn. This module defines the following values:
#
# ::
#
# MAVEN_EXECUTABLE: the full path to the tee tool.
# MAVEN_FOUND: True if tee has been found.
find_program(MAVEN_EXECUTABLE mvn)
include (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MAVEN REQUIRED_VARS MAVEN_EXECUTABLE)

View File

@ -1,2 +1,3 @@
dist
resources
build

View File

@ -1,9 +0,0 @@
# Catalogs are relative to this properties file
relative-catalogs=false
#Catalog list
catalogs=./../../../trick_source/data_products/DPX/XML/catalog.xml
# Make the verbosity bigger to get more debug information
verbosity=0

View File

@ -1,67 +0,0 @@
# Downloads the external java packages Trick uses. We use the maven repository to
# get the jar file. Currently we fix the version of the jar files we download.
# I wonder how long the links stay unchanged and active (Alex 1/22/15)
EXTERNAL_JARS = \
bsaf-1.9.2.jar \
jcommon-1.0.23.jar \
jfreechart-1.0.19.jar \
jfreesvg-2.1.jar \
jopt-simple-4.8.jar \
junit-4.12.jar \
swingx-1.6.1.jar \
hamcrest-core-1.3.jar \
pdfbox-2.0.11.jar \
fontbox-2.0.11.jar \
commons-logging-1.2.jar \
jaxb-runtime-2.4.0-b180830.0438.jar \
jaxb-xjc-2.4.0-b180830.0438.jar \
jaxb-jxc-2.4.0-b180830.0438.jar \
jaxb-impl-2.4.0-b180830.0438.jar \
jaxb-api-2.4.0-b180725.0427.jar \
jaxb-core-2.3.0.1.jar \
javax.activation-1.2.0.jar
curl := curl --retry 4 -O -s -S
.PHONY: external_jars
external_jars : ${EXTERNAL_JARS}
bsaf-1.9.2.jar:
$(curl) https://repo.maven.apache.org/maven2/org/jdesktop/bsaf/bsaf/1.9.2/bsaf-1.9.2.jar
jcommon-1.0.23.jar:
$(curl) https://repo.maven.apache.org/maven2/org/jfree/jcommon/1.0.23/jcommon-1.0.23.jar
jfreechart-1.0.19.jar:
$(curl) https://repo.maven.apache.org/maven2/org/jfree/jfreechart/1.0.19/jfreechart-1.0.19.jar
jfreesvg-2.1.jar:
$(curl) https://repo.maven.apache.org/maven2/org/jfree/jfreesvg/2.1/jfreesvg-2.1.jar
jopt-simple-4.8.jar:
$(curl) https://repo.maven.apache.org/maven2/net/sf/jopt-simple/jopt-simple/4.8/jopt-simple-4.8.jar
junit-4.12.jar:
$(curl) https://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar
swingx-1.6.1.jar:
$(curl) https://repo.maven.apache.org/maven2/org/swinglabs/swingx/1.6.1/swingx-1.6.1.jar
hamcrest-core-1.3.jar:
$(curl) https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
pdfbox-2.0.11.jar:
$(curl) https://repo.maven.apache.org/maven2/org/apache/pdfbox/pdfbox/2.0.11/pdfbox-2.0.11.jar
fontbox-2.0.11.jar:
$(curl) https://repo.maven.apache.org/maven2/org/apache/pdfbox/fontbox/2.0.11/fontbox-2.0.11.jar
commons-logging-1.2.jar :
$(curl) https://repo1.maven.org/maven2/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
jaxb-runtime-2.4.0-b180830.0438.jar:
$(curl) https://repo.maven.apache.org/maven2/org/glassfish/jaxb/jaxb-runtime/2.4.0-b180830.0438/jaxb-runtime-2.4.0-b180830.0438.jar
jaxb-xjc-2.4.0-b180830.0438.jar:
$(curl) https://repo.maven.apache.org/maven2/com/sun/xml/bind/jaxb-xjc/2.4.0-b180830.0438/jaxb-xjc-2.4.0-b180830.0438.jar
jaxb-jxc-2.4.0-b180830.0438.jar:
$(curl) https://repo.maven.apache.org/maven2/com/sun/xml/bind/jaxb-jxc/2.4.0-b180830.0438/jaxb-jxc-2.4.0-b180830.0438.jar
jaxb-impl-2.4.0-b180830.0438.jar:
$(curl) https://repo.maven.apache.org/maven2/com/sun/xml/bind/jaxb-impl/2.4.0-b180830.0438/jaxb-impl-2.4.0-b180830.0438.jar
jaxb-core-2.3.0.1.jar:
$(curl) https://repo.maven.apache.org/maven2/com/sun/xml/bind/jaxb-core/2.3.0.1/jaxb-core-2.3.0.1.jar
jaxb-api-2.4.0-b180725.0427.jar:
$(curl) https://repo.maven.apache.org/maven2/javax/xml/bind/jaxb-api/2.4.0-b180725.0427/jaxb-api-2.4.0-b180725.0427.jar
javax.activation-1.2.0.jar:
$(curl) https://repo.maven.apache.org/maven2/com/sun/activation/javax.activation/1.2.0/javax.activation-1.2.0.jar
clean:
rm -f ${EXTERNAL_JARS}

View File

@ -0,0 +1,6 @@
###############################################################
# Build Java
###############################################################
add_custom_target(java COMMAND mvn package -Dcmake=true -DbuildDirectory=${CMAKE_BINARY_DIR}/libexec/trick/java/build WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -1,6 +1,6 @@
TRICK_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))../..)
all: ${TRICK_HOME}/libexec/trick/java/build resources
all: ${TRICK_HOME}/libexec/trick/java/build
@echo "Java build successful"
${TRICK_HOME}/libexec/trick/java/build:
@ -11,6 +11,3 @@ javadoc:
clean:
mvn clean
resources: ${RESOURCES_DIR}/trick_icon.png: ${SRC_DIR}/trick/common/resources/trick_icon.png ${RESOURCES_DIR}
@cp $< $@

View File

@ -317,5 +317,18 @@
</pluginManagement>
</build>
<profiles>
<profile>
<build>
<directory>${buildDirectory}</directory>
</build>
<activation>
<property>
<name>cmake</name>
<value>true</value>
</property>
</activation>
</profile>
</profiles>
</project>