Converted to CMake

Mon, 01 Jun 2015 17:06:13 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Mon, 01 Jun 2015 17:06:13 +0300
changeset 36
b8fa9171be6e
parent 35
d0f08a77a798
child 37
c82a86ea87be

Converted to CMake

.hgignore file | annotate | diff | comparison | revisions
CMakeLists.txt file | annotate | diff | comparison | revisions
src/config.cpp file | annotate | diff | comparison | revisions
src/demo.cpp file | annotate | diff | comparison | revisions
src/prompts.cpp file | annotate | diff | comparison | revisions
src/versionEditor.cpp file | annotate | diff | comparison | revisions
zcinema.pro file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Mon Jun 01 17:06:13 2015 +0300
@@ -0,0 +1,4 @@
+syntax:glob
+debug
+release
+build
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CMakeLists.txt	Mon Jun 01 17:06:13 2015 +0300
@@ -0,0 +1,88 @@
+project (zcinema)
+cmake_minimum_required (VERSION 2.6)
+
+if (USE_QT5)
+	find_package (Qt5Widgets REQUIRED)
+	find_package (Qt5Core REQUIRED)
+	find_package (Qt5OpenGL REQUIRED)
+	find_package (Qt5Network REQUIRED)
+	set (CMAKE_AUTOMOC ON)
+else()
+	find_package (Qt4 REQUIRED)
+endif()
+
+include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
+
+set (ZCINEMA_SOURCES
+	src/cfg.cpp
+	src/config.cpp
+	src/demo.cpp
+	src/main.cpp
+	src/misc.cpp
+	src/prompts.cpp
+	src/types.cpp
+	src/versionEditor.cpp
+)
+
+set (ZCINEMA_HEADERS
+	src/cfg.h
+	src/config.h
+	src/demo.h
+	src/main.h
+	src/misc.h
+	src/prompts.h
+	src/versionEditor.h
+	src/types.h
+)
+
+set (ZCINEMA_FORMS
+	ui/findfile.ui
+	ui/demoprompt.ui
+	ui/unknownversion.ui
+	ui/versionEditor.ui
+	ui/configbox.ui
+	ui/addversion.ui
+)
+
+set (ZCINEMA_RESOURCES zcinema.qrc)
+
+if (NOT MSVC)
+	set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall")
+endif()
+
+include_directories ("${PROJECT_BINARY_DIR}")
+include_directories ("${PROJECT_BINARY_DIR}/src")
+
+if (USE_QT5)
+	qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS})
+	qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES})
+	qt5_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
+	add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_MOC}
+		${ZCINEMA_QRC} ${ZCINEMA_FORMS_HEADERS})
+else()
+	qt4_wrap_cpp (ZCINEMA_MOC ${ZCINEMA_HEADERS})
+	qt4_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
+	qt4_add_resources (ZCINEMA_RCC ${ZCINEMA_RESOURCES})
+	add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_RCC}
+		${ZCINEMA_FORMS_HEADERS} ${ZCINEMA_MOC})
+endif()
+
+if (USE_QT5)
+	target_link_libraries (${PROJECT_NAME} Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES})
+else()
+	target_link_libraries (${PROJECT_NAME}
+		${QT_QTCORE_LIBRARY}
+		${QT_QTGUI_LIBRARY}
+		${QT_QTNETWORK_LIBRARY}
+		${QT_QTOPENGL_LIBRARY}
+		${OPENGL_LIBRARIES}
+	)
+endif()
+
+# With clang, we need to set -Wno-deprecated since Qt headers seem to use the register keyword
+# which clang doesn't seem to like.
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+	set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
+endif()
+
+install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
\ No newline at end of file
--- a/src/config.cpp	Mon Jun 01 05:32:30 2015 +0000
+++ b/src/config.cpp	Mon Jun 01 17:06:13 2015 +0300
@@ -25,7 +25,6 @@
 #include "ui_configbox.h"
 #include "misc.h"
 #include "demo.h"
-#include "build/moc_config.cpp"
 #include "versionEditor.h"
 
 CONFIG (Bool, noprompt,      false)
@@ -247,4 +246,4 @@
 		dlg->saveChanges();
 		initVersions();
 	}
-}
\ No newline at end of file
+}
--- a/src/demo.cpp	Mon Jun 01 05:32:30 2015 +0000
+++ b/src/demo.cpp	Mon Jun 01 17:06:13 2015 +0300
@@ -283,10 +283,8 @@
 			return 1;
 	}
 
-	QStringList cmdlineList ({
-		"-playdemo", path,
-		"-iwad", iwadpath,
-	});
+	QStringList cmdlineList;
+	cmdlineList << "-playdemo" << path << "-iwad" << iwadpath;
 	
 	if (pwadpaths.size() > 0) {
 		cmdlineList << "-file";
@@ -298,4 +296,4 @@
 	proc->start (binarypath, cmdlineList);
 	proc->waitForFinished (-1);
 	return 0;
-}
\ No newline at end of file
+}
--- a/src/prompts.cpp	Mon Jun 01 05:32:30 2015 +0000
+++ b/src/prompts.cpp	Mon Jun 01 17:06:13 2015 +0300
@@ -20,7 +20,6 @@
 #include "ui_unknownversion.h"
 #include "misc.h"
 #include "config.h"
-#include "build/moc_prompts.cpp"
 #include "ui_findfile.h"
 #include <QFileDialog>
 
@@ -107,4 +106,4 @@
 // -----------------------------------------------------------------------------
 str FindFilePrompt::path() const {
 	return m_ui->m_path->text();
-}
\ No newline at end of file
+}
--- a/src/versionEditor.cpp	Mon Jun 01 05:32:30 2015 +0000
+++ b/src/versionEditor.cpp	Mon Jun 01 17:06:13 2015 +0300
@@ -21,7 +21,6 @@
 #include "ui_addversion.h"
 #include "config.h"
 #include "misc.h"
-#include "build/moc_versionEditor.cpp"
 
 EXTERN_CONFIG (Map,  binaryPaths)
 EXTERN_CONFIG (List, devBuildNames)
@@ -236,4 +235,4 @@
 void AddVersionPrompt::fieldsChanged() {
 	bool ok = (!m_ui->m_binaryName->text().isEmpty()) && (!m_ui->m_binaryPath->text().isEmpty());
 	m_ui->buttonBox->button (QDialogButtonBox::Ok)->setEnabled (ok);
-}
\ No newline at end of file
+}
--- a/zcinema.pro	Mon Jun 01 05:32:30 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-######################################################################
-# Automatically generated by qmake (2.01a) ti heinäkuuta 16 23:34:02 2013
-######################################################################
-
-TEMPLATE        = app
-CONFIG         += qt debug
-TARGET          = ./zcinema
-DEPENDPATH     += ./ ./ui
-INCLUDEPATH    += ./
-RC_FILE         = ./zcinema.rc
-RESOURCES       = ./zcinema.qrc
-RCC_DIR         = ./build/
-OBJECTS_DIR     = ./build/
-MOC_DIR         = ./build/
-RCC_DIR         = ./build/
-UI_DIR          = ./build/
-SOURCES         = ./src/*.cpp
-HEADERS         = ./src/*.h
-FORMS           = ./ui/*.ui
-QMAKE_CXXFLAGS += -std=c++0x
-
-# The widgets are separated into a different module in Qt5, so we need to add
-# it here. Doing so under Qt4 just results in a warning, though.
-greaterThan (QT_MAJOR_VERSION, 4): QT += widgets
\ No newline at end of file

mercurial