Skip to content

Commit 76d72b9

Browse files
authored
Merge pull request #390 from sbriseid/akva2_pack_mod
Akva2 pack mod
2 parents 6adba6c + 30d7a3d commit 76d72b9

32 files changed

+863
-319
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
gotools-core/include/GoTools/geometry/GoTools_version.h
22
doc
33
gpl/generate_gpl_headers
4+
*~

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ PROJECT(GoTools)
44
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
55

66
# Set version info
7-
SET(GoTools_VERSION_MAJOR 4)
8-
SET(GoTools_VERSION_MINOR 3)
7+
SET(GoTools_VERSION_MAJOR 5)
8+
SET(GoTools_VERSION_MINOR 0)
99
SET(GoTools_VERSION_PATCH 0)
1010
SET(GoTools_VERSION "${GoTools_VERSION_MAJOR}.${GoTools_VERSION_MINOR}.${GoTools_VERSION_PATCH}")
1111
SET(GoTools_ABI_VERSION "${GoTools_VERSION_MAJOR}.${GoTools_VERSION_MINOR}" CACHE INTERNAL "GoTools ABI version")
@@ -108,7 +108,7 @@ ENDIF(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
108108
# Set install prefix on Windows
109109
IF(WIN32)
110110
SET(CMAKE_INSTALL_PREFIX CACHE INTERNAL "")
111-
SET(GoTools_INSTALL_PREFIX "$ENV{PROGRAMFILES}/SINTEF/GoTools"
111+
SET(GoTools_WINDOWS_INSTALL_PREFIX "$ENV{PROGRAMFILES}/SINTEF/GoTools"
112112
CACHE PATH "Path to install GoTools")
113113
ENDIF(WIN32)
114114
# Organize the project in folders (VS only?)

INSTALL

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,28 @@ A set of options to control the build can be accessed in CMake (names starting w
7171
example, you can turn on/off building the various modules by checking/unchecking
7272
GoTools_COMPILE_MODULE_<modulename>.
7373

74-
If a C++11 compliant compiler is not available, the building process uses boost::shared_ptr instead of
75-
std::shared_ptr.
74+
If a C++11 compliant compiler is not available, the building process uses boost::shared_ptr instead
75+
of std::shared_ptr.
7676

7777
Windows
7878
*********
7979

8080
The code has been tested using Visual Studio 2015, 2019 and 2022, with x64.
8181

82-
Make sure that your installment of Visual Studio includes support for Visual C++. When installing Visual
83-
Studio you should select "Desktop development with C++" from the Workloads options. If you did not do
84-
that then you must launch the Visual Studio installer and select "Modify", then select "Desktop
85-
development with C++". Follow further instructions.
82+
Make sure that your installment of Visual Studio includes support for Visual C++. When installing
83+
Visual Studio you should select "Desktop development with C++" from the Workloads options. If you
84+
did not do that then you must launch the Visual Studio installer and select "Modify", then select
85+
"Desktop development with C++". Follow further instructions.
8686

87-
Note that Visual Studio introduced binary compatibility in Visual Studio 2015, allowing the user to mix
88-
binaries built by the VS toolsets v140, v141, v142 and v143 (Visual Studio 2015 and later, with some
89-
specific restrictions). The linker must use a toolset at least as recent as the newest toolset used by
90-
the binaries.
87+
Note that Visual Studio introduced binary compatibility in Visual Studio 2015, allowing the user to
88+
mix binaries built by the VS toolsets v140, v141, v142 and v143 (Visual Studio 2015 and later, with
89+
some specific restrictions). The linker must use a toolset at least as recent as the newest toolset
90+
used by the binaries.
9191

9292
How to edit environment variables:
9393
- Open the settings application.
94-
- Search for env, select: "Edit the system environment variables" (or "Edit environment variables for
95-
your account" to add them to your user only).
94+
- Search for env, select: "Edit the system environment variables" (or "Edit environment variables
95+
for your account" to add them to your user only).
9696

9797
Boost:
9898
- Download a binary release for your Visual Studio version.
@@ -161,20 +161,34 @@ CMake:
161161
- On Windows 10 the HOME variable is not set. This is needed by the cmake setup. Add HOME to the
162162
user environment variables, pointing to the home directory (typically 'C:\Users\<username>').
163163
- For 64 bit applications using Visual Studio 2015 you should make sure to choose x64 when
164-
generating the solution (default is x86).
164+
generating the solution using cmake-gui (default is x86).
165+
- Optionally you may run cmake from the command line, in this example using Visual Studio 2019 on
166+
an Intel/AMD 64-bit system:
167+
$ mkdir build_msvc2019
168+
$ cd build_msvc2019
169+
$ cmake ../ -G "Visual Studio 16 2019" -A x64
170+
171+
Build the project in Release mode from the build folder (replace with 'Debug' for building in debug
172+
mode):
173+
$ cmake --build . --config Release --parallel
174+
175+
Install using gsudo/sudo (or run in a shell with administrator privileges):
176+
$ gsudo cmake --install .
165177

166178
Building the gotools Visual Studio solution:
167179
- Open the gotools Visual Studio solution file that was generated by cmake. Choose either Release or
168180
Debug, build the solution by pressing 'F7'.
169181

170182
Running the tests from a shell (like Git Bash):
171183
- Run the tests in default (release) mode:
172-
$ ctest.exe
184+
$ ctest
185+
- Run the tests in parallel:
186+
$ ctest -j ${NUMBER_OF_PROCESSORS}
173187
- Run the tests in debug mode:
174-
$ ctest.exe -C debug
188+
$ ctest -C debug
175189
- Run only the acceptance tests (use unit or integration for the other test types, using a unique
176190
substring like 'cep' will also work):
177-
$ ctest.exe -L acceptance
191+
$ ctest -L acceptance
178192

179193

180194
MacOS

compositemodel/CMakeLists.txt

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -123,29 +123,60 @@ endif()
123123
# Create a tmp dir for generated data.
124124
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/tmp)
125125

126-
# 'install' target
126+
# === Install Targets and Export Package ===
127+
128+
include(CMakePackageConfigHelpers)
127129

130+
# 'install' target
128131
IF(WIN32)
129132
# Windows
130-
# lib
131-
INSTALL(TARGETS GoCompositeModel DESTINATION ${GoTools_INSTALL_PREFIX}/lib)
132-
#include
133-
INSTALL(DIRECTORY include/GoTools/compositemodel
134-
DESTINATION ${GoTools_INSTALL_PREFIX}/include/GoTools
135-
FILES_MATCHING PATTERN "*.h"
136-
PATTERN ".svn" EXCLUDE
137-
)
133+
set(CMAKE_INSTALL_LIBDIR ${GoTools_WINDOWS_INSTALL_PREFIX}/lib)
134+
set(CMAKE_INSTALL_INCLUDEDIR ${GoTools_WINDOWS_INSTALL_PREFIX}/include)
135+
set(CMAKE_INSTALL_BINDIR ${GoTools_WINDOWS_INSTALL_PREFIX}/bin)
138136
ELSE(WIN32)
139137
# Linux
140-
#lib
141-
INSTALL(TARGETS GoCompositeModel DESTINATION lib COMPONENT compositemodel)
142-
# include
143-
INSTALL(DIRECTORY include/GoTools/compositemodel
144-
DESTINATION include/GoTools
145-
COMPONENT compositemodel-dev
146-
FILES_MATCHING PATTERN "*.h"
147-
PATTERN ".svn" EXCLUDE
148-
)
138+
include(GNUInstallDirs)
149139
ENDIF(WIN32)
150140

141+
# Install the GoCompositeModel target with export set
142+
install(TARGETS GoCompositeModel
143+
EXPORT GoCompositeModelTargets
144+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
145+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
146+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
147+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
148+
)
149+
150+
# Install headers
151+
install(DIRECTORY include/
152+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
153+
FILES_MATCHING PATTERN "*.h"
154+
)
155+
156+
# Export the targets to a file
157+
install(EXPORT GoCompositeModelTargets
158+
FILE GoCompositeModelTargets.cmake
159+
#NAMESPACE GoTools:: # So consumer can do target_link_libraries(... GoTools::GoToolsCore)
160+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GoCompositeModel
161+
)
162+
163+
# Generate and install the Config and Version files
164+
write_basic_package_version_file(
165+
"${CMAKE_CURRENT_BINARY_DIR}/GoCompositeModelConfigVersion.cmake"
166+
VERSION ${GoTools_VERSION_MAJOR}.${GoTools_VERSION_MINOR}.${GoTools_VERSION_PATCH}
167+
COMPATIBILITY SameMajorVersion
168+
)
169+
170+
configure_package_config_file(
171+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/GoCompositeModelConfig.cmake.in"
172+
"${CMAKE_CURRENT_BINARY_DIR}/GoCompositeModelConfig.cmake"
173+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GoCompositeModel
174+
)
175+
176+
install(FILES
177+
"${CMAKE_CURRENT_BINARY_DIR}/GoCompositeModelConfig.cmake"
178+
"${CMAKE_CURRENT_BINARY_DIR}/GoCompositeModelConfigVersion.cmake"
179+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GoCompositeModel
180+
)
181+
151182
SET(CPACK_STRIP_FILES ${CPACK_STRIP_FILES} libGoCompositeModel.so)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@PACKAGE_INIT@
2+
3+
include("${CMAKE_CURRENT_LIST_DIR}/GoCompositeModelTargets.cmake")
4+
5+
# Legacy compatibility
6+
set(GoCompositeModel_LIBRARIES GoCompositeModel)
7+
8+
# Optionally set variables
9+
set(GoCompositeModel_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include")

gotools-core/CMakeLists.txt

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -98,36 +98,39 @@ if (GoTools_COPY_DATA)
9898
DESTINATION ${GoToolsCore_BINARY_DIR}/examples)
9999
endif()
100100

101-
# Set default installation prefix
102-
# IF(WIN32)
103-
# SET(GoTools_INSTALL_PREFIX "$ENV{PROGRAMFILES}/SINTEF/GoTools" CACHE PATH "Path to install GoTools")
104-
# ENDIF()
105-
if(NOT DEFINED GoTools_INSTALL_PREFIX)
106-
SET(GoTools_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Path to install GoTools")
107-
endif()
108-
109101
# === Install Targets and Export Package ===
102+
110103
include(CMakePackageConfigHelpers)
111104

105+
IF(WIN32)
106+
# Windows
107+
set(CMAKE_INSTALL_LIBDIR ${GoTools_WINDOWS_INSTALL_PREFIX}/lib)
108+
set(CMAKE_INSTALL_INCLUDEDIR ${GoTools_WINDOWS_INSTALL_PREFIX}/include)
109+
set(CMAKE_INSTALL_BINDIR ${GoTools_WINDOWS_INSTALL_PREFIX}/bin)
110+
ELSE(WIN32)
111+
# Linux
112+
include(GNUInstallDirs)
113+
ENDIF(WIN32)
114+
112115
# Install the GoToolsCore target
113116
install(TARGETS GoToolsCore
114117
EXPORT GoToolsCoreTargets
115-
ARCHIVE DESTINATION ${GoTools_INSTALL_PREFIX}/lib
116-
LIBRARY DESTINATION ${GoTools_INSTALL_PREFIX}/lib
117-
RUNTIME DESTINATION ${GoTools_INSTALL_PREFIX}/bin
118-
INCLUDES DESTINATION ${GoTools_INSTALL_PREFIX}/include
118+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
119+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
120+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
121+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
119122
)
120123

121124
# Install headers
122125
install(DIRECTORY include/
123-
DESTINATION ${GoTools_INSTALL_PREFIX}/include
126+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
124127
FILES_MATCHING PATTERN "*.h"
125128
)
126129

127130
# Export the targets
128131
install(EXPORT GoToolsCoreTargets
129132
FILE GoToolsCoreTargets.cmake
130-
DESTINATION ${GoTools_INSTALL_PREFIX}/lib/cmake/GoToolsCore
133+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GoToolsCore
131134
)
132135

133136
# Generate version file
@@ -141,14 +144,14 @@ write_basic_package_version_file(
141144
configure_package_config_file(
142145
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/GoToolsCoreConfig.cmake.in"
143146
"${CMAKE_CURRENT_BINARY_DIR}/GoToolsCoreConfig.cmake"
144-
INSTALL_DESTINATION ${GoTools_INSTALL_PREFIX}/lib/cmake/GoToolsCore
147+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GoToolsCore
145148
)
146149

147150
# Install the config files
148151
install(FILES
149152
"${CMAKE_CURRENT_BINARY_DIR}/GoToolsCoreConfig.cmake"
150153
"${CMAKE_CURRENT_BINARY_DIR}/GoToolsCoreConfigVersion.cmake"
151-
DESTINATION ${GoTools_INSTALL_PREFIX}/lib/cmake/GoToolsCore
154+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GoToolsCore
152155
)
153156

154157
# Optional stripping

igeslib/CMakeLists.txt

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,60 @@ if (GoTools_COPY_DATA)
6363
DESTINATION ${GoIgeslib_BINARY_DIR}/examples)
6464
endif()
6565

66-
# 'install' target
66+
# === Install Targets and Export Package ===
67+
68+
include(CMakePackageConfigHelpers)
6769

70+
# 'install' target
6871
IF(WIN32)
6972
# Windows
70-
# lib
71-
INSTALL(TARGETS GoIgeslib DESTINATION ${GoTools_INSTALL_PREFIX}/lib)
72-
# include
73-
INSTALL(DIRECTORY include/GoTools/igeslib
74-
DESTINATION ${GoTools_INSTALL_PREFIX}/include/GoTools
75-
FILES_MATCHING PATTERN "*.h"
76-
PATTERN ".svn" EXCLUDE
77-
)
73+
set(CMAKE_INSTALL_LIBDIR ${GoTools_WINDOWS_INSTALL_PREFIX}/lib)
74+
set(CMAKE_INSTALL_INCLUDEDIR ${GoTools_WINDOWS_INSTALL_PREFIX}/include)
75+
set(CMAKE_INSTALL_BINDIR ${GoTools_WINDOWS_INSTALL_PREFIX}/bin)
7876
ELSE(WIN32)
7977
# Linux
80-
# lib
81-
INSTALL(TARGETS GoIgeslib DESTINATION lib COMPONENT igeslib)
82-
# include
83-
INSTALL(DIRECTORY include/GoTools/igeslib
84-
COMPONENT igeslib-dev
85-
DESTINATION include/GoTools
86-
FILES_MATCHING PATTERN "*.h"
87-
PATTERN ".svn" EXCLUDE
88-
)
78+
include(GNUInstallDirs)
8979
ENDIF(WIN32)
9080

81+
# Install the GoToolsCore target with export set
82+
install(TARGETS GoIgeslib
83+
EXPORT GoIgeslibTargets
84+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
85+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
86+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
87+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
88+
)
89+
90+
# Install headers
91+
install(DIRECTORY include/
92+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
93+
FILES_MATCHING PATTERN "*.h"
94+
)
95+
96+
# Export the targets to a file
97+
install(EXPORT GoIgeslibTargets
98+
FILE GoIgeslibTargets.cmake
99+
#NAMESPACE GoTools:: # So consumer can do target_link_libraries(... GoTools::GoToolsCore)
100+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GoIgeslib
101+
)
102+
103+
# Generate and install the Config and Version files
104+
write_basic_package_version_file(
105+
"${CMAKE_CURRENT_BINARY_DIR}/GoIgeslibConfigVersion.cmake"
106+
VERSION ${GoTools_VERSION_MAJOR}.${GoTools_VERSION_MINOR}.${GoTools_VERSION_PATCH}
107+
COMPATIBILITY SameMajorVersion
108+
)
109+
110+
configure_package_config_file(
111+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/GoIgeslibConfig.cmake.in"
112+
"${CMAKE_CURRENT_BINARY_DIR}/GoIgeslibConfig.cmake"
113+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GoIgeslib
114+
)
115+
116+
install(FILES
117+
"${CMAKE_CURRENT_BINARY_DIR}/GoIgeslibConfig.cmake"
118+
"${CMAKE_CURRENT_BINARY_DIR}/GoIgeslibConfigVersion.cmake"
119+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GoIgeslib
120+
)
121+
91122
SET(CPACK_STRIP_FILES ${CPACK_STRIP_FILES} libGoIgeslib.so)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@PACKAGE_INIT@
2+
3+
include("${CMAKE_CURRENT_LIST_DIR}/GoIgesLibTargets.cmake")
4+
5+
# Legacy compatibility
6+
set(GoIgesLib_LIBRARIES GoIgesLib)
7+
8+
# Optionally set variables
9+
set(GoIgesLib_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include")

0 commit comments

Comments
 (0)