Skip to content

Commit

Permalink
Merge pull request #357 from sbriseid/msvc2022_support
Browse files Browse the repository at this point in the history
Msvc2022 support
  • Loading branch information
VibekeSkytt authored Oct 17, 2023
2 parents f48a1ab + 301e0da commit 7f0e415
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 26 deletions.
2 changes: 1 addition & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Linux

Install required packages:

$ sudo apt install -y git cmake make build-essential libgl1-mesa-dev freeglut3-dev libpugixml-dev libjsoncpp-dev libboost-test-dev qtbase5-dev qtbase5-dev-tools
$ sudo apt install -y git cmake make build-essential libgl1-mesa-dev freeglut3-dev libpugixml-dev libjsoncpp-dev libboost-test-dev libboost-timer-dev qtbase5-dev qtbase5-dev-tools

Git
***
Expand Down
4 changes: 2 additions & 2 deletions compositemodel/cmake/Modules/FindPugiXML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if(WIN32)
elseif((${MSVC_VERSION} GREATER_EQUAL 1920) AND (${MSVC_VERSION} LESS 1930))
# MESSAGE("Visual Studio 2019!")
set(MSVC_NAME "msvc2019_")
elseif((${MSVC_VERSION} EQUAL 1930))
elseif((${MSVC_VERSION} GREATER_EQUAL 1930) AND (${MSVC_VERSION} LESS 1940))
set(MSVC_NAME "msvc2022_")
else()
message("MSVC version not supported or not installed!")
Expand Down Expand Up @@ -75,7 +75,7 @@ find_library(PUGIXML_LIBRARY_RELEASE
"~/Install/${MSVC_NAME}lib${WIN_LIB_TYPE}/Release"
"C:/local/${MSVC_NAME}lib${WIN_LIB_TYPE}/Release"
)
# message("PUGIXML_LIBRARY_RELEASE:" ${PUGIXML_LIBRARY_RELEASE})
#message("PUGIXML_LIBRARY_RELEASE:" ${PUGIXML_LIBRARY_RELEASE})
if(PUGIXML_LIBRARY_DEBUG)
set(PUGIXML_LIBRARIES ${PUGIXML_LIBRARIES} debug ${PUGIXML_LIBRARY_DEBUG})
endif()
Expand Down
2 changes: 1 addition & 1 deletion gotools-core/src/geometry/GSSpoint.C
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace Go
namespace
{
/// Functor that scales the input argument.
class ScaleBy : public std::unary_function<double, double>
class ScaleBy// : public std::unary_function<double, double>
{
double m_scale;

Expand Down
2 changes: 1 addition & 1 deletion gotools-core/test/unit/LoopUtilsTest.C
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public:
#ifdef GOTOOLS_TEST_PRIVATE_DATA

// Path relative to build/gotools-extra/step_reader
const string datadir_priv = "../../../gotools-private-data/step_reader/data3/Ford/";
const string datadir_priv = "../../gotools-private-data/step_reader/data3/Ford/";

infiles.push_back(datadir_priv + "Ford_Hood_Outer_001_sf_303.g2");
infiles.push_back(datadir_priv + "Ford_Hood_Hinge_Reinf_001_sf_7.g2");
Expand Down
6 changes: 4 additions & 2 deletions gotools-core/test/unit/fixInvalidBoundedSurfaceTest.C
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public:
#ifdef GOTOOLS_TEST_PRIVATE_DATA

// Path relative to build/gotools-extra/step_reader
const string datadir_priv = "../../../gotools-private-data/step_reader/data3/";
const string datadir_priv = "../../gotools-private-data/step_reader/data3/";

// Ford models.
infiles.push_back(datadir_priv + "Ford/Ford_Car_Hood_inner_001_obj_378.g2");
Expand All @@ -72,6 +72,7 @@ public:

infiles.push_back(datadir_priv +
"CaxMan/Mould_Final_Version_1/Stock_Cavity_AM_stage4_R8_8_Printing_colorised_model_2_obj_12233.g2");
//"CaxMan/Mould_Final_Version_1/12233.g2");
valid_model.push_back(true);
#endif

Expand Down Expand Up @@ -107,7 +108,8 @@ BOOST_FIXTURE_TEST_CASE(BoundedSurfaceTest, Config)
string infile = infiles[i];
//string infile = "../step_reader/DemEx6woExtBlends.g2";

ifstream in(infile.c_str());
// std::cout << "infile: " << infile << std::endl;
ifstream in(infile.c_str(), std::ifstream::in);
BOOST_CHECK_MESSAGE(in.good(), "Input file not found or file corrupt");
header.read(in);
shared_ptr<BoundedSurface> bs(new BoundedSurface());
Expand Down
11 changes: 8 additions & 3 deletions lrsplines2D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ PROJECT(GoLRspline2D)
IF(GoTools_ENABLE_OPENMP)
FIND_PACKAGE(OpenMP REQUIRED)
ENDIF(GoTools_ENABLE_OPENMP)

#set(Boost_DEBUG ON)
FIND_PACKAGE(Boost COMPONENTS timer REQUIRED)

# Include directories

Expand All @@ -16,14 +17,17 @@ INCLUDE_DIRECTORIES(
${Boost_INCLUDE_DIRS}
)

ADD_COMPILE_DEFINITIONS(BOOST_TIMER_SOURCE)

# Linked in libraries
ADD_COMPILE_DEFINITIONS(BOOST_CHRONO_HEADER_ONLY)

# Linked in libraries
# message("Boost_USE_STATIC_LIBS: ${Boost_USE_STATIC_LIBS}")
SET(DEPLIBS
GoToolsCore
sisl
)

# message("DEPLIBS: ${DEPLIBS}")
# Make the GoLRspline2D library

FILE(GLOB_RECURSE GoLRspline2D_SRCS src/*.C include/*.h)
Expand Down Expand Up @@ -76,6 +80,7 @@ MACRO(ADD_APPS SUBDIR PROPERTY_FOLDER IS_TEST)
ENDMACRO(ADD_APPS)

IF(GoTools_COMPILE_APPS)
SET(DEPLIBS ${DEPLIBS} ${Boost_LIBRARIES})
FILE(GLOB_RECURSE GoLRspline2D_APPS app/*.C)
FOREACH(app ${GoLRspline2D_APPS})
GET_FILENAME_COMPONENT(appname ${app} NAME_WE)
Expand Down
16 changes: 12 additions & 4 deletions lrsplines2D/app/PointCloud2LR.C
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,16 @@
#include <fstream>
#include <string.h>
#include <sys/stat.h>
#include <boost/timer.hpp>
#include <boost/timer/timer.hpp>
//#include <chrono>
#include <boost/chrono.hpp>
#include <time.h>

#define BOOST_CHRONO_HEADER_ONLY
#define BOOST_TIMER_NO_LIB
#define BOOST_TIMER_SOURCE
#define BOOST_ALL_NO_LIB

//#define DEBUG
//#define DEBUG_EL
//#define DEBUG2
Expand Down Expand Up @@ -771,10 +778,10 @@ int main(int argc, char *argv[])



boost::timer t;
boost::timer::cpu_timer t;
double duration;

t.restart();
t.start();

// if (del > 3)
// {
Expand Down Expand Up @@ -884,8 +891,9 @@ int main(int argc, char *argv[])

approx->fetchOutsideTolInfo(maxout, avout);

auto nanoseconds = boost::chrono::nanoseconds(t.elapsed().user + t.elapsed().system);

duration = t.elapsed();
duration = 1.0e-09*nanoseconds.count();//t.elapsed();
std::cout << "Duration: " << duration << std::endl;
double min = floor(duration/60);
double sec = duration - 60*min;
Expand Down
8 changes: 8 additions & 0 deletions lrsplines3D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ IF(GoTools_ENABLE_OPENMP)
FIND_PACKAGE(OpenMP REQUIRED)
ENDIF(GoTools_ENABLE_OPENMP)

FIND_PACKAGE(Boost COMPONENTS timer REQUIRED)

# Include directories

INCLUDE_DIRECTORIES(
Expand All @@ -15,12 +17,17 @@ INCLUDE_DIRECTORIES(
${GoToolsCore_SOURCE_DIR}/include
${GoTrivariate_SOURCE_DIR}/include
${GoTools_COMMON_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)

ADD_COMPILE_DEFINITIONS(BOOST_TIMER_SOURCE)

ADD_COMPILE_DEFINITIONS(BOOST_CHRONO_HEADER_ONLY)

# Linked in libraries

SET(DEPLIBS
#${Boost_LIBRARIES}
GoToolsCore
sisl
GoTrivariate
Expand Down Expand Up @@ -80,6 +87,7 @@ MACRO(ADD_APPS SUBDIR PROPERTY_FOLDER IS_TEST)
ENDMACRO(ADD_APPS)

IF(GoTools_COMPILE_APPS)
SET(DEPLIBS ${DEPLIBS} ${Boost_LIBRARIES})
FILE(GLOB_RECURSE GoLRspline3D_APPS app/*.C)
FOREACH(app ${GoLRspline3D_APPS})
GET_FILENAME_COMPONENT(appname ${app} NAME_WE)
Expand Down
16 changes: 12 additions & 4 deletions lrsplines3D/app/PointCloud2LRVol.C
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
#include "GoTools/lrsplines3D/LRVolApprox.h"
#include "GoTools/geometry/ObjectHeader.h"
#include "GoTools/lrsplines3D/LRSpline3DBezierCoefs.h"
#include <boost/timer.hpp>
#include <boost/chrono.hpp>
//#include <chrono>
#include <boost/timer/timer.hpp>
#include <time.h>

#define BOOST_CHRONO_HEADER_ONLY
#define BOOST_TIMER_NO_LIB
#define BOOST_TIMER_SOURCE
#define BOOST_ALL_NO_LIB

using namespace std;
using namespace Go;

Expand Down Expand Up @@ -393,10 +400,10 @@ int main (int argc, char *argv[]) {



boost::timer t;
boost::timer::cpu_timer t;
double duration;

t.restart();
t.start();

std::cout << "Domain: [" << domain[0] << "," << domain[1] << "]x[" << domain[2];
std::cout << "," << domain[3] << "]x[" << domain[4] << "," << domain[5] << "]" << std::endl;
Expand Down Expand Up @@ -450,7 +457,8 @@ int main (int argc, char *argv[]) {

vol_approx.fetchOutsideTolInfo(maxout, avout);

duration = t.elapsed();
auto nanoseconds = boost::chrono::nanoseconds(t.elapsed().user + t.elapsed().system);
duration = duration = 1.0e-09*nanoseconds.count();//t.elapsed();
std::cout << "Duration: " << duration << std::endl;
double min = floor(duration/60);
double sec = duration - 60*min;
Expand Down
2 changes: 1 addition & 1 deletion trivariate/src/GSVpoint.C
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace Go
namespace
{
/// Functor that scales the input argument.
class ScaleBy : public std::unary_function<double, double>
class ScaleBy //: public std::unary_function<double, double>
{
double m_scale;

Expand Down
2 changes: 1 addition & 1 deletion trivariatemodel/cmake/Modules/FindPugiXML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if(WIN32)
elseif((${MSVC_VERSION} GREATER_EQUAL 1920) AND (${MSVC_VERSION} LESS 1930))
# MESSAGE("Visual Studio 2019!")
set(MSVC_NAME "msvc2019_")
elseif((${MSVC_VERSION} EQUAL 1930))
elseif((${MSVC_VERSION} GREATER_EQUAL 1930) AND (${MSVC_VERSION} LESS 1940))
set(MSVC_NAME "msvc2022_")
else()
message("MSVC version not supported or not installed!")
Expand Down
11 changes: 6 additions & 5 deletions viewlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ endif(GoTools_ENABLE_OPENMP)

find_package(OpenGL REQUIRED)
find_path(OPENGL_INCLUDE_DIR
gl.h
PATH_PREFIXES GL
GL/gl.h
# PATH_PREFIXES GL
PATHS
/usr/local/include
/usr/include
"$ENV{HOME}\\Install\\include" # For some reason HOME is not found in VS 2019.
"C:\\Users\\$ENV{USERNAME}\\Install\\include"
"C:\\local\\include")
"C:\\local\\include"
/usr/local/include
/usr/include
)
option(GoTools_USE_Qt4 "Use Qt4 (not Qt5)?" OFF)

if(GoTools_USE_Qt4)
Expand Down
2 changes: 1 addition & 1 deletion viewlib/cmake/Modules/FindJsonCpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if(WIN32)
elseif((${MSVC_VERSION} GREATER_EQUAL 1920) AND (${MSVC_VERSION} LESS 1930))
# MESSAGE("Visual Studio 2019!")
set(MSVC_NAME "msvc2019_")
elseif((${MSVC_VERSION} EQUAL 1930))
elseif((${MSVC_VERSION} GREATER_EQUAL 1930) AND (${MSVC_VERSION} LESS 1940))
set(MSVC_NAME "msvc2022_")
else()
message("MSVC version not supported or not installed!")
Expand Down

0 comments on commit 7f0e415

Please sign in to comment.