* Empty window example 3.x-dev

Thu, 21 Jan 2016 21:50:09 +0200

author
cemkalyoncu <cemkalyoncu@gmail.com>
date
Thu, 21 Jan 2016 21:50:09 +0200
branch
3.x-dev
changeset 820
ce047737c0fa
parent 819
e68ec3cc375e
child 822
b83c2c188d43

* Empty window example

CMakeLists.txt file | annotate | diff | comparison | revisions
Examples/Empty window/Bin/Icon.png file | annotate | diff | comparison | revisions
Examples/Empty window/Bin/default.ui.wgt file | annotate | diff | comparison | revisions
Examples/Empty window/CMakeLists.txt file | annotate | diff | comparison | revisions
Examples/Empty window/Main.cpp file | annotate | diff | comparison | revisions
Examples/README.txt file | annotate | diff | comparison | revisions
README.md file | annotate | diff | comparison | revisions
Scripts/GorgonConfig.cmake.in file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Thu Jan 21 20:58:13 2016 +0200
+++ b/CMakeLists.txt	Thu Jan 21 21:50:09 2016 +0200
@@ -72,6 +72,10 @@
 StartSource(Source/Gorgon)
 add_library(Gorgon STATIC ${All})
 
+set_target_properties( Gorgon
+  PROPERTIES VERSION ${GORGON_VERSION}
+)
+
 StartSource(Source/GorgonEditing)
 add_library(GorgonEditing STATIC ${All})
 
@@ -133,11 +137,11 @@
 configure_file(Scripts/GorgonEditingConfig.cmake.in
   "${PROJECT_PACKAGE_DIR}/GorgonEditingConfig.cmake" @ONLY)
   
-set(CONF_INCLUDE_DIRS "\${GORGON_CMAKE_DIR}/${REL_INCLUDE_DIR}")
+#set(CONF_INCLUDE_DIRS "\${GORGON_CMAKE_DIR}/${REL_INCLUDE_DIR}")
 configure_file(Scripts/GorgonConfig.cmake.in
   "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/GorgonConfig.cmake" @ONLY)
   
-set(CONF_INCLUDE_DIRS "\${GORGON_CMAKE_DIR}/${REL_INCLUDE_DIR}")
+#set(CONF_INCLUDE_DIRS "\${GORGON_CMAKE_DIR}/${REL_INCLUDE_DIR}")
 configure_file(Scripts/GorgonEditingConfig.cmake.in
   "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/GorgonEditingConfig.cmake" @ONLY)
 
Binary file Examples/Empty window/Bin/Icon.png has changed
Binary file Examples/Empty window/Bin/default.ui.wgt has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Examples/Empty window/CMakeLists.txt	Thu Jan 21 21:50:09 2016 +0200
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 2.8)
+
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bin)
+
+find_package(Gorgon REQUIRED)
+
+add_executable(YourProjectName Main.cpp)
+
+linkgorgon(YourProjectName)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Examples/Empty window/Main.cpp	Thu Jan 21 21:50:09 2016 +0200
@@ -0,0 +1,23 @@
+#include <string>
+#include <vector>
+
+#include <Gorgon/Widgets/Main.h>
+#include <Gorgon/Resource/Image.h>
+
+
+int Application(std::vector<std::string> &arguments) 
+{ 
+	gge::os::IconHandle icon=0;
+	gge::resource::Image iconimage;
+	if(iconimage.ImportPNG("Icon.png")==gge::resource::Image::NoError)
+		icon=gge::os::IconFromImage(iconimage);
+
+	gge::widgets::InitializeApplication("example", "Empty Window", 400, 300, icon);
+
+	gge::os::window::Destroyed.RegisterLambda([]{
+		gge::Main.Exit(0);
+	});
+
+	gge::Main.Run();
+	return 0;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Examples/README.txt	Thu Jan 21 21:50:09 2016 +0200
@@ -0,0 +1,3 @@
+Use the CMakeFile to generate makefiles or Visual Studio projects. 
+There are alternative UI files in Resource directory. Use one of the examples
+as a base.
--- a/README.md	Thu Jan 21 20:58:13 2016 +0200
+++ b/README.md	Thu Jan 21 21:50:09 2016 +0200
@@ -23,7 +23,7 @@
 OpenAL
 
 ## Documentation
-Follow the steps in [GGE_VS_INSTALLATION_TURKISH.pdf](GGE_VS_INSTALLATION_TURKISH.pdf) (in Turkish)
+Follow the steps in Examples directory
 
 # GGE 4.x (4.x-dev, gscript or audio branches)
 
--- a/Scripts/GorgonConfig.cmake.in	Thu Jan 21 20:58:13 2016 +0200
+++ b/Scripts/GorgonConfig.cmake.in	Thu Jan 21 21:50:09 2016 +0200
@@ -13,3 +13,103 @@
 # These are IMPORTED targets created by GorgonTargets.cmake
 set(GORGON_LIBRARIES Gorgon)
 set(GORGON_EXECUTABLE )
+
+MACRO(compilersetup)
+
+	if(UNIX) 
+		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLINUX -Werror=return-type")
+	else()
+		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800")
+	endif()
+
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLM_SWIZZLE -DGLM_FORCE_RADIANS")
+
+
+	#compiler check
+	IF(CMAKE_COMPILER_IS_GNUCXX)
+		EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
+		
+		IF(GCC_VERSION VERSION_LESS 4.8)
+			IF(IGNORE_COMPILER_VERSION)
+				MESSAGE(STATUS "Gorgon Library requires GCC 4.8+")
+			ELSE()
+				MESSAGE(STATUS "use cmake -DIGNORE_COMPILER_VERSION=ON to continue anyway")
+				MESSAGE(FATAL_ERROR "Gorgon Library requires GCC 4.8+")
+			ENDIF()
+		ENDIF()
+	ELSEIF(MSVC)
+		IF(MSVC_VERSION VERSION_LESS 14)
+			IF(IGNORE_COMPILER_VERSION)
+				MESSAGE(STATUS "Gorgon Library requires Visual Studio 2015+")
+			ELSE()
+				MESSAGE(STATUS "use cmake -DIGNORE_COMPILER_VERSION=ON to continue anyway")
+				MESSAGE(FATAL_ERROR "Gorgon Library requires Visual Studio 2015+")
+			ENDIF()
+		ENDIF()
+	ELSE()
+		IF(IGNORE_COMPILER_VENDOR)
+			MESSAGE(STATUS "Unsupported compiler! Gorgon Library requires GCC 4.8+ OR Visual Studio 2015+")
+			MESSAGE(STATUS "You may need to manually activate C++11 features")
+		ELSE()
+			MESSAGE(STATUS "use cmake -DIGNORE_COMPILER_VENDOR=ON to continue anyway")
+			MESSAGE(FATAL_ERROR "Unsupported compiler! Gorgon Library requires GCC 4.8+ OR Visual Studio 2015+")
+		ENDIF()
+	ENDIF()
+
+	OPTION(ENABLE_64_BIT "Enable 64 bit compilation" OFF)
+
+	#enable C++11 and 32-bit compilation
+	INCLUDE(CheckCXXCompilerFlag)
+	IF(CMAKE_COMPILER_IS_GNUCXX)
+		IF(${ENABLE_64_BIT})
+			SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+		ELSE()
+			SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m32")
+			SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
+		ENDIF()
+	ENDIF()
+
+	IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+		IF(${ENABLE_64_BIT})
+			SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+		ELSE()
+			SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m32")
+			SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
+		ENDIF()
+	ENDIF()
+
+	#MACRO(FixProject) 
+	#ENDMACRO()
+
+	#make sure 64bits cannot be activated
+	IF(MSVC)
+		ADD_DEFINITIONS(-D_SBCS -D_CRT_SECURE_NO_WARNINGS)
+		
+		SET(configs
+		CMAKE_C_FLAGS_DEBUG
+		CMAKE_C_FLAGS_MINSIZEREL
+		CMAKE_C_FLAGS_RELEASE
+		CMAKE_C_FLAGS_RELWITHDEBINFO
+		CMAKE_CXX_FLAGS_DEBUG
+		CMAKE_CXX_FLAGS_MINSIZEREL
+		CMAKE_CXX_FLAGS_RELEASE
+		CMAKE_CXX_FLAGS_RELWITHDEBINFO
+		)
+		
+		FOREACH(config ${configs})
+		IF(${config} MATCHES "/MD")
+			STRING(REGEX REPLACE "/MD" "/MT" ${config} "${${config}}")
+		ENDIF()
+		ENDFOREACH()
+		
+		IF(${CMAKE_CL_64} AND NOT(${ENABLE_64_BIT}))
+			MESSAGE(FATAL_ERROR "Gorgon Library works only 32bits")
+		ENDIF()
+	ENDIF()
+ENDMACRO()
+
+MACRO(linkgorgon target)
+	compilersetup()
+	target_link_libraries(${target} ${GORGON_LIBRARIES})
+	include_directories(${GORGON_INCLUDE_DIRS})
+ENDMACRO()

mercurial