# HG changeset patch # User Santeri Piippo # Date 1378283659 -10800 # Node ID 543a6696096f50826068712f3c556fb9e1480d7f # Parent 5b5c77c7f3ddf540ed1182e0f79683a4e334a26d down with cmake! diff -r 5b5c77c7f3dd -r 543a6696096f CMakeLists.txt --- a/CMakeLists.txt Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -####################################################################################### -# 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} ${LDFORGE_MOC}) -target_link_libraries (ldforge - ${QT_LIBRARIES} - GL - GLU -) \ No newline at end of file diff -r 5b5c77c7f3dd -r 543a6696096f cmake/CheckCXX11Features.cmake --- a/cmake/CheckCXX11Features.cmake Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -# 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) - diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-__func__-N2340.cpp --- a/cmake/c++11-test-__func__-N2340.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#include - -int main() -{ - if (!__func__) { return 1; } - if(std::strlen(__func__) <= 0) { return 1; } - return 0; -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-auto-N2546.cpp --- a/cmake/c++11-test-auto-N2546.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - -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; -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-constexpr-N2235.cpp --- a/cmake/c++11-test-constexpr-N2235.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -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; -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-cstdint.cpp --- a/cmake/c++11-test-cstdint.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -#include -int main() -{ - bool test = - (sizeof(int8_t) == 1) && - (sizeof(int16_t) == 2) && - (sizeof(int32_t) == 4) && - (sizeof(int64_t) == 8); - return test ? 0 : 1; -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-decltype-N2343.cpp --- a/cmake/c++11-test-decltype-N2343.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ - -bool check_size(int i) -{ - return sizeof(int) == sizeof(decltype(i)); -} - -int main() -{ - bool ret = check_size(42); - return ret ? 0 : 1; -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-lambda-N2927.cpp --- a/cmake/c++11-test-lambda-N2927.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -int main() -{ - int ret = 0; - return ([&ret]() -> int { return ret; })(); -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-long_long-N1811.cpp --- a/cmake/c++11-test-long_long-N1811.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -int main(void) -{ - long long l; - unsigned long long ul; - - return ((sizeof(l) >= 8) && (sizeof(ul) >= 8)) ? 0 : 1; -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-nullptr-N2431.cpp --- a/cmake/c++11-test-nullptr-N2431.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -int main() -{ - int* test = nullptr; - return test ? 1 : 0; -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-nullptr-N2431_fail_compile.cpp --- a/cmake/c++11-test-nullptr-N2431_fail_compile.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -int main() -{ - int i = nullptr; - return 1; -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-rvalue_references-N2118.cpp --- a/cmake/c++11-test-rvalue_references-N2118.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -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; -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-sizeof_member-N2253.cpp --- a/cmake/c++11-test-sizeof_member-N2253.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -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; -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-static_assert-N1720.cpp --- a/cmake/c++11-test-static_assert-N1720.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -int main() -{ - static_assert(0 < 1, "your ordering of integers is screwed"); - return 0; -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-static_assert-N1720_fail_compile.cpp --- a/cmake/c++11-test-static_assert-N1720_fail_compile.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -int main() -{ - static_assert(1 < 0, "this should fail"); - return 0; -} diff -r 5b5c77c7f3dd -r 543a6696096f cmake/c++11-test-variadic_templates-N2555.cpp --- a/cmake/c++11-test-variadic_templates-N2555.cpp Sat Aug 24 16:52:45 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -int Accumulate() -{ - return 0; -} - -template -int Accumulate(T v, Ts... vs) -{ - return v + Accumulate(vs...); -} - -template -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; -} diff -r 5b5c77c7f3dd -r 543a6696096f ldforge.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ldforge.pro Wed Sep 04 11:34:19 2013 +0300 @@ -0,0 +1,7 @@ +###################################################################### +# 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 diff -r 5b5c77c7f3dd -r 543a6696096f src/gui_actions.cpp --- a/src/gui_actions.cpp Sat Aug 24 16:52:45 2013 +0300 +++ b/src/gui_actions.cpp Wed Sep 04 11:34:19 2013 +0300 @@ -88,7 +88,8 @@ ui.rb_license_ca->isChecked() ? CALicense : ui.rb_license_nonca->isChecked() ? NonCALicense : ""; - LDFile::current()->addObjects ({new LDComment (ui.le_title->text()), + LDFile::current()->addObjects ({ + new LDComment (ui.le_title->text()), new LDComment ("Name: .dat" ), new LDComment (fmt ("Author: %1", ui.le_author->text())), new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")), diff -r 5b5c77c7f3dd -r 543a6696096f src/src.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/src.pro Wed Sep 04 11:34:19 2013 +0300 @@ -0,0 +1,18 @@ +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