Thu, 22 Aug 2013 20:24:16 +0300
Changed build system from qmake to CMake.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CMakeLists.txt Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,124 @@ +####################################################################################### +# The original ldforge.pro was once generated by qmake (2.01a) Sat Sep 22 17:29:49 2012 +# That shalt be the official birthday of LDForge. +####################################################################################### + +project (ldforge) +cmake_minimum_required (VERSION 2.8.6) + +include(cmake/CheckCXX11Features.cmake) + +include_directories (${CMAKE_BINARY_DIR}/src) +include_directories (${CMAKE_BINARY_DIR}) + +# C++11 stuff from http://pageant.ghulbus.eu/?p=664 +# GCC specifics +if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -std=c++0x") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb") +endif() +# Visual Studio specifics +if(MSVC) + # Warning Level 4 for Debug builds + list(APPEND CMAKE_CXX_FLAGS_DEBUG " /W4") + list(REMOVE_DUPLICATES CMAKE_CXX_FLAGS_DEBUG) +endif() + +find_package (OpenGL REQUIRED) + +if (NOT QT5) + find_package (Qt4 REQUIRED) +else() + find_package (Qt5 REQUIRED) +endif() + +set (QT_USE_QTOPENGL true) +set (QT_USE_QTNETWORK true) + +# grep -l Q_OBJECT src/*.h +set (LDFORGE_MOC_INPUT + src/addObjectDialog.h + src/colorSelectDialog.h + src/configDialog.h + src/dialogs.h + src/download.h + src/file.h + src/gldraw.h + src/gui.h + src/messagelog.h + src/primitives.h + src/widgets.h +) + +set (LDFORGE_FORMS + src/ui/about.ui + src/ui/addhistoryline.ui + src/ui/colorsel.ui + src/ui/config.ui + src/ui/coverer.ui + src/ui/downloadfrom.ui + src/ui/edger2.ui + src/ui/editraw.ui + src/ui/extprogpath.ui + src/ui/flip.ui + src/ui/intersector.ui + src/ui/isecalc.ui + src/ui/ldforge.ui + src/ui/ldrawpath.ui + src/ui/makeprim.ui + src/ui/newpart.ui + src/ui/openprogress.ui + src/ui/overlay.ui + src/ui/rectifier.ui + src/ui/replcoords.ui + src/ui/rotpoint.ui + src/ui/ytruder.ui +) + +set (LDFORGE_SOURCES + src/addObjectDialog.cpp + src/colors.cpp + src/colorSelectDialog.cpp + src/config.cpp + src/configDialog.cpp + src/dialogs.cpp + src/docs.cpp + src/download.cpp + src/extprogs.cpp + src/file.cpp + src/gldraw.cpp + src/gui_actions.cpp + src/gui.cpp + src/gui_editactions.cpp + src/history.cpp + src/ldconfig.cpp + src/ldtypes.cpp + src/main.cpp + src/messagelog.cpp + src/misc.cpp + src/primitives.cpp + src/types.cpp + src/widgets.cpp +) + +set (LDFORGE_QRC ldforge.qrc) +set (LDFORGE_RC ldforge.rc) + +if (NOT QT5) + qt4_wrap_cpp (LDFORGE_MOC ${LDFORGE_MOC_INPUT}) + qt4_wrap_ui (LDFORGE_XFORMS ${LDFORGE_FORMS}) + qt4_add_resources (LDFORGE_XQRC ${LDFORGE_QRC}) +else() + qt5_wrap_cpp (LDFORGE_MOC ${LDFORGE_MOC_INPUT}) + qt5_wrap_ui (LDFORGE_XFORMS ${LDFORGE_FORMS}) + qt5_add_resources (LDFORGE_XQRC ${LDFORGE_QRC}) +endif() + +include (${QT_USE_FILE}) +add_definitions (${QT_DEFINITIONS}) +add_executable (ldforge ${LDFORGE_SOURCES} ${LDFORGE_XFORMS} ${LDFORGE_XQRC}) +target_link_libraries (ldforge + ${QT_LIBRARIES} + GL + GLU +) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/CheckCXX11Features.cmake Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,103 @@ +# Checks for C++11 features +# CXX11_FEATURE_LIST - a list containing all supported features +# HAS_CXX11_AUTO - auto keyword +# HAS_CXX11_NULLPTR - nullptr +# HAS_CXX11_LAMBDA - lambdas +# HAS_CXX11_STATIC_ASSERT - static_assert() +# HAS_CXX11_RVALUE_REFERENCES - rvalue references +# HAS_CXX11_DECLTYPE - decltype keyword +# HAS_CXX11_CSTDINT_H - cstdint header +# HAS_CXX11_LONG_LONG - long long signed & unsigned types +# HAS_CXX11_VARIADIC_TEMPLATES - variadic templates +# HAS_CXX11_CONSTEXPR - constexpr keyword +# HAS_CXX11_SIZEOF_MEMBER - sizeof() non-static members +# HAS_CXX11_FUNC - __func__ preprocessor constant +# +# Original script by Rolf Eike Beer +# Modifications by Andreas Weis +# +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3) + +SET(CHECK_CXX11_OLD_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) +IF(CMAKE_COMPILER_IS_GNUCXX) + SET(CMAKE_CXX_FLAGS "-std=c++0x") +endif() + +MACRO(CXX11_CHECK_FEATURE FEATURE_NAME FEATURE_NUMBER RESULT_VAR) + IF (NOT DEFINED ${RESULT_VAR}) + SET(_bindir "${CMAKE_CURRENT_BINARY_DIR}/cxx11/cxx11_${FEATURE_NAME}") + + IF (${FEATURE_NUMBER}) + SET(_SRCFILE_BASE ${CMAKE_CURRENT_LIST_DIR}/c++11-test-${FEATURE_NAME}-N${FEATURE_NUMBER}) + SET(_LOG_NAME "\"${FEATURE_NAME}\" (N${FEATURE_NUMBER})") + ELSE (${FEATURE_NUMBER}) + SET(_SRCFILE_BASE ${CMAKE_CURRENT_LIST_DIR}/c++11-test-${FEATURE_NAME}) + SET(_LOG_NAME "\"${FEATURE_NAME}\"") + ENDIF (${FEATURE_NUMBER}) + MESSAGE(STATUS "Checking C++11 support for ${_LOG_NAME}") + + SET(_SRCFILE "${_SRCFILE_BASE}.cpp") + SET(_SRCFILE_FAIL "${_SRCFILE_BASE}_fail.cpp") + SET(_SRCFILE_FAIL_COMPILE "${_SRCFILE_BASE}_fail_compile.cpp") + + IF (CROSS_COMPILING) + try_compile(${RESULT_VAR} "${_bindir}" "${_SRCFILE}") + IF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) + try_compile(${RESULT_VAR} "${_bindir}_fail" "${_SRCFILE_FAIL}") + ENDIF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) + ELSE (CROSS_COMPILING) + try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR + "${_bindir}" "${_SRCFILE}") + IF (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR) + SET(${RESULT_VAR} TRUE) + ELSE (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR) + SET(${RESULT_VAR} FALSE) + ENDIF (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR) + IF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) + try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR + "${_bindir}_fail" "${_SRCFILE_FAIL}") + IF (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR) + SET(${RESULT_VAR} TRUE) + ELSE (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR) + SET(${RESULT_VAR} FALSE) + ENDIF (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR) + ENDIF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) + ENDIF (CROSS_COMPILING) + IF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE}) + try_compile(_TMP_RESULT "${_bindir}_fail_compile" "${_SRCFILE_FAIL_COMPILE}") + IF (_TMP_RESULT) + SET(${RESULT_VAR} FALSE) + ELSE (_TMP_RESULT) + SET(${RESULT_VAR} TRUE) + ENDIF (_TMP_RESULT) + ENDIF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE}) + + IF (${RESULT_VAR}) + MESSAGE(STATUS "Checking C++11 support for ${_LOG_NAME} -- works") + LIST(APPEND CXX11_FEATURE_LIST ${RESULT_VAR}) + ELSE (${RESULT_VAR}) + MESSAGE(STATUS "Checking C++11 support for ${_LOG_NAME} -- not supported") + ENDIF (${RESULT_VAR}) + SET(${RESULT_VAR} ${${RESULT_VAR}} CACHE INTERNAL "C++11 support for ${_LOG_NAME}") + ENDIF (NOT DEFINED ${RESULT_VAR}) +ENDMACRO(CXX11_CHECK_FEATURE) + +CXX11_CHECK_FEATURE("auto" 2546 HAS_CXX11_AUTO) +CXX11_CHECK_FEATURE("nullptr" 2431 HAS_CXX11_NULLPTR) +CXX11_CHECK_FEATURE("lambda" 2927 HAS_CXX11_LAMBDA) +CXX11_CHECK_FEATURE("static_assert" 1720 HAS_CXX11_STATIC_ASSERT) +CXX11_CHECK_FEATURE("rvalue_references" 2118 HAS_CXX11_RVALUE_REFERENCES) +CXX11_CHECK_FEATURE("decltype" 2343 HAS_CXX11_DECLTYPE) +CXX11_CHECK_FEATURE("cstdint" "" HAS_CXX11_CSTDINT_H) +CXX11_CHECK_FEATURE("long_long" 1811 HAS_CXX11_LONG_LONG) +CXX11_CHECK_FEATURE("variadic_templates" 2555 HAS_CXX11_VARIADIC_TEMPLATES) +CXX11_CHECK_FEATURE("constexpr" 2235 HAS_CXX11_CONSTEXPR) +CXX11_CHECK_FEATURE("sizeof_member" 2253 HAS_CXX11_SIZEOF_MEMBER) +CXX11_CHECK_FEATURE("__func__" 2340 HAS_CXX11_FUNC) + +SET(CXX11_FEATURE_LIST ${CXX11_FEATURE_LIST} CACHE STRING "C++11 feature support list") +MARK_AS_ADVANCED(FORCE CXX11_FEATURE_LIST) + +SET(CMAKE_CXX_FLAGS ${CHECK_CXX11_OLD_CMAKE_CXX_FLAGS}) +UNSET(CHECK_CXX11_OLD_CMAKE_CXX_FLAGS) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-__func__-N2340.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,8 @@ +#include <cstring> + +int main() +{ + if (!__func__) { return 1; } + if(std::strlen(__func__) <= 0) { return 1; } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-auto-N2546.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,12 @@ + +int main() +{ + auto i = 5; + auto f = 3.14159f; + auto d = 3.14159; + bool ret = ( + (sizeof(f) < sizeof(d)) && + (sizeof(i) == sizeof(int)) + ); + return ret ? 0 : 1; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-constexpr-N2235.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,19 @@ +constexpr int square(int x) +{ + return x*x; +} + +constexpr int the_answer() +{ + return 42; +} + +int main() +{ + int test_arr[square(3)]; + bool ret = ( + (square(the_answer()) == 1764) && + (sizeof(test_arr)/sizeof(test_arr[0]) == 9) + ); + return ret ? 0 : 1; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-cstdint.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,10 @@ +#include <cstdint> +int main() +{ + bool test = + (sizeof(int8_t) == 1) && + (sizeof(int16_t) == 2) && + (sizeof(int32_t) == 4) && + (sizeof(int64_t) == 8); + return test ? 0 : 1; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-decltype-N2343.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,11 @@ + +bool check_size(int i) +{ + return sizeof(int) == sizeof(decltype(i)); +} + +int main() +{ + bool ret = check_size(42); + return ret ? 0 : 1; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-lambda-N2927.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,5 @@ +int main() +{ + int ret = 0; + return ([&ret]() -> int { return ret; })(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-long_long-N1811.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,7 @@ +int main(void) +{ + long long l; + unsigned long long ul; + + return ((sizeof(l) >= 8) && (sizeof(ul) >= 8)) ? 0 : 1; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-nullptr-N2431.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,5 @@ +int main() +{ + int* test = nullptr; + return test ? 1 : 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-nullptr-N2431_fail_compile.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,5 @@ +int main() +{ + int i = nullptr; + return 1; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-rvalue_references-N2118.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,15 @@ +int foo(int& lvalue) +{ + return 123; +} + +int foo(int&& rvalue) +{ + return 321; +} + +int main() +{ + int i = 42; + return ((foo(i) == 123) && (foo(42) == 321)) ? 0 : 1; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-sizeof_member-N2253.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,14 @@ +struct foo { + char bar; + int baz; +}; + +int main(void) +{ + bool ret = ( + (sizeof(foo::bar) == 1) && + (sizeof(foo::baz) >= sizeof(foo::bar)) && + (sizeof(foo) >= sizeof(foo::bar)+sizeof(foo::baz)) + ); + return ret ? 0 : 1; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-static_assert-N1720.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,5 @@ +int main() +{ + static_assert(0 < 1, "your ordering of integers is screwed"); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-static_assert-N1720_fail_compile.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,5 @@ +int main() +{ + static_assert(1 < 0, "this should fail"); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/c++11-test-variadic_templates-N2555.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -0,0 +1,23 @@ +int Accumulate() +{ + return 0; +} + +template<typename T, typename... Ts> +int Accumulate(T v, Ts... vs) +{ + return v + Accumulate(vs...); +} + +template<int... Is> +int CountElements() +{ + return sizeof...(Is); +} + +int main() +{ + int acc = Accumulate(1, 2, 3, 4, -5); + int count = CountElements<1,2,3,4,5>(); + return ((acc == 5) && (count == 5)) ? 0 : 1; +}
--- a/ldforge.pro Thu Aug 22 18:13:20 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Sat Sep 22 17:29:49 2012 -###################################################################### - -TEMPLATE = subdirs -TARGET = ldforge -SUBDIRS += ./src \ No newline at end of file
--- a/src/addObjectDialog.cpp Thu Aug 22 18:13:20 2013 +0300 +++ b/src/addObjectDialog.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -34,7 +34,7 @@ #include "widgets.h" #include "misc.h" #include "primitives.h" -#include "build/moc_addObjectDialog.cpp" +#include "moc_addObjectDialog.cxx" // ============================================================================= // -----------------------------------------------------------------------------
--- a/src/colorSelectDialog.cpp Thu Aug 22 18:13:20 2013 +0300 +++ b/src/colorSelectDialog.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -31,7 +31,7 @@ #include "config.h" #include "misc.h" #include "ui_colorsel.h" -#include "build/moc_colorSelectDialog.cpp" +#include "moc_colorSelectDialog.cxx" static const int g_numColumns = 16; static const short g_squareSize = 32;
--- a/src/configDialog.cpp Thu Aug 22 18:13:20 2013 +0300 +++ b/src/configDialog.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -38,7 +38,7 @@ #include "colorSelectDialog.h" #include "gldraw.h" #include "ui_config.h" -#include "build/moc_configDialog.cpp" +#include "moc_configDialog.cxx" extern_cfg (String, gl_bgcolor); extern_cfg (String, gl_maincolor);
--- a/src/dialogs.cpp Thu Aug 22 18:13:20 2013 +0300 +++ b/src/dialogs.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -42,7 +42,7 @@ #include "ui_openprogress.h" #include "ui_extprogpath.h" #include "ui_about.h" -#include "build/moc_dialogs.cpp" +#include "moc_dialogs.cxx" extern const char* g_extProgPathFilter; extern_cfg (String, io_ldpath);
--- a/src/download.cpp Thu Aug 22 18:13:20 2013 +0300 +++ b/src/download.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -26,7 +26,7 @@ #include "ui_downloadfrom.h" #include "types.h" #include "gui.h" -#include "build/moc_download.cpp" +#include "moc_download.cxx" #include "file.h" #include "gldraw.h"
--- a/src/file.cpp Thu Aug 22 18:13:20 2013 +0300 +++ b/src/file.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -33,7 +33,7 @@ #include "history.h" #include "dialogs.h" #include "gldraw.h" -#include "build/moc_file.cpp" +#include "moc_file.cxx" cfg (String, io_ldpath, ""); cfg (List, io_recentfiles, {});
--- a/src/gldraw.cpp Thu Aug 22 18:13:20 2013 +0300 +++ b/src/gldraw.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -36,7 +36,7 @@ #include "dialogs.h" #include "addObjectDialog.h" #include "messagelog.h" -#include "build/moc_gldraw.cpp" +#include "moc_gldraw.cxx" static const struct staticCameraMeta { const char glrotate[3];
--- a/src/gui.cpp Thu Aug 22 18:13:20 2013 +0300 +++ b/src/gui.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -919,4 +919,4 @@ return QImage (data, w, h, QImage::Format_ARGB32).rgbSwapped().mirrored(); } -#include "build/moc_gui.cpp" \ No newline at end of file +#include "moc_gui.cxx" \ No newline at end of file
--- a/src/messagelog.cpp Thu Aug 22 18:13:20 2013 +0300 +++ b/src/messagelog.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -21,7 +21,7 @@ #include "messagelog.h" #include "gldraw.h" #include "gui.h" -#include "build/moc_messagelog.cpp" +#include "moc_messagelog.cxx" static const unsigned int g_maxMessages = 5; static const int g_expiry = 5;
--- a/src/misc.h Thu Aug 22 18:13:20 2013 +0300 +++ b/src/misc.h Thu Aug 22 20:24:16 2013 +0300 @@ -94,7 +94,7 @@ }; double snap (double value, const Grid::Config axis); -}; +} // ============================================================================= template<class T> void dataswap (T& a, T& b) {
--- a/src/primitives.cpp Thu Aug 22 18:13:20 2013 +0300 +++ b/src/primitives.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -26,6 +26,7 @@ #include "ui_makeprim.h" #include "misc.h" #include "colors.h" +#include "moc_primitives.cxx" List<PrimitiveCategory> g_PrimitiveCategories; static PrimitiveLister* g_activePrimLister = null; @@ -563,6 +564,4 @@ // spinbox to 48. if (on && ui->sb_segs->value() == lores) ui->sb_segs->setValue (hires); -} - -#include "build/moc_primitives.cpp" \ No newline at end of file +} \ No newline at end of file
--- a/src/src.pro Thu Aug 22 18:13:20 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -TARGET = ../ldforge -DEPENDPATH += . -INCLUDEPATH += . -RC_FILE = ../ldforge.rc -RESOURCES = ../ldforge.qrc -RCC_DIR = ./build/ -OBJECTS_DIR = ./build/ -MOC_DIR = ./build/ -RCC_DIR = ./build/ -SOURCES = *.cpp -HEADERS = *.h -FORMS = ui/*.ui -QT += opengl network -QMAKE_CXXFLAGS += -std=c++0x - -unix { - LIBS += -lGLU -} \ No newline at end of file
--- a/src/widgets.cpp Thu Aug 22 18:13:20 2013 +0300 +++ b/src/widgets.cpp Thu Aug 22 20:24:16 2013 +0300 @@ -30,7 +30,7 @@ #include <map> #include "widgets.h" -#include "build/moc_widgets.cpp" +#include "moc_widgets.cxx" // ============================================================================= // -----------------------------------------------------------------------------