Skip to content

Commit

Permalink
Make Win64 build work directly from CMake. See README-WIN64.txt.
Browse files Browse the repository at this point in the history
  • Loading branch information
l-korous committed Mar 27, 2014
1 parent 359e3b1 commit 1fe0e7e
Show file tree
Hide file tree
Showing 9 changed files with 188 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
@@ -1,10 +1,14 @@
# Set project's name
PROJECT( agros2d )
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

# For Win64
if(${CMAKE_CL_64})
set(WIN64 YES)
set(CMAKE_EXE_LINKER_FLAGS "/machine:X64")
SET (CMAKE_SHARED_LINKER_FLAGS "/machine:X64")
SET (CMAKE_MODULE_LINKER_FLAGS "/machine:X64")
else(${CMAKE_CL_64})
set(WIN64 NO)
endif(${CMAKE_CL_64})
Expand Down
1 change: 1 addition & 0 deletions CMakeQt.cmake
Expand Up @@ -28,5 +28,6 @@ ELSE(WITH_QT5)
SET(QT_USE_QTXMLPATTERNS TRUE)
FIND_PACKAGE(Qt4 REQUIRED)
# This has to be here, otherwise CMake will not do the magic and will not link to OpenGL
FIND_PACKAGE(OpenGLCustom REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
ENDIF(WITH_QT5)
15 changes: 13 additions & 2 deletions README-WIN64.txt
Expand Up @@ -55,8 +55,18 @@
-> to \...\dependencies-64/bin

1.7) Ifconsol.lib
- https://nees.org/tools/openfresco/export/327/trunk/WIN32/lib/IFCONSOL.LIB
- Save to \...\dependencies-64\bin
- http://www.gams.com/~svigerske/intel/win64/11.1/
- Save the following to \...\dependencies-64\bin
- ifconsol.lib
- libifcoremd.lib + .dll
- libifcoremdd.lib + .dll
- libifportmd.lib + .dll
- libirc.lib
- libmmd.lib + .dll
- libmmdd.lib + .dll
- svml_disp.lib
- svml_dispmd.lib + .dll



2) Before build
Expand All @@ -74,6 +84,7 @@
- set(DEPENDENCIES_ROOT "/.../dependencies-64")
- SET(CMAKE_PREFIX_PATH "C:\\Qt\\Qt5.2.1\\5.2.1\\msvc2012_64_opengl\\")
- SET(ZLIB_ROOT "/.../dependencies-64"")
- SET(OPENGL_LIB_DIR "c:\\Program Files (x86)\\Windows Kits\\8.0\\Lib\\win8\\um\\x64")

3) Build

Expand Down
10 changes: 9 additions & 1 deletion agros2d-library/CMakeLists.txt
Expand Up @@ -56,10 +56,18 @@ endforeach()
add_custom_target(CYTHON_AGROS2D ALL DEPENDS ${CMAKE_HOME_DIRECTORY}/resources_source/python/agros2d.cpp)

IF(WIN32)
ADD_CUSTOM_COMMAND(
# In W64 Python, for some reason calling the script (.py) does not work - an error on the cython's side probably
IF(WIN64)
ADD_CUSTOM_COMMAND(
COMMAND C:/Python27/Scripts/cython ARGS --cplus ${CMAKE_HOME_DIRECTORY}/resources_source/python/agros2d.pyx
DEPENDS ${CMAKE_HOME_DIRECTORY}/resources_source/python/agros2d.pyx
OUTPUT ${CMAKE_HOME_DIRECTORY}/resources_source/python/agros2d.cpp)
ELSE()
ADD_CUSTOM_COMMAND(
COMMAND C:/Python27/Scripts/cython.py ARGS --cplus ${CMAKE_HOME_DIRECTORY}/resources_source/python/agros2d.pyx
DEPENDS ${CMAKE_HOME_DIRECTORY}/resources_source/python/agros2d.pyx
OUTPUT ${CMAKE_HOME_DIRECTORY}/resources_source/python/agros2d.cpp)
ENDIF()
ELSE()
ADD_CUSTOM_COMMAND(
COMMAND cython ARGS --cplus ${CMAKE_HOME_DIRECTORY}/resources_source/python/agros2d.pyx
Expand Down
85 changes: 85 additions & 0 deletions agros2d_x64.iss
@@ -0,0 +1,85 @@
[Setup]

#define AppName "Agros2D"
#define AppVersion GetFileVersion("agros2d.exe")
#define AppDate GetFileDateTimeString("agros2d.exe", "mm/dd/yyyy", "/", ":")
#define OutputBaseFileName "Agros2D" + "_" + AppVersion + "." + GetDateTimeString('yyyymmdd', '', '')

AppName={#AppName}
AppVerName={#AppName} {#AppVersion} ({#AppDate})
OutputBaseFilename={#OutputBaseFileName}
DefaultGroupName=Agros2D
LicenseFile=COPYING

AppId=Agros2D
AppPublisher=hpfem.org
AppCopyright=hpfem.org
AppPublisherURL=http://www.agros2d.org/
AppMutex=Agros2D
OutputDir=setup
DefaultDirName={pf}\Agros2D
UninstallDisplayIcon={app}\images\agros2d.ico
Compression=lzma/max
PrivilegesRequired=admin

WizardImageFile=resources_source\images\setup\SetupModern.bmp
WizardSmallImageFile=resources_source\images\setup\SetupModernSmall.bmp

[Languages]

[Files]
Source: agros2d_util.dll; DestDir: {app}; DestName: agros2d_util.dll
Source: agros2d_pythonlab_library.dll; DestDir: {app}; DestName: agros2d_pythonlab_library.dll
Source: agros_pythonlab.exe; DestDir: {app}; DestName: PythonLab.exe
Source: agros2d_library.dll; DestDir: {app}; DestName: agros2d_library.dll
Source: libs\*.dll; DestDir: {app}/libs
Source: agros2d.exe; DestDir: {app}; DestName: Agros2D.exe
Source: agros2d_solver.exe; DestDir: {app}; DestName: Solver.exe
;Source: agros2d_remote.exe; DestDir: {app}; DestName: Remote.exe
Source: solver_external.exe; DestDir: {app}; DestName: Solver_External.exe
Source: resources\images\agros2d.ico; DestDir: {app}; DestName: Agros2D.ico
Source: resources\*; DestDir: {app}/resources; Flags: recursesubdirs
Source: ..\agros2d-win64\*; DestDir: {app}; Flags: recursesubdirs
; VC++ 2012 runtime
Source: "..\vcredist_x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall

[Icons]
Name: {group}\Agros2D; Filename: {app}\Agros2D.exe; WorkingDir: {app}
Name: {group}\Web pages; Filename: {app}\Agros2D.url
Name: {group}\COPYING; Filename: {app}\COPYING
Name: {group}\Uninstall; Filename: {uninstallexe}
Name: {commondesktop}\Agros2D; Filename: {app}\Agros2D.exe; WorkingDir: {app}; Tasks: desktopicon

[Tasks]
Name: desktopicon; Description: Create icon on desktop

[Run]
Filename: "{tmp}\vcredist_x64.exe"

[Registry]
; a2d
Root: HKCR; SubKey: .a2d; ValueType: string; ValueData: Agros2D.Data; Flags: uninsdeletekey
Root: HKCR; SubKey: Agros2D.Data; ValueType: string; ValueData: Agros2D data file; Flags: uninsdeletekey
Root: HKCR; SubKey: Agros2D.Data\Shell\Open\Command; ValueType: string; ValueData: """{app}\Agros2D.exe"" -p ""%1"""; Flags: uninsdeletevalue
Root: HKCR; Subkey: Agros2D.Data\DefaultIcon; ValueType: string; ValueData: {app}\Agros2D.ico; Flags: uninsdeletevalue

[INI]
Filename: {app}\Agros2D.url; Section: InternetShortcut; Key: URL; String: http://www.agros2d.org/

[UninstallDelete]
Type: files; Name: {app}\Agros2D.url

[Code]
#IFDEF UNICODE
#DEFINE AW "W"
#ELSE
#DEFINE AW "A"
#ENDIF
type
INSTALLSTATE = Longint;
const
INSTALLSTATE_INVALIDARG = -2; // An invalid parameter was passed to the function.
INSTALLSTATE_UNKNOWN = -1; // The product is neither advertised or installed.
INSTALLSTATE_ADVERTISED = 1; // The product is advertised but not installed.
INSTALLSTATE_ABSENT = 2; // The product is installed for a different user.
INSTALLSTATE_DEFAULT = 5; // The product is installed for the current user.
41 changes: 41 additions & 0 deletions cmake/FindOpenGLCustom.cmake
@@ -0,0 +1,41 @@
# - Try to find OpenGL
# Once done this will define
#
# OPENGL_FOUND - system has OpenGL
# OPENGL_XMESA_FOUND - system has XMESA
# OPENGL_GLU_FOUND - system has GLU
# OPENGL_INCLUDE_DIR - the GL include directory
# OPENGL_LIBRARIES - Link these to use OpenGL and GLU
#
# If you want to use just GL you can use these values
# OPENGL_gl_LIBRARY - Path to OpenGL Library
# OPENGL_glu_LIBRARY - Path to GLU Library
#
# On OSX default to using the framework version of opengl
# People will have to change the cache values of OPENGL_glu_LIBRARY
# and OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX

#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)

if (WIN32)
if (WIN64)
if(ZLIB_ROOT)
find_library(OPENGL_gl_LIBRARY opengl32 ${ZLIB_ROOT})
find_library(OPENGL_glu_LIBRARY glu32 ${ZLIB_ROOT})
else()
set (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32")
set (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32")
endif()
endif()
endif()
10 changes: 9 additions & 1 deletion pythonlab-library/CMakeLists.txt
Expand Up @@ -10,10 +10,18 @@ INCLUDE_DIRECTORIES(${CMAKE_HOME_DIRECTORY}/util)
add_custom_target(CYTHON_PYTHONLAB ALL DEPENDS ${CMAKE_HOME_DIRECTORY}/resources_source/python/pythonlab.cpp)

IF(WIN32)
ADD_CUSTOM_COMMAND(
# In W64 Python, for some reason calling the script (.py) does not work - an error on the cython's side probably
IF(WIN64)
ADD_CUSTOM_COMMAND(
COMMAND C:/Python27/Scripts/cython ARGS --cplus ${CMAKE_HOME_DIRECTORY}/resources_source/python/pythonlab.pyx
DEPENDS ${CMAKE_HOME_DIRECTORY}/resources_source/python/pythonlab.pyx
OUTPUT ${CMAKE_HOME_DIRECTORY}/resources_source/python/pythonlab.cpp)
ELSE()
ADD_CUSTOM_COMMAND(
COMMAND C:/Python27/Scripts/cython.py ARGS --cplus ${CMAKE_HOME_DIRECTORY}/resources_source/python/pythonlab.pyx
DEPENDS ${CMAKE_HOME_DIRECTORY}/resources_source/python/pythonlab.pyx
OUTPUT ${CMAKE_HOME_DIRECTORY}/resources_source/python/pythonlab.cpp)
ENDIF()
ELSE()
ADD_CUSTOM_COMMAND(
COMMAND cython ARGS --cplus ${CMAKE_HOME_DIRECTORY}/resources_source/python/pythonlab.pyx
Expand Down
1 change: 1 addition & 0 deletions pythonlab-library/pythonlab.h
Expand Up @@ -27,6 +27,7 @@

class AGROS_PYTHONLAB_API PythonLabApplication : public QtSingleApplication
{
Q_OBJECT
public:
PythonLabApplication(int& argc, char ** argv);
};
Expand Down
35 changes: 25 additions & 10 deletions resources/templates/generator/plugins_CMakeLists_txt.tpl
@@ -1,6 +1,23 @@
project(plugins)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../hermes/cmake)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/../hermes/cmake)

# Policy handling
if(POLICY CMP0020)
cmake_policy(PUSH)
cmake_policy(SET CMP0020 OLD)
endif()

# For Win64
if(${CMAKE_CL_64})
set(WIN64 YES)
set(CMAKE_EXE_LINKER_FLAGS "/machine:X64")
SET (CMAKE_SHARED_LINKER_FLAGS "/machine:X64")
SET (CMAKE_MODULE_LINKER_FLAGS "/machine:X64")
else(${CMAKE_CL_64})
set(WIN64 NO)
endif(${CMAKE_CL_64})

# Debug yes / no.
SET(AGROS_DEBUG NO)
Expand All @@ -13,17 +30,13 @@ ADD_DEFINITIONS(-DQT_DLL)

SET(CMAKE_AGROS_DIRECTORY "${CMAKE_HOME_DIRECTORY}/../")

# For Win64
if(${CMAKE_CL_64})
set(WIN64 YES)
else(${CMAKE_CL_64})
set(WIN64 NO)
endif(${CMAKE_CL_64})

# Allow to override the default values in CMake.vars:
include(../CMake.vars OPTIONAL)
include(../CMakeHermes.cmake OPTIONAL)

# OpenGL
FIND_PACKAGE(OpenGLCustom REQUIRED)

# Handle Qt.
include(../QtHandling.cmake)

Expand Down Expand Up @@ -73,7 +86,6 @@ ENDIF(WIN32)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_AGROS_DIRECTORY}/libs)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_AGROS_DIRECTORY}/libs)


SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_AGROS_DIRECTORY}/libs)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_AGROS_DIRECTORY}/libs)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_AGROS_DIRECTORY}/libs)
Expand All @@ -88,7 +100,6 @@ IF(WIN32)
ENDIF(WIN32)



set(WITH_OPENMP YES)
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(WITH_OPENMP NO)
Expand Down Expand Up @@ -190,3 +201,7 @@ INCLUDE_DIRECTORIES(${MUMPS_INCLUDE_DIR})
{{#SOURCE}}
ADD_SUBDIRECTORY({{ID}}){{/SOURCE}}

# Policy handling
if(POLICY CMP0020)
cmake_policy(POP)
endif()

0 comments on commit 1fe0e7e

Please sign in to comment.