Skip to content

Commit 21226a3

Browse files
KIT-McCadKIT-McCad
KIT-McCad
authored and
KIT-McCad
committed
init the program
0 parents  commit 21226a3

File tree

5,810 files changed

+1509553
-0
lines changed

Some content is hidden

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

5,810 files changed

+1509553
-0
lines changed

CMakeLists.txt

+189
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
cmake_minimum_required(VERSION 2.6)
2+
cmake_policy(VERSION 2.6)
3+
4+
PROJECT (McCad)
5+
SET (MCCAD_VERSION_MAJOR 0)
6+
SET (MCCAD_VERSION_MINOR 4)
7+
SET (MCCAD_VERSION_PATCH 1)
8+
9+
SET(MCCAD_VERSION ${MCCAD_VERSION_MAJOR}.${MCCAD_VERSION_MINOR}.${MCCAD_VERSION_PATCH})
10+
11+
#
12+
# McCad is a CAD interface program for the Monte Carlo Particle Transport Codes MCNP and TRIPOLI
13+
#
14+
# McCad uses the cmake for installation. Please download cmake from www.cmake.org and follow the installation
15+
# instructions.
16+
#
17+
# Software requirements for McCad :
18+
# - OpenCASCADE >= 6.5 (www.opencascade.org)
19+
# - Qt >= 4.1 (qt.nokia.com)
20+
#
21+
# Installing McCad :
22+
# cd /my/path/to/McCad
23+
# mkdir build
24+
# cd build
25+
# cmake ../
26+
# make
27+
#
28+
# Any problems? --> please contact dennis.grosse@kit.edu, ulrich.fischer@kit.edu
29+
#
30+
31+
# general configuration file
32+
# ----------------------------------------------------
33+
configure_file (
34+
"${PROJECT_SOURCE_DIR}/inc/McCadConfig.h.in"
35+
"${PROJECT_SOURCE_DIR}/inc/McCadConfig.h"
36+
)
37+
# -----------------------------------------------------
38+
39+
set( BUILD_TO_DIR ${McCad_SOURCE_DIR} )
40+
include_directories( ${McCad_SOURCE_DIR}/inc )
41+
42+
#
43+
# Check for Qt-4
44+
#
45+
FIND_PACKAGE(Qt4 REQUIRED)
46+
47+
IF(QT4_FOUND)
48+
MESSAGE ("-- Using Qt-Libraries in: ${QT_LIBRARY_DIR}")
49+
ELSE(QT4_FOUND)
50+
MESSAGE (FATAL_ERROR "Couldn't find QT4: please set shell var QTDIR to your QT4 dir")
51+
ENDIF(QT4_FOUND)
52+
53+
ADD_DEFINITIONS(${QT_DEFINITIONS})
54+
55+
# SET (QT_USE_QTASSISTANT true)
56+
SET (QT_USE_QTOPENGL true)
57+
SET (QT_USE_QTNETWORK true)
58+
SET (QT_USE_QTXML true)
59+
INCLUDE(${QT_USE_FILE})
60+
61+
62+
63+
#
64+
# Check for OpenCASCADE Libraries
65+
#
66+
find_package(OCE)
67+
if(OCE_FOUND)
68+
message(STATUS "Found OCE version ${OCE_VERSION}")
69+
# Include files reside in ${OCE_INCLUDE_DIRS};
70+
include_directories(${OCE_INCLUDE_DIRS})
71+
else(OCE_FOUND)
72+
# OCE not found; either it is not found and user
73+
# has to set OCE_DIR to the directory containing
74+
# OCEConfig.cmake, or OCE is not installed and we
75+
# try to find OpenCascade files.
76+
if(DEFINED ENV{CASROOT})
77+
if(NOT DEFINED OCC_INCLUDE_PATH)
78+
set(OCC_INCLUDE_PATH "$ENV{CASROOT}/inc")
79+
endif()
80+
if(NOT DEFINED OCC_LIB_PATH)
81+
set(OCC_LIB_PATH "$ENV{CASROOT}/lin/lib")
82+
endif(NOT DEFINED OCC_LIB_PATH)
83+
else(DEFINED ENV{CASROOT})
84+
if(NOT DEFINED OCC_INCLUDE_PATH OR NOT DEFINED OCC_LIB_PATH)
85+
message(FATAL_ERROR "To specify paths of OpenCascade files, you may either define the CASROOT environment variable, or set both OCC_INCLUDE_PATH and OCC_LIB_PATH variables.")
86+
endif(NOT DEFINED OCC_INCLUDE_PATH OR NOT DEFINED OCC_LIB_PATH)
87+
endif(DEFINED ENV{CASROOT})
88+
if(DEFINED OCC_INCLUDE_PATH)
89+
message(STATUS "OCC search path for include files: OCC_INCLUDE_PATH=${OCC_INCLUDE_PATH}")
90+
include_directories(${OCC_INCLUDE_PATH})
91+
endif(DEFINED OCC_INCLUDE_PATH)
92+
if(DEFINED OCC_LIB_PATH)
93+
message(STATUS "OCC search path for libraries: OCC_LIB_PATH=${OCC_LIB_PATH}")
94+
link_directories(${OCC_LIB_PATH})
95+
endif(DEFINED OCC_LIB_PATH)
96+
endif(OCE_FOUND)
97+
98+
#
99+
# set build parameter
100+
#
101+
include(CheckCXXCompilerFlag)
102+
SET(LIBRARY_OUTPUT_PATH ${McCad_SOURCE_DIR}/lib )
103+
SET(EXECUTABLE_OUTPUT_PATH ${McCad_SOURCE_DIR}/bin )
104+
105+
SET(CMAKE_CXX_FLAGS "-fPIC -funsigned-char -Wall -fmessage-length=0 -DNO_CXX_EXCEPTION -MD -DHAVE_LIMITS_H -DHAVE_IOSTREAM -DHAVE_CONFIG_H -fpermissive -pthread -fopenmp " )
106+
107+
if(DEFINED OCC650)
108+
add_definitions( -DOCC650 )
109+
endif()
110+
111+
if (CMAKE_SIZEOF_VOID_P MATCHES "8") # x86_64
112+
SET(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -m64 -D_OCC64" )
113+
set(BIT 64)
114+
else()
115+
set(BIT 32)
116+
endif()
117+
118+
if(DEBUG EQUAL true)
119+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O1" )
120+
else()
121+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3" )
122+
endif()
123+
124+
125+
CHECK_CXX_COMPILER_FLAG("-ffriend-injection" compiler_accepts_-ffriend-injection_FLAG)
126+
IF(compiler_accepts_-ffriend-injection_FLAG)
127+
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffriend-injection")
128+
ENDIF(compiler_accepts_-ffriend-injection_FLAG)
129+
130+
131+
OPTION (BUILD_SHARED_LIBS "build all libs as SHARED" ON ) #build all libraries as SHARED
132+
133+
#
134+
# prepare McCad shell script to set up environment before
135+
#
136+
configure_file( ${PROJECT_SOURCE_DIR}/src/McCad.template
137+
${PROJECT_SOURCE_DIR}/bin/McCad )
138+
139+
140+
#
141+
# settings for CPack debian package generator
142+
#
143+
set(CPACK_SET_DESTDIR true )
144+
SET(CPACK_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} )
145+
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "McCad - a CAD interface for Monte Carlo particle transport codes")
146+
147+
SET(CPACK_PACKAGE_VERSION_MAJOR ${MCCAD_VERSION_MAJOR})
148+
SET(CPACK_PACKAGE_VERSION_MINOR ${MCCAD_VERSION_MINOR})
149+
SET(CPACK_PACKAGE_VERSION_PATCH ${MCCAD_VERSION_PATCH})
150+
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME} )
151+
152+
SET(CPACK_PACKAGE_CONTACT "Ulrich Fischer <ulrich.fischer@kit.edu>")
153+
154+
SET(CPACK_GENERATOR "DEB")
155+
if( CPACK_GENERATOR MATCHES ".*DEB.*" )
156+
157+
if( ${CMAKE_VERSION} STREQUAL "2.8.2" )
158+
# bug http://vtk.org/Bug/view.php?id=11020
159+
message( WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!")
160+
endif()
161+
set(CPACK_DEBIAN_PACKAGE_SECTION "science")
162+
# debian source packages aren't yet supported by cmake, but the following list will help anyone who is trying to figure out what to apt-get install before building.
163+
set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS "cmake (>= 2.8), libtool,
164+
libx11-dev, libxmu-dev, libxext-dev,
165+
libgl1-mesa-dev | libgl-dev, libglu1-mesa-dev | libglu-dev,
166+
libftgl-dev, libgl2ps-dev")
167+
# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3), libfreetype6 (>= 2.2.1), libftgl2 (>= 2.1.3~rc5),
168+
# libgcc1 (>= 1:4.1.1), libgl1-mesa-glx, libglu1-mesa,
169+
# libgomp1 (>= 4.2.1), libstdc++6 (>= 4.4.0), libx11-6, libxext6,
170+
# libxmu6, libxt6, tcl8.5 (>= 8.5.0), tk8.5 (>= 8.5.0)")
171+
set(CPACK_DEBIAN_PACKAGE_PROVIDES "libmccad")
172+
if( BIT EQUAL 64 )
173+
set( CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64" )
174+
else()
175+
set( CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386" )
176+
endif()
177+
string( TOLOWER "${CPACK_PACKAGE_NAME}-${MCCAD_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_FILE_NAME )
178+
endif()
179+
# after 'cmake ..' and 'make' you can run cpack to generate a debian package when you
180+
# uncomment the following line
181+
include(CPack)
182+
183+
184+
#
185+
# enter build directory and run build script
186+
#
187+
add_subdirectory(src)
188+
# add_subdirectory(test)
189+

0 commit comments

Comments
 (0)