Skip to content

Commit

Permalink
Linux also add versions
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmanek94 committed Sep 17, 2023
1 parent 0b85301 commit fb793c4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 23 deletions.
14 changes: 12 additions & 2 deletions Source/DLLs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,25 @@ MACRO(SUBDIRLIST result curdir)
SET(${result} ${dirlist})
ENDMACRO()


if (MSVC)
if("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "X86")
set(GALAXY_ARCH "x86")
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "x64")
set(GALAXY_ARCH "x64")
endif()
else()
# unsupported arch/OS/compiler?
return()

if(NOT GALAXY_ARCH)
set(GALAXY_ARCH "" CACHE STRING "Architecture which is being compiled for (x86 or x64)")
endif()

if(NOT "--${GALAXY_ARCH}--" STREQUAL "--x86--")
if(NOT "--${GALAXY_ARCH}--" STREQUAL "--x64--")
message("Unknown GALAXY_ARCH, please define GALAXY_ARCH manually (x86 or x64)")
return()
endif()
endif()
endif()

SUBDIRLIST(SUBDIRS ${UNIVERSELAN_DLL_CMAKE_CURRENT_SOURCE_DIR})
Expand Down
40 changes: 20 additions & 20 deletions Source/Version/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
cmake_minimum_required(VERSION 3.12)

file(GLOB_RECURSE COMMON_VERSION_SRC CONFIGURE_DEPENDS "*.*")

add_library(universelan-common-version STATIC ${COMMON_VERSION_SRC} )

target_include_directories(universelan-common-version PUBLIC ".")

if(MSVC)
set(UpdateVersionExt bat)
else()
set(UpdateVersionExt sh)
endif()

add_custom_target(
custom_version_updater
COMMAND ${CMAKE_SOURCE_DIR}/Util/UpdateVersion.${UpdateVersionExt}
)

add_dependencies(universelan-common-version custom_version_updater)
cmake_minimum_required(VERSION 3.12)

file(GLOB_RECURSE COMMON_VERSION_SRC CONFIGURE_DEPENDS "*.*")

add_library(universelan-common-version STATIC ${COMMON_VERSION_SRC} )

target_include_directories(universelan-common-version PUBLIC ".")

if(MSVC)
set(UpdateVersionExt bat)
else()
set(UpdateVersionExt sh)
endif()

add_custom_target(
custom_version_updater
COMMAND ${CMAKE_SOURCE_DIR}/Util/UpdateVersion.${UpdateVersionExt}
)

add_dependencies(universelan-common-version custom_version_updater)
11 changes: 10 additions & 1 deletion cmake-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,13 @@ mkdir cmake-linux/
cd cmake-linux/

# GCC 13 or 14
cmake -D CMAKE_C_COMPILER=/usr/local/bin/gcc -D CMAKE_CXX_COMPILER=/usr/local/bin/g++ ..
GALAXY_ARCH="x$(getconf LONG_BIT)"

if [ "$GALAXY_ARCH" = "x64" ]; then
echo "Using GALAXY_ARCH=x64"
else
echo "Using GALAXY_ARCH=x86"
GALAXY_ARCH="x86"
fi

cmake -D CMAKE_C_COMPILER=/usr/local/bin/gcc -D CMAKE_CXX_COMPILER=/usr/local/bin/g++ -D GALAXY_ARCH="${GALAXY_ARCH}" ..

0 comments on commit fb793c4

Please sign in to comment.