Skip to content

Commit 61f653c

Browse files
Updated CMake scripts, added CI. [skip ci]
1 parent aab3e9f commit 61f653c

File tree

14 files changed

+486
-75
lines changed

14 files changed

+486
-75
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Create build directory and run CMake
2020
run: |
2121
sudo apt-get -y update
22-
sudo apt-get -y install freeglut3-dev qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qttools5-dev-tools libxi-dev
22+
sudo apt-get -y install freeglut3-dev qtbase5-dev qttools5-dev libxi-dev
2323
mkdir cmake_download_dir
2424
DOWNLOAD_FILE_COIN=coin-latest-Ubuntu2204-gcc11-x64.tar.gz
2525
RELEASE_ID=`curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/coin3d/coin/releases | jq -r --arg COIN_REPO_TAG_NAME "CI-builds" '.[] | select(.tag_name==$COIN_REPO_TAG_NAME) | .id'`
@@ -37,16 +37,16 @@ jobs:
3737
tar xzf $DOWNLOAD_FILE_SOQT -C cmake_download_dir
3838
cmake -S . -B cmake_build_dir -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake_install_dir -DCMAKE_PREFIX_PATH=cmake_download_dir/Coin3D -DGui=Qt
3939
- name: Build project
40-
run: cmake --build cmake_build_dir --target all --config Release -- -j4
40+
run: cmake --build cmake_build_dir --target install --config Release -- -j4
4141
#- name: Run tests
4242
# run: ctest -C Release -VV
4343
# working-directory: cmake_build_dir
44-
#- name: Create Artifacts
45-
# uses: actions/upload-artifact@v3
46-
# with:
47-
# name: Ubuntu-Artifacts
48-
# path: cmake_install_dir/
49-
# if: always()
44+
- name: Create Artifacts
45+
uses: actions/upload-artifact@v3
46+
with:
47+
name: Ubuntu-Artifacts
48+
path: cmake_install_dir/
49+
if: always()
5050

5151
windows-build:
5252
name: Windows Build
@@ -85,16 +85,16 @@ jobs:
8585
7z x %DOWNLOAD_FILE_SOWIN% -ocmake_download_dir
8686
cmake -S . -B cmake_build_dir -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake_install_dir -DCMAKE_PREFIX_PATH=cmake_download_dir/Coin3D -DGui=Win
8787
- name: Build project
88-
run: cmake --build cmake_build_dir --target ALL_BUILD --config Release -- /nologo /verbosity:minimal /maxcpucount:2 /property:MultiProcessorCompilation=true
88+
run: cmake --build cmake_build_dir --target INSTALL --config Release -- /nologo /verbosity:minimal /maxcpucount:2 /property:MultiProcessorCompilation=true
8989
#- name: Run tests
9090
# run: ctest -C Release -VV
9191
# working-directory: cmake_build_dir
92-
#- name: Create Artifacts
93-
# uses: actions/upload-artifact@v3
94-
# with:
95-
# name: Windows-Artifacts
96-
# path: cmake_install_dir/
97-
# if: always()
92+
- name: Create Artifacts
93+
uses: actions/upload-artifact@v3
94+
with:
95+
name: Windows-Artifacts
96+
path: cmake_install_dir/
97+
if: always()
9898

9999
macos-build:
100100
name: MacOS Build
@@ -124,13 +124,13 @@ jobs:
124124
tar xzf $DOWNLOAD_FILE_SOQT -C cmake_download_dir
125125
cmake -S . -B cmake_build_dir -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake_install_dir -DCMAKE_PREFIX_PATH="cmake_download_dir/Coin3D;/usr/local/opt/qt5" -DGui=Qt
126126
- name: Build project
127-
run: sudo cmake --build cmake_build_dir --target all --config Release -- -j4
127+
run: sudo cmake --build cmake_build_dir --target install --config Release -- -j4
128128
#- name: Run tests
129129
# run: ctest -C Release -VV
130130
# working-directory: cmake_build_dir
131-
#- name: Create Artifacts
132-
# uses: actions/upload-artifact@v3
133-
# with:
134-
# name: MacOS-Artifacts
135-
# path: cmake_install_dir/
136-
# if: always()
131+
- name: Create Artifacts
132+
uses: actions/upload-artifact@v3
133+
with:
134+
name: MacOS-Artifacts
135+
path: cmake_install_dir/
136+
if: always()

Base/elements/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
21
add_executable(lstextures lstextures.cpp texturefilenameelement.cpp)
2+
set_target_properties(lstextures PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
33
target_link_libraries(lstextures Coin::Coin)
4+
install(TARGETS lstextures RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ivexamples_${Gui}/Base)

CMakeLists.txt

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
cmake_minimum_required (VERSION 3.9.1)
1+
cmake_minimum_required(VERSION 3.9.1)
22

33
set(CMAKE_CXX_STANDARD 11)
44

55
# Add path for Coin specific utility scripts
66
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
7-
include(CoinCMakeUtilities)
87

9-
coin_project(ivexamples VERSION 1.0.0 DESCRIPTION "Examples from Inventor Mentor and Inventor Toolmaker.")
8+
project(ivexamples VERSION 1.0.0 DESCRIPTION "Examples from Inventor Mentor and Inventor Toolmaker.")
109

1110
if(POLICY CMP0072)
1211
# get rid of OpenGL GLVND warning from CMake 3.11
@@ -17,25 +16,29 @@ endif()
1716
# CMake module includes
1817
# ############################################################################
1918

19+
include(GNUInstallDirs)
2020
include(CheckIncludeFile)
2121
include(CheckIncludeFiles)
2222
include(CheckIncludeFileCXX)
23+
include(CoinCMakeUtilities)
24+
25+
coin_setup_gui_project()
2326

2427
# ############################################################################
2528
# Provide options to customise the build
2629
# ############################################################################
2730

28-
option(HAVE_ASAN "Link executable with the Address Sanitizer static library")
29-
option(HAVE_DEBUG "Add debugging information during the configure process")
31+
option(HAVE_ASAN "Link executable with the Address Sanitizer static library" OFF)
32+
option(HAVE_DEBUG "Add debugging information during the configure process" OFF)
3033

31-
if (HAVE_ASAN)
34+
if(HAVE_ASAN)
3235
find_library(ASAN_LIBRARY NAMES libasan.so.4)
33-
if (NOT ASAN_LIBRARY)
36+
if(NOT ASAN_LIBRARY)
3437
MESSAGE(WARNING "address sanitizer not installed.")
35-
else (NOT ASAN_LIBRARY)
38+
else()
3639
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address")
37-
endif (NOT ASAN_LIBRARY)
38-
endif(HAVE_ASAN)
40+
endif()
41+
endif()
3942

4043
# ############################################################################
4144
# Target environment checks
@@ -52,7 +55,7 @@ set(CMAKE_REQUIRED_INCLUDES)
5255
find_package(OpenGL REQUIRED)
5356
find_package(Coin REQUIRED)
5457
find_package(So${Gui} REQUIRED)
55-
if (Gui STREQUAL "Xt")
58+
if(Gui STREQUAL "Xt")
5659
find_package(Motif REQUIRED)
5760
find_package(X11 REQUIRED COMPONENTS Xt)
5861
endif()
@@ -73,14 +76,12 @@ SIM_INCLUDE_GLEXT_H
7376

7477
configure_file(config.h.cmake.in config.h)
7578
add_compile_definitions(HAVE_CONFIG_H=1)
79+
if(WIN32)
80+
set(CMAKE_DEBUG_POSTFIX "d")
81+
endif()
7682

77-
#Add header directories
78-
include_directories(BEFORE
79-
# ${So${Gui}_INCLUDE_DIRS}
80-
# ${Coin_INCLUDE_DIR}
81-
# ${OPENGL_INCLUDE_DIR}
82-
${CMAKE_BINARY_DIR}
83-
)
83+
# Add header directories
84+
include_directories(BEFORE ${CMAKE_BINARY_DIR})
8485

8586
add_subdirectory(Base)
8687
add_subdirectory(Mentor)

Mentor/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ macro(add_example)
55
cmake_parse_arguments(EXAMPLE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
66
set(name ${EXAMPLE_UNPARSED_ARGUMENTS})
77
dump_variable(
8-
name
9-
EXAMPLE_LIBS
8+
name
9+
EXAMPLE_LIBS
1010
)
1111
configure_file(${name}.cpp.in ${name}.cpp @ONLY)
1212
add_executable(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp)
13+
set_target_properties(${name} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
1314
target_link_libraries(${name} So${Gui}::So${Gui} ${EXAMPLE_LIBS})
15+
install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ivexamples_${Gui}/Mentor)
1416
endmacro(add_example)
1517

1618
add_example(02.1.HelloCone)

Toolmaker/02.Nodes/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
set(CMAKE_INCLUDE_CURRENT_DIR ON)
22
configure_file(newNodes.cpp.in newNodes.cpp @ONLY)
33
configure_file(Pyramid.cpp.in Pyramid.cpp @ONLY)
4-
add_executable(newNodes
4+
add_executable(02.Nodes
55
${CMAKE_CURRENT_BINARY_DIR}/newNodes.cpp
66
${CMAKE_CURRENT_BINARY_DIR}/Pyramid.cpp
77
Glow.cpp
88
Alternate.cpp
99
)
10-
target_link_libraries(newNodes So${Gui}::So${Gui} OpenGL::GL)
10+
set_target_properties(02.Nodes PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
11+
target_link_libraries(02.Nodes So${Gui}::So${Gui} OpenGL::GL)
12+
install(TARGETS 02.Nodes RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ivexamples_${Gui}/Toolmaker)

Toolmaker/03.Fields/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
set(CMAKE_INCLUDE_CURRENT_DIR ON)
2-
add_executable(fieldtest main.cpp SFDouble.cpp MFDouble.cpp)
3-
target_link_libraries(fieldtest So${Gui}::So${Gui})
2+
add_executable(03.Fields main.cpp SFDouble.cpp MFDouble.cpp)
3+
set_target_properties(03.Fields PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
4+
target_link_libraries(03.Fields So${Gui}::So${Gui})
5+
install(TARGETS 03.Fields RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ivexamples_${Gui}/Toolmaker)

Toolmaker/04.Actions/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
set(CMAKE_INCLUDE_CURRENT_DIR ON)
22
configure_file(printVolume.cpp.in printVolume.cpp @ONLY)
3-
add_executable(printVolume
3+
add_executable(04.Actions
44
${CMAKE_CURRENT_BINARY_DIR}/printVolume.cpp
55
GetVolumeAction.cpp
66
)
7-
target_link_libraries(printVolume So${Gui}::So${Gui})
8-
7+
set_target_properties(04.Actions PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
8+
target_link_libraries(04.Actions So${Gui}::So${Gui})
9+
install(TARGETS 04.Actions RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ivexamples_${Gui}/Toolmaker)

Toolmaker/05.Elements/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
set(CMAKE_INCLUDE_CURRENT_DIR ON)
2-
add_executable(elementtest main.cpp TemperatureElement.cpp)
3-
target_link_libraries(elementtest So${Gui}::So${Gui})
2+
add_executable(05.Elements main.cpp TemperatureElement.cpp)
3+
set_target_properties(05.Elements PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
4+
target_link_libraries(05.Elements So${Gui}::So${Gui})
5+
install(TARGETS 05.Elements RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ivexamples_${Gui}/Toolmaker)

Toolmaker/07.Nodekits/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
set(CMAKE_INCLUDE_CURRENT_DIR ON)
22
configure_file(jumpingJackKitTest.cpp.in jumpingJackKitTest.cpp @ONLY)
3-
add_executable(jumpingJackKitTest
3+
add_executable(07.Nodekits
44
${CMAKE_CURRENT_BINARY_DIR}/jumpingJackKitTest.cpp
55
JumpingJackKit.cpp
66
)
7-
target_link_libraries(jumpingJackKitTest So${Gui}::So${Gui})
7+
set_target_properties(07.Nodekits PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
8+
target_link_libraries(07.Nodekits So${Gui}::So${Gui})
9+
install(TARGETS 07.Nodekits RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ivexamples_${Gui}/Toolmaker)

Toolmaker/08.Manips/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
set(CMAKE_INCLUDE_CURRENT_DIR ON)
22
configure_file(newManips.cpp.in newManips.cpp @ONLY)
3-
add_executable(newManips
3+
add_executable(08.Manips
44
${CMAKE_CURRENT_BINARY_DIR}/newManips.cpp
55
TranslateRadialDragger.cpp
66
RotTransDragger.cpp
77
TranslateRadialManip.cpp
88
RotTransManip.cpp
99
Coordinate3Manip.cpp
1010
)
11-
target_link_libraries(newManips So${Gui}::So${Gui})
11+
set_target_properties(08.Manips PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
12+
target_link_libraries(08.Manips So${Gui}::So${Gui})
13+
install(TARGETS 08.Manips RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ivexamples_${Gui}/Toolmaker)
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
set(CMAKE_INCLUDE_CURRENT_DIR ON)
22
configure_file(selectionTest.cpp.in selectionTest.cpp @ONLY)
3-
add_executable(selectionTest
3+
add_executable(09.Highlights_Selection
44
${CMAKE_CURRENT_BINARY_DIR}/selectionTest.cpp
55
ShowSelectionRA.cpp
66
)
7-
target_link_libraries(selectionTest Coin::Coin So${Gui}::So${Gui})
7+
set_target_properties(09.Highlights_Selection PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
8+
target_link_libraries(09.Highlights_Selection Coin::Coin So${Gui}::So${Gui})
9+
install(TARGETS 09.Highlights_Selection RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ivexamples_${Gui}/Toolmaker)
810

911
configure_file(overlayTest.cpp.in overlayTest.cpp @ONLY)
10-
add_executable(overlayTest
12+
add_executable(09.Highlights_Overlay
1113
${CMAKE_CURRENT_BINARY_DIR}/overlayTest.cpp
1214
OverlayHL.cpp
1315
)
14-
target_link_libraries(overlayTest So${Gui}::So${Gui})
16+
set_target_properties(09.Highlights_Overlay PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
17+
target_link_libraries(09.Highlights_Overlay So${Gui}::So${Gui})
18+
install(TARGETS 09.Highlights_Overlay RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ivexamples_${Gui}/Toolmaker)

Toolmaker/10.Components/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ if (Gui STREQUAL "Xt")
1515
configure_file(SceneTumble.h.in SceneTumble.h @ONLY)
1616
configure_file(SceneTumble.cpp.in SceneTumble.cpp @ONLY)
1717
configure_file(tumble.cpp.in tumble.cpp @ONLY)
18-
add_executable(tumble
18+
add_executable(10.Components
1919
${CMAKE_CURRENT_BINARY_DIR}/tumble.cpp
2020
${CMAKE_CURRENT_BINARY_DIR}/SceneTumble.cpp
2121
)
22-
target_link_libraries(tumble So${Gui}::So${Gui} X11::Xt)
22+
set_target_properties(10.Components PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
23+
target_link_libraries(10.Components So${Gui}::So${Gui} X11::Xt)
24+
install(TARGETS 10.Components RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ivexamples_${Gui}/Toolmaker)
2325
endif()

0 commit comments

Comments
 (0)