Skip to content

Commit ae5bedf

Browse files
committed
a first concept
0 parents  commit ae5bedf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+14719
-0
lines changed

CMakeLists.txt

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#########################################################################
2+
#
3+
# BRL-CAD
4+
#
5+
# Copyright (c) 2011-2020 United States Government as represented by
6+
# the U.S. Army Research Laboratory.
7+
#
8+
# This library is free software; you can redistribute it and/or
9+
# modify it under the terms of the GNU Lesser General Public License
10+
# version 2.1 as published by the Free Software Foundation.
11+
#
12+
# This library is distributed in the hope that it will be useful, but
13+
# WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
# Lesser General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU Lesser General Public
18+
# License along with this file; see the file named COPYING for more
19+
# information.
20+
#
21+
#########################################################################
22+
# @file CMakeLists.txt
23+
#########################################################################
24+
25+
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.3)
26+
27+
PROJECT(MOOSE)
28+
29+
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
30+
31+
# We need BRL-CAD
32+
FIND_PACKAGE(BRLCAD REQUIRED)
33+
34+
IF(BRLCAD_VERSION_FOUND)
35+
SET(VERSION_H_CONTENT
36+
"#define BRLCAD_LIB_MAJOR ${BRLCAD_MAJOR_VERSION}\n"
37+
"#define BRLCAD_LIB_MINOR ${BRLCAD_MINOR_VERSION}\n"
38+
"#define BRLCAD_LIB_PATCH ${BRLCAD_PATCH_VERSION}\n"
39+
)
40+
FILE(WRITE ${CMAKE_BINARY_DIR}/include/brlcad/version.h ${VERSION_H_CONTENT})
41+
42+
ADD_SUBDIRECTORY(src)
43+
ELSE(BRLCAD_VERSION_FOUND)
44+
MESSAGE(STATUS "\tCould not find BRL-CAD")
45+
ENDIF(BRLCAD_VERSION_FOUND)

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# BRL-CAD MOOSE
2+
3+
MOOSE shall become the new API of the BRL-CAD (https://brlcad.org, https://github.com/BRL-CAD) core.
4+
The acronym stands for Modular Object-Oriented Solidity Engine.
5+
6+
This repository demonstrates a concept of the API.
7+
It is based on the C++ core interface work in rt^3.

cmake/FindBRLCAD.cmake

+304
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,304 @@
1+
#########################################################################
2+
#
3+
# BRL-CAD
4+
#
5+
# Copyright (c) 1997-2020 United States Government as represented by
6+
# the U.S. Army Research Laboratory.
7+
#
8+
# This library is free software; you can redistribute it and/or
9+
# modify it under the terms of the GNU Lesser General Public License
10+
# version 2.1 as published by the Free Software Foundation.
11+
#
12+
# This library is distributed in the hope that it will be useful, but
13+
# WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
# Lesser General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU Lesser General Public
18+
# License along with this file; see the file named COPYING for more
19+
# information.
20+
#
21+
#########################################################################
22+
# @file cmake/FindBRLCAD.cmake
23+
#
24+
# Try to find brlcad libraries.
25+
# Once done, this will define:
26+
#
27+
# BRLCAD_FOUND - system has BRL-CAD
28+
# BRLCAD_VERSION - the BRL-CAD version string
29+
# BRLCAD_INCLUDE_DIRS - the BRL-CAD include directories
30+
# BRLCAD_LIBRARIES - link these to use the BRL-CAD Libraries
31+
#
32+
# BRLCAD_ANALYZE_LIBRARY - BRL-CAD Analysis library
33+
# BRLCAD_BN_LIBRARY - BRL-CAD Numerical library
34+
# BRLCAD_BU_LIBRARY - BRL-CAD Utility library
35+
# BRLCAD_CURSOR_LIBRARY - libcursor
36+
# BRLCAD_DM_LIBRARY - BRL-CAD Display Manager library
37+
# BRLCAD_FB_LIBRARY - BRL-CAD Frame Buffer library
38+
# BRLCAD_FFT_LIBRARY - BRL-CAD FFT library
39+
# BRLCAD_GCV_LIBRARY - BRL-CAD Geometry Conversion library
40+
# BRLCAD_GED_LIBRARY - BRL-CAD Geometry Editing library
41+
# BRLCAD_ICV_LIBRARY - BRL-CAD Image Conversion library
42+
# BRLCAD_MULTISPECTRAL_LIBRARY - BRL-CAD multispectral library
43+
# BRLCAD_NMG_LIBRARY - BRL-CAD non-manifold geometry library
44+
# BRLCAD_OPTICAL_LIBRARY - BRL-CAD optical library
45+
# BRLCAD_ORLE_LIBRARY - liborle
46+
# BRLCAD_PKG_LIBRARY - BRL-CAD libpkg
47+
# BRLCAD_RENDER_LIBRARY - librender
48+
# BRLCAD_RT_LIBRARY - BRL-CAD Raytracing library
49+
# BRLCAD_SYSV_LIBRARY - libsysv
50+
# BRLCAD_TERMIO_LIBRARY - libtermio (non WIN32 systems)
51+
# BRLCAD_WDB_LIBRARY - BRL-CAD Write Database library
52+
#
53+
# Technically these are external but we need the versions
54+
# tweaked for BRL-CAD. If a developer wishes to use the
55+
# BRL-CAD altered versions of these libraries to satisfy a
56+
# "generic" request for the library, they'll need to assign
57+
# the results of these variables to the non-BRL-CAD specific
58+
# variables they are using
59+
#
60+
# BRLCAD_EXPPP_LIBRARY - SCL libexppp library
61+
# BRLCAD_EXPRESS_LIBRARY - SCL libexpress library
62+
# BRLCAD_STEPCORE_LIBRARY - SCL core library
63+
# BRLCAD_STEPDAI_LIBRARY - SCL dai library
64+
# BRLCAD_STEPEDITOR_LIBRARY - SCL editor library
65+
# BRLCAD_STEPUTILS_LIBRARY - SCL utils library
66+
# BRLCAD_OPENNURBS_LIBRARY - openNURBS library
67+
#
68+
# In addition to the above variables, which are essentially unique
69+
# to BRL-CAD, this routine will look for local copies of libraries
70+
# installed with BRL-CAD and return their results as would a
71+
# standard find_package for that library (if one exists). The
72+
# distinction between these libraries and those above is that these
73+
# libraries do not have known modifications required by BRL-CAD that
74+
# preclude system libraries from substituting for them, although
75+
# if BRL-CAD was compiled against local versions of these it is
76+
# not guaranteed (or in some cases expected) that a found system
77+
# version will successfully replace the local copy.
78+
#
79+
# libregex
80+
# libpng
81+
# zlib
82+
# libtermlib
83+
# tcl/tk
84+
# Togl
85+
# utahrle
86+
#
87+
#########################################################################
88+
89+
SET(BRLCAD_ROOT "$ENV{BRLCAD_ROOT}")
90+
IF(BRLCAD_BASE_DIR AND BRLCAD_ROOT)
91+
MESSAGE("Warning - BRLCAD_ROOT was found but is overridden by BRLCAD_BASE_DIR")
92+
ELSE(BRLCAD_BASE_DIR AND BRLCAD_ROOT)
93+
IF(BRLCAD_ROOT)
94+
SET(BRLCAD_BASE_DIR ${BRLCAD_ROOT})
95+
ENDIF(BRLCAD_ROOT)
96+
ENDIF(BRLCAD_BASE_DIR AND BRLCAD_ROOT)
97+
98+
#First, find the install directories.
99+
IF(NOT BRLCAD_BASE_DIR)
100+
#try looking for BRL-CAD's brlcad-config - it should give us
101+
#a location for bin, and the parent will be the root dir
102+
IF(NOT BRLCAD_BASE_DIR)
103+
FIND_PROGRAM(BRLCAD_CONFIGEXE brlcad-config)
104+
IF(BRLCAD_CONFIGEXE)
105+
EXEC_PROGRAM(brlcad-config ARGS --prefix OUTPUT_VARIABLE BRLCAD_BASE_DIR)
106+
ENDIF(BRLCAD_CONFIGEXE)
107+
ENDIF(NOT BRLCAD_BASE_DIR)
108+
109+
#if that didn't work, see if we can find brlcad-config and use the parent path
110+
IF(NOT BRLCAD_BASE_DIR)
111+
FIND_PATH(BRLCAD_BIN_DIR brlcad-config)
112+
IF(BRLCAD_BIN_DIR)
113+
GET_FILENAME_COMPONENT(BRLCAD_BASE_DIR ${BRLCAD_BIN_DIR} PATH)
114+
ENDIF(BRLCAD_BIN_DIR)
115+
ENDIF(NOT BRLCAD_BASE_DIR)
116+
117+
#Look for headers if we come up empty with brlcad-config
118+
IF(NOT BRLCAD_BASE_DIR)
119+
SET(BRLCAD_HEADERS_DIR_CANDIDATES
120+
/usr/brlcad/include/brlcad
121+
/usr/local/brlcad/include/brlcad
122+
)
123+
FIND_PATH(BRLCAD_HEADERS_DIR NAMES bu.h bn.h rt.h PATHS ${BRLCAD_HEADERS_DIR_CANDIDATES})
124+
IF(BRLCAD_HEADERS_DIR)
125+
GET_FILENAME_COMPONENT(BRLCAD_BASE_DIR ${BRLCAD_HEADERS_DIR} PATH)
126+
ENDIF(BRLCAD_HEADERS_DIR)
127+
ENDIF(NOT BRLCAD_BASE_DIR)
128+
129+
IF(NOT BRLCAD_BASE_DIR)
130+
MESSAGE(FATAL_ERROR "\nCould not find BRL-CAD root directory - please set BRLCAD_BASE_DIR in CMake")
131+
ENDIF(NOT BRLCAD_BASE_DIR)
132+
ENDIF(NOT BRLCAD_BASE_DIR)
133+
134+
#Find include directories
135+
IF(NOT BRLCAD_HEADERS_DIR)
136+
FIND_PATH(BRLCAD_HEADERS_DIR NAMES bu.h HINTS ${BRLCAD_BASE_DIR} PATH_SUFFIXES include/brlcad)
137+
GET_FILENAME_COMPONENT(BRLCAD_HEADERS_PARENT_DIR ${BRLCAD_HEADERS_DIR} PATH)
138+
ENDIF(NOT BRLCAD_HEADERS_DIR)
139+
FIND_PATH(BRLCAD_OPENNURBS_HEADERS_DIR NAMES opennurbs.h HINTS ${BRLCAD_BASE_DIR} PATH_SUFFIXES include/openNURBS include/opennurbs)
140+
SET(BRLCAD_INCLUDE_DIRS ${BRLCAD_HEADERS_PARENT_DIR} ${BRLCAD_HEADERS_DIR} ${BRLCAD_OPENNURBS_HEADERS_DIR})
141+
SET(BRLCAD_INCLUDE_DIRS ${BRLCAD_INCLUDE_DIRS} CACHE STRING "BRL-CAD include directories")
142+
143+
#Find library directory
144+
IF(CMAKE_LINK_LIBRARY_SUFFIX)
145+
FIND_PATH(BRLCAD_LIB_DIR "libbu${CMAKE_LINK_LIBRARY_SUFFIX}" PATHS ${BRLCAD_BASE_DIR} PATH_SUFFIXES lib libs bin)
146+
ELSE(CMAKE_LINK_LIBRARY_SUFFIX)
147+
FIND_PATH(BRLCAD_LIB_DIR "libbu${CMAKE_SHARED_LIBRARY_SUFFIX}" PATHS ${BRLCAD_BASE_DIR} PATH_SUFFIXES lib libs bin)
148+
ENDIF(CMAKE_LINK_LIBRARY_SUFFIX)
149+
150+
#Find binary directory
151+
IF(NOT BRLCAD_BIN_DIR)
152+
FIND_PATH(BRLCAD_BIN_DIR brlcad-config PATHS ${BRLCAD_BASE_DIR} PATH_SUFFIXES bin)
153+
ENDIF(NOT BRLCAD_BIN_DIR)
154+
155+
#Attempt to get brlcad version.
156+
IF(NOT BRLCAD_CONFIGEXE)
157+
FIND_PROGRAM(BRLCAD_CONFIGEXE brlcad-config)
158+
ENDIF(NOT BRLCAD_CONFIGEXE)
159+
IF(BRLCAD_CONFIGEXE)
160+
EXECUTE_PROCESS(COMMAND ${BRLCAD_CONFIGEXE} --version OUTPUT_VARIABLE BRLCAD_VERSION)
161+
STRING(STRIP "${BRLCAD_VERSION}" BRLCAD_VERSION)
162+
IF(BRLCAD_VERSION)
163+
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" BRLCAD_MAJOR_VERSION "${BRLCAD_VERSION}")
164+
STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" BRLCAD_MINOR_VERSION "${BRLCAD_VERSION}")
165+
STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" BRLCAD_PATCH_VERSION "${BRLCAD_VERSION}")
166+
SET(BRLCAD_VERSION_FOUND TRUE)
167+
ELSE(BRLCAD_VERSION)
168+
MESSAGE(WARNING "\t\t'brlcad-config --version' was found and executed, but produced no output.")
169+
SET(BRLCAD_VERSION_FOUND FALSE)
170+
ENDIF(BRLCAD_VERSION)
171+
ELSE(BRLCAD_CONFIGEXE)
172+
IF(BRLCAD_VERSION)
173+
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" BRLCAD_MAJOR_VERSION "${BRLCAD_VERSION}")
174+
STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" BRLCAD_MINOR_VERSION "${BRLCAD_VERSION}")
175+
STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" BRLCAD_PATCH_VERSION "${BRLCAD_VERSION}")
176+
SET(BRLCAD_VERSION_FOUND TRUE)
177+
ELSE(BRLCAD_VERSION)
178+
MESSAGE(WARNING "Could not locate 'brlcad-config' - please set BRLCAD_VERSION in CMake")
179+
SET(BRLCAD_VERSION_FOUND FALSE)
180+
ENDIF(BRLCAD_VERSION)
181+
ENDIF(BRLCAD_CONFIGEXE)
182+
183+
#TODO figure out why brlcad-config isn't present on Windows.
184+
##########################################################################
185+
# First, search for BRL-CAD's own libraries
186+
SET(BRL-CAD_LIBS_SEARCH_LIST
187+
analyze
188+
bn
189+
bu
190+
cursor
191+
dm
192+
fb
193+
fft
194+
gcv
195+
ged
196+
icv
197+
multispectral
198+
nmg
199+
optical
200+
orle
201+
pkg
202+
render
203+
rt
204+
sysv
205+
termio
206+
wdb
207+
)
208+
209+
FOREACH(brl_lib ${BRL-CAD_LIBS_SEARCH_LIST})
210+
STRING(TOUPPER ${brl_lib} LIBCORE)
211+
FIND_LIBRARY(BRLCAD_${LIBCORE}_LIBRARY NAMES ${brl_lib} lib${brl_lib} PATHS ${BRLCAD_LIB_DIR} NO_SYSTEM_PATH)
212+
IF(BRLCAD_${LIBCORE}_LIBRARY)
213+
SET(BRLCAD_LIBRARIES ${BRLCAD_LIBRARIES} ${BRLCAD_${LIBCORE}_LIBRARY})
214+
ELSE(BRLCAD_${LIBCORE}_LIBRARY)
215+
SET(BRLCAD_LIBRARIES_NOTFOUND ${BRLCAD_LIBRARIES_NOTFOUND} ${brl_lib})
216+
ENDIF(BRLCAD_${LIBCORE}_LIBRARY)
217+
ENDFOREACH(brl_lib ${BRL-CAD_LIBS_SEARCH_LIST})
218+
219+
# Then, look for customized src/other libraries that we need
220+
# local versions of
221+
222+
SET(BRL-CAD_SRC_OTHER_REQUIRED
223+
exppp
224+
express
225+
stepcore
226+
stepdai
227+
stepeditor
228+
steputils
229+
openNURBS
230+
)
231+
232+
FOREACH(ext_lib ${BRL-CAD_LIBS_SEARCH_LIST})
233+
STRING(TOUPPER ${ext_lib} LIBCORE)
234+
FIND_LIBRARY(BRLCAD_${LIBCORE}_LIBRARY NAMES ${ext_lib} lib${ext_lib} PATHS ${BRLCAD_LIB_DIR} NO_SYSTEM_PATH)
235+
IF(BRLCAD_${LIBCORE}_LIBRARY)
236+
SET(BRLCAD_LIBRARIES ${BRLCAD_LIBRARIES} ${BRLCAD_${LIBCORE}_LIBRARY})
237+
ELSE(BRLCAD_${LIBCORE}_LIBRARY)
238+
SET(BRLCAD_LIBRARIES_NOTFOUND ${BRLCAD_LIBRARIES_NOTFOUND} ${ext_lib})
239+
ENDIF(BRLCAD_${LIBCORE}_LIBRARY)
240+
ENDFOREACH(ext_lib ${BRL-CAD_LIBS_SEARCH_LIST})
241+
242+
# Lastly, we need to check for local installs in the BRL-CAD install of
243+
# libraries that might otherwise be present on the system - if they are
244+
# found in the BRL-CAD install tree, use those versions instead of any
245+
# system results by setting the variables a find_package result would
246+
# produce.
247+
248+
# zlib
249+
FIND_LIBRARY(ZLIB_LIBRARY NAMES z zlib zdll PATHS ${BRLCAD_LIB_DIR} NO_SYSTEM_PATH)
250+
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h PATHS ${BRLCAD_INCLUDE_DIRS} NO_SYSTEM_PATH)
251+
SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
252+
SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
253+
254+
# libregex
255+
FIND_LIBRARY(REGEX_LIBRARY NAMES regex libregex PATHS ${BRLCAD_LIB_DIR} NO_SYSTEM_PATH)
256+
FIND_PATH(REGEX_INCLUDE_DIR regex.h PATHS ${BRLCAD_INCLUDE_DIRS} NO_SYSTEM_PATH)
257+
258+
# libpng
259+
FIND_LIBRARY(PNG_LIBRARY NAMES png libpng png14 libpng14 png14d libpng14d PATHS ${BRLCAD_LIB_DIR} NO_SYSTEM_PATH)
260+
FIND_PATH(PNG_PNG_INCLUDE_DIR png.h PATHS ${BRLCAD_INCLUDE_DIRS} NO_SYSTEM_PATH)
261+
SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
262+
SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
263+
264+
# libtermlib
265+
FIND_LIBRARY(TERMLIB_LIBRARY NAMES termlib libtermlib PATHS ${BRLCAD_LIB_DIR} NO_SYSTEM_PATH)
266+
267+
# utahrle
268+
FIND_LIBRARY(UTAHRLE_LIBRARY NAMES utahrle libutahrle PATHS ${BRLCAD_LIB_DIR} NO_SYSTEM_PATH)
269+
FIND_PATH(UTAHRLE_INCLUDE_DIR rle.h PATHS ${BRLCAD_INCLUDE_DIRS} NO_SYSTEM_PATH)
270+
271+
# tcl/tk
272+
FIND_PROGRAM(TCL_TCLSH_EXECUTABLE NAMES tclsh tclsh85 tclsh8.5 tclsh-8.5 tclsh-85 PATHS ${BRLCAD_BIN_DIR} NO_SYSTEM_PATH)
273+
SET(TCL_TCLSH ${TCL_TCLSH_EXECUTABLE})
274+
FIND_PROGRAM(TCL_WISH_EXECUTABLE NAMES wish wish85 wish8.5 wish-8.5 wish-85 PATHS ${BRLCAD_BIN_DIR} NO_SYSTEM_PATH)
275+
SET(TK_WISH ${TCL_WISH_EXECUTABLE})
276+
FIND_LIBRARY(TCL_LIBRARY NAMES tcl tcl85 tcl8.5 tcl-8.5 tcl-85 PATHS ${BRLCAD_LIB_DIR} NO_SYSTEM_PATH)
277+
FIND_LIBRARY(TCL_TK_LIBRARY NAMES tk tk85 tk8.5 tk-8.5 tk-85 PATHS ${BRLCAD_LIB_DIR} NO_SYSTEM_PATH)
278+
SET(TCL_LIBRARIES ${TCL_LIBRARY} ${TCL_TK_LIBRARY})
279+
SET(TK_LIBRARY ${TCL_TK_LIBRARY})
280+
GET_FILENAME_COMPONENT(TCL_CONF_PREFIX ${TCL_LIBRARY} PATH)
281+
SET(TK_CONF_PREFIX ${TCL_CONF_PREFIX})
282+
SET(TCL_TK_CONF_PREFIX ${TCL_CONF_PREFIX})
283+
FIND_LIBRARY(TCL_STUB_LIBRARY NAMES tclstub tclstub85 tclstub8.5 tclstub-8.5 tclstub-85 PATHS ${BRLCAD_LIB_DIR} NO_SYSTEM_PATH)
284+
FIND_LIBRARY(TCL_TK_STUB_LIBRARY NAMES tkstub tkstub85 tkstub8.5 tkstub-8.5 tkstub-85 PATHS ${BRLCAD_LIB_DIR} NO_SYSTEM_PATH)
285+
SET(TCL_STUB_LIBRARIES ${TCL_STUB_LIBRARY} ${TCL_TK_STUB_LIBRARY})
286+
SET(TK_STUB_LIBRARY ${TCL_TK_STUB_LIBRARY})
287+
FIND_PATH(TCL_INCLUDE_PATH tcl.h PATHS ${BRLCAD_INCLUDE_DIRS} NO_SYSTEM_PATH)
288+
FIND_PATH(TK_INCLUDE_PATH tk.h PATHS ${BRLCAD_INCLUDE_DIRS} NO_SYSTEM_PATH)
289+
SET(TCL_INCLUDE_DIRS ${TCL_INCLUDE_PATH} ${TK_INCLUDE_PATH})
290+
291+
# Togl
292+
FIND_LIBRARY(TOGL_LIBRARY NAMES togl PATHS ${BRLCAD_LIB_DIR} NO_SYSTEM_PATH)
293+
FIND_PATH(TOGL_INCLUDE_DIR NAMES togl/togl.h PATHS ${BRLCAD_INCLUDE_DIRS} NO_SYSTEM_PATH)
294+
295+
##########################################################################
296+
#Print status
297+
IF(BRLCAD_VERSION)
298+
MESSAGE(STATUS "Found BRL-CAD ${BRLCAD_VERSION} at ${BRLCAD_BASE_DIR}")
299+
ELSE(BRLCAD_VERSION)
300+
MESSAGE(STATUS "Found BRL-CAD at ${BRLCAD_BASE_DIR}")
301+
ENDIF(BRLCAD_VERSION)
302+
303+
#Set found flag - TODO: this is wrong, need to set this based on variables
304+
SET(BRLCAD_FOUND TRUE)

0 commit comments

Comments
 (0)