Skip to content

Commit 4689bf8

Browse files
committed
Merge branch 'master' into release
2 parents 5df9655 + 54764f2 commit 4689bf8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1381
-534
lines changed

Authors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Contributors:
2323
Arthur Nishimoto
2424
JD Pirtle
2525
Qi Sun
26+
Luolei Zhao
2627

2728
Module Contributors:
2829
Caroline Grace Alexander
@@ -34,7 +35,6 @@ Module Contributors:
3435
Jason Leigh
3536
Matt McCrory
3637
Alex Simes
37-
Luolei Zhao
3838

3939
Patch Contributors:
4040
J Markus Maunus

CMakeModules/FindOmegalib.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ else()
3232
endif()
3333

3434
if(OMEGA_BINARY_DIR)
35-
set(OMICRON_DEFAULT_BINARY_DIR ${OMEGA_BINARY_DIR}/omicron/omicron)
35+
set(OMICRON_DEFAULT_BINARY_DIR ${OMEGA_BINARY_DIR}/src/omicron/omicron)
3636
#set(OMICRON_BIN_DIR ${OMEGA_BINARY_DIR}/bin)
3737
#set(OMICRON_LIB_DIR ${OMEGA_BINARY_DIR}/lib)
38-
include(${OMEGA_SOURCE_DIR}/omicron/CMakeModules/FindOmicron.cmake)
38+
include(${OMEGA_SOURCE_DIR}/src/omicron/CMakeModules/FindOmicron.cmake)
3939

4040
# the following are the include directories needed to build a 3rd party omegalib application.
4141
# in the future, just ${OMEGA_ROOT_DIR}/include will be needed, but for now, multiple paths
@@ -45,6 +45,7 @@ if(OMEGA_BINARY_DIR)
4545
${OMICRON_INCLUDE_DIRS}
4646
${OMEGA_BINARY_DIR}/include
4747
${OMEGA_SOURCE_DIR}/include
48+
${OMEGA_SOURCE_DIR}/src/glew
4849
${OMEGA_SOURCE_DIR}/external/include
4950
${OMEGA_SOURCE_DIR}/modules
5051
${OSG_INCLUDES}

CMakeModules/ModuleUtils.cmake

Lines changed: 86 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,19 @@ function(module_def MODULE_NAME URL DESCRIPTION)
3131
message(STATUS "Module ${MODULE_NAME} installed")
3232
endif()
3333

34-
select_module_branch(${GIT_BRANCH} ${CMAKE_SOURCE_DIR}/modules/${MODULE_NAME} ${MODULE_NAME})
35-
34+
if(NOT PACK_APP_MODE)
35+
select_module_branch(${GIT_BRANCH} ${CMAKE_SOURCE_DIR}/modules/${MODULE_NAME} ${MODULE_NAME})
36+
endif()
37+
3638
# substitute dashes with underscores in macro module names ('-' is
3739
# not a valid character
3840
string(REPLACE "-" "_" MACRO_MODULE_NAME ${MODULE_NAME})
3941
string(REPLACE "." "_" MACRO_MODULE_NAME ${MACRO_MODULE_NAME})
40-
file(APPEND ${MODULES_CONFIG_FILE} "#define ${MACRO_MODULE_NAME}_ENABLED\n")
41-
42+
43+
if(NOT PACK_APP_MODE)
44+
file(APPEND ${MODULES_CONFIG_FILE} "#define ${MACRO_MODULE_NAME}_ENABLED\n")
45+
endif()
46+
4247
# find dependencies
4348
file(STRINGS ${CMAKE_SOURCE_DIR}/modules/${MODULE_NAME}/CMakeLists.txt
4449
${MODULE_NAME}_DEPS_RAW
@@ -118,7 +123,6 @@ function(add_module MODULE_ID)
118123
endif()
119124
endif()
120125
endif()
121-
122126
set(MODULES_${MODULE_NAME} true CACHE BOOL ${MODULES_${MODULE_NAME}_DESCRIPTION})
123127
#module_def(${MODULE_NAME} https://github.com/${MODULE_GIT_ORG}/${MODULE_NAME}.git ${MODULES_${MODULE_NAME}_DESCRIPTION})
124128
endfunction()
@@ -155,13 +159,13 @@ function(request_dependency MODULE_FULLNAME)
155159
endfunction()
156160

157161
#-------------------------------------------------------------------------------
158-
# Entry point for module processing, used by src/CMakeLists.txt
159-
macro(process_modules)
162+
# updated the enabled modules list (MODULES) based on the MODULES_ADD and
163+
# MODULES_REMOVE variables
164+
macro(update_enabled_modules)
160165
# MODULES_LIST = modules that the user wants installed
161166
# REQUESTED_MODULES = modules requested by the user + all resolved dependencies
162167
set(MODULES "" CACHE STRING "The list of enabled modules")
163168
set(REQUESTED_MODULES "")
164-
set(REGENERATE_REQUESTED true CACHE BOOL "" FORCE)
165169

166170
# Add modules from the MODULES_ADD variable to the list of initial modules
167171
# remove modules from the MODULES_REMOVE variable from the list of initial modules
@@ -174,6 +178,43 @@ macro(process_modules)
174178
list(REMOVE_DUPLICATES MODULES)
175179
set(MODULES ${MODULES} CACHE STRING "The list of enabled modules" FORCE)
176180

181+
separate_arguments(MODULES_LIST WINDOWS_COMMAND "${MODULES}")
182+
string(REPLACE " " ";" MODULES_LIST "${MODULES_LIST}")
183+
string(REPLACE "\"" "" MODULES_LIST "${MODULES_LIST}")
184+
endmacro()
185+
186+
#-------------------------------------------------------------------------------
187+
# creates the initial modulesConfig.h file
188+
macro(create_modules_config_header)
189+
set(MODULES_CONFIG_FILE ${CMAKE_BINARY_DIR}/include/modulesConfig.h)
190+
file(REMOVE ${MODULES_CONFIG_FILE})
191+
file(APPEND ${MODULES_CONFIG_FILE} "//auto-generated file\n")
192+
endmacro()
193+
194+
#-------------------------------------------------------------------------------
195+
# creates the initial pack script file
196+
macro(create_pack_file)
197+
# create the pack.cmake file. This file contains the commands to create
198+
# packaged modules for the omegalib installer. Each module will append
199+
# its own pack.cmake file to this one.
200+
if(PACK_APP_MODE)
201+
set(PACK_FILE ${PACKAGE_DIR}/pack.cmake)
202+
else()
203+
set(PACK_FILE ${CMAKE_SOURCE_DIR}/install/pack.cmake)
204+
endif()
205+
file(REMOVE ${PACK_FILE}.in)
206+
file(READ ${CMAKE_SOURCE_DIR}/src/pack_header.cmake PACK_HEADER_FILE_CONTENTS)
207+
file(READ ${CMAKE_SOURCE_DIR}/src/pack_core.cmake PACK_CORE_FILE_CONTENTS)
208+
file(APPEND ${PACK_FILE}.in "${PACK_HEADER_FILE_CONTENTS} ${PACK_CORE_FILE_CONTENTS}")
209+
endmacro()
210+
211+
#-------------------------------------------------------------------------------
212+
# Entry point for module processing, used by src/CMakeLists.txt
213+
macro(process_modules)
214+
set(REGENERATE_REQUESTED true CACHE BOOL "" FORCE)
215+
216+
update_enabled_modules()
217+
177218
if(NOT "${MODULES}" STREQUAL "")
178219
# First step: request modules that the user wants.
179220
separate_arguments(MODULES_LIST WINDOWS_COMMAND "${MODULES}")
@@ -182,38 +223,31 @@ macro(process_modules)
182223
string(REPLACE "\"" "" UNQUOTEDMODULE "${MODULE}")
183224
request_dependency(${UNQUOTEDMODULE})
184225
endforeach()
185-
226+
186227
# Keep running until all module dependencies are resolved.
187228
while(REGENERATE_REQUESTED)
188229
set(REGENERATE_REQUESTED false CACHE BOOL "" FORCE)
189230

190-
# delete the modulesConfig.h file, it will be regenerated by module_def
191-
# for native modules.
192-
set(MODULES_CONFIG_FILE ${CMAKE_BINARY_DIR}/include/modulesConfig.h)
193-
file(REMOVE ${MODULES_CONFIG_FILE})
194-
file(APPEND ${MODULES_CONFIG_FILE} "//auto-generated file\n")
195-
196-
# create the pack.cmake file. This file contains the commands to create
197-
# packaged modules for the omegalib installer. Each module will append
198-
# its own pack.cmake file to this one.
199-
set(PACK_FILE ${CMAKE_SOURCE_DIR}/install/pack.cmake)
200-
file(REMOVE ${PACK_FILE}.in)
201-
file(READ pack_header.cmake PACK_HEADER_FILE_CONTENTS)
202-
file(READ pack_core.cmake PACK_CORE_FILE_CONTENTS)
203-
file(APPEND ${PACK_FILE}.in "${PACK_HEADER_FILE_CONTENTS} ${PACK_CORE_FILE_CONTENTS}")
231+
if(NOT PACK_APP_MODE)
232+
create_modules_config_header()
233+
endif()
234+
235+
create_pack_file()
204236

205237
# Loop through all the requested modules, loading the module definitions.
206-
# The module_def call will process dependencies for each module,
207-
# adding missing dependencies to REQUESTED_MODULES until all dependencies are
238+
# The module_def call will process dependencies for each module, adding
239+
# missing dependencies to REQUESTED_MODULES until all dependencies are
208240
# resolved and REGENERATE_REQUESTED stays false.
209241
list(REMOVE_DUPLICATES REQUESTED_MODULES)
242+
210243
foreach(MODULE_ID ${REQUESTED_MODULES})
244+
# Split module id into module name and (optional) git organization
211245
get_filename_component(MODULE_GIT_ORG ${MODULE_ID} DIRECTORY)
212246
get_filename_component(MODULE_NAME ${MODULE_ID} NAME)
213-
214247
if("${MODULE_GIT_ORG}" STREQUAL "")
215248
set(MODULE_GIT_ORG ${OMEGA_DEFAULT_MODULE_ORGANIZATION})
216249
endif()
250+
217251
# Local module support
218252
if("${MODULE_GIT_ORG}" STREQUAL ".")
219253
module_def(
@@ -228,17 +262,17 @@ macro(process_modules)
228262

229263
configure_file(${PACK_FILE}.in ${PACK_FILE} @ONLY)
230264
endwhile()
231-
232-
# Add the modules subdirectory. This will include cmake scripts for all native modules
233-
#add_subdirectory(${CMAKE_SOURCE_DIR}/modules ${CMAKE_BINARY_DIR}/modules)
234-
list(REMOVE_DUPLICATES REQUESTED_MODULES)
235-
list(REVERSE REQUESTED_MODULES)
236-
foreach(MODULE ${REQUESTED_MODULES})
237-
get_filename_component(MODULE_GIT_ORG ${MODULE} DIRECTORY)
238-
get_filename_component(MODULE_NAME ${MODULE} NAME)
239-
message("processing module ${MODULE_NAME}")
240-
add_subdirectory(${CMAKE_SOURCE_DIR}/modules/${MODULE_NAME} ${CMAKE_BINARY_DIR}/modules/${MODULE_NAME})
241-
endforeach()
265+
266+
if(NOT PACK_APP_MODE)
267+
list(REMOVE_DUPLICATES REQUESTED_MODULES)
268+
list(REVERSE REQUESTED_MODULES)
269+
foreach(MODULE ${REQUESTED_MODULES})
270+
get_filename_component(MODULE_GIT_ORG ${MODULE} DIRECTORY)
271+
get_filename_component(MODULE_NAME ${MODULE} NAME)
272+
message("processing module ${MODULE_NAME}")
273+
add_subdirectory(${CMAKE_SOURCE_DIR}/modules/${MODULE_NAME} ${CMAKE_BINARY_DIR}/modules/${MODULE_NAME})
274+
endforeach()
275+
endif()
242276
endif()
243277
endmacro()
244278

@@ -262,7 +296,7 @@ macro(declare_native_module MODULE_NAME)
262296
endmacro()
263297

264298
# Copy a list of files from one directory to another. Relative files paths are maintained.
265-
macro(postbuild_copy_files target file_list source_dir target_dir)
299+
macro(copy_files target file_list source_dir target_dir)
266300
foreach(FILENAME ${file_list})
267301
set(source_file ${source_dir}/${FILENAME})
268302
set(target_file ${target_dir}/${FILENAME})
@@ -287,10 +321,21 @@ endmacro()
287321
macro(copy_shared_libs target libs source_dir)
288322
foreach(LIB ${libs})
289323
if(OMEGA_OS_WIN)
290-
postbuild_copy_files("${target}" "${LIB}.dll" "${source_dir}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG}")
291-
postbuild_copy_files("${target}" "${LIB}.dll" "${source_dir}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE}")
324+
copy_files("${target}" "${LIB}.dll" "${source_dir}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG}")
325+
copy_files("${target}" "${LIB}.dll" "${source_dir}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE}")
326+
elseif(OMEGA_OS_OSX)
327+
copy_files("${target}" "lib${LIB}.dylib" "${source_dir}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
292328
else()
293-
postbuild_copy_files("${target}" "${LIB}.so" "${source_dir}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
329+
copy_files("${target}" "lib${LIB}.so" "${source_dir}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
294330
endif()
295331
endforeach()
296332
endmacro()
333+
334+
macro(copy_files_to_bin target file_list source_dir)
335+
if(OMEGA_OS_WIN)
336+
copy_files("${target}" "${file_list}" "${source_dir}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG}")
337+
copy_files("${target}" "${file_list}" "${source_dir}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE}")
338+
else()
339+
copy_files("${target}" "${file_list}" "${source_dir}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
340+
endif()
341+
endmacro()

default.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
config:
22
{
3+
orun: {initScript="default_init.py";};
34
systemConfig = "system/desktop.cfg";
45
//systemConfig = "system/desktop-omicron.cfg";
56
//systemConfig = "evl/lyra-xinerama.cfg";

etc/mtools/choose.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ set(CHOOSE_FILE ${CMAKE_CURRENT_LIST_DIR}/../../../choose_${ARG2}.bat)
88
file(REMOVE ${CHOOSE_FILE})
99
file(APPEND ${CHOOSE_FILE} "set OMEGA_HOME=${CMAKE_CURRENT_LIST_DIR}/../../\n")
1010
file(APPEND ${CHOOSE_FILE} "set PATH=${CMAKE_CURRENT_LIST_DIR}/../../build/bin/release;%PATH%\n")
11+
file(APPEND ${CHOOSE_FILE} "cmd")
1112

1213
message("Choose script prepared")
1314
message("call choose_${ARG2}.bat to switch your omegalib environment to ${ARG2}")

etc/mtools/pack.app.cmake

Lines changed: 58 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,73 @@ if("${ARG2}" STREQUAL "")
33
return()
44
endif()
55

6-
if(NOT WIN32)
7-
message("ERROR: omega pack.app is currently only supported on windows")
8-
return()
9-
endif()
6+
# ARG2 - distribution
7+
# ARG3 - app name (also name of the module in distribution)
8+
9+
include(${ARG2}/CMakeModules/ModuleUtils.cmake)
1010

1111
if(WIN32)
1212
set(BIN_DIR ${ARG2}/build/bin/release)
1313
else()
1414
set(BIN_DIR ${ARG2}/build/bin)
1515
endif()
1616

17-
set(PACKAGE_DIR pack/${ARG3})
18-
19-
# By default the app directory is apps/<appname>
20-
# If we can't find it, we assume the application is inside the omegalib modules directory
21-
set(APP_DIR apps/${ARG3})
22-
if(NOT EXISTS ${APP_DIR})
23-
set(APP_DIR ${ARG2}/modules/${ARG3})
24-
endif()
25-
set(SOURCE_DIR ${ARG2})
26-
set(PACKAGED_MODULES "")
27-
28-
function(pack_module MODULE_NAME MODULE_DIR)
29-
message("Packing dependent module ${MODULE_NAME}")
30-
list(APPEND PACKAGED_MODULES ${MODULE_NAME})
31-
message(${PACKAGED_MODULES})
32-
33-
#Run the pack commands for the module
34-
include("${MODULE_DIR}/pack.cmake")
35-
36-
# find dependencies and pack them
37-
file(STRINGS "${MODULE_DIR}/CMakeLists.txt"
38-
${MODULE_NAME}_DEPS_RAW
39-
REGEX "^request_dependency([a-zA-Z0-9_]*)")
17+
set(CALLING_DIR ${CMAKE_SOURCE_DIR})
18+
set(PACKAGE_DIR packs/${ARG3})
19+
set(CMAKE_SOURCE_DIR ${ARG2})
20+
set(CMAKE_BINARY_DIR ${ARG2}/build)
21+
set(CMAKE_INSTALL_PREFIX ${PACKAGE_DIR})
4022

41-
if(NOT "${${MODULE_NAME}_DEPS_RAW}" STREQUAL "")
42-
string(REGEX REPLACE "request_dependency\\(([a-zA-Z0-9_]*)\\)" "\\1 " ${MODULE_NAME}_DEPS_STR ${${MODULE_NAME}_DEPS_RAW})
43-
separate_arguments(${MODULE_NAME}_DEPS_LIST WINDOWS_COMMAND "${${MODULE_NAME}_DEPS_STR}")
44-
foreach(dependency ${${MODULE_NAME}_DEPS_LIST})
45-
list(FIND PACKAGED_MODULES ${dependency} _i)
46-
if(${_i} EQUAL -1)
47-
pack_module(${dependency} "${ARG2}/modules/${dependency}")
48-
endif()
49-
endforeach()
50-
endif()
51-
endfunction()
23+
# copy the core install files to the package target dir
24+
file(INSTALL DESTINATION ${PACKAGE_DIR}
25+
TYPE DIRECTORY
26+
FILES
27+
${CMAKE_SOURCE_DIR}/install/config
28+
)
29+
file(INSTALL DESTINATION ${PACKAGE_DIR}/packages/core
30+
TYPE DIRECTORY
31+
FILES
32+
${CMAKE_SOURCE_DIR}/install/packages/core/meta
33+
)
34+
35+
# Prepare to run process_modules in pack-app mode. Set all the
36+
# required variables
37+
set(PACK_APP_MODE TRUE)
38+
set(MODULES_ADD ${ARG3})
5239

53-
endmacro()
40+
process_modules()
41+
include(${ARG2}/src/pack_functions.cmake)
42+
include(${PACKAGE_DIR}/pack.cmake)
5443

44+
if(NOT EXISTS cmake/qtifw)
45+
file(MAKE_DIRECTORY cmake/qtifw)
46+
message("Downloading the Qt Installer Framework tools")
47+
if(WIN32)
48+
set(TOOLS "archivegen.exe;binarycreator.exe;installerbase.exe;repogen.exe")
49+
foreach(S IN LISTS TOOLS)
50+
message("...${S}")
51+
file(DOWNLOAD ${OPM_URL}/qtifw-1.5.0-win/${S} cmake/qtifw/${S})
52+
endforeach()
53+
elseif(APPLE)
54+
set(TOOLS "archivegen;binarycreator;installerbase;repogen")
55+
foreach(S IN LISTS TOOLS)
56+
message("...${S}")
57+
file(DOWNLOAD ${OPM_URL}/qtifw-2.0.0-osx/${S} cmake/qtifw/${S})
58+
execute_process(COMMAND chmod +x ${S} WORKING_DIRECTORY cmake/qtifw)
59+
endforeach()
60+
endif()
61+
endif()
5562

56-
#set the default configuration for packages
57-
set(PACK_EXAMPLES false CACHE INTERNAL "")
58-
set(PACK_CORE_EQUALIZER true CACHE INTERNAL "")
59-
set(PACK_CORE_UI true CACHE INTERNAL "")
60-
61-
#include file with functions used by packaging scripts
62-
include("${ARG2}/src/pack_functions.cmake")
63+
# Delete the local repositoryor the repogen command will fail
64+
#file(REMOVE_RECURSE ${ARG2}/install/repository)
6365

64-
# pack the application and all its dependencies
65-
pack_module(${ARG3} ${APP_DIR})
66-
message(${PACK_CORE_EQUALIZER})
67-
# pack the omegalib runtime core
68-
include("${ARG2}/src/pack_core.cmake")
66+
message("---- Building offline installer")
67+
if(WIN32)
68+
execute_process(COMMAND ${CALLING_DIR}/cmake/qtifw/binarycreator.exe
69+
-c config/config-offline.xml -p packages ${ARG3}Setup.exe
70+
WORKING_DIRECTORY ${CALLING_DIR}/packs/${ARG3})
71+
else()
72+
execute_process(COMMAND ${CALLING_DIR}/cmake/qtifw/binarycreator
73+
-c config/config-offline.xml -p packages ${ARG3}Setup
74+
WORKING_DIRECTORY ${CALLING_DIR}/packs/${ARG3})
75+
endif()

0 commit comments

Comments
 (0)