Simplified Windows build.

This commit is contained in:
Arron David Nelson 2024-07-24 14:58:36 -07:00
parent 97b5300e48
commit 4d7e7596b6
4 changed files with 14 additions and 45 deletions

View File

@ -13,7 +13,8 @@ project(EHS CXX C)
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows") if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
set(IS_OS_WINDOWS TRUE) set(IS_OS_WINDOWS TRUE)
set(USER_HOME_DIRECTORY $ENV{USERPROFILE}) set(USER_HOME_DIRECTORY "$ENV{USERPROFILE}")
string(REPLACE "\\" "/" USER_HOME_DIRECTORY "${USER_HOME_DIRECTORY}")
message("Building for the Windows operating system.") message("Building for the Windows operating system.")
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
set(IS_OS_LINUX TRUE) set(IS_OS_LINUX TRUE)
@ -239,14 +240,14 @@ endif()
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
#message("${CMAKE_CXX_FLAGS}") #message("${CMAKE_CXX_FLAGS}")
add_library(EHS_STC STATIC ${EHS_SOURCES}) add_library(EHS_Stc STATIC ${EHS_SOURCES})
add_library(EHS_DYN SHARED ${EHS_SOURCES}) add_library(EHS_Dyn SHARED ${EHS_SOURCES})
add_executable(StrToHash src/StrToHash.cpp) add_executable(StrToHash src/StrToHash.cpp)
target_compile_definitions(EHS_DYN PRIVATE EHS_LIB_EXPORT) target_compile_definitions(EHS_Dyn PRIVATE EHS_LIB_EXPORT)
target_include_directories(EHS_STC PUBLIC ${PROJECT_SOURCE_DIR}/include) target_include_directories(EHS_Stc PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_include_directories(EHS_DYN PUBLIC ${PROJECT_SOURCE_DIR}/include) target_include_directories(EHS_Dyn PUBLIC ${PROJECT_SOURCE_DIR}/include)
if (IS_OS_LINUX) if (IS_OS_LINUX)
set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/.local") set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/.local")
@ -254,9 +255,9 @@ elseif (IS_OS_WINDOWS)
set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/EHS") set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/EHS")
endif () endif ()
install(TARGETS EHS_STC DESTINATION lib) install(TARGETS EHS_Stc DESTINATION lib)
install(TARGETS EHS_DYN RUNTIME DESTINATION bin) install(TARGETS EHS_Dyn RUNTIME DESTINATION bin)
install(TARGETS EHS_DYN LIBRARY DESTINATION lib) install(TARGETS EHS_Dyn LIBRARY DESTINATION lib)
install(TARGETS StrToHash DESTINATION bin) install(TARGETS StrToHash DESTINATION bin)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include)
@ -275,11 +276,11 @@ else ()
message(STATUS "OpenSSL was not found.") message(STATUS "OpenSSL was not found.")
endif () endif ()
target_link_libraries(EHS_STC OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB) target_link_libraries(EHS_Stc OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)
target_link_libraries(EHS_DYN OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB avrt ws2_32) target_link_libraries(EHS_Dyn OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB avrt ws2_32)
if (IS_OS_WINDOWS) if (IS_OS_WINDOWS)
target_link_libraries(StrToHash ws2_32 avrt EHS_STC) target_link_libraries(StrToHash ws2_32 avrt EHS_Stc)
elseif (IS_OS_LINUX) elseif (IS_OS_LINUX)
if (LINUX_WINDOW_SYSTEM STREQUAL "Wayland") if (LINUX_WINDOW_SYSTEM STREQUAL "Wayland")
target_link_libraries(StrToHash wayland-client) target_link_libraries(StrToHash wayland-client)
@ -287,5 +288,5 @@ elseif (IS_OS_LINUX)
target_link_libraries(StrToHash xcb xcb-cursor xcb-xfixes xcb-xinput) target_link_libraries(StrToHash xcb xcb-cursor xcb-xfixes xcb-xinput)
endif () endif ()
target_link_libraries(StrToHash z asound EHS_STC) target_link_libraries(StrToHash z asound EHS_Stc)
endif () endif ()

View File

@ -1,12 +0,0 @@
{
"version": 3,
"configurePresets": [
{
"name": "default",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
}
]
}

View File

@ -1,14 +0,0 @@
{
"default-registry": {
"kind": "git",
"baseline": "42bb0d9e8d4cf33485afb9ee2229150f79f61a1f",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [
{
"kind": "artifact",
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
"name": "microsoft"
}
]
}

View File

@ -1,6 +0,0 @@
{
"dependencies": [
"openssl",
"zlib"
]
}