Skip to content

Commit 5e09e1e

Browse files
authored
Merge pull request #81 from jberlin/master
update for multiple internal build and bug fixes
2 parents db4cfca + 8ef62bb commit 5e09e1e

Some content is hidden

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

57 files changed

+535
-382
lines changed

CMakeLists.txt

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ set(LLVM_LIB "")
8888
if (ENABLE_LLVM_BACKEND)
8989
set(LLVM_DIR /usr/share/llvm/cmake CACHE PATH "Where to search for LLVM i.e. ")
9090

91-
find_package(LLVM CONFIG NAMES LLVM CONFIGS LLVMConfig.cmake)
91+
find_package(LLVM CONFIG NAMES LLVM CONFIGS LLVM-Config.cmake LLVMConfig.cmake)
9292
if (LLVM_FOUND)
9393
set(SEEXPR_ENABLE_LLVM_BACKEND 1)
9494
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
@@ -176,9 +176,27 @@ if (NOT CMAKE_BUILD_TYPE)
176176
FORCE)
177177
endif()
178178

179-
find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL)
180-
if (QT4_FOUND)
181-
include_directories(${QT_INCLUDE_DIR})
179+
if (ENABLE_QT5)
180+
find_package(Qt5 COMPONENTS Core Gui OpenGL)
181+
if (Qt5_FOUND)
182+
message(STATUS "Qt5 Enabled")
183+
message(STATUS "Qt5Core_INCLUDE_DIRS = ${Qt5Core_INCLUDE_DIRS}")
184+
message(STATUS "Qt5Gui_INCLUDE_DIRS = ${Qt5Gui_INCLUDE_DIRS}")
185+
message(STATUS "Qt5OpenGL_INCLUDE_DIRS = ${Qt5OpenGL_INCLUDE_DIRS}")
186+
include_directories(${Qt5Core_INCLUDE_DIRS})
187+
include_directories(${Qt5Gui_INCLUDE_DIRS})
188+
include_directories(${Qt5OpenGL_INCLUDE_DIRS})
189+
endif()
190+
else()
191+
find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL)
192+
if (QT4_FOUND)
193+
message(STATUS "Qt4 Enabled")
194+
message(STATUS "QT_INCLUDE_DIR = ${QT_INCLUDE_DIR}")
195+
include_directories(${QT_INCLUDE_DIR}
196+
${QT_INCLUDE_DIR}/QtCore
197+
${QT_INCLUDE_DIR}/QtGui
198+
${QT_INCLUDE_DIR}/QtOpenGL)
199+
endif()
182200
endif()
183201

184202
if (DEFINED ANIMLIB_DIR)
@@ -220,13 +238,13 @@ set(SEEXPR_EDITOR_LIBRARIES SeExpr2Editor)
220238
include_directories(BEFORE ${CMAKE_BINARY_DIR}/include)
221239
include_directories(BEFORE ${CMAKE_BINARY_DIR}/src/SeExpr)
222240
include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src/SeExpr)
223-
include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src/EditorUI)
241+
include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src/ui)
224242

225243
## Traverse subdirectories
226244
add_subdirectory(src/SeExpr)
227245
add_subdirectory(src/ui)
228-
add_subdirectory(src/tests)
229246
add_subdirectory(src/py)
230247
add_subdirectory(src/utils)
231248
add_subdirectory(src/demos)
232249
add_subdirectory(src/doc)
250+
add_subdirectory(src/tests)

Makefile.config.example

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@ uname_S := $(shell uname -s)
55
# Example Linux config
66
ifeq ($(uname_S),Linux)
77

8-
EXTRA_CMAKE_ARGS += -DGTEST_DIR=/usr
8+
ifdef RP_gtest
9+
EXTRA_CMAKE_ARGS += -DGTEST_DIR=$(RP_gtest)
10+
else
11+
EXTRA_CMAKE_ARGS += -DGTEST_DIR=/usr
12+
endif
913

10-
ifdef RP_animlib
14+
# only build animlib if soure directory exists and env var set
15+
CE_dir = $(wildcard "src/ui/CE")
16+
ifneq ("$(CE_dir)", "")
17+
ifdef RP_animlib
1118
EXTRA_CMAKE_ARGS += -DANIMLIB_DIR=$(RP_animlib)
1219
endif
20+
endif
1321

1422
ifdef RP_boost_disney
1523
EXTRA_CMAKE_ARGS += -DBOOST_DIR=$(RP_boost_disney)
@@ -37,6 +45,17 @@ ifeq ($(uname_S),Linux)
3745
EXTRA_CMAKE_ARGS += -DQDGUI_DIR=$(RP_qdgui)
3846
endif
3947

48+
ifdef RP_qt5
49+
EXTRA_CMAKE_ARGS += -DENABLE_QT5=true
50+
endif
51+
52+
ifdef RP_pyqt5
53+
EXTRA_CMAKE_ARGS += -DPYQT_SIP_DIR=$(RP_pyqt5)/share/sip/PyQt5
54+
endif
55+
56+
ifdef RP_pyqt4
57+
EXTRA_CMAKE_ARGS += -DPYQT_SIP_DIR=$(RP_pyqt4)/share/sip
58+
endif
4059
endif
4160

4261

src/SeExpr/ExprFunc.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ FuncTable* Functions = 0;
105105

106106
namespace SeExpr2 {
107107

108+
std::vector<void*> ExprFunc::dynlib;
109+
108110
static SeExprInternal2::Mutex mutex;
109111

110112
void ExprFunc::init() {
@@ -116,6 +118,13 @@ void ExprFunc::cleanup() {
116118
SeExprInternal2::AutoMutex locker(mutex);
117119
delete Functions;
118120
Functions = nullptr;
121+
#ifdef SEEXPR_WIN32
122+
#else
123+
for(size_t i=0; i<dynlib.size(); i++){
124+
dlclose(dynlib[i]);
125+
}
126+
#endif
127+
119128
}
120129

121130
const ExprFunc* ExprFunc::lookup(const std::string& name) {
@@ -255,18 +264,15 @@ void ExprFunc::loadPlugin(const char* path) {
255264
typedef void (*initfn_v3)(ExprFunc::Define3);
256265
initfn_v3 init_v3 = (initfn_v3)dlsym(handle, "SeExpr2PluginInit");
257266

258-
if (init_v3)
267+
if (init_v3) {
259268
init_v3(defineInternal3);
260-
else {
261-
void* init_v2 = dlsym(handle, "SeExprPluginInitV2");
262-
void* init_v1 = dlsym(handle, "SeExprPluginInit");
263-
if (!init_v1 && !init_v2) {
264-
std::cerr << "Error reading expression plugin: " << path << std::endl;
265-
std::cerr << "No functions named SeExprPluginInit and SeExprPluginInitV2 called" << std::endl;
266-
}
269+
dynlib.push_back(handle);
270+
} else {
271+
std::cerr << "Error reading expression plugin: " << path << std::endl;
272+
std::cerr << "No function named SeExpr2PluginInit defined" << std::endl;
267273
dlclose(handle);
268-
return;
269274
}
275+
return;
270276
#endif
271277
}
272278
}

src/SeExpr/ExprFunc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class ExprFunc {
129129
ExprFuncX* _func;
130130
int _minargs;
131131
int _maxargs;
132+
static std::vector<void*> dynlib;
132133
};
133134
}
134135

src/SeExpr/ExprLLVMCodeGeneration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ struct VarCodeGeneration {
11111111
varRef->type().isLifetimeUniform() ? baseMemory : Builder.CreateInBoundsGEP(baseMemory, indirectIndex);
11121112
return Builder.CreateLoad(variablePointer);
11131113
} else {
1114-
std::vector<Value *> loadedValues(3);
1114+
std::vector<Value *> loadedValues(dim);
11151115
for (int component = 0; component < dim; component++) {
11161116
Value *componentIndex = ConstantInt::get(Type::getInt32Ty(llvmContext), component);
11171117
/// If we are uniform always assume indirectIndex is 0 (there's only one value)

src/SeExpr/ExprNode.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,9 @@ ExprType ExprModuleNode::prep(bool wantScalar, ExprVarEnvBuilder& envBuilder) {
136136
}
137137

138138
ExprType ExprPrototypeNode::prep(bool wantScalar, ExprVarEnvBuilder& envBuilder) {
139-
// TODO: implement prototype
140-
bool error = false;
141-
checkCondition(false, "Prototypes are currently not supported", error);
142-
return ExprType().Error();
143-
#if 0
144139
bool error = false;
145140

141+
#if 0 // TODO: implement prototype
146142
if (_retTypeSet) checkCondition(returnType().isValid(), "Function has bad return type", error);
147143

148144
_argTypes.clear();
@@ -155,14 +151,15 @@ ExprType ExprPrototypeNode::prep(bool wantScalar, ExprVarEnvBuilder& envBuilder)
155151
std::cerr << "after create localvar phi " << localVar->getPhi() << std::endl;
156152
child(c)->prep(wantScalar, envBuilder);
157153
}
158-
154+
#else
155+
checkCondition(false, "Prototypes are currently not supported", error);
156+
#endif
159157
if (error)
160158
setType(ExprType().Error());
161159
else
162160
setType(ExprType().None().Varying());
163161

164162
return _type;
165-
#endif
166163
}
167164

168165
void ExprPrototypeNode::addArgTypes(ExprNode* surrogate) {
@@ -188,9 +185,10 @@ void ExprPrototypeNode::addArgs(ExprNode* surrogate) {
188185
}
189186

190187
ExprType ExprLocalFunctionNode::prep(bool wantScalar, ExprVarEnvBuilder& envBuilder) {
191-
#if 0 // TODO: no local functions for now
192188
bool error = false;
193189

190+
#if 0 // TODO: no local functions for now
191+
194192
// prep prototype and check for errors
195193
ExprPrototypeNode* prototype = (ExprPrototypeNode*)child(0);
196194
ExprVarEnv functionEnv;
@@ -223,12 +221,16 @@ ExprType ExprLocalFunctionNode::prep(bool wantScalar, ExprVarEnvBuilder& envBuil
223221
checkCondition(false, "Invalid type for blockType is " + blockType.toString(), error);
224222
error = true;
225223
}
226-
return _type = error ? ExprType().Error() : ExprType().None().Varying();
227224
#else
228-
bool error = false;
229225
checkCondition(false, "Local functions are currently not supported.", error);
230-
return ExprType().Error();
231226
#endif
227+
228+
if (error)
229+
setType(ExprType().Error());
230+
else
231+
setType(ExprType().None().Varying());
232+
233+
return _type;
232234
}
233235

234236
// TODO: write buildInterpreter for local function node

src/SeExpr/ExprParser.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ typeListOptional:
198198
typeList:
199199
typeDeclare { $$ = NODE(@$.first_column, @$.last_column, Node);
200200
SeExpr2::ExprType type = SeExpr2::ExprType($1.type, $1.dim, $1.lifetime);
201-
SeExpr2::ExprNode* varNode = NODE2(@$.first_column, @$.last_column, VarNode, 0, type);
201+
SeExpr2::ExprNode* varNode = NODE2(@$.first_column, @$.last_column, VarNode, "", type);
202202
$$->addChild(varNode); }
203203
| typeList ',' typeDeclare { $$ = $1;
204204
SeExpr2::ExprType type = SeExpr2::ExprType($3.type, $3.dim, $3.lifetime);
205-
SeExpr2::ExprNode* varNode = NODE2(@3.first_column, @3.last_column, VarNode, 0, type);
205+
SeExpr2::ExprNode* varNode = NODE2(@3.first_column, @3.last_column, VarNode, "", type);
206206
$$->addChild(varNode); }
207207
;
208208

src/build/build-info

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def main():
2121
('python-site', python_site),
2222
('python-inc', python_inc),
2323
('pyqt4-sip', pyqt4_sip),
24+
('pyqt-sip-flags', pyqt_sip_flags),
2425
('sip-inc', sip_inc),
2526
)
2627

@@ -60,6 +61,16 @@ def pyqt4_sip(args):
6061
return pkg_cfg['pyqt_sip_dir']
6162

6263

64+
def pyqt_sip_flags(args):
65+
try:
66+
import PyQt5.Qt
67+
return PyQt5.Qt.PYQT_CONFIGURATION['sip_flags']
68+
except ImportError:
69+
from PyQt4 import pyqtconfig
70+
pkg_cfg = pyqtconfig._pkg_config
71+
return pkg_cfg['pyqt_sip_flags']
72+
73+
6374
def sip_inc(args):
6475
pkg_cfg = sipconfig._pkg_config
6576
return pkg_cfg['sip_inc_dir']

src/demos/imageEditor/CMakeLists.txt

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,52 @@
1717
# Set application root dir for use inside the source code.
1818
add_definitions(-DIMAGE_EDITOR_ROOT="${CMAKE_INSTALL_PREFIX}")
1919

20-
find_package(Qt4 COMPONENTS QtCore QtGui)
20+
if (ENABLE_QT5)
21+
find_package(Qt5 COMPONENTS Core Gui Widgets) # find and setup Qt5 for this project
22+
include_directories(${Qt5Core_INCLUDE_DIRS}
23+
${Qt5Gui_INCLUDE_DIRS}
24+
${Qt5OpenGL_INCLUDE_DIRS})
25+
else()
26+
find_package(Qt4 COMPONENTS QtCore QtGui)
27+
include_directories(${QT_INCLUDE_DIR}
28+
${QT_INCLUDE_DIR}/QtCore
29+
${QT_INCLUDE_DIR}/QtGui)
30+
endif()
31+
2132
find_package(PNG)
2233

23-
if (QT4_FOUND AND PNG_FOUND)
34+
if(Qt5_FOUND OR QT4_FOUND)
35+
if(PNG_FOUND)
2436
set(imageEditor_MOC_HDRS ImageEditorDialog.h)
2537
set(imageEditor_CPPS imageEditor.cpp)
38+
39+
if (ENABLE_QT5)
40+
qt5_wrap_cpp(imageEditor_MOC_SRCS ${imageEditor_MOC_HDRS})
41+
else()
2642
qt4_wrap_cpp(imageEditor_MOC_SRCS ${imageEditor_MOC_HDRS})
43+
endif()
2744

2845
add_executable(imageEditor2 ${imageEditor_CPPS} ${imageEditor_MOC_SRCS})
29-
include_directories(${QT_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
46+
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
3047
include_directories(${SEEXPR_EDITOR_INCLUDES})
48+
49+
if (ENABLE_QT5)
50+
target_link_libraries(imageEditor2 Qt5::Core)
51+
target_link_libraries(imageEditor2 Qt5::Gui)
52+
target_link_libraries(imageEditor2 Qt5::Widgets)
53+
else()
3154
target_link_libraries(imageEditor2 ${QT_QTCORE_LIBRARY})
3255
target_link_libraries(imageEditor2 ${QT_QTGUI_LIBRARY})
56+
endif()
57+
3358
target_link_libraries(imageEditor2 ${SEEXPR_LIBRARIES})
3459
target_link_libraries(imageEditor2 ${SEEXPR_EDITOR_LIBRARIES})
3560

3661
include_directories(SYSTEM ${PNG_INCLUDE_DIR})
3762
target_link_libraries(imageEditor2 ${PNG_LIBRARIES})
3863
install(TARGETS imageEditor2 DESTINATION ${CMAKE_INSTALL_BINDIR})
3964
endif()
65+
endif()
4066

4167
install(FILES fbm.se noisecolor1.se noisecolor2.se noise.se raytrace.se sinc.se
4268
DESTINATION share/SeExpr2/expressions)

src/demos/imageEditor/ImageEditorDialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
@file ImageEditorDialog.h
2020
*/
2121

22-
#include <QtGui/QDialog>
22+
#include <QDialog>
2323

2424
class QLabel;
2525
class ExprEditor;

0 commit comments

Comments
 (0)